Locking/Unlocking joints through script
hzr
Posts: 207
Hey there,
quick question for those of you who are familiar with scripting in DS. I am looking to lock/unlock a selection of nodes (in my example it would be all the toe joints) and do this with a script instead of having to select the joints manually, then hit lock/unlock keys that I have mapped. This is really cumbersome and takes alot of time for a very simple thing.
Would be nice if someone could paste me a couple lines of code or maybe even some quick explanation with a list of variables that could be controlled through a similar script?
Anyhow, looking forward to any help I can get.
Comments
Get the figure (use Scene.getSelectedSkeletonList() for example), then iterate over that and for each selected figure use node.findNodeChild( name , true) to get the toe bones (true is needed or it will check only the immediate children of the figure - name you can get by selecting the bone and using the Scene ID command). Once you have the bone(s), you can use the node.getXRotControl() etc. functions to get the transform properties and then property.lock( true ) to lock it (or proeprty.lock( false ) to unlock).
I think this look so (tested). True or false - lock or not lock. As Richard Haseltine wrote
Yes, that will work if you just want to lock/unlock selected bones. I think the OP was wanting to avoid the need to select the specific target bones, however, which was why I suggested getting selected figures (where it doesn't matter what is selected) and then getting the bones by name.
Yup, already got it. Thanks for the replies :)