Hello @ferdinand ! Thanks for answer it is very clear, i will use virtual resolution from now on
Latest posts made by shivamist
-
RE: Refresh viewport after updating RenderData width and height
-
RE: Refresh viewport after updating RenderData width and height
@ferdinand
What's incorrect is the aspect ratio of the Background object or anything material that is in a Frontal projectionIn the following screenshot you can see that on the border of the Safe Frames (turned them red for easier readability), the Background object stops at the border of the image
Here is the result after using the script with SetParameter() :
I hope the issue is clear now, the expected behavior would be that if the resolution changes, the background object should follow
-
RE: Refresh viewport after updating RenderData width and height
@ferdinand
Here is the User action that fixes the viewport aspect ratio :
-
Refresh viewport after updating RenderData width and height
Hello,
I have a script that is used to update the resolution of the active document. Recently we implemented a way to get overscan size data (VFX work) and i'm having trouble with refreshing the viewport.
The issue resides in the fact that if you don't interact with the resolution slider or input something manually, the viewport show effectively the change with the Safe Frames but if there is an existing Background object/ Material with Frontal projection it will not update. Only an user interaction can help.Here are some code snippets that i used to showcase the issue and what i tried in terms of flags/update/dirty states :
import c4d import random def main(): doc = c4d.documents.GetActiveDocument() rd = doc.GetActiveRenderData() bd = doc.GetActiveBaseDraw() print(f"Render Data X_Res before : {rd[c4d.RDATA_XRES]}") print(f"Render Data Y_Res before : {rd[c4d.RDATA_YRES]}") print("-------------------------------------------------") xres = random.randint(0, 1920) yres = random.randint(0, 1080) rd[c4d.RDATA_XRES] = xres print(f"Render Data X_Res after : {rd[c4d.RDATA_XRES]}") rd[c4d.RDATA_YRES] = yres print(f"Render Data Y_Res after : {rd[c4d.RDATA_YRES]}") print("-------------------------------------------------") rd.Message(c4d.MSG_UPDATE) rd.SetDirty(c4d.DIRTYFLAGS_ALL) rd.SetDirty(c4d.DIRTYFLAGS_DATA) c4d.GeSyncMessage(c4d.EVMSG_UPDATEBASEDRAW) c4d.EventAdd() if __name__=='__main__': main()
import c4d import random def main(): doc = c4d.documents.GetActiveDocument() rd = doc.GetActiveRenderData() bd = doc.GetActiveBaseDraw() print(f"Render Data X_Res before: {rd[c4d.RDATA_XRES]}") print(f"Render Data Y_Res before: {rd[c4d.RDATA_YRES]}") print("-------------------------------------------------") xres = random.randint(1000, 1920) print(f"Random X_Res: {xres}") yres = random.randint(500, 1080) print(f"Random Y_Res: {yres}") # Set the new X and Y resolution using SetParameter rd.SetParameter(c4d.RDATA_XRES, xres, c4d.DESCFLAGS_SET_USERINTERACTION | c4d.DESCFLAGS_SET_FORCESET | c4d.DESCFLAGS_SET_INDRAG) rd.SetParameter(c4d.RDATA_YRES, yres, c4d.DESCFLAGS_SET_USERINTERACTION | c4d.DESCFLAGS_SET_FORCESET | c4d.DESCFLAGS_SET_INDRAG) print(f"Render Data X_Res after: {rd[c4d.RDATA_XRES]}") print(f"Render Data Y_Res after: {rd[c4d.RDATA_YRES]}") print("-------------------------------------------------") print("-------------------------------------------------") rd.Message(c4d.MSG_UPDATE) rd.SetDirty(c4d.DIRTYFLAGS_ALL) rd.SetDirty(c4d.DIRTYFLAGS_DATA) c4d.GeSyncMessage(c4d.EVMSG_UPDATEBASEDRAW) c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW) c4d.EventAdd() if __name__=='__main__': main()
Video showcasing the issue :