Cinema looking at the wrong place?

On 29/01/2013 at 03:57, xxxxxxxx wrote:

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

Hello there fellow coders,

Recently I started coding a plug-in for Cinema that exports the scene to another file format for use in a "2.5D" game engine.

I've done that already for another file format, so I'm certainly not new to this. However, back then I didn't need any resources or such, as it was only a simple SceneSaver.

So now I do need resources, because this time I'm utilizing Tags, which of course need parameters. Unfortunately, this is where I am new to. To get into that, I tried to make use of the "look at camera" tag from the SDK examples, putting every file needed for the descriptions in their places, renaming them, registered a test tag plugin which tries to load the resource files just like in "lookatcamera.cpp".

It builds just fine and also loads into Cinema, I can even assign this test tag to an object in the scene. However, it immediately tells me that Cinema couldn't load the file '<Cinema directory>/resource/strings_us/description/tpathsetuptag.str' ("tpathsetuptag" is the name I gave those files).

Putting every file into the corresponding directory in <Cinema directory>/resource/ does fix this, but I'm certain it is not supposed to work like that.

The plug-in directory is structured exactly like described in the SDK Help (and the c4dsdk-project).

Of course, I already tried searching for solutions to this problem, but generally just get results for people having problems even building their plug-ins.

Why is Cinema even looking there instead of the plug-in directory? Shouldn't those resource files be built into the dynamic library? Maybe this is what's going wrong here, misconfiguration of my Xcode (4.5.2) project.

Thanks in advance,

On 29/01/2013 at 09:33, xxxxxxxx wrote:

The .str, .h, and .res files are NOT built into the dynamic library.  For instance, .str allows you to support multiple languages by putting into different folders (strings_us, strings_de, strings_fr, and so on).  The plugin 'res' folder must be in your plugin's folder.

You should have a Plugin folder setup like this:

- myplugin.cdl
- myplugin.cdl64
- myplugin.dylib
- res:
-- c4d_symbols.h  // general resource ids
-- description:
---- tmyplugin.h    // your tag plugin's resource ids
---- tmyplugin.res  // your tag plugin's resource description
-- strings_us:
---- c4d_strings.str // general resource strings
---- description:
------ tmyplugin.str  // your tag plugin's resource strings

On 29/01/2013 at 09:37, xxxxxxxx wrote:

Did you by any chance re-use the code from GetDDescription in the SDK example in your plugin? And did you get a new unique ID for it from here?

For a basic tag you just need to implement the two virtual functions Init() and Execute(), and you might be able to get away without Init() depending on what you need to do. Just discard the code for GetDDescription if you used that.

The resource files are not compiled into the .dylib, they are separate files loaded at run time.


On 30/01/2013 at 00:33, xxxxxxxx wrote:

Oh man, quite embarrassing...

I found out what went wrong. I was most likely too quick in removing everything unnecessary from the main.cpp of the cinema4dsdkexample project that I accidentally removed the following line from the code:


So, of course Cinema was looking at the "wrong" place, it wasn't even told to consider the plug-in directory!

The code in main.cpp was too little for me to even think about looking there.

Thank you both for replying!