Need to save additional data with new DzProperty

Vholf3DVholf3D Posts: 63

I need to store certain string data along with a newly created (standard) DzFloatProperty,

I looked into getAttributes / setAttributes, but although I can read the default attributes, if I add more values to it and then try to set the attributes back to the property, this new settting entries are not stored. Is this not the intented use? if not, is there an out of the box way to store extra info when creating properties?

Thank you.

Post edited by Vholf3D on

Comments

  • Scripting cannot create new classes inherting DzProperty. In the SDK the getAttributes/setAttributes are virtual - it is up the deverloper of the new DzProperty sub-class to implement them for the relevant attributes of their property.

  • Vholf3DVholf3D Posts: 63

    Sorry, I didn't mean to say "custom", it is a standard DzFloatProperty.

    Using setAttributes I can update already existing values and it will be saved to the property, but I cannot add new key-values to the DzProperttySettings, or rather, I can, but they won't persist on the property.

     

     

  • You mean animation keys? Use one of the setValue methods.

    DzProperty objects don't support custom data, if you mean something other than property values - DzElemnt-derived objects do support custom data (DzElementData), as does the scene itself (DzSceneData) if that is the kind of thing you want. This is an area that is being worked on, see the change log http://docs.daz3d.com/doku.php/public/software/dazstudio/4/change_log

  • Vholf3DVholf3D Posts: 63
    edited August 2022

    Thank your Richard. I will look into DzElementData, it seems to be exactly what I need. I was using something like this instead, and expected the new attribute values would persist, but they do not.

                property = getProperty("Bend"); // this methods gets a property from a node

                var settings = new DzPropertySettings();

                property.getAttributes(settings);

                settings.setStringValue("MYSETTING_KEY", "MYSETTING_VALUE");

                property.setAttributes(settings);

    Post edited by Vholf3D on
  • I am a little surrpised that did anything, but no it won't persist as DzFloatProperty won't know how to save the new attribute.

Sign In or Register to comment.