How to set up pose parameter by script?
Victor_B
Posts: 391
Hello.
Please, help me with these questions.
- How to set up Rotation parameter (Bend or Twist) of Left Forearm Bend of the selected figure?
- How to check selected figure is G8F?
Thank you.
Post edited by Victor_B on
Comments
This code of mine is how I do it. You'll need to select the node of the figure first before running this.
Also, the nSomeValue variable is hard-coded to 0.0, so you'll need to provide a means of passing a value.
Hope it helps.
Thank you, Richard, for your answer, but I found decision already. In two words:
But the second question is still burning. I know this code:
But I don't like it because user can change that label. Is there more reliable solution to check that selected figure is G8F?
Thanks.
Rob asks why you are using sClass = oProp.getWidgetClass() instead of getting the class of the property directly? He also points out that because you are not using a var in front of your loop variables (for i = instead of for var i =, or just declare them before starting the outer loop) you are creating global variables, with the potential to conflict with other loops using the same names elsewhere in the script.
Rather than use the label, which as you say can vary, use the name (or the geometry name) - Rob also pointed that out.
Quick solution here (against global variables) is to incapsulate all this code:
But the best solution is to rewrite this code with methods I mentioned in previous post.
Ok, getName() works good. Thanks.
Any variable that is used without being decalered through a var statement is treated as a global, as far as I am aware. Edit: yes, it is the case http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/language_reference/declarations/start#variables