How to use more than one .res file?



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

    On 03/11/2011 at 09:52, xxxxxxxx wrote:

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

    ---------
    Can anyone tell me how to set up the code in my .cpp file to be able to load GUI items from more than one resource (.res) file?

    I couldn't find any examples of this in the SDK examples.

    -ScottA



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

    On 04/11/2011 at 13:13, xxxxxxxx wrote:

    No one?

    Here's an example:
    ** The .cpp file:**

    #include "c4d.h"  
    #include "c4d_symbols.h"  
    #include "tsimpletag.h"  //The .h file holding the ID numbers for the first .res file's GUI items  
    #include "tsimpletag2.h" //The .h file holding the ID numbers for the second .res file's GUI items  
      
    #define PLUGIN_ID    1000003   // be sure to use a unique ID obtained from www.plugincafe.com  
      
    class SimpleTag : public TagData  
    {  
      public:  
          virtual Bool Message(GeListNode *node, LONG type, void *t_data);  
          virtual Bool Init(GeListNode *node);  
          virtual Bool GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags);          
          virtual EXECUTIONRESULT Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);  
            
          static NodeData *Alloc(void) { return gNew SimpleTag; }  
    };  
      
    Bool SimpleTag::Message(GeListNode *node, LONG type, void *data)  
    {   
      return TRUE;  
    }  
      
    Bool SimpleTag::Init(GeListNode *node)  
    {  
      BaseTag    *tag  = (BaseTag* )node;               // Assigns a variable to the tag's node  
      BaseContainer *data = tag->GetDataInstance(); // Assigns a variable to that node's container  
      
      data->SetBool(MYBOX,FALSE);             //This checkbox is in the first .res file("tsimpletag.res")  
      data->SetString(MYTEXTBOX2, "HELLO_2"); //This textbox is located inside of a second .res file("tsimpletag2.res")  
      
      return TRUE;  
    }  
      
    Bool SimpleTag::GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags)  
    {  
      return TRUE;  
    }  
      
    EXECUTIONRESULT SimpleTag::Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags)  
    {      
      return EXECUTIONRESULT_OK;  
    }  
      
    Bool RegisterSimpleTag(void)  
    {  
      return RegisterTagPlugin(PLUGIN_ID,GeLoadString(IDS_SIMPLETAG),TAG_EXPRESSION|TAG_VISIBLE,SimpleTag::Alloc,"tsimpletag",AutoBitmap("myicon.tif"),0);      
    }
    

    _ The c4d_symbols file:_

    enum  
    {  
      // string table definitions  
        
      IDS_SIMPLETAG = 10000,  
      IDS_SIMPLETAG2 = 10001,      
      
    // End of symbol definition  
      _DUMMY_ELEMENT_  
    };  
    

    It looks to me like the plugin is loading the first .res file through this code in the registration:GeLoadString(IDS_SIMPLETAG).
    But I have no idea how to change it to load multiple .res files?

    Am I looking in the wrong place to do this?
    Maybe, possibly, I have to use some sort of LoadDescription() instead?

    -ScottA



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

    On 05/11/2011 at 06:50, xxxxxxxx wrote:

    Since you can only associate one resource file with a plugin in the Register...() function by name (const String& decription) and only during registration, it should be evident that you cannot use more than one resource file.  Why do you need two?



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

    On 05/11/2011 at 07:32, xxxxxxxx wrote:

    I suppose if you want to make a really big change to an object's description it might be easier to load a new one rather than change an old one, if you can do it.

    I've looked at this out of interest and one possible way might be to use RegisterDescription() when registering the plugin, then in GetDDescription() do a LoadDescription() for the registered description. I have no idea if it would work, though.



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

    On 05/11/2011 at 08:36, xxxxxxxx wrote:

    Maybe I've explained poorly.
    I've seen plugins that don't just have one .res file. But many of them in their description folder.
    Dans' rigging plugins is one example. So I was wondering how that is done?

    I see that you must have an .h file accompanying each .res file. That makes sense to me.
    But after that I don't know what else is required.
    It occurred to me today that these people might also be using multiple .cpp files in their plugins.

    So it might go something like this:
    myfirst.cpp--->Holds some code with references to a myfirst.res & myfirst.h files
    mysecond.cpp--->Holds some code with references to a mysecond.res & mysecond.h files
    mymain.cpp--->Holds the  main code with the plugin registration at the bottom

    I've never done a plugin with this kind of widely spread out OOP type layout before with C4D. And I'm having trouble figuring it out the proper syntax need to put something like this together.

    -ScottA



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

    On 05/11/2011 at 09:03, xxxxxxxx wrote:

    OIC. These are actually separate plugins. Although there's only one .cdl (or .cdl64 or .dylib) file, in fact it contains multiple plugins. For example, it might contain a menu plugin, an object plugin, a shader plugin, and a couple of tags, all forming part of the overall project. Each of these plugins will have its own unique ID and resource files. So the project structure might look like:

    mymenuplugin.cpp   
    myobjectplugin.cpp
    myshaderplugin.cpp
    myfirsttag.cpp
    mysecondtag.cpp
    main.cpp (contains just the code required to register and start the various plugins)

    You just add all the required .cpp and .h files to your project, get unique IDs for all the plugins you create, build their resource files and compile as usual. You end up with one executable plus several resource files.



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

    On 05/11/2011 at 09:54, xxxxxxxx wrote:

    Oh.
    I didn't know they were always multiple plugins.

    Some of them are so small that it didn't seem logical to use as a stand alone plugin. So I thought they were able to split up the .res files somehow.

    Thanks for the information.🍺

    -ScottA



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

    On 05/11/2011 at 11:17, xxxxxxxx wrote:

    Glad that you clarified and see what's going on.  Yeah, you can build multiple 'plugins' into a single plugin dynamic-link library.  InterPoser Pro is composed of something like 20+ plugins in one .cdl/.dylib.  Each plugin only gets one resource file but there are plenty of resource files for the plugin dll.

    If you need to have 'dynamic' description elements for a single plugin then you should look into using GetDDescription() which allows you to load your static resource and then add dynamic elements as well.



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

    On 05/11/2011 at 11:52, xxxxxxxx wrote:

    Ok. Thanks Robert.🍺

    -ScottA


Log in to reply