Author Topic: Python remove render region in VFB  (Read 430 times)

2022-10-03, 16:08:07

JPeters

  • Active Users
  • **
  • Posts: 80
    • View Profile
Hi guys,

For an in-house tool/plugin I'd like to be able to remove the Corona VFB render region selection if it's enabled.
In the vprendersettings.h I've found the following two calls which seem to be for this purpose:
CORONA_SETTINGS_RENDER_REGION         = 3024,
CORONA_SETTINGS_RENDER_REGION_ENABLED = 3025,


When I try to apply these to the render post however, nothing happens.

What am I missing? Any pointers on how I can achieve a disabling/deletion of the render region in a file via Python?

Cheers,

2022-10-03, 22:18:35
Reply #1

j.nosh

  • Active Users
  • **
  • Posts: 18
    • View Profile
Sorry can't help you with thisone. But this tool would be super helpful. How many times I found my final render in the morning ruined by regions. Super annoying!
Would be cool if you let me know when you get this to work. THX! 

2022-10-04, 12:43:56
Reply #2

Ales

  • Corona Team
  • Active Users
  • ****
  • Posts: 162
    • View Profile
Hi,
setting False into CORONA_SETTINGS_RENDER_REGION_ENABLED parameter of renderer video post should work - and it seems to be working here. I am attaching example that I tested here - running this script for any Corona scene should ensure it will render with render regions disabled.

Code: [Select]
# Get Corona renderer video post
PLUGINID_CORONA4D = 1030480
videoPost = c4d.documents.GetActiveDocument().GetActiveRenderData().GetFirstVideoPost()
while videoPost and not videoPost.IsInstanceOf(PLUGINID_CORONA4D):
    videoPost = videoPost.GetNext()

# Disable regions
if videoPost:
    videoPost[c4d.CORONA_SETTINGS_RENDER_REGION_ENABLED] = False

Note that setting this will either disable it immediately in VFB in case the current document is being rendered in VFB at the time you run this script or disable it for following render in case the render is not in progress.

2022-10-05, 08:51:46
Reply #3

JPeters

  • Active Users
  • **
  • Posts: 80
    • View Profile
Hi Ales,

Thanks a ton for the pointer, it's weird because I had a similar code that didn't seem to work:

Code: [Select]
CORONA = 1030480    #Declaring Corona render for GetVideoPost function

    def getCoronaRenderSettings(rdata):    #Courtesy of mmarcotic, check if Corona is the actual video post
        videopost = rdata.GetFirstVideoPost()
        while videopost:
            if videopost.GetType() == CORONA:
                return videopost
            videopost = videopost.GetNext()

    rdata = doc.GetActiveRenderData()
    rpost = getCoronaRenderSettings(rdata)

    rpost[c4d.CORONA_SETTINGS_RENDER_REGION_ENABLED] = False

    c4d.StopAllThreads()
    doc.InsertRenderDataLast(rdata)
    doc.SetActiveRenderData(rdata)
    c4d.EventAdd()   



But I guess my error was that I applied it to the render post and render data, not the actual video post.
I will try your code instead, let's see!

Cheers,
« Last Edit: 2022-10-05, 09:19:19 by JPeters »

2022-10-10, 10:10:49
Reply #4

JPeters

  • Active Users
  • **
  • Posts: 80
    • View Profile
Hi Ales,

Just a quick update, I got it to work in my plugin as well now, thanks again for the help!