How to Manipulate a Selected Character in Daz Script

Newbie Scripting question here, but in my defense, my Java experience is over ten years out of date. What I'm looking to do is use a Script to rotate a character's specific body part by a specified amount. For example, I want to select a character and have their lower abdomen twist by 10%. I've got it working okay, but it always rotates whatever character is first on the Scene Tab, no matter what character I have selected. I'm pretty sure it has to do with my using the command Scene.findNodebyLabel("Lower Abdomen") But I'm not sure which object to use instead of Scene, or if there's a way to just specify a node for the selected figure. Also, I'm about 20 miles away from my PC right now, so I may be misremembering the specific command above, but I'm pretty sure that's it. Can anyone point me in the right direction?

Comments

  • nonesuch00nonesuch00 Posts: 17,929

    I'd suggest looking at the scripts of long time DAZ Studio use mCasual:

    https://sites.google.com/site/mcasualsdazscripts9/home

    Since you are experienced programmer you need just a bit of effort to pick up the help you need from them.

  • Note that Daz Script is related to (shares a common ancestor with rather than descends from) Javascript, not Java.

    A better approach would be to find the figure and then use findNodeChildByLabel on that, rather than just grabbing the first node with the right label. You could also target your script at a selected figure and use Scene.getPrimarySelection() or Scene.getSelectedSkeletonList() before using the findNodeChildByLabel() method. There are relevant sampels here http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#nodes

  • Well, I don't know how or why it worked this last time I tried it, but that second one finally did the trick.  I used getPrimarySelection() to grab the figure and then findNodeChildByLabel().  I could swear I tried that method five or six times, though, and always had the script error out and say it wasn't a function.  Weird... Well, it works now.  Thanks!

Sign In or Register to comment.