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. chuanzhen
    3. Topics
    • Profile
    • Following 1
    • Followers 6
    • Topics 72
    • Posts 214
    • Best 18
    • Controversial 0
    • Groups 0

    Topics created by chuanzhen

    • chuanzhenC

      Frozen Matrix different

      Cinema 4D SDK
      • 2025 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      119
      Views

      i_mazlovI

      Hi @chuanzhen,

      Glad to hear the issue went away.

      Just to note, the frozen matrices are designed in a way that simulate behavior of an intermediate parent null object, i.e. just as if you had an invisible parent null object with matrix being equal to the frozen one. Sometimes it can get confusing, because the way the global matrix of the object is calculated is effectively:

      [Local Matrix] = [Frozen Translation] * [Frozen Rotation] * [Relative Translation] * [Relative Rotation] * [Frozen Scale] * [Relative Scale]

      If the relative transform (the main one) and the frozen transform are the same for two objects, given they are children of the same parent and there're no other 3rd parties involved (e.g. plugins, python tags etc), the global transform matrices of these two objects are the same.

      Please find more useful insights in our great Matrix Manual.

      Cheers,
      Ilia

    • chuanzhenC

      Set RenderData framerate causing C4D to crash

      Bugs
      • python 2025 • • chuanzhen
      4
      0
      Votes
      4
      Posts
      1.0k
      Views

      M

      Hi I was able to reproduce the issue and fix it for the next version.
      The bug is that setting RDATA_FRAMERATE require the RenderData to be part of a document in case the "Use Project Frame Rate" is enabled on the render settings. If this is enabled and this is enabled by default the value you enter will be disregarded. "Use Project Frame Rate" is a new setting added in 2025.2.

      I will ping you once the fix is available.
      Cheers,
      Maxime.

    • chuanzhenC

      Problem encountered when check double click in Message() Use MSG_EDIT

      Cinema 4D SDK
      • 2025 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      121
      Views

      chuanzhenC

      @i_mazlov Thanks

    • chuanzhenC

      How to Execute a Modifier plugin in Expression priority

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      7
      0
      Votes
      7
      Posts
      255
      Views

      chuanzhenC

      @i_mazlov Thanks,it works!

    • chuanzhenC

      Change Icon Color parameter

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      6
      0
      Votes
      6
      Posts
      191
      Views

      chuanzhenC

      @i_mazlov Thanks for your help, it works well.

    • chuanzhenC

      How to convert the length of a line on the screen to the length of an object.

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      4
      0
      Votes
      4
      Posts
      211
      Views

      ferdinandF

      Hey,

      Yes, parallel/orthographic projection is effectively just the dot product. The modelling examples cover point plane projections with a function very similar to yours. There is also c4d.utils.PointLineSegmentDistance but I never use it, as it strikes me as more cumbersome to use than just doing the math yourself.

      Cheers,
      Ferdinand

    • chuanzhenC

      Show or Hide Object in Viewport

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      4
      0
      Votes
      4
      Posts
      174
      Views

      ferdinandF

      Sorry, I am rotating on the spot right now, did not yet get to answering here. @gheyret is right, there is still a bug, will give @m_adam a note on Monday.

    • chuanzhenC

      How to drag rows in Treeview

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      4
      0
      Votes
      4
      Posts
      159
      Views

      chuanzhenC

      @ferdinand Thanks for your help!👍

    • chuanzhenC

      Switching of Multi Object Working Axis for Move Tools

      Cinema 4D SDK
      • python 2024 • • chuanzhen
      3
      0
      Votes
      3
      Posts
      136
      Views

      chuanzhenC

      @ferdinand Thanks for reply. Perhaps not expressed clearly. For changing the axis of an object, it is not a problem. What I want to ask is whether the manual operation step of selecting the axis before the Move tool works can be implemented using a script.

    • chuanzhenC

      TreeView rows selected?

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      4
      0
      Votes
      4
      Posts
      132
      Views

      chuanzhenC

      @m_adam Thanks,it works well👍
      2b524b98-f131-4d69-bcf0-4dec858821ab-image.png

      this is code:

      import c4d import random from c4d import gui # Welcome to the world of Python NAME = 0 LINKTO = 1 LINK = 2 TYPE = 3 class TreeView_Item(object): def __init__(self,): self.type = 'psr' self.selected = False self.obj_name = str(random.randint(1,100)) self.linkto_name = "" @property def IsSelected(self): return self.selected def Select(self): self.selected = True def Deselect(self): self.selected = False def __repr__(self): return str(self) def __str__(self): return self.obj_name class TreeView(c4d.gui.TreeViewFunctions): def __init__(self,items_list=None): self.items_list = items_list if items_list else [] def GetLineHeight(self,root, userdata, obj, col, area): return area.DrawGetFontHeight() def IsResizeColAllowed(self, root, userdata, lColID): return True def IsTristate(self, root, userdata): return False def GetColumnWidth(self, root, userdata, obj, col, area): """Measures the width of cells. Although this function is called #GetColumnWidth and has a #col, it is not only executed by column but by cell. So, when there is a column with items requiring the width 5, 10, and 15, then there is no need for evaluating all items. Each item can return its ideal width and Cinema 4D will then pick the largest value. Args: root (any): The root node of the tree view. userdata (any): The user data of the tree view. obj (any): The item for the current cell. col (int): The index of the column #obj is contained in. area (GeUserArea): An already initialized GeUserArea to measure the width of strings. Returns: TYPE: Description """ # The default width of a column is 80 units. width = 80 # Replace the width with the text width. area is a prepopulated # user area which has already setup all the font stuff, we can # measure right away. if col == NAME: return area.DrawGetTextWidth(obj.obj_name) + 5 if col == LINKTO: return area.DrawGetTextWidth("-->") + 5 if col == LINK: return area.DrawGetTextWidth(obj.linkto_name) + 5 if col == TYPE: return area.DrawGetTextWidth(obj.type) + 5 return width def GetFirst(self, root, userdata): """ Return the first element in the hierarchy, or None if there is no element. """ rValue = None if not len(self.items_list) else self.items_list[0] return rValue def GetNext(self, root, userdata, obj): """ Returns the next Object to display after arg:'obj' """ rValue = None currentObjIndex = self.items_list.index(obj) nextIndex = currentObjIndex + 1 if nextIndex < len(self.items_list): rValue = self.items_list[nextIndex] return rValue def GetPred(self, root, userdata, obj): """ Returns the previous Object to display before arg:'obj' """ rValue = None currentObjIndex = self.items_list.index(obj) predIndex = currentObjIndex - 1 if 0 <= predIndex < len(self.items_list): rValue = self.items_list[predIndex] return rValue def GetId(self, root, userdata, obj): """ Return a unique ID for the element in the TreeView. """ return hash(obj) def Select(self, root, userdata, obj, mode): print(obj.obj_name) if mode == c4d.SELECTION_NEW: for item in self.items_list: item.Deselect() obj.Select() elif mode == c4d.SELECTION_ADD: obj.Select() elif mode == c4d.SELECTION_SUB: obj.Deselect() def IsSelected(self, root, userdata, obj): return obj.IsSelected def DeletePressed(self, root, userdata): "Called when a delete event is received." for item in reversed(self.items_list): if item.IsSelected: self.items_list.remove(item) def GetName(self, root, userdata, obj): """ Returns the name to display for arg:'obj', only called for column of type LV_TREE """ return str(obj) # Or obj.texturePath def DrawCell(self, root, userdata, obj, col, drawinfo, bgColor): """ Draw into a Cell, only called for column of type LV_USER """ if col == NAME: text = obj.obj_name elif col == LINKTO: text = '-->' elif col == LINK: text = obj.linkto_name elif col == TYPE: text = obj.type else: text = '' canvas = drawinfo["frame"] xpos = drawinfo["xpos"] ypos = drawinfo["ypos"] txtColorDict = canvas.GetColorRGB(c4d.COLOR_TEXT_SELECTED) if obj.IsSelected else canvas.GetColorRGB( c4d.COLOR_TEXT) txtColorVector = c4d.Vector(txtColorDict["r"] / 255.0, txtColorDict["g"] / 255.0, txtColorDict["b"] / 255.0) canvas.DrawSetTextCol(txtColorVector, bgColor) canvas.DrawText(text, xpos, ypos) def DoubleClick(self, root, userdata, obj, col, mouseinfo): return True class test_dialog(gui.GeDialog): def __init__(self): self._treegui = None self.treeview = TreeView() def CreateLayout(self): # Other than edit fields, buttons do not have a builtin bubble help. customgui = c4d.BaseContainer() customgui.SetBool(c4d.TREEVIEW_BORDER, c4d.BORDER_THIN_IN) customgui.SetBool(c4d.TREEVIEW_HAS_HEADER, True) # True if the tree view may have a header line. customgui.SetBool(c4d.TREEVIEW_HIDE_LINES, False) # True if no lines should be drawn. customgui.SetBool(c4d.TREEVIEW_MOVE_COLUMN, False) # True if the user can move the columns. customgui.SetBool(c4d.TREEVIEW_RESIZE_HEADER, True) # True if the column width can be changed by the user. customgui.SetBool(c4d.TREEVIEW_FIXED_LAYOUT, True) # True if all lines have the same height. customgui.SetBool(c4d.TREEVIEW_ALTERNATE_BG, True) # Alternate background per line. customgui.SetBool(c4d.TREEVIEW_CURSORKEYS, True) # True if cursor keys should be processed. customgui.SetBool(c4d.TREEVIEW_NOENTERRENAME, True) # Suppresses the rename popup when the user presses enter. customgui.SetBool(c4d.TREEVIEW_NO_MULTISELECT, False) self._treegui = self.AddCustomGui(1000, c4d.CUSTOMGUI_TREEVIEW, "", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 300, 300, customgui) if not self._treegui: print("[ERROR]: Could not create TreeView") return False self.AddButton(1001, c4d.BFH_CENTER, name="Add") return True def InitValues(self) -> bool: layout = c4d.BaseContainer() layout.SetInt32(NAME, c4d.LV_USER) layout.SetInt32(LINKTO, c4d.LV_USER) layout.SetInt32(LINK, c4d.LV_USER) layout.SetInt32(TYPE, c4d.LV_USER) self.layout = layout self._treegui.SetLayout(4, layout) # Set the header titles. self._treegui.SetHeaderText(NAME, "Name") self._treegui.SetHeaderText(LINKTO, "") self._treegui.SetHeaderText(LINK, "Link") self._treegui.SetHeaderText(TYPE, "Type") # Set TreeViewFunctions instance used by our CUSTOMGUI_TREEVIEW self._treegui.SetRoot(self._treegui, self.treeview, None) self._treegui.Refresh() return True def Command(self, id, msg): if id == 1001: item = TreeView_Item() self.treeview.items_list.append(item) self._treegui.Refresh() return True return True # Execute main() if __name__=='__main__': dlg = test_dialog() dlg.Open(c4d.DLG_TYPE_ASYNC,0 -1,-1,400,400)
    • chuanzhenC

      Cannot post?

      General Talk
      • chit-chat • • chuanzhen
      4
      0
      Votes
      4
      Posts
      183
      Views

      chuanzhenC

      @ferdinand Thanks for the detailed explanation👍

    • chuanzhenC

      How to add a tree view to a Description Resource?

      Cinema 4D SDK
      • 2025 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      158
      Views

      chuanzhenC

      @ferdinand Thank you for your detailed answer.

    • chuanzhenC

      SetJointResetState() Parameter interpretation error in py doc?

      Cinema 4D SDK
      • python • • chuanzhen
      4
      0
      Votes
      4
      Posts
      213
      Views

      M

      Thanks a lot for reporting this kind of issue !
      This is going to be fixed in the next update of the doc.

      Cheers,
      Maxime.

    • chuanzhenC

      GeUserArea use DrawBitmap() to overlay multiple images(has alpha)

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      296
      Views

      i_mazlovI

      Hi @chuanzhen,

      Glad you've solved the issue! We're grateful to you for sharing your solution with the community (moreover in such a visual way), this is highly appreciated!

      Cheers,
      Ilia

    • chuanzhenC

      BitmapButton not work

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      5
      0
      Votes
      5
      Posts
      580
      Views

      chuanzhenC

      @ferdinand Thanks👍

    • chuanzhenC

      Xref object Make it Editable

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      501
      Views

      chuanzhenC

      @ferdinand Thanks for your reply!

    • chuanzhenC

      How to get screen space

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      479
      Views

      chuanzhenC

      @m_adam Thanks!👍

    • chuanzhenC

      Discussion on Methods for Calculating the Inner Points of a Quadrilateral

      General Talk
      • learning-resource • • chuanzhen
      9
      0
      Votes
      9
      Posts
      1.9k
      Views

      chuanzhenC

      @i_mazlov 👍

    • chuanzhenC

      After undo, point object SetAllPoints not update

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      3
      1
      Votes
      3
      Posts
      432
      Views

      chuanzhenC

      @ferdinand Thanks for your help!

    • chuanzhenC

      some icon index not find

      Cinema 4D SDK
      • python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      406
      Views

      chuanzhenC

      @ferdinand Thanks