Skip to content

Instantly share code, notes, and snippets.

@Neill3d
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neill3d/10719256 to your computer and use it in GitHub Desktop.
Save Neill3d/10719256 to your computer and use it in GitHub Desktop.
Get FBModel class pointer from a relation box
// Create the input node.
mNodeMesh = AnimationNodeInCreate( 0, "Mesh", ANIMATIONNODE_TYPE_VECTOR );
// ...
/************************************************
* Real-time engine evaluation
************************************************/
bool Box_RayIntersect::AnimationNodeNotify( HFBAnimationNode pAnimationNode, HFBEvaluateInfo pEvaluateInfo )
{
/*
* 1. Read the data from the in connector
* 2. Treat the data as required
* 3. Write the data to the out connector
* 4. Return the status (LIVE/DEAD) of the box.
*/
FBVector3d lMeshVector;
int lStatus; // Status of input node
// Read the input nodes.
lStatus = mNodeMesh->ReadData( lMeshVector, pEvaluateInfo );
// If the read was not from a dead node.
if( lStatus != CNT_STATUS_DEAD )
{
int count = mNodeMesh->GetSrcCount();
for (int i=0; i<count; ++i)
{
HFBPlug pPlug = mNodeMesh->GetSrc(i);
pPlug = pPlug->GetOwner();
if (pPlug->Is( FBModelPlaceHolder::TypeInfo ) )
{
HFBModelPlaceHolder pPlaceHolder = (HFBModelPlaceHolder) pPlug;
HFBModel pModel = pPlaceHolder->Model;
FBString name = pModel->Name;
printf( "%s\n", name );
}
}
}
return CNT_STATUS_DEAD;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment