Best Way to store Custom Complex Data

mattiascibienmattiascibien Posts: 140
edited December 1969 in Daz SDK Developer Discussion

Hello,
I am currently using a DzSimpleElementData to store additional information in a DzNode.

The fact is that I need to store complex data like a list of custom objects inside it. What is the best way to keep this data inside?

Should I add multiple settings with setSettingsValue and then retrieve them using the key?

Thank you.
Mattias.

Comments

  • mattiascibienmattiascibien Posts: 140
    edited December 1969

    Acutally my custom objects are just structures with string and ints anyway. Can I also use DzCustomData?

  • rbtwhizrbtwhiz Posts: 2,267
    edited December 1969

    Search in this forum, using the field in the bottom left of the thread index page, for "SceneData" and/or "ElementData". One of the results will be my response to another member asking a related question.

    -Rob

  • mattiascibienmattiascibien Posts: 140
    edited December 1969

    Ok. I got this. But how can my custom node interact with the nodes in my scene? Do I have to manually create them or are they magically injected to existing DzNodes (then I should only cast them to MyCustomNode)? I need my custom methods and properties to interact with a a DzPanel (to acutally edit my custom data).

    Thanks Rob for your support.

  • rbtwhizrbtwhiz Posts: 2,267
    edited December 1969

    Initially you stated that you had custom data that you hang on a DzNode... But your last post suggests that what you actually have is a DzNode subclass, with its own methods and properties. Have you looked at the Custom Element Loading Saving sample? It shows how to implement a DzNode subclass for writing/reading... as well as writing/reading DzShape, DzModifier and DzMaterial subclasses.

    -Rob

  • mattiascibienmattiascibien Posts: 140
    edited December 1969

    I have looked at them and it seems that I have implemented custom loading and saving. Anyway the thing I do not understand is how to interact with my custom node... Can I cast exsisting DzNodes to my custom nodes or do I have to create a custom action?

  • rbtwhizrbtwhiz Posts: 2,267
    edited December 1969

    You'll need to be more clear about what exactly you mean by "interact." Are you asking how to instantiate your DzNode subclass? How to add it to the scene once you've instantiated it? How to manipulate it once it has been added to the scene? How to cause an instance in the scene to be saved to a file?

    -Rob

  • mattiascibienmattiascibien Posts: 140
    edited December 1969

    Acutally what I need to do is to interact with existing nodes with the scene, since what I am doing is adding a bunch of custom things that will be added to exising nodes.

    I.E. I have a list of constraints (which is actually a QList in my custom node) which I need to be added to the particoular Victoria 6 I have in my scene.

    I actually have a custom panel which gets updated with the changing of the selection in the scene. Can I actually just cast the reference of the selected node to my custom node class?

  • Richard HaseltineRichard Haseltine Posts: 101,551
    edited December 1969

    Not an expert, but surely if you take a data object and cast it to a derived data type with more members or functions you are asking for a crash as your code requests information or tries to use a function that it doesn't have? I don't recall that casting adds data to an object, though I may be wrong (it's been a while since I used C++).

  • mattiascibienmattiascibien Posts: 140
    edited July 2014

    That's actually possibile to cast to a child class...


    EDIT: If I have gotten everything wrong I can save a List of constraints (my custom data) to the scene data instead of the nodes while keeping the references to the affected nodes in the data instead of keeping the data inside the notes.

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