[Closed] SDK Path Controller
Hello,
I am trying to Travese the scene and search for all my Camera and append them to a INodeTab. After which, I want to be able to see if that Node has Path Controller ( Path Constraint). Is there any way of searching to see if my Camera has a Path Constraint on it ?
would be something like this:
Control *c = camNode->GetTMController()->GetPositionController();
if(c->ClassID() == Class_ID(PATH_CONTROL_CLASS_ID, 0))
{
...
}
Hi, I have had a look at some samples, and they are using the same code you are to find the Path Constraint. Although, I am still unable to get it working. It will pick up the Super Class ID but not the Class ID. I have even tested it with the Position Constraint but still no luck.
The Code I am using is below:
for(int i = 0; i < nodeTab.Count(); i++){
Control *c = nodeTab[i]->GetTMController()->GetPositionController();
if(c->SuperClassID()==CTRL_POSITION_CLASS_ID && c->ClassID()==Class_ID(PATH_CONTROL_CLASS_ID,0))
{
ExecuteMAXScriptScript(_T("print \"Path Control\""), 0, 0);
}
}
See any reason why this wouldn’t work ?
Edit : I found out that my Camera with the Path constraint has the Class ID of POSLIST_CONTROL_CLASS_ID. Which is great, but of course works for all Constraints, so is there any way to just get the Path constraint from this ?
here we go…
Control *c = node->GetTMController()->GetPositionController();
if(c->SuperClassID()==CTRL_POSITION_CLASS_ID && c->ClassID()==Class_ID(PATH_CONTROL_CLASS_ID,0))
{
...
}
else if(c->ClassID() == Class_ID(POSLIST_CONTROL_CLASS_ID, 0))
{
IListControl* lc = (IListControl*)c->GetInterface(LIST_CONTROLLER_INTERFACE);
int i, cntControl = lc->GetListCount();
for(i=0; i<cntControl; i++)
{
c = lc->GetSubCtrl(i);
if(c->SuperClassID()==CTRL_POSITION_CLASS_ID && c->ClassID()==Class_ID(PATH_CONTROL_CLASS_ID,0))
{
...
}
}
}