NodeData list



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2010 at 08:48, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    hello all,
    i have made new nodedata plugin and i'dd to alloc a list of this mynode in a document, store the list in it ,make recusion in it and retrive some data.

    any experience ?
    Franz



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/04/2010 at 02:12, xxxxxxxx wrote:

    NodeData plugins can only be stored in SceneHooks. So you have to write your own SceneHook to save your list of NodeData plugins along with the document.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/04/2010 at 03:18, xxxxxxxx wrote:

    i am exactly in this situation ... but any sample ?
    is not very clear how is possible?

    Franz



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/04/2010 at 08:01, xxxxxxxx wrote:

    I may have mixed up something here. I will try to find a solution.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/04/2010 at 00:23, xxxxxxxx wrote:

    thanks :)
    Franz



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/05/2010 at 06:39, xxxxxxxx wrote:

    FYI, I put together a small example of how to store a NodeData plugin within a scene hook.

    Please check the code comments for more detailed information.

    the NodeData plugin:

      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
      
      
    //just a extremly simple Nodedata plugin :)  
      
    class MyNode : public NodeData  
    {  
      public:  
          static NodeData *Alloc(void) { return gNew MyNode; }  
    };  
      
      
    #define ID_MYNODE 1024726  
      
    Bool RegisterMyNode(void)  
    {  
      return RegisterNodePlugin(ID_MYNODE, "My Node", 0, MyNode::Alloc, NULL, 0, NULL);  
    }  
    

    the SceneHookData plugin to store the NodeData plugin:

      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
      
      
    class MyNode;  
      
    #define ID_MYSCENEHOOK 1025181  
      
      
    class MySceneHook : public SceneHookData  
    {  
      public:  
          //constructor; initialization and plugin node allocation  
          MySceneHook()  
          {  
              hookname = String("My SceneHook Name");  
              mynode = (BaseList2D* )AllocListNode(1024726);  
          }  
      
          virtual Bool Init(GeListNode *node);  
          virtual Bool Read(GeListNode *node, HyperFile *hf, LONG level);  
          virtual Bool Write(GeListNode *node, HyperFile *hf);  
          virtual LONG GetBranchInfo(GeListNode* node, BranchInfo* info, LONG max, ULONG flags);  
      
          static NodeData *Alloc(void) { return gNew MySceneHook; }  
      
      private:  
          AutoAlloc<GeListHead> head;        //this is the list head were the plugin node will be inserted to  
          String hookname;  
          BaseList2D *mynode;        //pointer to an instance of the plugin node  
    };  
      
    Bool MySceneHook::Init(GeListNode *node)  
    {  
      if (!head || !mynode) return FALSE;  
      
      head->SetParent(node);        //needed to save the node list  
      
      head->Insert(mynode, NULL, NULL);    //insert the plugin node into the list  
      
      return TRUE;  
    }  
      
    Bool MySceneHook::Read(GeListNode *node, HyperFile *hf, LONG level)  
    {  
      return head->ReadObject(hf, TRUE);    //needed to read files  
    }  
      
    Bool MySceneHook::Write(GeListNode *node, HyperFile *hf)  
    {  
      return head->WriteObject(hf);    //needed to save files  
    }  
      
    LONG MySceneHook::GetBranchInfo(GeListNode *node, BranchInfo *info, LONG max, ULONG flags)  
    {  
      //fill the info structure array; only one element is saved in this example  
      
      info[0].head = head;  
      info[0].name = &hookname;  
      info[0].id = ID_MYSCENEHOOK;  
      info[0].flags = 0;  
      
      return 1;    //return the number of filled BranchInfo elements  
    }  
      
      
      
    Bool RegisterMySceneHook(void)  
    {  
      return RegisterSceneHookPlugin(ID_MYSCENEHOOK, "My SceneHook", 0, MySceneHook::Alloc, EXECUTION_EXPRESSION, 0, NULL);  
    }  
    

    main.cpp

      
    ...  
    Bool RegisterMyNode(void);  
    Bool RegisterMySceneHook(void);  
    ...  
      
    Bool PluginStart(void)  
    {  
    ...  
      if (!RegisterMyNode()) return FALSE;  
      if (!RegisterMySceneHook()) return FALSE;  
    ...  
      return TRUE;  
    }  
    

    hope this helps

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/05/2010 at 06:43, xxxxxxxx wrote:

    Great!!!!!!!!!!!!
    now is clear for me ;)
    Franz


Log in to reply