Find all geografts on a figure?

How do I find all the geografted sub-figures on a given figure?   Geografted sub-figures have their Fit To property set to the parent figure, but this is also true for clothing and hair.   Is there some additional critera I can use to reduce that list to just geografted nodes?

Thanks

 

Comments

  • rbtwhizrbtwhiz Posts: 1,826
    edited April 2016

    Here is how to get at Geo-Grafting and Geo-Culling (scion) figures, for a given (stock) figure. The lists of either type of scion maintained on the stock may not 'currently' be affecting the mesh(es) depending on whether a given view tool must temporarily disable it to perform its own function. The list maintained on the stock shape is of the scion(s) that is(are) currently affecting the mesh(es)—with a hint of something being worked on in 4.9.2.x.

    void myFunction()
    {
    	DzNode* primaryNode = dzScene->getprimaryNodeSelection();
    	if( !primaryNode )
    	{
    		return;
    	}
    	
    	DzFigure* stockFigure;
    	if( DzFigure* figure = qobject_cast<DzFigure*>(primaryNode) )
    	{
    		stockFigure = figure;
    	}
    	else
    	{
    		stockFigure = qobject_cast<DzFigure*>(primaryNode->getSkeleton());
    	}
    	
    	if( !stockFigure )
    	{
    		return;
    	}
    	
    	DzWeakFigureListIterator graftingFigsIter = stockFigure->graftFigureIterator();
    	while( graftingFigsIter.hasNext() )
    	{
    		//grafting - may not be currently affecting the mesh due to view tools
    		if( DzFigure* graftingFigure = graftingFigsIter.next() )
    		{
    		}
    	}
    	
    	DzWeakFigureListIterator cullingFigsIter = stockFigure->cullFigureIterator();
    	while( cullingFigsIter.hasNext() )
    	{
    		//culling - may not be currently affecting the mesh due to view tools
    		if( DzFigure* cullingFigure = cullingFigsIter.next() )
    		{
    		}
    	}
    	
    	DzObject* stockObject = stockFigure->getObject();
    	if( !stockObject )
    	{
    		return;
    	}
    	
    	DzGraftingFigureShape* stockShape = qobject_cast<DzGraftingFigureShape*>(stockObject->getCurrentShape());
    	if( !stockShape )
    	{
    		return;
    	}
    	
    	for( int i = 0, numGrafts = stockShape->getNumActiveGrafts(); i < numGrafts; i++ )
    	{
    		DzNode* scionNode = stockShape->getActiveGraftNode( i );
    		if( !scionNode )
    		{
    			//self-culling via modifier (4.9.2.x)
    		}
    		else
    		{
    			//grafting - currently affecting the mesh
    		}
    	}
    }

    -Rob

    Post edited by rbtwhiz on
  • shoei321shoei321 Posts: 112

    Thanks Rob, that worked perfectly.  

Sign In or Register to comment.