Changing the value of a morph on a g8 figure
MeneerWolfman
Posts: 426
This seems insanely simple, but the sample scripting and other questions posted on here do not seem to have much direction to give me.
I want to change the value of a handful properties so I can run a script and have the selected propertyies' value change to a value written in the script.
I know how to select the figure and read the skeleton and locate bones, but I'm not quite sure how to find a property and then change its value. Is there something similar to "findbonebylabel" but for morphs?
Thanks.
Comments
If it's actual morph those are on the figure, not the bone. You get the object from the figure node http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/node_dz#a_1a5b6bf06e4ee1b03b841f22efb27b3e3b , then the modifier can be found on the object (by name, rather than label) http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/object_dz#a_1a259d193e74e4003ab512d904e214509c . Once you have the modifier you get its value channel as I recall (DzModifier dosc are curently offline) on which you can then use setValue( val ) or one of its variants (setting at a time, for example).
This seems to work, as a proof of conceept rather than a proper script:
Thanks, Richard. That and some other code I found through Google was able to help.
Appreciate the help, sorry for the late reply.
Comment removed. I think my suggestion was wrong now...
I was able to get this to work, but not for morphs that are built-in to G8.1. For example, the morph in the attached image has the "Morph" category next to "Owner", and it will be found by the above script. But if you attempt to find morphs that are built-in to G8.1 (such as facs morphs) the script will fail to find them. I noticed that these morphs do not have "Morph" next to the Owner, they have "Node". Is there some other way to access these types of morphs via script?
Of course, I find the solution shortly after posting here. The issue was that facs and eCTRL are not morphs, they are properties. I was able to modify their values using the following code:
I'm not much of a programmer so apologies if this is wildly inefficient, just needed a method to automate the assigning of certain values with Daz characters for a separate project I'm working on.