Digital Art Zone

 
     
DzNode->setNodeParent protected
Posted: 08 November 2012 05:25 PM   [ Ignore ]
Power Member
Avatar
RankRankRank
Total Posts:  1258
Joined  2009-10-27

Any chance to set a parent node without having to subclass DzNode, since setNodeParent is protected?

 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile
 
 
Posted: 09 November 2012 12:15 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09
class DZ_EXPORT DzNode : public DzElement, public DzSceneAsset {
 
...
public 
slots:
 ...
 
DzError addNodeChildDzNode *childbool inPlace false );
 ...
}

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 09 November 2012 09:05 AM   [ Ignore ]   [ # 2 ]
Power Member
Avatar
RankRankRank
Total Posts:  1258
Joined  2009-10-27

Thanks Rob, I already tried addNodeChild and didn’t work as expected: the children nodes were added to the main one, but would not render.
Then, I tried to add the child node to the scene, and after that call the addNodeChild. That worked.

I expected that actually addNodeChild, having that “add” word in it, would automatically add the child node to the scene as well. That misled me.

 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile
 
 
Posted: 09 November 2012 10:56 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09

DzNode::addNodeChild() doesn’t automatically add the node to the scene because you may want to do something to/with that node before it gets drawn. When the scene draws, only those nodes that have already been added to the scene are processed. In cases where there is creation and a parent/child relationship at play… we typically create the node, DzNode::addNodeChild(), do any work based on that relationship and then DzScene::addNode() once we are ready for that node to be displayed to the user. If the node is added to the scene too early, not only can it be a bit disconcerting to the user to see things they shouldn’t, it can cause a significant performance hit because there are a number of connections that get made and you begin paying for the drawing.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 09 November 2012 11:50 AM   [ Ignore ]   [ # 4 ]
Power Member
Avatar
RankRankRank
Total Posts:  1258
Joined  2009-10-27

Thank you very much for the detailed explanation Rob, now that makes sense.

 Signature 

Real Plants Collection 1: Fallen Trees, Ivy and Vines”
Blog
LAMH FB

Profile