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
    • Login
    1. Maxon Developers Forum
    2. chuanzhen
    3. Topics
    • Profile
    • Following 1
    • Followers 6
    • Topics 74
    • Posts 219
    • Best 18
    • Controversial 0
    • Groups 0

    Topics created by chuanzhen

    • chuanzhenC

      How to obtain the object deformed by the deformer

      Cinema 4D SDK
      • 2025 windows python • • chuanzhen
      5
      0
      Votes
      5
      Posts
      420
      Views

      chuanzhenC

      @ferdinand Thanks for detailed explanation.
      Let me introduce the goals that the custom deformer plugin wants to achieve. (As can be seen from the cube, cube. 1, cube. 2... in the image, each object has a weight tag.) The custom deformer plugin needs to preprocess and store some data before the ModifyObjects () function works. (By clicking a button) Access the weight tag of each object to be deformed in Message (), preprocess and store some data, and then use the preprocessed data to execute the ModifyObjects () function to correctly process the deformation calculation.
      9c418a15-9d3c-4466-83c2-0481e7b67c69-image.png

      In C4D, it seems that the Surface deformer has achieved a similar function
      5ef7303f-0ea2-4d3b-bed4-c342a755350c-image.png

      (there are certain benefits to restricting the custom deformer plugin only to the parent level, as there is no need to spend effort on correctly linking the corresponding preprocessed data when the ModifyObjects () function works.But it did break the general logic operation of the deformer)

      The only way you could do that is by checking each deformed object being passed into , to be the parent of the also passed in (i.e., the deformer also simply accessible via ). Only for an which is the parent of would you then carry out the modification.

    • chuanzhenC

      pythonsdk doc Matrix manunl error?

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

      chuanzhenC

      @ferdinand Thank you for explanation. The point of confusion should be marked as 2 in the image. in doc the counterclockwise rotation (ccw) refers to the counterclockwise rotation from the spatial perspective of the image. but for the same rotation, the z-axis should have rotated clockwise(cw). However, in any case, the calculation is correct, only the description is different。
      (Describing a rotation of an axis, it is assumed that a person looks in the negative direction from the positive direction of the axis, and based on this, counterclockwise and clockwise are defined)

    • chuanzhenC

      Frozen Matrix different

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

      kangddanK

      @i_mazlov said in Frozen Matrix different:

      象,并且没有其

      I found that it's very similar to the offsetParentMatrix attribute introduced in Maya 2020.:)

    • chuanzhenC

      Set RenderData framerate causing C4D to crash

      Bugs
      • python 2025 • • chuanzhen
      4
      0
      Votes
      4
      Posts
      15.9k
      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
      575
      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
      835
      Views

      chuanzhenC

      @i_mazlov Thanks,it works!

    • chuanzhenC

      Change Icon Color parameter

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      6
      0
      Votes
      6
      Posts
      707
      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
      592
      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
      603
      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
      543
      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
      487
      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
      362
      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
      778
      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
      350
      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
      363
      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
      487
      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
      761
      Views

      chuanzhenC

      @ferdinand Thanks👍

    • chuanzhenC

      Xref object Make it Editable

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

      chuanzhenC

      @ferdinand Thanks for your reply!

    • chuanzhenC

      How to get screen space

      Cinema 4D SDK
      • 2024 python • • chuanzhen
      3
      0
      Votes
      3
      Posts
      602
      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
      3.2k
      Views

      chuanzhenC

      @i_mazlov 👍