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

    bad path to plugin res directory

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 572 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 19/01/2010 at 14:23, xxxxxxxx wrote:

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

      ---------
      Hi,

      When my plugin executes, it tries to load the resource files from the path of the CINEMA_4D executable instead of from the plugin path.

      I tried using resource.Init("path_to_my_plugin_directory"), but that does not work.

      I also tried resource.ReloadResource, even though the header file warned against it. But it still does not work.

      In both cases, the methods were called in response to the C4DPL_INIT_SYS plugin message.

      What am I overlooking? How can I force Cinema4D to look for my resource files in the plugin path instead of in the CINEMA_4D path?

      Note that when we launch cinema4D, we first set the C4D_PLUGINS_DIR environment variable. Could that be causing a problem with loading resources?

      Thanks!

      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 20/01/2010 at 00:41, xxxxxxxx wrote:

        I am not sure what you mean with resources. If you just want to get the plugin path I think Filename GeGetPluginPath(void) is what you are looking for. It returns the plugin path.

        cheers,
        Matthias

        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 21/01/2010 at 12:33, xxxxxxxx wrote:

          There are three res files that are needed by the plugin:
              res/description/vpapplylut.h
              res/description/vpapplylut.res
              res/strings_us/description/vpapplylut.str

          According to the documentation, the res directory should exist in the same directory as the plugin dso:
              /path_to_my_plugin/applylut.so
              /path_to_my_plugin/res

          But Cinema4D wants to load the files from it's own res directory:
              /path_to_executable/CINEMA_4D
              /path_to_executable/resource/res
              /path_to_executable/resource/strings_us

          I'm trying to force Cinema4D to load the res files from the plugin path.

          I just tried this (as recommended in the SDK documentation) :

            
          Bool PluginStart(void)   
          {   
              const Filename pluginPath = GeGetPluginPath();   
              if (!resource.Init(pluginPath)) return FALSE;   
              Bool result = RegisterVideoPostPlugin(ID_APPLYLUT, "applyLUT", 0,   
                      ApplyLut::Alloc, "VPapplyLut",0,0);   
          }   
          

          It does not work, as resource.Init returns FALSE.

          Note that if I copy the files from the plugin res directory into the executable res directory, then it loads correctly. So I'm convinced that there's no problem with the res files themselves.

          How can I force Cinema4D to load these files from the plugin directory?

          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 22/01/2010 at 03:00, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            Note that when we launch cinema4D, we first set the C4D_PLUGINS_DIR environment variable. Could that be causing a problem with loading resources?

            I tried to reproduce the problem but it is working fine or me. Could this be a problem of the path itself (network path?) or the way you run Cinema (commandline?) ?

            Have you tried if this happens on a Windows system too?

            To use a custom resource path you have to allocate a GeRource for your plugin. Please check following code:

              
            //global pointer to custom resource  
            GeResource *customres = NULL;  
              
              
            //C4D_PL_INIT  
            Filename fn = Filename("custom_res_path");  
              
            customres = gNew GeResource;  
            if(customres && customres->Init(fn))  
            {  
              LocalResource* localres = NULL;  
              localres = customres->Get();  
              //register custom description location  
              RegisterDescription(unique_ID, "VPapplyLut", localres);  
            }  
              
              
            //C4DPL_ENDACTIVITY  
            if(customres)  
            {  
              customres->Free();  
              gDelete(customres);  
            }  
            

            cheers,
            Matthias

            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 21/06/2010 at 09:03, xxxxxxxx wrote:

              I have been trying for days to understand why I am getting the same results (Windows 7, 64 bit, Cinema 11.027). Given my current level of expertise with Cinema 4D plugins, it is quite likely that I am doing something wrong.

              Demo:

              http://rapidshare.com/files/401366326/otest.zip.html
              MD5: 1622D41CAD5D76799FBC7D4AE844EB9C

              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 26/09/2010 at 08:01, xxxxxxxx wrote:

                After comparing with RoundedTube, I found out I had to the following:

                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;
                }
                return FALSE;
                }

                Instead of just

                Bool PluginMessage(LONG id, void *data)
                {
                return true;
                }

                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 26/09/2010 at 14:21, xxxxxxxx wrote:

                  Most definitely.  You MUST examine the examples in the cinema4dsdk folder.  You will never figure out all of the nuances by looking only at the SDK docs. 🙂

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