Wow @m_adam , thanks for that, I'll check this after work!
Posts made by Dunhou
-
RE: How to compare a port value has been changed?
-
RE: How to compare a port value has been changed?
Hey @m_adam ,
I think this is equal to port.GetValue('value'), and it will get the current value for the node but not the default value.
if I change the roughness to 0.5, they both return 0.5 but bot 0 for default.
Cheers~
DunHou -
RE: What is the meaning of code like `doc: c4d.documents.BaseDocument`?
Lovely tips! I'm a big fan of type hint (deeply influenced by the Ferdinand code style while studying)
Cheers~
DunHou -
RE: How to use Python to implement rendering with Octane in C4D and export as PNG
@tx3008 You just modify the rd but not rendering anythings.
-
RE: How to use Python to implement rendering with Octane in C4D and export as PNG
Hey @tx3008 ,
You need check the Octane
BaseVideoPost
to get the data container.You can change the render settings and use
RenderDocument
to render images.In case if you didn't want to use my extra libs, the
GetVideoPost
is not complicated.Cheer~
DunHou# 获取渲染器VideoPost 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: if vpost.GetType() == int(videopost): theVp = vpost vpost = vpost.GetNext() return theVp
import c4d import Renderer def main(): OctaneRenderer = Renderer.GetVideoPost(c4d.documents.GetActiveDocument(), Renderer.ID_OCTANE) OctaneRenderer[c4d.SET_PASSES_FILEFORMAT] = 10 # Octane PNG, 6 = PNG OctaneRenderer[c4d.SET_PASSES_SAVE_MAINPASS] = True OctaneRenderer[c4d.SET_PASSES_ENABLED] = True OctaneRenderer[c4d.SET_PASSES_SAVEPATH] = "Render/$prj/$prj" c4d.EventAdd() if __name__=='__main__': main()
-
RE: How to compare a port value has been changed?
Hey @m_adam ,
Thanks for that quick answer and a sweet codes for
GraphModelInterface.GetModificationStamp
I took a look at this, but these might be some details I still need.For example, I get a material from others. I want to check the material:
- oh, He/She modified the ior value to 2. That is a change applied to result.
- also He/She changed roughness 0 -> 0.2 -> 0. It has been modified but that is a default value, I didn't want to catch this.
Can we get the this stored value here, aka the default value we create the new material?
Cheers~
DunHou -
How to compare a port value has been changed?
Hi community,
I would like to know if there is a way to obtain the default value of a port(maxon.GraphNode), then catch which port in the graph is changed. I'm not sure if I missed something, but I didn't find any relevant methods in the document.
Any suggestions are welcomed!
Cheers~
DunHou -
RE: Add Expression Value in Render Settings Save Path
Hey @Gemini ,
You should take a look at py-render-token example, and filter the version number of your project like
re.findall("v"+"\d+",filePath)
if I understand not wrong.Cheers~
DunHou -
RE: How do I sort the plug-in menu?
Hey @treezw , first of all, nice icons, love it!
If you want to customize your plugin menu, you can check this Building menus with C4DPL_BUILDMENU in S26+.
Cheers~
DunHou -
RE: Retrieving Images from Cinema 4D's Picture Viewer for Importing into Photoshop
I think picture viewer is hard-coding, we can do nothing, but wait for official answer
-
RE: How does C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY) work?
woops, I try lots of stuff to debug this, hope it can fix soon. will use old way to track new objects for now.
-
How does C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY) work?
Hi community,
My understanding is that
C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY)
can track the document dirty with when a new object is created( hierarchy changed of course ), but if I delete objects, the dirty count will not change, but if I reload python plugin, it can worked again.I didn't know if I misunderstand this method, why that happened?
Cheers~
DunHouWin11 23H2 + C4D 2024.5.1
Codes:
import c4d import typing doc: c4d.documents.BaseDocument # The active document op: typing.Optional[c4d.BaseObject] # The selected object, can be None. class Dialog (c4d.gui.GeDialog): def CreateLayout(self) -> bool: return True def CoreMessage(self, mid: int, data: c4d.BaseContainer) -> bool: if mid == c4d.EVMSG_CHANGE: doc = c4d.documents.GetActiveDocument() print(doc.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY)) return super().CoreMessage(mid, data) if __name__ == '__main__': global dlg dlg = Dialog() dlg.Open(c4d.DLG_TYPE_ASYNC)
Video:
-
RE: Plugin: Render Message
wow @kmhfygg , super cool plugin, I had a plugin to catch batch render state, but message with email (I know nothing about app), and very happy to see your awesome work!
PS : you can edit your post here
-
RE: Open source wrapper for Octane/Redshift/Arnold/Vray/Corona in Cinema 4D.
Hi community!
Add Basic CentiLeo Material support, also with ConvertPorts data, This a "new" GPU Renderer and in active development. I am very interested in it.
Not add AOV due to still being in the early stages of development, waiting for this.
Cheers~
DunHou -
RE: Export RSproxy with Python
Hey @Richard-Prism ,
You can check the my custom library Renderer.Redshift.Scene on Github here , witch also can visit from General Talk, and modify the codes, or just use this if match what you need.
Nothing special here.
Cheers~
DunHouimport c4d from Renderer import Redshift def main(): scene_helper = Redshift.Scene(doc) scene_helper.auto_proxy(node=op, remove_objects=False) if __name__ == '__main__': main()
-
RE: How to simulate "Cappucino" behavior?
Hey @ferdinand , thanks for your super useful answer here!
@ferdinand said in How to simulate "Cappucino" behavior?:
What do you want to record, and how?
- Mostly is the PSR change if camera, or some params( maybe slow, but I think if we can make it work, it is same as the psr data).
- How: maybe a 3D mouse or regular mouse input, that you hint me it can cause problem.
@ferdinand said in How to simulate "Cappucino" behavior?:
Animation Conflict: You seem to imply that you want to just press play and then have your tool record the camera. This can again result in conflicts, depending on your approach. As a fix, when you have a static scene, you can just animate/update the camera yourself as I did in my dialog example in (1). But when you animate the camera in an also animated scene, you would have also to manually animate the scene. I.e., for each frame you "animate", you must also advance the active frame of the active document and then execute the passes on the document, so that the scene does update. Remember that as a rule of thumb, you must execute the passes three times in a row to fully update a scene (due to some complex dependencies things like MoGraph can build)
- wow , super strange of muti passes, I'm a little curious why we have a flag that can force update in one function?
@ferdinand said in How to simulate "Cappucino" behavior?:
Long story short, there is no super good way to do this, especially in Python. Python might be intrinsically too slow for this as you only have a very small window of 1/30 of a second - or even less - to carry out quite a bit of computations. And you also cannot just pre-compute/cache thing as you are dependent on user inputs.
Thank you for all your suggestions!
Cheers~
DunHou -
How to simulate "Cappucino" behavior?
Hi community,
I want to rebuild a tool similar to "Cappucino" but bake the camera and some parameters,
so :- Move our camera
- Start record then the camera then it changed first time
- Start animate of the doc, like we hit play
- Add a keyframe we want every frame
- End if we hit the end of timeline
- but how to simulate a "Play" in timeline, I test the animate.py, it finished immediately but not in "real time",time.sleep(1/doc.GetFps()) will freeze c4d, how to avoid that?
- how to avoid freezing with run the timeline with bake and draw the camera?
Cheers~
DunHou -
RE: Can I convert a BaseBitmap into a Image file in memory?
Hey @ferdinand , oops, I have an impression of this topic and tried to recall it, but I couldn't find any keywords in my mind at the time. I must have gone crazy.
And the key is the GetData(), I have no concept of file composition and did not realize that what is returned here is the data required for an image file. Thank you very much.
Cheers~
DunHou -
Can I convert a BaseBitmap into a Image file in memory?
Hi community !
I want to send my render images to a website, but I have to use BaseBitmap.Save to save the result and then post them, I am trying to speed this a little, and I didn't know to can I do this :
- convert the BaseBitmap to a "normal" PNG image file in memory.
- send the file to a server directly without write them to disk.
Is that possible to do this?
Cheers~
DunHou