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

    Object doesn't show up in plugin menu.

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 264 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 26/12/2009 at 12:30, xxxxxxxx wrote:

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

      ---------
      I created a basic object template and for some reason no object is showing up in the plugins menu.    Here is the .cpp file and the main.cpp file..    Does anyone see any reason why this wouldn't work in 11.5?

      TreeMaker.cpp

        
        
      /////////////////////////////////////////////////////////////  
      // TreeMaker  
        
      #include "c4d.h"  
      #include "c4d_symbols.h"  
      #include "otreemaker.h"  
        
      // be sure to use a unique ID obtained from www.plugincafe.com  
      #define ID_TREEMAKER  1024835  
        
      class TreeMaker : public ObjectData  
      {  
        INSTANCEOF(TreeMaker,ObjectData)  
        
        public:  
            virtual Bool Init(GeListNode *node);  
            virtual Bool Message(GeListNode *node, LONG type, void *t_data);  
            static    NodeData *Alloc(void) { return gNew TreeMaker; }  
                    Bool CreateTree(GeListNode *node, BaseObject* op);  
        
                      
      };  
        
      // initialize settings  
      Bool TreeMaker::Init(GeListNode *node)  
      {    //Called when a new instance of the node plugin has been allocated. You can use this function to for example fill the BaseContainer of the connected node with default values:  
        return TRUE;  
      }  
        
      Bool TreeMaker::Message(GeListNode *node, LONG type, void *t_data)  
      {      
        return TRUE;  
      }  
        
      Bool TreeMaker::CreateTree(GeListNode *node, BaseObject* op)  
      {  
        return TRUE;  
      }  
        
      Bool RegisterTreeMaker(void)  
      {  
        // decide by name if the plugin shall be registered - just for user convenience  
        String name=GeLoadString(IDS_TREEMAKER); if (!name.Content()) return TRUE;  
        return RegisterObjectPlugin(ID_TREEMAKER,name,OBJECT_GENERATOR|OBJECT_INPUT,TreeMaker::Alloc,"OTreeMaker","TreeMaker.tif",0);  
      }  
        
        
      

      and here is main.cpp

        
      /////////////////////////////////////////////////////////////  
      // CINEMA 4D SDK                                           //  
      /////////////////////////////////////////////////////////////  
      // (c) 1989-2004 MAXON Computer GmbH, all rights reserved  //  
      /////////////////////////////////////////////////////////////  
        
      // Starts the plugin registration  
        
      #include "c4d.h"  
      #include <string.h>  
        
      // forward declarations  
      Bool RegisterTreeMaker(void);  
        
      C4D_CrashHandler old_handler;  
        
      void SDKCrashHandler(CHAR *crashinfo)  
      {  
        //printf("SDK CrashInfo:\n");  
        //printf(crashinfo);  
          
        // don't forget to call the original handler!!!  
        if (old_handler) (*old_handler)(crashinfo);  
      }  
        
      void EnhanceMainMenu(void)   
      {  
        // do this only if necessary - otherwise the user will end up with dozens of menus!  
        
        if (!(GeGetVersionType()&VERSION_CINEMA4D)) // only if C4D is loaded  
            return;  
        
        BaseContainer *bc = GetMenuResource(String("M_EDITOR"));  
        if (!bc) return;  
        
        // search for the most important menu entry. if present, the user has customized the settings  
        // -> don't add menu again  
        if (SearchMenuResource(bc,String("PLUGIN_CMD_1000472")))  
            return;   
        
        GeData *last = SearchPluginMenuResource();  
        
        BaseContainer sc;  
        sc.InsData(MENURESOURCE_SUBTITLE,String("SDK Test"));  
        sc.InsData(MENURESOURCE_COMMAND,String("IDM_NEU")); // add C4D's new scene command to menu  
        sc.InsData(MENURESOURCE_SEPERATOR,TRUE);  
        sc.InsData(MENURESOURCE_COMMAND,String("PLUGIN_CMD_1000472")); // add ActiveObject dialog to menu  
          
        if (last)  
            bc->InsDataAfter(MENURESOURCE_STRING,sc,last);  
        else // user killed plugin menu - add as last overall entry  
            bc->InsData(MENURESOURCE_STRING,sc);  
      }  
        
      Bool PluginStart(void)  
      {  
        // example of installing a crashhandler  
        old_handler = C4DOS.CrashHandler; // backup the original handler (must be called!)  
        C4DOS.CrashHandler = SDKCrashHandler; // insert the own handler  
          
        // shader plugins  
        if (!RegisterTreeMaker()) return FALSE;  
        
        
        return TRUE;  
      }  
        
      void PluginEnd(void)  
      {  
        
      }  
        
      Bool PluginMessage(LONG id, void *data)  
      {  
        //use the following lines to set a plugin priority  
        //  
        switch (id)  
        {  
            case C4DPL_INIT_SYS:  
                if (!resource.Init()) return FALSE; // don't start plugin without resource  
                //if (!RegisterTreeMaker()) return FALSE;  
                return TRUE;  
        
            case C4DMSG_PRIORITY:   
                return TRUE;  
        
            case C4DPL_BUILDMENU:  
                EnhanceMainMenu();       
                break;  
                  
            case C4DPL_COMMANDLINEARGS:  
                {  
                    C4DPL_CommandLineArgs *args = (C4DPL_CommandLineArgs* )data;  
                    LONG i;  
        
                    for (i=0;i<args->argc;i++)  
                    {  
                        if (!args->argv[i]) continue;  
                          
                        if (!strcmp(args->argv[i],"--help") || !strcmp(args->argv[i],"-help"))  
                        {  
                            // do not clear the entry so that other plugins can make their output!!!  
                            GePrint("\x01-SDK is here :-)");  
                        }  
                        else if (!strcmp(args->argv[i],"-SDK"))  
                        {  
                            args->argv[i] = NULL;  
                            GePrint("\x01-SDK executed:-)");  
                        }  
                        else if (!strcmp(args->argv[i],"-plugincrash"))  
                        {  
                            args->argv[i] = NULL;  
                            *((LONG* )0) = 1234;  
                        }  
                    }  
                }  
                break;  
        
            case C4DPL_EDITIMAGE:  
                {  
                    C4DPL_EditImage *editimage = (C4DPL_EditImage* )data;  
                    if (!data) break;  
                    if (editimage->return_processed) break;  
                    GePrint("C4DSDK - Edit Image Hook: "+editimage->imagefn->GetString());  
                    // editimage->return_processed = TRUE; if image was processed  
                }  
                return FALSE;  
        }  
        
        return FALSE;  
      }  
      

      Thanks,

      ~Shawn

      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 27/12/2009 at 04:29, xxxxxxxx wrote:

        You have to overload the ObjectData::GetVirtualObjects() member.

        cheers,
        Matthias

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