getPropertyList() properties missing
When getting the list of properties with getPropertyList, some properties seem to be missing. I used this code to test it, it prints all properties with their values changed:
var selectedNode = Scene.getSelectedNode(0);
var properties = selectedNode.getPropertyList();
for(var i = 0; i < properties.length; i++)
{
var prop = properties[i];
if(prop != null && prop.getValue() != prop.getDefaultValue())
{
print("Property:", prop.name, prop.getValue(), prop.getDefaultValue());
}
}
Now, for some properties like XTranslate, it seems to work just fine. But other random properties, for example "Shoulder Size" don't appear. This is the case for some other properties aswell. Is there a reason why they don't appear? How can I access them?
Comments
Have a look at http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/node_properties/start
This can't find "Shoulder Size" either.
Executing Script...
Compared to XTranslate:
Executing Script...
Yeah, not even this recursive function worked. I can't seem to find it anywhere
function printAllPropertiesInNode(node)
{
var properties = selectedNode.getPropertyList();
print( "Printing Node:",node.name );
for(var i = 0; i < properties.length; i++)
{
var prop = properties[i];
if(prop != null && prop.getValue() != prop.getDefaultValue())
{
print("Property:", prop.name, prop.getValue(), prop.getDefaultValue());
}
}
var children = node.getNodeChildren();
for ( var i = 0; i < children.length; i++ )
{
printAllPropertiesInNode(children[i]);
}
}
I also tried replacing it with getPrivatePropertyList(), just in the off-chance that it for some reason counts as private (even though I'm able to see it in the Parameters tab), but no dice.
Alright, I'm not entirely sure, but it looks like morphs aren't included. Properties that control others (for things that control both left and right) seem to be included, the left / right parts with the actual morphs not.
I think I was right, it's the morphs that are missing. I created a few new properties in Edit Mode, and the one with "Create As Empty Morph" checked is missing. Now, how do I get them to show up?
After hours of searching, I finally found something. It looks like morphs are stored in the DzObject along with other "modifiers". Unfortunately, DzMorph doesn't seem to exist on the documentation site, so I have no clue how to read or write a morph's value. Gonna look into it some more.
You need DzMorph.getValueChannel() as I recall, which should usually be a DzFloatProperty for which you can getValue()/setValue( val ).
Oh, I just found an older thread where you showed an example that solved my problem!
https://hpclscruffy.daz3d.com/forums/discussion/460906/changing-the-value-of-a-morph-on-a-g8-figure
In case others ever have this problem:
DzElement.getPropertyList() doesn't include morphs.
You need to get the modifier from the element's DzObject.
As of the time of this writing, DzMorph is not available in the docs. But DzMorph has a function called getValueChannel(), which returns a DzFloatProperty. This controls the morph's values.
Edit:
Nice, you replied just as I was typing this ^^