Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Set preference parameters

    SDK Help
    0
    6
    801
    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
      Helper
      last edited by

      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 https://developers.maxon.net/docs/cpp/2023_2/netprefs_8h.html
      but how do I get the BaseContainer to modify the preference parameters ?

      Thank you for your time.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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().

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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;
            }
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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.

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