Script to toggle visibility of a node and all children nodes?
cwichura
Posts: 1,042
Anyone aware of a script for Studio that will toggle the visibility of a selected node and all of its children nodes in one shot? This would be useful for things like turning off the left or right collar on down through all the fingers on a set of gloves when you only want the left or right glove, for example. Obviously, one can toggle each node manually, but when there are a lot of nodes, it's a nuisance due to the UI lag when toggling nodes.
Thanks
Comments
You don't have to toggle them individually. Select the root note you want to start from in the Scene Tab and right-click, then choose Select Children. Now you can toggle them all invisible simultaneously in Parameters tab--Display. Just make sure you turn off both Visible and Visible In Render.
You can multi-seelct and then turn the visibility off for all in the Parameters pane, but something like
and the same with nodes[ n ].setVisible( true ); to show them again.
Crosspost with Mr. Kitty Cat. ;) Or you can do that.
Hmm, so the elements in the Display sub-category correspond to the node visibility icon in the Scene list? I've never actually messed with the stuff under Display. But the visibility icons in the Scene list ignore multi-selection, hence my original request. If you toggle them in the Display sub-category, does the visibility icon also change?
And thanks Richard for the script. I'll give that a try when I'm back in the office tomorrow.
Yes, the eye in the Scene pane and the visibility button in Parameters are the same property, just different ways to access it - that's also true of the selectable control
Very handy info. Thanks!
Richarrrrrd ^^;
one more quesiton,,, I simply make visible selection node and children , sciot
(just change "false" to "true" ) from your auto invisible selection node and children scirpt.
but as you know,, when I hope to visble under r-foot,, if the root genesis set invisibe,
it can not work,,
so I may need apply code,,
"if root node is invsible turn root visible "
"else you need not do anything,, it may work"
so please tell me the ds script code to do it^^;
============
or simply I need to apply ,
anyway select root ,set root visible.
I know it is so easy,, but where is good place to understand each ID or action etc in daz studio? ^^;
or would not you tell me the link of them directly?
is it wrong?
You could also try adding this to the loop
Or it may be more efficient to use Scene.getSelectedSkeletonList() at the start and make all of those visible before going through the nodes, though with a simple script like this the overhead of checking the same skeleton repeatedly if multiple bones are selected probably doesn't matter.
I checked skelton and bone method and property etc,, but it was difficult to understand at first challenge how to use them,,, ^^;
Is not there "method" which serch and direct get the root node and return it,, by current selected Node?
like,, getRootNodeEasy() ,, I hoped and serched it,,,^^;
"if multiple bones are selected" yes,, I know,,I thought the case,, if apply multselection, it can be more useful.
But,,, actually,,,,I do not like scripting so ,,, ^^;
anyway thank you much.
The skeleton is the root node of the figure - strictly speaking, the root node inherits DzSkeleton but is a derivative object in DS4, figures are now either Poser figures or TriAx figures, but in DS3 all figures (except Optitex cloth perhaps) were plain DzSkeletons.
The other way to get at the root, if you also want to get the top of a set or parented props or a group, is to use something like
which is slightly simpler than your script. You can then build an array of roots by declaring an array and using array.pushIfNotExists( root ) to make sure each root is added only once, then go through that array doing whatever it is you want (rather than getting the root for each node and performing the action on that, possibly adding unneeded repeats).
thank you,,,, I keep tweaking,, array etc,,I may keep studying, step by step,,
Now I check your script one by one,, about method and dzclass,,etc,,
I now understand how to get selected multi node as array,,
and get the qobject name,,,
.(I do not like scripting,, but feel interesting now ^^;)
and I may hope more quesiton,,, so where is best forum to ask these?
nuts and bolts may ok? or new user forum?
because my quesiton seems so basic,, i think,, eg,,
I want to know,, save as documents which I indicate in message box.
I saw script rdwigh wrote,,, which show all short cut,, but I hope to save it as txt.
so I am serching way,, which class or method may work,,to save it as txt.
anyway,, good night,sir Richard I need to sleep now ^^;
This is the forum intended for scripting http://www.daz3d.com/forums/categories/60/http://www.daz3d.com/forums/categories/60/