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
    • Register
    • Login
    1. Home
    2. Dunhou
    3. Posts
    • Profile
    • Following 2
    • Followers 4
    • Topics 51
    • Posts 250
    • Best 50
    • Controversial 0
    • Groups 0

    Posts made by Dunhou

    • RE: Load presets args in python?

      It sounds worth a try, but there may be latency issues when it comes to changes, or data changes can be manually processed during the changes

      Perhaps for my needs, I can force the database to be use GetSceneRepository, anyway, it's worth a try. Thank you for your guidance 😊

      posted in Bugs
      DunhouD
      Dunhou
    • RE: Load presets args in python?

      yes, but I want to use it in my own dialog, it needs to be as fast as normal drop down, but it is not a necessary function so I can wait for this.

      posted in Bugs
      DunhouD
      Dunhou
    • RE: Load presets args in python?

      Hey @ferdinand ,

      Thanks for the tips, sadly to see that GetDefaultSettings is broken, and I tried GetDefaultObject. It is way too slow, so I had to give up this until GetDefaultSettings fixed.

      Thanks for your time

      Cheess~
      DunHou

      posted in Bugs
      DunhouD
      Dunhou
    • RE: Free plugins all in one : Boghma HUB

      hey @shafy ,

      you can drag the param into python console to get the id,
      5c52cb55-bc07-4b7c-b830-a5b3046331d4-image.png

      posted in General Talk
      DunhouD
      Dunhou
    • Load presets args in python?

      Hey Community,

      I want to load some presets args for special objects, e.g, implement the function of selecting and loading preset buttons
      2c504c88-7958-42c5-9d4b-d4a34b2d80ad-image.png
      but I look the assets api handbook and the preset example, it need a PresetLoadArgs but it seems not valid in python.

      How can I achieve similar effects in existing versions?

      Cheers~
      DunHou

      posted in Bugs windows python 2025
      DunhouD
      Dunhou
    • RE: Graphic card

      If it's just for developing plugins (ask in this forum), I think the Mac mini M4's minimum configuration, which is 16GB of memory, is a good choice, especially considering Apple's more expensive than gold memory. This can ensure that your users can use it normally on low-end computers, and it has to be said that for fans of Windows computers, the new Mac mini is really refreshing. The performance is better than the Macbook Air M4, thanks to its active heat dissipation. As a size that can fit in a pocket, his CPU performance is astonishing. And since I am not doing rendering and simulation on it, I have not encountered any GPU bottlenecks.

      If you only need the Windows system, the overheating of mini machines is indeed a big problem, but of course, if it is only for development and use, it is not a big deal. Moreover, the performance of entry-level mini hosts is far inferior to that of Mac mini, except for cheaper memory and hard drive options. However, as far as I know, the price of NUCs does not have advantages

      If there is a requirement for small size, I personally recommend ITX, which can install independent graphics cards and has better heat dissipation. The disadvantage is that due to the small space, the installation process and cable organization are very complicated, and the price of ITX accessories is usually higher than that of ordinary hardware specifications.

      I would like to reiterate that the above viewpoints are all based on the use of Cinema 4D development plugins.

      Cheers~
      DunHou

      posted in General Talk
      DunhouD
      Dunhou
    • RE: How to simulate a drag behavior with UA?

      @ferdinand said in How to simulate a drag behavior with UA?:

      All it it does when the users starts to drag, according to Maxime, is inject the asset object into the document, make sure there is no object selected and then enable the place tool (and probably set the mouse cursor)

      This is my solution in my mind, definitely take a try after work. 👏

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: How to simulate a drag behavior with UA?

      Hey @ferdinand,

      Thanks for your clarification.This is exactly what I am worried about, which is more or less undesirable in Python. I will try using custom tools or calling built-in placement tools after loading assets.

      Cheers~
      DunHou

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • How to simulate a drag behavior with UA?

      Hi community,

      I want to imitate the function of dragging models from Asset Manager to the scene, but with my own userarea, can I do this in python?

      More specific:

      • I want to drag a model path the UA represents to viewport (I learned from the forum that filename is not working and needs to be forged through the Assets API).
      • when holding on the mouse, draw a bounding box and its axis, assume we have the size data.
      • we can place the axis with the model as "Place" tool does.
      • Insert the model at the mouse position.

      Any guidance would be greatly appreciated.

      Cheers~
      DunHou

      posted in Cinema 4D SDK windows python 2025
      DunhouD
      Dunhou
    • RE: 2025.2.0 SDK Release

      Love the mxutils and GeDialog Changes, I use these features almost every time, thank you for having a more refined official version.

      Thank you to the SDK team for their work achievements

      Cheers~
      DunHou

      posted in News & Information
      DunhouD
      Dunhou
    • RE: Hiding Node Previews for all Redshift Nodes in Redshift Materials

      Hey @d_keith ,

      I'll hide all nodes preview and un-hide the output preview, I write two examples.

      • First one uses my Renderer lib, if you installed boghma plugin manager, it will out of the box to use.
      • Second one uses maxon codes, it should work more widely.

      Cheers~
      DunHou

      Renderer

      import c4d
      import maxon
      import Renderer
      
      def mylib_solution():
          doc = c4d.documents.GetActiveDocument()
          for mat in doc.GetMaterials():
              with Renderer.EasyTransaction(mat) as tr:
                  tr.FoldPreview(tr.GetAllShaders(), False)
                  tr.FoldPreview(tr.GetOutput(), True)
          c4d.EventAdd()
      

      maxon

      import c4d
      import maxon
      def maxon_solution():
          doc = c4d.documents.GetActiveDocument()
          for mat in doc.GetMaterials():
              nodeMaterial: c4d.NodeMaterial = mat.GetNodeMaterialReference()
              if not nodeMaterial.HasSpace(maxon.NodeSpaceIdentifiers.RedshiftMaterial):
                  continue
      
              graph: maxon.NodesGraphModelRef = nodeMaterial.GetGraph(maxon.NodeSpaceIdentifiers.RedshiftMaterial)
              root: maxon.GraphNode = graph.GetViewRoot()
              nimbusRef: maxon.NimbusBaseRef = mat.GetNimbusRef(maxon.NodeSpaceIdentifiers.RedshiftMaterial)
              endNodePath: maxon.NodePath = nimbusRef.GetPath(maxon.NIMBUS_PATH.MATERIALENDNODE)
              endNode: maxon.GraphNode = graph.GetNode(endNodePath)
      
              with graph.BeginTransaction() as transaction:
                  node: maxon.GraphNode
                  for node in root.GetInnerNodes(mask=maxon.NODE_KIND.NODE, includeThis=False):
                      node.SetValue(maxon.NODE.BASE.DISPLAYPREVIEW, maxon.Bool(False))
      
                  endNode.SetValue(maxon.NODE.BASE.DISPLAYPREVIEW, maxon.Bool(True))
      
                  transaction.Commit()
      
          c4d.EventAdd()
      
      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: How to create UV of obj.

      Wow @ferdinand , super cool answer as always, super busy after ask, will get back and learning asap.

      Cheers~
      DunHou

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • How to create UV of obj.

      Hi community,

      First touch of modeling, I wonder how to create uv when importing object, for example, we have a polygon object in OM, how can we construct a new polygon with uv as same as the source?

      I had read the awesome geometry_polygonobject_s26.py example and had a basic knowledge of polygon.

      Cheers~
      DunHou

      posted in Cinema 4D SDK windows python 2025
      DunhouD
      Dunhou
    • RE: Storage issues with plugin settings

      Hi @Neekoe ,

      There are many ways to save data, like c4d.storage.HyperFile or json-like stuff, or you can use WorldContainer, I like to use json for my plugins, but for more "c4d-like", you can use WorldContainer.

      Cheers~
      DunHou

      import c4d
      
      YOUR_UID: int = 123456789
      
      # Setting id, better to use a unique id, but not necessary
      SETTING1: int = 1000
      SETTING2: int = 1001
      
      
      def main() -> None:
          # Create a new BaseContainer for storing the plugin data
          bcWorld: c4d.BaseContainer = c4d.GetWorldContainerInstance()
          bcPlug: c4d.BaseContainer = c4d.BaseContainer()
          bcPlug.SetBool(SETTING1, True)
          bcPlug.SetInt32(SETTING2, 10)
          bcWorld.SetContainer(YOUR_UID, bcPlug)
      
          # Get the BaseContainer from the world container
          bcPlug: c4d.BaseContainer = bcWorld.GetContainerInstance(YOUR_UID)
          print(bcPlug.GetBool(SETTING1))
          print(bcPlug[SETTING2])
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: Image Viewer API

      Sadly, we can't read any data from image viewer

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: Add icons to treeview

      Hi Neekoe,

      Those look like a very old code snippet in boghma community website (closed and turn to discord).

      If you want to use TreeView more easily and less codes, please check the new easy_tree in our boghma lib, which I used in my Octane Lister plugin.

      btw, in boghma library, we have two examples toshow how to use easey_tree.

      Have fun.

      Cheers~
      DunHou

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: Python script for keyframing node material geometry opacity

      Hi @mia-elisenberg ,

      If you want to add c4d.CKey to a maxon.GraphNode object, you need to:

      • Get the BaseList2D of the node, in this case, the opacity is port, it is a maxon.GraphNode, you need to get his host object aka the true node, the Standard Surface BRDF node, also it is a maxon.GraphNode.
      • Use the GetBaseListForNode to get the c4d.BaseList2D
      • Get the port c4d.DescID
      • Create track on the c4d.BaseList2D

      BTW, you can find a topic which is a python library for renderers, in General Talk. I had added those methods but not pushed yet, will be pushed asap, you can take a look if needed.

      Hope it helps.

      Cheers~
      DunHou

      import c4d
      import maxon
      
      doc: c4d.documents.BaseDocument  # The currently active document.
      op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
      
      nodespaceId = "com.redshift3d.redshift4c4d.class.nodespace"
      standardBRDF = "com.redshift3d.redshift4c4d.nodes.core.standardmaterial"
      
      
      def main() -> None:
          doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument()
      
          for material in doc.GetActiveMaterials():
              nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference()
      
              if not nodeMaterial.HasSpace(nodespaceId):
                  continue
      
              graph: maxon.GraphModelInterface = nodeMaterial.GetGraph(nodespaceId)
              nimbusRef: maxon.NimbusBaseRef = material.GetNimbusRef(nodespaceId)
              
              result: list[maxon.GraphNode] = []
              maxon.GraphModelHelper.FindNodesByAssetId(graph, standardBRDF, True, result)
              if not result:
                  continue
      
              # assume we just have one brdf node in this gragh
              brdf_node: maxon.GraphNode = result[0]
              opacityPort: maxon.GraphNode = brdf_node.GetInputs().FindChild('com.redshift3d.redshift4c4d.nodes.core.standardmaterial.opacity_color')
      
              # try to find the BaseList2D for the node, this host on the true node in gragh
              # 'opcacity' is a port, we have to get the host node: ie. the true node
              parentNode: maxon.GraphNode = opacityPort.GetAncestor(maxon.NODE_KIND.NODE)
              parentNodePath = parentNode.GetPath()
              opacityPortBL2D: c4d.BaseList2D = nodeMaterial.GetBaseListForNode(nodespaceId, parentNodePath)
      
              # create track and add key
              opacityPortDescID: c4d.DescID = nimbusRef.GetDescID(opacityPort.GetPath())
              track: c4d.CTrack = c4d.CTrack(opacityPortBL2D, opacityPortDescID)
              opacityPortBL2D.InsertTrackSorted(track)
              curve: c4d.CCurve = track.GetCurve()
              key = c4d.CKey()
              track.FillKey(doc, opacityPortBL2D, key)
              ctime: c4d.BaseTime = c4d.BaseTime(doc.GetTime().GetFrame(doc.GetFps()), doc.GetFps())
              key.SetValue(curve, 50.0)
              key.SetTime(curve, ctime)
              curve.InsertKey(key)
      
          c4d.EventAdd()
      
      if __name__ == '__main__':
          main()
      
      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: python script change Redshift setting

      you need to change the id of you want

      PREFS_REDSHIFT_MATPREVIEW_MODE_BACKGROUND: int = 3
      PREFS_REDSHIFT_MATPREVIEW_MODE_IDLE: int = 1
      PREFS_REDSHIFT_MATPREVIEW_MODE_OFF: int = 0
      PREFS_REDSHIFT_MATPREVIEW_MODE_SUSPEND: int = 2
      
      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: python script change Redshift setting

      Hi @RTF , the c4d.PREFS_REDSHIFT_MATPREVIEW_MODE doesn't seem stored in Redshift VideoPost, is this code generated by GPT or something similar?

      Back to the topic, this parameter is stored in the Redshift tab of the preferences node. You should get the redshift preference node and then set the parameter.

      If you installed Renderer lib or boghma hub, you can use this:

      import c4d
      from Renderer import Redshift
      
      if __name__ == '__main__':
          Redshift.SetMaterialPreview(preview_mode = 1)
      

      or just few codes:

      import c4d
      
      ID_PREFERENCES_NODE = 465001632 # Prefs ID
      
      def GetPreference() -> c4d.BaseList2D:
          """
          Get the Redshift preferenc.
          """
          prefs: c4d.plugins.BasePlugin = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE)
          if not isinstance(prefs, c4d.BaseList2D):
              raise RuntimeError("Could not access preferences node.")
            
          descIdSettings = c4d.DescID(
          c4d.DescLevel(1036220, 1, 465001632), # pref ID Redshift
          c4d.DescLevel(888, 133, 465001632)
          )
          return prefs[descIdSettings]
      
      if __name__ == '__main__':
          redshift_pref: c4d.BaseList2D = GetPreference()
          redshift_pref[c4d.PREFS_REDSHIFT_MATPREVIEW_MODE] = 1
      

      Cheers~
      DunHou

      posted in Cinema 4D SDK
      DunhouD
      Dunhou
    • RE: GraphModelInterface.GetNode not worked

      Hi @m_adam ,

      Thanks for your reply, it worked well.

      But I still have some doubts about the usage of Node Path, such as how to calculate the port through NodePath instead of concatenating strings (which can easily lead to misoperation).

      There are few examples and answers for NodePath on the forum, and it seems that people rarely use it. Do you have any insights on this, or in other words, what usage scenarios do you think NodePath is more suitable for.

      Cheers~
      DunHou

      posted in Cinema 4D SDK
      DunhouD
      Dunhou