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
    • Recent
    • Tags
    • Users
    • Login

    Registering SceneHookData

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 260 Views
    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 Offline
      Helper
      last edited by

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

      On 15/07/2010 at 02:50, xxxxxxxx wrote:

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

      ---------
      Hi all!

      I'm a beginner in writing C++ plugins for C4D. I would like to control the rotations of the camera in the active viewport. I've read the basics about writing plugins in C++ and I think my plugin class should derive from SceneHookData.

      The problem seems to be the registration of my plugin. Here is my code :

      Main.cpp

      #include "c4d.h"
        
      Bool RegisterMyPlugin();
        
      Bool PluginStart(void)
      {
          if(!RegisterMyPlugin()) return FALSE;
          return TRUE;
      }
        
      void PluginEnd(void)
      {
      }
      Bool PluginMessage(LONG id, void *data)
      {
          switch (id)
          {
              case C4DPL_INIT_SYS:
                  if (!resource.Init()) return FALSE; // don't start plugin without resource
                  return TRUE;
              case C4DMSG_PRIORITY: 
                  return TRUE;
          }
          return FALSE;
      }
      

      MyPlugin.cpp

      #include "c4d.h"
        
      #define ID_MYPLUGIN 123456789
        
      class MyPlugin : public SceneHookData
      {
          public:
              static NodeData *Alloc(void) { return gNew MyPlugin; }
      };
        
      Bool RegisterMySceneHook(void)
      {
          return RegisterSceneHookPlugin(ID_MYPLUGIN,"My Plugin",PLUGINFLAG_SCENEHOOK_SUPPORT_DOCUMENT_DESCRIPTION,MyPlugin::Alloc,EXECUTION_EXPRESSION,0,NULL);
      }
      

      And my Errors (I use Visual Studio) :

      Error	1	error LNK2019: unresolved external symbol "int __cdecl RegisterMyPlugin(void)" (?RegisterMyPlugin@@YAHXZ) referenced in function "int __cdecl PluginStart(void)" (?PluginStart@@YAHXZ)	Main.obj	plugintemplate
        
      Error	2	fatal error LNK1120: 1 unresolved externals	plugintemplate.cdl	plugintemplate
      

      Thank you for your help !

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

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

        On 15/07/2010 at 03:51, xxxxxxxx wrote:

        try addin "void" in the brackets

        Bool RegisterMyPlugin();
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 15/07/2010 at 05:38, xxxxxxxx wrote:

          Thank you sandidolsak but I finally rearranged the project and it works!

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