to select node in the needed figure
Edpa
Posts: 46
I have 2 figures in a scene to example - Genesis(1) and Genesis (2).
I need to select Hip in Genesis (2).
var roots = Scene.getNodeList();var itemLd=Scene.findNodeByLabel( "Genesis (2)" )itemLd.select(true );var itemLH=Scene.findNodeByLabel( "Hip" )itemLH.select(true );
But this code selects Hip in Genesis(1)
Post edited by Edpa on
Comments
Scene.findNodeByLabel(label_name) finds the FIRST node which matches the label_name. If there are multiple ones, it only selects the first. You'll need to find another way to narrow down your search. Probably will need to find the figure's root node, then traverse downard to the hip, using Scene.getNodeList() and using a loop to iterate over it, matching the needed characteristics until you find it.
I try it, but I have no result now
It's actually easier than that....I forgot about findNodeChildByLabel(). Try this:
Remember, the first find ("Genesis (2)"), could return NULL, and it will only return the FIRST one found. If you had multiple figures labelled "Genesis (2)" in your scene, it'll just return the first one it finds. Which could change from load scene to scene.
findChildNodeByLabel I corrected the function name in script :) - findNodeChildByLabel
I tried to use getSelectedNodeList() with getNodeChildren together. As a result, I was able to sellect fully Genesis (2) :))
Thank you very much! Your script works well