C++ SDK Documentation for CINEMA 4D R15.037



  • On 17/09/2013 at 10:36, xxxxxxxx wrote:

    Well, not really dumping, just renaming. 🙂
    If you want to compile a plugin coded with the R14 (or later) API, you can define __LEGACY_API
    before including the c4d header file. You can do this in your IDE's settings or in a source file

    #ifndef __LEGACY_API
        #define __LEGACY_API
    #endif
      
    #include <c4d.h>
      
    Bool SomeFunc(LONG x) {
       // ...
    }
    

    Best,
    -Niklas



  • On 17/09/2013 at 11:31, xxxxxxxx wrote:

    Interesting trick Nik.
    I'll probably just force myself to learn the new names though.
    My fingers type LONG & REAL without thinking about them. It's just going to take a while to re-train my brain to these new names.

    Change is hard.

    -ScottA



  • On 23/09/2013 at 16:58, xxxxxxxx wrote:

    Howdy,

    Originally posted by xxxxxxxx

    Well, not really dumping, just renaming. 🙂
    If you want to compile a plugin coded with the R14 (or later) API, you can define __LEGACY_API
    before including the c4d header file. You can do this in your IDE's settings or in a source file

    #ifndef __LEGACY_API
        #define __LEGACY_API
    #endif
     
    #include <c4d.h>
     
    Bool SomeFunc(LONG x) {
       // ...
    }
    

    Best,
    -Niklas

    Well, I can't get it to work. I'm still getting a ton of "Unknown type name ..." errors. 😠
    Does it matter to which one of my header files I add the above define?

    Adios,
    Cactus Dan



  • On 25/09/2013 at 01:47, xxxxxxxx wrote:

    Is there anywhere a description as how and what needs to be done to support the new TeamRender functionality (there's a bunch of corresponding classes...)? The code that worked fine on NET does not seem to work anymore. How is custom asset distribution handled? Is TeamRender replacing the old NET interface in the future?

    I have endless questions and there is not a single example in the docs showing this utterly important feature.



  • On 26/09/2013 at 04:46, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Howdy,

    Originally posted by xxxxxxxx

    Well, not really dumping, just renaming. 🙂
    If you want to compile a plugin coded with the R14 (or later) API, you can define __LEGACY_API
    before including the c4d header file. You can do this in your IDE's settings or in a source file

    #ifndef __LEGACY_API
        #define __LEGACY_API
    #endif
     
    #include <c4d.h>
     
    Bool SomeFunc(LONG x) {
       // ...
    }
    

    Best,
    -Niklas

    Well, I can't get it to work. I'm still getting a ton of "Unknown type name ..." errors. 😠
    Does it matter to which one of my header files I add the above define?

    Adios,
    Cactus Dan

    Hi Cactus,

    __LEGACY_API must be defined whenever you include the c4d.h header file. The best solution
    is usually to add the definition to the Visual Studio/XCode project settings under "Preprocessor
    Options" so that every single translation unit has that definition pre-defined.

    Best,
    -Niklas



  • On 26/09/2013 at 04:48, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Is there anywhere a description as how and what needs to be done to support the new TeamRender functionality (there's a bunch of corresponding classes...)? The code that worked fine on NET does not seem to work anymore. How is custom asset distribution handled? Is TeamRender replacing the old NET interface in the future?

    I have endless questions and there is not a single example in the docs showing this utterly important feature.

    I have forwarded your question to our internal communication platform. There should be an answer
    soon.



  • On 26/09/2013 at 07:08, xxxxxxxx wrote:

    Thanks Niklas!



  • On 27/09/2013 at 12:32, xxxxxxxx wrote:

    Hi Katachi,

    I got an answer from a developer. Unfortunately I am unable to contribute to the discussion as
    I didn't work with this part of the API before. Is this information satisfying your needs?

    >
    >
    >
    > >These are the two functions which must be implemented in Message(...).

    >
    >
    >
    >
    >

    case MSG_GETALLASSETS:
    \> 
    \> {
    \> 
    \>    // add the file to the asset list.
    \> 
    \>    if (some_filename.Content())
    \> 
    \>    {
    \> 
    \>       ((AssetData* )msgdata)->Add(some_filename, (BaseList2D* )node, netRequestOnDemand);
    \> 
    \>    }
    \> 
    \>    break;
    \> 
    \> }
    

    >
    >
    >
    >
    >

    // Remove the path of the bitmap file, leaving just the filename
    \> 
    \> case MSG_MULTI_CLEARSUGGESTEDFOLDER:
    \> 
    \> {
    \> 
    \>    if (some_filename.Content())
    \> 
    \>    {
    \> 
    \>       some_filename = some_filename.GetFile();
    \> 
    \>    }
    \> 
    \>    break;
    \> 
    \> }
    

    >
    >
    >
    >
    >
    >
    >
    > If the bool value passed to AssetData::Add(..,..,netRequestOnDemand ) is false then the developer doesn't need to do anything.
    >
    > If he sets it to true he must following the next steps:
    >
    > If the plugin registered the file and reads it on its own then it must be requested also from the server with the following peace of code before its read the first time on the client.
    >
    > It depends on the object where to get the correct _service (1st argument passed to NetRenderGetFileFromServer) where to get it from. Where is the corresponding developer
    >
    > going to implement that piece of code?
    >
    >
    >
    >
    >

    Filename fSourceFile = some_filename; // just the filename: "mycache.cache"
    \> 
    \> Filename fPath            = vps->doc->GetDocumentPath();
    \> 
    \> Filename fDestName      = fPath + fSourceFile;
    \> 
    \>   
    \> 
    \> 
    \> NetRenderGetFileFromServer((NetRenderService* )vps->net->_service, fSourceFile, fDestName, vps->thread);
    

    Best,
    -Niklas



  • On 29/09/2013 at 03:51, xxxxxxxx wrote:

    Thanks very much Niklas! I will try this when I am back in the office and let you know.

    Oh and btw. I am implementing this code in a scenehook of mine (dynamics execution stage) to answer the question. Does this pose any issues?



  • On 18/11/2015 at 12:15, xxxxxxxx wrote:

    Hi,

    I am coming back to this finally as I am working on it right now but it doesn't seem to work.

    As mentioned I am in a SceneHook::Execute. I have reacted to MSG_GETALLASSETS and CLEARSUGGESTEDFOLDER (I know there will be no duplicate asset names so I am not handling RENAMETEXTURE yet...it's not thrown as I am at least printing that out in case).

    Testing this with "Save Project with all assets" works without problems. All my custom assets are copied over to the scene folder and the paths are correctly removed during CLEARSUGGESTEDFOLDER leaving only the asset names.

    However, I am stuck with the NetRenderGetFileFromServer call which should get the asset from the server on demand (so I can load it myself). It always returns false though. I am using something like:

    Filename tr_output_filename;  
    NetRenderService* glb_service = GetGlobalNetRenderService();  
          if(glb_service && glb_service->IsRunning() && NetRenderGetFileFromServer(glb_service, assetname.GetFileString(), tr_output_filename))...
    

    I have no clue if that's supposed to work or if it's correct. I can't find any other way to get a NetRenderService pointer or any other information concerning this.

    Can somebody shed some light how the function is supposed to be called from a scene hook? Is my assumption correct that it will ask the server to copy the asset with the given filename to the client machine (specifically to the folder where the scene file asset itself was copied to)?

    Using "Team Render to PV" the assets don't seem to be copied over to the client (roaming folder c4d/teamrender client/users/client/pv).

    I have some more TR related questions but let's stick with this one for now.

    Thanks in advance



  • On 18/11/2015 at 12:29, xxxxxxxx wrote:

    Oh btw. I am doing all this in R16. And maybe the mods could split this topic (or at least change the topic name). It seems misguiding with this topic (but I didn't want to start an all new thread either for the information contained in here).



  • On 19/11/2015 at 02:15, xxxxxxxx wrote:

    Hi Katachi,

    we have no option to split threads and I don't think, we should rename this thread, as it is the announcement of the R15 SDK documentation. I'd rather ask you to open a new thread for this question, if you don't mind.



  • On 19/11/2015 at 05:01, xxxxxxxx wrote:

    Ok, did so.


Log in to reply