ScriptSpot

Forum topic · General Scripting

Is there a script to change the color of objects to Layer Color ?

By chunchk · 2014-06-04

Description

My friend gave me a lot of scenes for learning rendering, but every objects have different colors and its really disturbing....
Is there a script to let me change all the objects color to Layer Color with just one click ?

Comments (5)

This is native to max (3steps instead)

3dwannab · 2014-11-02

See steps of attached images.
1. Select all objects
2. Click white square box of the 1st image.
3. Click mixed. That changes to By layer.

An optional step is to go to your preferences and check the box shown. This will made sure all new objects take on the properties of the layer.

Attachments

Done it (AFTER I learned some scripting) :]

3dwannab · 2015-04-15

All objects in scene changed to ByLayer properties.

	for o in objects do
	(
		o.colorByLayer = on ; o.wirecolor = o.layer.wirecolor
		o.displaybylayer = on
		o.renderbylayer = on
		o.motionbylayer = on
	)

Just selection changed to ByLayer properties.

	for o in selection do
	(
		o.colorByLayer = on ; o.wirecolor = o.layer.wirecolor
		o.displaybylayer = on
		o.renderbylayer = on
		o.motionbylayer = on
	)

.

miauu · 2014-06-04


(
	for i = 0 to LayerManager.count-1 do 
	(
		layer = LayerManager.getLayer i
		layer.nodes &theNodes
		theNodes.wirecolor = layer.wirecolor
	)
)

chunchk · 2014-06-05

Adore!

Thanks for your quick response and script, It helps a lot!

barigazy · 2014-06-15

Or if you need to restore color of imported object for CAD software you can try this line

for o in objects where o.colorByLayer do (o.colorByLayer = off ; o.wirecolor = o.layer.wirecolor)