Script linking display color to label color?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  08 August 2013
Script linking display color to label color?

Just because I'm a organizational freak, would there be a way to set the Icon Color checkbox "on" and set the Display Color (Attributes palette -> Basic) to the same color as the Layer Color (Layer palette)?

Is that something scriptable?
__________________
----end of line
 
  08 August 2013
I'm sure it is, I haven't done a lot with Layers and Python yet, but setting the display color of objects is pretty simple, for example:


import c4d
red=c4d.Vector(1,0,0)
green=c4d.Vector(0,1,0)
blue=c4d.Vector(0,0,1)

def colorObjects(objects,color):
	for item in objects:	  
		findIt=doc.SearchObject(item)
		if findIt != None: ## if the object is in the scene..
			findIt[c4d.ID_BASEOBJECT_USECOLOR]=2
			findIt[c4d.ID_BASEOBJECT_COLOR]=color
			c4d.EventAdd
 
# then run the colorObjects proc sending it the name of the item and a color (vector)

Then you just need to parse the layer for the objects and extract the color info and use those variables in the proc above.

Cheers,
Brian
 
  08 August 2013
I am dumb...

Attributes > Use Color > Layer

D'oh
Attached Images
File Type: png Screen-Shot-2013-08-21-at-2.18.49-PM.png (10.7 KB, 24 views)
__________________
----end of line
 
  08 August 2013
D'oh indeed! Glad I didn't spend time trying to get the color of the layer via Python.

You could still script it so that if it's something you do a lot you could have this on an icon button in your UI, then just select the objects and click to set them all to use layer color. 1.42 seconds faster than going to the attributes manager and switching it there.. (no I didn't time it )


import c4d
def main():
	objList=doc.GetActiveObjects(True)# get the selected objects
	for obj in objList:
		obj[c4d.ID_BASEOBJECT_USECOLOR]=3 # switch on use layer color
	c4d.EventAdd()	   
					   
if __name__=='__main__':
	main()


Cheers,
Brian
 
  08 August 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:26 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.