Max SDK C++ Create Skylight

Max SDK C++ Create Skylight

no.name
Participant Participant
1,199 Views
3 Replies
Message 1 of 4

Max SDK C++ Create Skylight

no.name
Participant
Participant

How do you create a skylight in 3DS Max SDK?

 

Accepted solutions (1)
1,200 Views
3 Replies
Replies (3)
Message 2 of 4

drew_avis
Autodesk
Autodesk
Accepted solution

The Skylight object is not exposed as a class in the SDK, but you can create an instance in a scene from its class ID:

 

INode* maxLightsDemoUtility::createSkyLight(){

Interface *ip = GetCOREInterface();

TimeValue tv(0);

// Light

INode *nodeLight;

GenLight* lightObjLight = (GenLight*) CreateInstance(LIGHT_CLASS_ID,Class_ID(0x7bf61478, 0x522e4705));

// show the gizmo

lightObjLight->Enable(true);

// add to scene

nodeLight = ip->CreateObjectNode(lightObjLight);

nodeLight->SetName(_T("MySkyLight")); // light naming

return nodeLight;

}

 

You can get the Class ID of a class in MaxScript using ShowClass(), or from an object in a scene using $obj.ClassID():

 

showClass "Skylight"
Skylight : light {7bf61478,522e4705}

 

Hope that helps.

 

Drew

 

 



Drew Avis
Content Experience Designer
Message 3 of 4

omidt_gh
Enthusiast
Enthusiast

how can i get color of sky light in c++.
i try this and its always return same value.


: : Point3 trans = SkyLight->GetNodeTM(GetCOREInterface11()->GetTime()).GetTrans();
: : Point3 color;

Properties props;
std::string objString;

ObjectState ostate = SkyLight->EvalWorldState(0);
LightObject *light = (LightObject*)ostate.obj;
color = light->GetRGBColor(GetCOREInterface()->GetTime(), FOREVER);

0 Likes
Message 4 of 4

omidt_gh
Enthusiast
Enthusiast

it solved.

0 Likes