Sign in to follow this  

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

This topic is 2041 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
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

This topic is 2041 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this