Scene saving and loading issues

I've got an old Studio3 based plugin, that I'm upgrading to be 4.6 compatable.

It needs to save some general state data, and the code for this is in a DzPane based class.

Firstly, I removed to legacy saveSection function, but kept the loadSection member for backwards compatability with old scene files.

Hurray! Old scene files load with the new plugin.

Next, I added code based on the custom scene data sample.

Now, when saving I got a message saying that some scene assets could not be saved.
The duf file contained the custom scene data, and they were also loaded correctly from that file.

I had a bit of a head scratch about the save error, and then realised that the four assets Studio complained about were custom DzNodes.
I had a look at the Black Hole sample, and added an IO class similar to the one in DzBlackHoleNode (but without any functional code in the applyInstanceToObject member) to each of the custom nodes.

No error messages now, and those assets appear to save and load OK.

Onto the next issue, which has got me stumped. One of the nodes has a custom material which has two DzFloatProperty controllers added to it.
These properties appear in the duf file, but any keys on them are not there!
Also on load, these properties are not loaded and atached to the material.

Have I done anything wrong in the code conversion? Anyone know how I can get this working?

Thanks in anticipation.

Comments

  • dtammdtamm Posts: 126
    edited December 1969

    DeltaX15 said:
    I've got an old Studio3 based plugin, that I'm upgrading to be 4.6 compatable.

    It needs to save some general state data, and the code for this is in a DzPane based class.

    Firstly, I removed to legacy saveSection function, but kept the loadSection member for backwards compatability with old scene files.

    Hurray! Old scene files load with the new plugin.

    Next, I added code based on the custom scene data sample.

    Now, when saving I got a message saying that some scene assets could not be saved.
    The duf file contained the custom scene data, and they were also loaded correctly from that file.

    I had a bit of a head scratch about the save error, and then realised that the four assets Studio complained about were custom DzNodes.
    I had a look at the Black Hole sample, and added an IO class similar to the one in DzBlackHoleNode (but without any functional code in the applyInstanceToObject member) to each of the custom nodes.

    No error messages now, and those assets appear to save and load OK.

    Onto the next issue, which has got me stumped. One of the nodes has a custom material which has two DzFloatProperty controllers added to it.
    These properties appear in the duf file, but any keys on them are not there!
    Also on load, these properties are not loaded and atached to the material.

    Have I done anything wrong in the code conversion? Anyone know how I can get this working?

    Thanks in anticipation.

    No properties on load:
    - You have to create the properties in your constructor.

    No keyframes
    - Currently, properties that are children of materials(as opposed to nodes) will not have their keyframes saved. We will review if DAZ Studio should change this.

    2 ways to solve this currently:
    1) Save and load the keyframes manually. See mycustommaterial.h and look ad the bool value as a start.
    2) Create two hidden DzFloatProperty's on your node. Link them to the properties on the materials.

  • edited December 1969

    dtamm said:
    No properties on load:
    - You have to create the properties in your constructor.

    No keyframes
    - Currently, properties that are children of materials(as opposed to nodes) will not have their keyframes saved. We will review if DAZ Studio should change this.

    2 ways to solve this currently:
    1) Save and load the keyframes manually. See mycustommaterial.h and look ad the bool value as a start.
    2) Create two hidden DzFloatProperty's on your node. Link them to the properties on the materials.

    Thanks for the reply.

    I've gone for #2 solution.

Sign In or Register to comment.