getPropertyList() properties missing

cimarcimar Posts: 13

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?

Post edited by cimar on

Comments

  • cimarcimar Posts: 13

    This can't find "Shoulder Size" either.

    Executing Script...

    Result: 
    Script executed in 0 secs 1 msecs.

     

    Compared to XTranslate:

    Executing Script...

    - DzFigure "Genesis8_1Female" :: DzFloatProperty (/General/Transforms/Translation/XTranslate) "X Translate"
    Result: 
    Script executed in 0 secs 1 msecs.
  • cimarcimar Posts: 13

    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.

  • cimarcimar Posts: 13

    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.

  • cimarcimar Posts: 13

    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?

  • cimarcimar Posts: 13

    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.

  • Richard HaseltineRichard Haseltine Posts: 100,886

    You need DzMorph.getValueChannel() as I recall, which should usually be a DzFloatProperty for which you can getValue()/setValue( val ).

  • cimarcimar Posts: 13
    edited May 2022

    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 ^^

     

    Post edited by cimar on
Sign In or Register to comment.