Set preference parameters



  • On 27/09/2016 at 01:27, xxxxxxxx wrote:

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

    ---------
    Hello.

    In my VideoPostData's Execute method, I would like to change a parameter from TeamRender preferences.
    I have seen this http://developers.maxon.net/docs/Cinema4DCPPSDK/html/netprefs_8h.html
    but how do I get the BaseContainer to modify the preference parameters ?

    Thank you for your time.



  • On 27/09/2016 at 08:06, xxxxxxxx wrote:

    Hi,

    in general it's the wrong place to set preference parameters in Execute(). You have no real idea at what place in the rendering pipeline your VideoPost gets executed. Also which other parts of the rendering pipeline rely on what settings. So changing preferences in the midst of a rendering process is generally not a good idea.
    Instead you should think about doing such changes as a reaction to changes of parameters of your VideoPost, i.e. in SetDParameter() of your VideoPostData.

    Now for actually accessing the Team Render preferences:
    You can use NetRenderService::GetNetPreferences(). The needed NetRenderService you get via GetGlobalNetRenderService().



  • On 03/10/2016 at 01:29, xxxxxxxx wrote:

    Thank you for your help.

    What I want to do is to force the option "Get Assets on Demand" to be disabled before I start the scene processing. Having this enabled, everything that is rendered with Team Render, has missing textures. By disabling this, the textures appear fine.

    How else can I ignore this option and always send the textures in Team Render client before the rendering start ?

    Thank you once again for your time.



  • On 04/10/2016 at 06:14, xxxxxxxx wrote:

    Hi,

    actually I think, it's the wrong approach to change the user's preferences in this case. Instead, you should rather add a few lines of code, so your plugin works with Team Render nicely.
    Please don't get angry, if I recap too many things you already know, I just want to make sure, I don't miss anything:

    First of all, handle the messages MSG_GETALLASSETS, MSG_MULTI_CLEARSUGGESTEDFOLDER
     and MSG_RENAMETEXTURES, while these are needed for "Save Project with Assets..." anyway, they are also used in a Team Render context.
    Here are a few threads on this topic:
    MSG_GETALLASSETS calls?
    Weird filenames when using make project
    TeamRender&MSG_MULTI_CLEARSUGGESTEDFOLDER
    questions about network rendering.

    I guess, up to this point there's probably not much new to you.
    Now, you need to take care for the case, where the Team Render Clients are supposed to "Get Assets on Demand", in this case your plugin needs to take care of the situation, if running in a Team Render Client. Don't worry, it's actually pretty simple, although I have to apologize in advance, that it's currently documented a bit "sub-optimally".

    Basically all you need to do is call NetRenderGetFileFromServer() on the document net render context retrieved via GetNetRenderDocumentContext(). You'd normally do this, when you want to load some external asset from disk. At that point, you check, if the asset is already there (ready to be loaded) or if it's still missing and needs to be requested from the Team Render Server.
    For example like so:

    // Checks, if fn already exists locally, otherwise the file will be requested from TRS and fn is changed to point to the file received from TRS
    void GetTeamRenderAsset(BaseDocument* const doc, Filename& fn)
    {
    	if (GeFExist(fn))
    		return;
    	NetRenderDocumentContext* const context = doc->GetNetRenderDocumentContext();
    	if (context == nullptr)
    		return;
    	Filename fnNet;
    	if (NetRenderGetFileFromServer(context->_service, fn.GetFile(), fnNet)) // NOTE: only filename (not path) is used to request the file from TRS
    		fn = fnNet;
    }
    


  • On 04/10/2016 at 06:49, xxxxxxxx wrote:

    Hello Andreas.

    I cannot express how much I thank you for your time describing this issue with so many details.
    The snippet is what I miss in my code.

    Thank you again.



  • On 05/10/2016 at 02:05, xxxxxxxx wrote:

    Hello.

    Do I have to react to MSG_GETALLASSETS calls if the MaterialData consists only of ShaderLink parameters ? (Edit: right now I don't handle the bitmap shader parameters and it seems their texture files are automatically collected by Cinema4D).

    Right now, in MSG_GETALLASSETS  calls, I add to AssetData only the files that are referred in Filename parameters (not the shader link ones). In this case, I don't need to worry for enabled "Get Assets on Demand" because the assets are transferred anyway (am i correct ?).

    So, just for the NodeData plugins that use shader link parameters which are not handled in MSG_GETALLASSETS, I need to use the snippet you wrote above.

    Do I understand it correctly ?

    Thank you.


Log in to reply