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

    My VideoPost Plugin can't be inserted

    SDK Help
    0
    6
    455
    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.
    • H
      Helper
      last edited by

      On 28/06/2015 at 08:29, xxxxxxxx wrote:

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

      ---------
      Hello SDK Support Team!
      I've run into a little big problem and I can't find out what could be the cause and I also wasn't able
      to revert to a situation where this problem does not occur.

      The VideoPostData  plugin I created can not be added the the RenderData. You can see it in the
      drop-down menu when you press the "Effect..." button, but selecting it from the list does not
      insert it.

      I've added a print statement to my LensVideoPost::Alloc() static function to check when the
      function is called. The observations I made certainly confuse me.

      1. Pressing the "Effect..." button calls LensVideoPost::Alloc(). But the object is destroyed immediately
        afterwards (I assume the "Effect..." button builds the menu by allocating an instance of each plugin,
        getting its name and then freeing it again)
      2. After the Video Post is selected, nothing happens. Alloc() is not even called!
      3. Trying to create one from Python fails instantly, Alloc() is not called!
      4. Opening a scene that already had this Video Post inserted works! However, when you remove the
        Video Post and try to add it again, its the same behaviour as I already described.
      5. Cloning the Video Post from the scene that was loaded works as well.

      I would like to send you the plugin for Windows or Mac (both same behaviour) and a scene that
      contains the plugin so you can also check out observation #4. Please let me know if you need it
      and where to send it.

      Thanks a lot in advance!
      Niklas

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 30/06/2015 at 02:37, xxxxxxxx wrote:

        Hello,

        without any code it is hard to say anything. Please provide some snippets of the most relevant parts of your code (Register() etc.).

        Best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 30/06/2015 at 04:27, xxxxxxxx wrote:

          Hi Sebastian,

          sure. Here's the register, alloc, init and free functions:

          /// ---------------------------------------------------------------------------
          /// ---------------------------------------------------------------------------
          class LensVideoPost: public VideoPostData
          {
            // ...
          public:
            static NodeData* Alloc() { GePrint(">>> LensVideoPost::Alloc()"); return NewObjClear(LensVideoPost); }
            // ...
          };
            
          /// ---------------------------------------------------------------------------
          /// ---------------------------------------------------------------------------
          Bool RegisterLensVideoPost()
          {
            const String name = GeLoadString(PROJLENS_PLUGINID);
            return RegisterVideoPostPlugin(
              PROJLENS_PLUGINID,    // Plugin ID
              name,                 // Name
              0,                    // Info Flags
              LensVideoPost::Alloc, // Allocator
              "vpprojlens",         // Description
              0,                    // Disklevel
              0,                    // Priority
              nullptr);             // Unused, always nullptr
          }
            
          /// ---------------------------------------------------------------------------
          /// ---------------------------------------------------------------------------
          Bool LensVideoPost::Init(GeListNode* node)
          {
            GePrint(">>> LensVideoPost::Init() #1");
            if (!node || !super::Init(node)) return false;
            BaseContainer* bc = Get(node)->GetDataInstance();
            GePrint(">>> LensVideoPost::Init() #2");
            if (!bc) return false;
            GePrint(">>> LensVideoPost::Init() #3");
            bc->SetInt32(PROJLENS_TYPE, PROJLENS_TYPE_EQUIRECTANGULAR);
            bc->SetFloat(PROJLENS_EQUI_HFOV, Rad(180.0));
            bc->SetFloat(PROJLENS_EQUI_VFOV, Rad(90.0));
            bc->SetBool(PROJLENS_EQUI_NODISTORTION, true);
            bc->SetFloat(PROJLENS_FISH_FOV,  Rad(180.0));
            bc->SetBool(PROJLENS_FISH_OVERLAY, false);
            bc->SetFloat(PROJLENS_STEREOGRAPHIC_ZPOSITION, 1.0);
            return true;
          }
            
          /// ---------------------------------------------------------------------------
          /// ---------------------------------------------------------------------------
          void LensVideoPost::Free(GeListNode* node)
          {
            GePrint(">>> LensVideoPost::Free()");
          }
          

          Cheers,
          -Niklas

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 30/06/2015 at 08:49, xxxxxxxx wrote:

            hey Niklas,
            I'm not sure about the 2 early returns in your Init() function.
            1- in my videopost plugin I don't call parent Init()
            2- I get container like this "not sure about the Get(node)"

            BaseVideoPost\* bvp  = (BaseVideoPost\* )node;
            BaseContainer\* data = bvp->GetDataInstance();  
            

            so maybe when you create the plugin it get stuck at Init()
            but when you load a document with the plugin it doesn't call Init() at all "as it may be using read/write stuff to copy data directly without the need of using Init()"

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 30/06/2015 at 09:07, xxxxxxxx wrote:

              hey Mohamend,
              thanks for your comment. But Init() succeeds, so that's not the issue I think. The Get()  you see in
              Init()  is overloaded and does basically the cast to  BaseVideoPost.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 01/07/2015 at 01:47, xxxxxxxx wrote:

                Hello,

                you code looks good so gar. But based on the class name I assume you are creating a custom lens? Maybe this causes the described behavior.

                Best wishes,
                Sebastian

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