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

    Preprocessing document before rendering [SOLVED]

    SDK Help
    0
    5
    361
    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 10/06/2015 at 03:00, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      Hi! I use MSG_MULTI_RENDERNOTIFICATION to modify a document before it is rendered. For instance,
      inserting an object works, but modifying the active render settings does not. I guess this is because there
      is a BaseContainer passed for the render settings on RenderDocument().

      I see that I can read and write the render settings via Render::GetRenderData() and
      Render::SetRenderData(), but how would I then go about modifying settings for a Video Post?

      switch (msg) {
        case MSG_MULTI_RENDERNOTIFICATION: {
          auto* data = static_cast<RenderNotificationData*>(pdata);
          if (!data->start || !data->external) break;
          data->doc->InsertObject(BaseObject::Alloc(Ocube));  
          BaseContainer bc = data->render->GetRenderData();  
          bc.SetFilename(RDATA_PATH, "");
          data->render->SetRenderData(bc);
          if (bc.GetInt32(RDATA_RENDERENGINE) == VRAYBRIDGE_ID) {
             // todo: How would I go about changing settings for the Vray Bridge video post here (or any other)?
          }
          break;
        }
      }
      

      Thanks in advance!
      Niklas

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

        On 10/06/2015 at 07:21, xxxxxxxx wrote:

        Hello,

        as always you can edit the settings of a video post by simply looping trough the video posts starting with GetFirstVideoPost(). You could access the needed RenderData from the document link of the RenderNotificationData. See also "Getting settings from VRay RenderData?".

        Best wishes,
        Sebastian

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

          On 10/06/2015 at 07:39, xxxxxxxx wrote:

          Hi Sebastian,

          Do you mean like this?

          RenderData* data = rnotif_data->doc->GetActiveRenderData();
          // Find Vray Video Post in RenderData ..
          

          That's actually what I have already tried, but I'll check again.

          Thanks,
          Niklas

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

            On 10/06/2015 at 07:56, xxxxxxxx wrote:

            Here is code that I use as an example.  Hopefully this works at render notification.  Note that I am using the active document (just fyi).   PLUGINID_VRAYBRIDGE is simply an enumeration to the plugin ID.

            // Enable/Disable GI in VrayBridge
            // - RenderData guaranteed never to be NULL! ;)
            RenderData*	pRenderData =	pDoc->GetActiveRenderData();
            if (!pRenderData)
            	return;
            for (BaseVideoPost* pBVP = pRenderData->GetFirstVideoPost(); pBVP != NULL; pBVP = pBVP->GetNext())
            {
            	if (pBVP->IsInstanceOf(PLUGINID_VRAYBRIDGE))
            	{
            		pBVP->SetParameter(DescID(VP_VRAYBRIDGE_GI_ON), GeData(m_bIBLCalculation), DESCFLAGS_SET_DONTCHECKMINMAX);
            		pBVP->Message(MSG_CHANGE);
            		EventAdd();
            		break;
            	}
            }
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 10/06/2015 at 23:35, xxxxxxxx wrote:

              That is actually what I was already doing, but from Python. I might have been testing wrong, because it
              works now that I'm doing it from C++ and I see no reason why it should not have worked from Python.
              My fault I guess 🙂

              Thanks! -Niklas

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