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
    • Recent
    • Tags
    • Users
    • Login

    change the color of icon in object manager

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 446 Views
    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.
    • H Offline
      Helper
      last edited by

      On 05/05/2014 at 07:47, xxxxxxxx wrote:

      Hi
      After 2 weeks of trail and error i managed to write 8 lines of (python)code that adds a Null with
      a Xpresso tag to the object manager after pressing the button.

      it works fine, a input dialog pops up so i can give the null a name and a color picker dialog to give the icon a color. But i dont want to use the color picker i just want to give the RGB values somewhere in the code and skip the colorpicker

      i have no idea how to do that.

      im not a developer and its my first post so sorry if its not in the right place.
      this is the code.

      script that adds a null object with an Xpresso tag to the object manager

      import c4d
      from c4d import documents
      from c4d import gui

      usrInput = raw_input('type text here: ')        #Input dialog to name myobject

      def main() :
       
       
      #create the xpressoNULL
        myobject = c4d.BaseObject(c4d.Onull)        #create a null object (myobject)
        doc.InsertObject(myobject)                  #Insert the object into the documents object manager
        myobject.MakeTag(1001149)                   #Add xpresso tag to myobject
        myobject[c4d.ID_BASELIST_NAME] = usrInput   #Give myobject a name (comes from the input dialog)

      Switch on Color options in the basic tab.comment out to deactivated

      iconColor = c4d.gui.ColorDialog(0)            #Color Picker to color myobject
        myobject[c4d.NULLOBJECT_ICONCOL] = True       #Set "Icon Color" on in basic tab
        myobject[c4d.ID_BASEOBJECT_USECOLOR] = True   #Set " Use Color" on automatic in basic tab
        myobject[c4d.ID_BASEOBJECT_COLOR] = iconColor #set "Display Color" in basic tab
       
      #Refresh the managers to show the new object   
        c4d.EventAdd()
       
      main()

      KC

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 05/05/2014 at 08:06, xxxxxxxx wrote:

        Hi,

        op[c4d.ID_BASEOBJECT_COLOR]=c4d.Vector(1,0,0)

        this is a pure red

        The vector represents the rgb values, like c4d.Vector(R,G,B), in the range from 0 to 1

        cheers
        martin

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 05/05/2014 at 08:18, xxxxxxxx wrote:

          Thanks Martin
          it works !Big smile[URL-REMOVED]

          kc


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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