@Dunhou I understand now. I have tried it successfully. Thank you very much!
T
Posts made by tx3008
-
RE: How to use Python to implement rendering with Octane in C4D and export as PNG
-
RE: How to use Python to implement rendering with Octane in C4D and export as PNG
@Dunhou
Thank you very much for answering my questions. I saw your library yesterday and tried to write like thisfrom typing import Optional import c4d ID_OCTANE: int = 1029525 # Octane ID_REDSHIFT: int = 1036219 # Redshift ID_ARNOLD: int = 1029988 # Arnold ID_VRAY: int = 1053272 ID_CORONA: int = 1030480 ID_LOOKS: int = 1054755 ID_CENTILEO: int = 1036821 ID_OCTANE_VIDEO_POST = 1029525 # octane render file_path="C:/Users/admin/Documents/WXWork/1688858265477290/Cache/File/2024-09/OC_light/11.png" doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def GetVideoPost(document: c4d.documents.BaseDocument = None, videopost: int = ID_REDSHIFT) -> Optional[c4d.documents.BaseVideoPost]: """ Get the videopost of given render engine of filled document. Args: document (c4d.documents.BaseDocument, optional): Fill None to check active documents. Defaults to None. videopost (int, optional): The id of the videopost. Defaults to ID_REDSHIFT. Returns: Optional[c4d.documents.BaseVideoPost]: The videopost we get. """ if not document: document = c4d.documents.GetActiveDocument() rdata: c4d.documents.RenderData = document.GetActiveRenderData() vpost: c4d.documents.BaseVideoPost = rdata.GetFirstVideoPost() theVp: c4d.documents.BaseVideoPost = None while vpost: print(vpost.GetType()) if vpost.GetType() == int(ID_OCTANE_VIDEO_POST): theVp = vpost vpost = vpost.GetNext() return theVp def main(): OctaneRenderer = GetVideoPost(c4d.documents.GetActiveDocument(),ID_OCTANE) OctaneRenderer[c4d.SET_PASSES_FILEFORMAT] = 6 # Octane PNG, 6 = PNG OctaneRenderer[c4d.SET_PASSES_SAVE_MAINPASS] = True OctaneRenderer[c4d.SET_PASSES_ENABLED] = True OctaneRenderer[c4d.SET_PASSES_SAVEPATH] = file_path c4d.EventAdd() if __name__=='__main__': main()
But there are no images generated in the directory. What could be the reason?
-
How to use Python to implement rendering with Octane in C4D and export as PNG
How to use Python to implement rendering with Octane in C4D and export as PNG