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. Oliver
    O
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    Oliver

    @Oliver

    0
    Reputation
    9
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Oliver Unfollow Follow

    Latest posts made by Oliver

    • RE: Weight Manager UI Not Updating Immediately After Locking Joints via API?

      @ferdinand Got it, thanks for the heads-up!

      posted in Bugs
      O
      Oliver
    • Weight Manager UI Not Updating Immediately After Locking Joints via API?

      Hello everyone,
      
      I've encountered an issue where the Weight Manager UI doesn't update immediately after using the API to lock joints.
      
      Specifically, when I use the

      c4d.modules.character.CAWeightMgr.LockAllJoints(doc)
      

      or

      c4d.modules.character.CAWeightMgr.LockSelectedJoints(doc)
      

      functions, the joints are indeed locked internally, meaning I can no longer paint weights on them. However, the lock icon in the Weight Manager UI remains in the "unlocked" state, not reflecting the actual locked status. Even after switching windows or reopening the Weight Manager, the UI still shows them as unlocked.
      
      I've tried calling c4d.EventAdd() after the lock operation, as well as CAWeightMgr.SetDirty(doc) and CAWeightMgr.Update(doc) before c4d.EventAdd(), but the UI still doesn't refresh to show the correct locked state.

      Is there a specific method or command to force the Weight Manager UI to instantly update its display of the joint lock status?

      Any insights or solutions would be greatly appreciated.
      
      Thank you!

      import c4d
      from c4d.modules.character import CAWeightMgr
      CAWeightMgr.LockAllJoints(doc) # lock all joints
      c4d.EventAdd()
      

      52153ca34d0b53b4b8c993c458262c3.png

      posted in Bugs windows 2024 python
      O
      Oliver
    • RE: How to retrieve the text content (options/items) of a User Data Cycle Property?

      @ferdinand
      Thank you for the detailed explanation and the solution! This perfectly solved my problem, and I really appreciate you clarifying how to access the DESC_CYCLE values!!

      posted in Cinema 4D SDK
      O
      Oliver
    • How to retrieve the text content (options/items) of a User Data Cycle Property?

      Hello everyone,
      I'm working with Python in Cinema 4D and I've added a custom user data attribute to an object. This attribute is a Cycle (or enum) property, similar to Maya's enum, which generates a dropdown menu.
      My attribute has the following options:
      0;X
      1;Y
      2;Z
      3;-X
      ...
      I've written a script to switch this attribute's value programmatically. My current approach involves getting the selected object and accessing its user data. I can successfully change the value, but I'm relying on hardcoded IDs (e.g., op[descId] = 0 for 'X', op[descId] = 1 for 'Y', etc.).
      Here's a snippet of my current code:

      import c4d
      
      ATTR_NAME = 'Axis'
      
      userData = op.GetUserDataContainer()
      
      for descId, container in userData:
          if container.GetInt32(c4d.DESC_CUSTOMGUI) != c4d.CUSTOMGUI_CYCLE:
              continue
          if container[c4d.DESC_NAME] != ATTR_NAME:
              continue
          
          enumString = container.GetString(c4d.CUSTOMGUI_CYCLE)
          print(enumString) # is None
          
          # clicked X
          op[descId] = 0
      
      c4d.EventAdd()
      

      My goal is to be able to switch the attribute's value by its name (e.g., 'X', '-Z') instead of its integer ID. To do this, I need to retrieve the full list of options (the 0;X\n1;Y... string) from the Cycle property itself, so I can map the option names to their corresponding integer IDs.
      I tried using container.GetString(c4d.DESC_CYCLE), but it returned an empty string, which is unexpected for a properly set up Cycle user data.
      Could anyone guide me on the correct way to extract this textual content (the 0;X\n1;Y... string) from a User Data Cycle property in Python?
      Any help would be greatly appreciated!
      4a726e5a95fc06abf24b2f56467cb81.png

      posted in Cinema 4D SDK 2025 python windows
      O
      Oliver
    • RE: How to gracefully obtain the number of targets in a constraint tag?

      @i_mazlov This is very useful as it helps avoid manually inputting hard-coded index values! Thank you, and have a great day! 🙂

      posted in Cinema 4D SDK
      O
      Oliver
    • How to gracefully obtain the number of targets in a constraint tag?

      Hello all, I need to dynamically obtain the number of Targets in a Constraint tag. I couldn't find a 'Constraint tag' class, and the BaseTag class offers very limited functionality. I had to try retrieving the information from the container. Fortunately, the container contains the data I need. However, I'm curious if there's a more elegant solution beyond using the container?

      import c4d
      
      def getTargetCount(tag) -> int:
         tagData    = tag.GetDataInstance()
         count      = 0
         startIndex = 10002
      
         while True:
             if tagData.GetData(startIndex) is None:
                 break
             count      += 1
             startIndex += 10
      
         return count
      
      def main():
         tag = doc.GetSelection()[0]
         print(getTargetCount(tag))
         
      
      if __name__ == '__main__':
         main()
      

      253c5d95a5a61cbe08ddf2aa13e790e.png

      posted in Cinema 4D SDK python 2024 windows
      O
      Oliver
    • RE: How to hide an object's native attributes

      @i_mazlov Thank you

      posted in Cinema 4D SDK
      O
      Oliver
    • How to hide an object's native attributes

      Hello all, I would like to know if C4D can hide an object's native attributes (e.g., hiding the Object tab of a spline object). This would help avoid unnecessary attributes when selecting the corresponding controllers while animating, thus improving efficiency. In the following code, I found that SetParameter doesn't work. I can only hide custom user data attributes 😞
      e2f961ced0af4a2316cf21f92cc6fe5.png

      import c4d
      
      def main():
         obj = op
         description = obj.GetDescription(c4d.DESCFLAGS_DESC_NONE)
         doc.StartUndo()
      
         for bc, paramId, groupId in description:
      
             if bc[c4d.DESC_NAME] == 'Object Properties':
                 doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj)
                 print(bc[c4d.DESC_HIDE])                    #  return None
                 bc[c4d.DESC_HIDE] = False
      
                 obj.SetParameter(groupId, bc, c4d.DESCFLAGS_SET_NONE)
               # obj.SetUserDataContainer(groupId, bc)      # hide userData attr
                 obj.Message(c4d.MSG_CHANGE)
      
         doc.EndUndo()
         c4d.EventAdd()
      
      if __name__ == '__main__':
         main()
      
      posted in Cinema 4D SDK windows 2024 python
      O
      Oliver