Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Ignore missing plugins - NodeData

    Cinema 4D SDK
    r19 r20 c++
    2
    8
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C4DSC
      C4DS
      last edited by

      I have this plugin where I have a SceneHook derived plugin, and several NodeData derived plugins. Over time I have created numerous scene files containing the registered NodeData-derived plugins. Having now realized some of these NodeData-derived plugins are obsolete, I thought of removing them from the project, and thus not registering them anymore. However, when I then open a saved scene file, it complains (obviously) about the missing plugins.

      What options do I have to not register the obsolete plugins, but avoid the "missing plugin" warning?
      Can I read the NodeData in the SceneHook somehow, and ignore it? Or do I still have to create a dummy NodeData derived plugin for the obsolete pluginIDs?

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        I also don't see any other way then to have at least some dummy plugins to avoid that message.

        Would it make sense to have some kind of converter that handles a scene with with the old elements and removes them correctly?

        How are your scene hook and the other plugins related? Do you store the NodeData based plugins within your scene hook?

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • C4DSC
          C4DS
          last edited by

          Thanks Sebastian,

          I do register a SceneHook using a "level" value, which represents the version.
          Each NodeData is created during SceneHook::Init and inserted into the scenehook's GeListHead

          The SceneHook::Read performs a GeListHead::ReadObject and then checks the level value and there I create new NodeData introduced after that particular level value.

          The SceneHook::Write does perform a GeListHead::WriteObject.

          Should / Could I check for the particular level value and remove obsolete NodeData from the GeListHead before writing out?
          Or do I need to filter out the obsolete NodeData during the Read?

          Currently, the Init method does not create, nor insert the obsolete NodeData into the SceneHook's GeListHead (anymore). I suppose this needs to be reverted, as the obsolete NodeDatas need to be known in order to filter them out.
          So, a convertor to read the old elements and removes them would be indeed what I am after.
          How should I proceed?

          1 Reply Last reply Reply Quote 0
          • S
            s_bach
            last edited by

            Hello,

            you could try to filter the unneeded nodes after reading (as far as I understand you don't have any use for these nodes anyway). This would still requires at least some dummy nodes to avoid issues.

            After filtering, you could write the GeListHead as it is in Write().

            Why do you need the order of the nodes? You could get the type of the nodes to check if it is still a needed node or not.

            best wishes,
            Sebastian

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            C4DSC 1 Reply Last reply Reply Quote 0
            • C4DSC
              C4DS @s_bach
              last edited by C4DS

              @s_bach
              Order?
              Ah, yeah! Sorry, I see why you assume I need a specific order from following sentence:
              "as the obsolete NodeDatas need to be known in order to filter them out."
              But what I meant to say was that I assume the obsolete NodeData need to be known, for them to be filtered out. Where "order" was not meant as meaning "a specific sequence".

              So, I still need dummy plugins, and apparently it would also be better to have dummy NodeData to avoid issues?
              I guess I better keep the original plugin and NodeData then. They're obsolete, so I could remove any processing implementation from their methods. But still leave them as is, instead of trying to replace them by dummy ones.

              1 Reply Last reply Reply Quote 0
              • S
                s_bach
                last edited by

                Hello,

                yes, having dummy plugins seems necessary.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • C4DSC
                  C4DS
                  last edited by

                  Hello again,
                  I am having second thoughts, as I still would like to clean up the mistakes I made.
                  I want to filter out unneeded NodeData.
                  But how does the actual filtering work? What needs to be done?

                  Following is what I do for the needed NodeData:

                  1. In the main part of the plugin I register these NodeData plugins.
                  2. In the SceneHook::Init I allocate these NodeData and insert them in scenehooks' node branch.
                  3. For new NodeData that were introduced for new features, and are not yet available in older scene files, I allocate NodeData and insert them in the scenehooks' node branch during the SceneHook::Read.
                  4. In the SceneHook:Write I save all using following implementation
                  Bool MySceneHook::Write(GeListNode *node, HyperFile *hf)
                  {
                  	return mBranchHead->WriteObject(hf);
                  }
                  
                  class MySceneHook : public SceneHookData
                  {
                  private:
                  	AutoAlloc<GeListHead> mBranchHead;
                  

                  If I understand correctly, to filter out the unneeded NodeData I have to:

                  1. still register the NodeData plugin
                  2. skip allocating and inserting them during SceneHook::Init
                  3. skip allocating and inserting them during SceneHook::Read
                  4. ??? do what in SceneHook::Write ???

                  In theory, once all scene files have been updated (removed from unneeded NodeData), I then could also skip registering the needed NodeData plugins.

                  Main question thus remains, what to do in the SceneHook::Write ?

                  1 Reply Last reply Reply Quote 0
                  • S
                    s_bach
                    last edited by

                    Hello,

                    I don't think you have to do anything else in Write(). WriteObject() should only write the nodes that you inserted into the list head. If you don't add outdated nodes to your list head, they are not written into the file.

                    best wishes,
                    Sebastian

                    MAXON SDK Specialist

                    Development Blog, MAXON Registered Developer

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post