change the color of icon in object manager

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

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

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

Thanks Martin
it works Big smile

kc