Notifications
Clear all

[Closed] Set all material's diffuse to white

Hello,
I want to set diffuse color to white for all selection material.
I could set white by new material. But I want to overwrite existing material to keep texture.
Is there any way to do that?
thank you

for o in selection do
(
     Rr= 255
     Rg= 255
     Rb= 255
     m = standardmaterial()
     m.diffuse = color Rr Rg Rb
     o.material = m
)
7 Replies

Maybe like this:

(
	whiteClr = (color 255 255 255)
	for o in selection where (mat = o.material) != undedined do
	(
		
		case classOf mat of
		(
			standardMaterial: mat.diffuse = whiteClr
			coronaMtl: mat.colorDiffuse = whiteClr
			vrayMtl: mat.diffuse = whiteClr
		)
	)
)

Hi sir, Thank you for your help
Your script worked in single material! But it can’t work on multimat…
Anything tips for me?
Thank you

(
	whiteClr = (color 255 255 255)
	for o in selection where (mat = o.material) != undedined do
	(		
		case classOf mat of
		(
			standardMaterial: mat.diffuse = whiteClr
			coronaMtl: mat.colorDiffuse = whiteClr
			vrayMtl: mat.diffuse = whiteClr
			Multimaterial:
			(
				for i = 1 to mat.numsubs do
				(
					case classOf mat[i] of
					(
						standardMaterial: mat[i].diffuse = whiteClr
						coronaMtl: mat[i].colorDiffuse = whiteClr
						vrayMtl: mat[i].diffuse = whiteClr
					)
				)
			)
		)
	)
)

what if submaterial is also a multimaterial?

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0
for obj in selection do
(
	(mats = getclassinstances Standard target:obj).diffuse = white
)

Maybe the OP will solve this case and will post a solution.

Hi, Thank you both! It worked.
I learned a lot