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

    Python missing ObjectColorProperties?

    Cinema 4D SDK
    r19 r20 python
    2
    3
    705
    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.
    • C4DSC
      C4DS
      last edited by

      The C++ SDK does have BaseObject::GetColorProperties to obtain the custom displaycolor assigned to an object. This seems not to be available in the Python SDK.

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        You can go directly through the properties, e.g.

        import c4d
        
        def main():
            selectlist = doc.GetSelection() 
            for obj in selectlist: 
                print obj.GetName(), " ", obj[c4d.ID_BASEOBJECT_COLOR]
                obj[c4d.ID_BASEOBJECT_USECOLOR] = True
                obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,0,1)
                obj.Message(c4d.MSG_UPDATE)
                c4d.EventAdd()
        
        if __name__=='__main__':
            main()
        

        So you don't need specific functions.

        C4DSC 1 Reply Last reply Reply Quote 2
        • C4DSC
          C4DS @Cairyn
          last edited by

          @cairyn
          You are right.
          I thought having to go over the BaseContainer obtained from the object via GetData(), but didn't see anything in its content related to the displaycolor ... didn't think of just accessing the object's properties directly. I am not that confident with the Python SDK.
          Thanks for the piece of code.

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