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

    Posts made by 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