• Advertisement
Sign in to follow this  

Using D3DXFrameFind() to find multiple frame with the same name

This topic is 2112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I use D3DXFrameFind() to find multiple frames with the same name?

I want to control the matrix for different frames using the same name, but when I call D3DXFrameFind() once it only get one frame with that name.

Share this post


Link to post
Share on other sites
Advertisement
Hi.
You will need to loop through all the frames and compare there names
something like this.
[source]
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void GetAllFrameNames(std::vector<std::string> *framenames)
{
if(FrameRoot == NULL)
return;//error empty frames
DWORD numframes = 0;
FrameRoot->Count(&numframes);
UINT currentindex = 0;
Frame *frame = NULL;
for(DWORD ctr = 0; ctr < numframes; ctr++)
{
//get the frames name
currentindex = 0;
frame = FrameRoot->Find(ctr, &currentindex);
if(frame)
{
framenames->push_back(frame->Name);

}

}//end all frames
}//end GetAllFrameNames
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//------------------------------------------------------------
// Function to scan hierarchy for matching frame by index
//----------------------------------------------------------
Frame *Find(UINT index, UINT *Currentindex)
{
Frame *pFrame, *pFramePtr;
if(*Currentindex == index)
return this;
*Currentindex += 1;
// Return this frame instance if name matched

// Scan siblings
if((pFramePtr = (Frame*)pFrameSibling))
{
if((pFrame = pFramePtr->Find(index, Currentindex)))
return pFrame;
}
// Scan children
if((pFramePtr = (Frame*)pFrameFirstChild))
{
if((pFrame = pFramePtr->Find(index, Currentindex)))
return pFrame;
}
// Return none found
return NULL;
}//end Find
//////////////////////////////////////////////////////////////////////////

[/source] Edited by ankhd

Share this post


Link to post
Share on other sites
@ankhd: I thought about this idea, however I am concerned that it could slow down the rendering since I will be using that on alot of meshes. Edited by Medo3337

Share this post


Link to post
Share on other sites
Hello.
You may need to find all frames at load time
Then store them in a container ready to be used
At run time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement