Plugin ID Collisions



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

    On 09/10/2012 at 10:27, xxxxxxxx wrote:

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

    ---------
    Hello all.

    Once again I'm having trouble with some C++.  Whenever I have more then one C++ Plugin inside the  the Cinema plugin folder, I get an error when I load up Cinema saying "The plugin ID 'Number here...'  in file 'plugin name' collides with the same ID in file 'another plugin name here'."  The two plugins don't have the same ID, and the collisions are just based off of the order plugins in the folder.

    For example,  if plugin A is before plugin B then B's id collides with A's.  But if B was before A then A's id collides with B's.   If that makes sense.   I followed this example to create the two plugins.  I don't know if there's a buried ID somewhere that's colliding, but I don't think so because the IDs that are colliding are always the standard one's I put to make each unique.

    So, in the end I can't have more then one plugin at once, and I need to know how to fix it.  Thanks for any help, if this makes any sense.

    Dan

    Edit:

    Also is there a way to get feedback from a web browser that's open with AddCustomGui(), with  CUSTOMGUI_HTMLVIEWER inside of C4D?



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

    On 09/10/2012 at 22:03, xxxxxxxx wrote:

    try to rename your target in the xcode project.
    there seem to be problems if you have two projects that are called the same. I always do a search&replace; on the project.pbxproj file in a texteditor to be absolutely sure that all names are unique.



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

    On 10/10/2012 at 09:56, xxxxxxxx wrote:

    Hello, thanks for the response!  DO you mean that I should rename cinema4dSDK underneath Targets?  And I did a search for pbxproj filetypes and none were returned inside of the folder within my projects.  Do you just mean inside my cpp files?  I'm fairly certain none of those share the same name.   Thanks again.

    Dan



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

    On 10/10/2012 at 22:15, xxxxxxxx wrote:

    inside your *.xcodeproj folder (yes, it's a folder, osx just hides it from you) there's a project.pbxproj. I always do a string replace of "cinema4dsdk" with my project title when i copy the project files from the sdk. That way i'm sure there is no name conflict.

    I don't really remember which occurrence caused that problem for me, so i replace all to be safe ;)

    You can also just try and replace all occurrences of "cinema4dsdk" in your project tree



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

    On 10/10/2012 at 23:28, xxxxxxxx wrote:

    Also search for "Product Name" in your Xcode project settings and change it to something unique. I've had the same problem some years ago where SurfaceSPREAD would collide with other plugins even though it had a unique ID. Changing the product name helped for some weird reason that only Xcode fans understand ^^



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

    On 11/10/2012 at 09:58, xxxxxxxx wrote:

    Thanks to both of you, I've got them working now. I would never have looked inside the xcodeproj to try to fix it.  Thanks a ton.

    Also, I saw a couple threads about SetCallBackURL but none of them had answers, does any one know how it interacts with a HTML custom gui?  Can you get feedback back from it with SetCallBackURL?
    Dan



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

    On 15/10/2012 at 03:41, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Also, I saw a couple threads about SetCallBackURL but none of them had answers, does any one know how it interacts with a HTML custom gui?  Can you get feedback back from it with SetCallBackURL?

    Hi Dan,
     
    The URL callback is called whenever a new URL has been selected, either if the user clicked on a link or if the plugin programmer calls HtmlViewerCustomGui::SetUrl(). In the callback you then have access to the string URL of the new page and information on the string encoding.



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

    On 15/10/2012 at 08:39, xxxxxxxx wrote:

    Thanks, Yannick.

    What I'm mainly confused about is the syntax for calling the function. Would I do:

          
    //virtual Bool CreateLayout(void)  
        
           viewer = AddCustomGui(DIALOGID, CUSTOMGUI_HTMLVIEWER, "pyBROWSER", BFH_SCALEFIT|BFV_SCALEFIT, 512, 250, bc);  
            
            
          HtmlViewerCustomGuiURLCallback callback;  
          HtmlViewerCustomGui* view;  
          view = (HtmlViewerCustomGui* )viewer;  
          view->SetURLCallback(callback, <#void *user_data#>)  
            
          view->SetUrl("https://www.google.com/", URL_ENCODING_UTF16);  
            
    

    If that's right, what would userdata be in this circumstance?
    And how would I set up the call to that callback?

    Dan



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

    On 15/10/2012 at 09:36, xxxxxxxx wrote:

    A callback is a function, so here's how you can define it for the HtmlViewerCustomGui:

    void htmlViewerCallback(void* user_data, const String& url, LONG encoding, void* reserved)
    {
        GePrint(url);
    }
      
    virtual Bool CreateLayout(void)
    {
        ...
        htmlViewer->SetURLCallback(htmlViewerCallback, NULL);
        ...
    }
    

    The user data is used to have a custom object accessible in the callback so you can set it to NULL if you don't need it. The user data could be set to htmlViewer if you want to access the HtmlViewerCustomGui from the callback for example.



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

    On 15/10/2012 at 13:10, xxxxxxxx wrote:

    Thank again Yannick.

    Should I be able to just cop and paste that?  I've been trying to get it working but I've been getting an error saying that there's "no function call to SetURLCallback(<unresolved overloaded function>,Null)".

    I've been reading though your last post here, but I haven't had any luck with that either.  
    Thanks for all the help.

    Dan



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

    On 15/10/2012 at 17:54, xxxxxxxx wrote:

    Callback methods can be very confusing unless you see a full working example of them in action.
    So maybe this example will help.

    This is the entire .cpp code for a very basic dialog plugin example with no external resources.
    When the plugin opens. The HtmlViewerCustomGui fetches the Google website and displays it in the plugin.
    When the button is clicked. It loads the Maxon website. Plus... it also calls to the htmlViewerCallback() method and runs the code inside of it.
    In this case it just prints url.

    Example:

    // Testing ID# Only!!!!   Be sure to use a unique ID obtained from www.plugincafe.com  
    #define PLUGIN_ID 1000006  
      
    #include "c4d.h"  
    #include "gui.h"  
    #include "c4d_symbols.h"  
    #include "customgui_htmlviewer.h"  
      
    enum  
    {  
      MY_HTML_VIEWER = 5000,  
      MY_LABEL,  
      MY_BUTTON,  
      _dummy  
    };  
      
    class myDialog : public GeDialog  
    {  
      private:  
          HtmlViewerCustomGui *viewer;  
          C4DGadget *myButton;  
      
      public:  
          myDialog(void);  
          virtual Bool CreateLayout(void);  
          virtual Bool InitValues(void);  
          virtual Bool Command(LONG id,const BaseContainer &msg);  
    };  
      
    //This is a custom callback method that will print the url of the webpage when the button is clicked  
    void htmlViewerCallback(void* user_data, const String& url, LONG encoding, void* reserved)  
    {  
      GePrint(url);  
    }  
      
      
    //The constructor  
    myDialog::myDialog(void){}  
      
    Bool myDialog::CreateLayout(void)  
    {  
      SetTitle("Simple HTML Viewer Example");  
      
      GroupBegin(0,BFH_SCALEFIT,2,0,"",0);  
      {  
          AddStaticText(0,BFH_LEFT,0,0,"My Viewer",0);  
          myButton = AddButton( MY_BUTTON, BFH_SCALEFIT, 80,  15, "Load HTML Page");  
      }  
      GroupEnd();  
      
      //Set up the HtmlViewerCustomGui stuff  
      BaseContainer htmlc;  
      viewer = (HtmlViewerCustomGui* )AddCustomGui(MY_HTML_VIEWER, CUSTOMGUI_HTMLVIEWER, "HTML_WINDOW", BFH_SCALEFIT|BFV_SCALEFIT, 512, 250, htmlc);  
      viewer->SetUrl("https://www.google.com/", URL_ENCODING_UTF16);  
      
      return TRUE;  
    }  
      
      
    Bool myDialog::InitValues(void)  
    {      
      return TRUE;  
    }  
      
    Bool myDialog::Command(LONG id,const BaseContainer &msg)  
    {  
            
      switch (id)  
      {  
            
          case MY_BUTTON:  
              if (MY_BUTTON)  
              {  
                  viewer->SetUrl("http://maxon.net", URL_ENCODING_UTF16);  //Load this HTML page  
                  viewer->SetURLCallback(htmlViewerCallback, NULL);        //Execute whatever code is inside the htmlViewerCallback() method  
              }  
              break;  
      
      }      
      
      return TRUE;  
    }  
      
      
    ///////// The plugin registration section ///////////////  
    class myHTMLviewer : public CommandData  
    {  
      private:  
          myDialog dlg;  
      
      public:  
          virtual Bool Execute(BaseDocument *doc);  
          virtual Bool RestoreLayout(void *secret);          
    };  
      
    Bool myHTMLviewer::Execute(BaseDocument *doc)  
    {  
      return dlg.Open(DLG_TYPE_ASYNC,PLUGIN_ID, -1, -1, 300,150);      
    }  
      
    Bool myHTMLviewer::RestoreLayout(void *secret)  
    {  
      return dlg.RestoreLayout(PLUGIN_ID,0,secret);  
    }  
      
    Bool RegistermyHTMLviewer(void)  
    {  
      return RegisterCommandPlugin(PLUGIN_ID,GeLoadString(IDS_HTML_VIEWER),0,AutoBitmap("icon.tif"),String("HTML Viewer"),gNew myHTMLviewer);      
    }
    

    -ScottA



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

    On 17/10/2012 at 14:17, xxxxxxxx wrote:

    Thanks so much Scott, it works perfectly.

    Is there a way to get any other type of information from a website besides a url?  For example could I get an array from a website or something similar?

    Thanks a bunch!

    Dan



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

    On 17/10/2012 at 14:54, xxxxxxxx wrote:

    Look up GetTextArea in the docs.
    That function might possibly read the text in the loaded HTML page.
    I never use this URL stuff. So I don't really know what all of the possibilities are.

    I've have had difficulty with understanding how to use the callbacks in the SDK myself. And Yannick helped me understand how to use them in a previous thread.
    That's really all I can offer advice about.

    -ScottA



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

    On 18/10/2012 at 11:11, xxxxxxxx wrote:

    Thanks Scott.  I've been experimenting with the code you provided.  No luck yet but I'm going to keep trying.

    Dan


Log in to reply