Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    How to Get CAJoint points Counts(Bone Display Set : Polygon)

    Cinema 4D SDK
    r20 python
    2
    3
    442
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chuanzhenC
      chuanzhen
      last edited by chuanzhen

      Bone Display Set:Polygon,i can change CAJoint point postion in Point Edit Mode.But how can i get more info or change,i can not use the function of PointObject to get a CAJoint info.
      How can I handle CAJoint like a PointObject?(My goal is to change the number of Points and Polygons of CAJoint.)
      Thanks for any help!

      相信我,可以的!

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @chuanzhen

        The CAJoint is registered as PolygonObject, unfortunately, due to the nature of python, is not possible to cast this CAJoint to a PolygonObject, while in C++ you could use the ToPoly macro to convert it.

        With that's said, you can still access the PolygonData/PointData with the hidden VariableTag: PointTag and PolygonTag.
        Here a quick example:

        import c4d
        
        # Main function
        def main():
            if not op:
                return
            
            tag = op.GetTag(c4d.Tpoint)
            if not tag:
                return
            
            pos = tag.GetAllHighlevelData()
            pos[0] = c4d.Vector(100, 0, 0)
            tag.SetAllHighlevelData(pos)
            op.Message(c4d.MSG_UPDATE)
            c4d.EventAdd()
        
        # Execute main()
        if __name__=='__main__':
            main()
        

        Of course, Tpoint and Tpolygon have no safety mechanism like ensure the VertexId are consistent and so on, so please be careful with the data you write since you can easily screw up the scene.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        chuanzhenC 1 Reply Last reply Reply Quote 1
        • chuanzhenC
          chuanzhen @m_adam
          last edited by

          @m_adam Thanks

          相信我,可以的!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post