Accessing composite map color in standard material maxscript

Hi I'm new.

I'm trying to access and change the color of a specific composite map layer within the diffuse slot of a standard material.

Can anyone tell me where I am going wrong?

Thanks for any help


colorArray=#(red, green, blue, yellow)

rollout a "Random Shirt"
(
Button btn "Change Color"
on btn pressed do
(
selectedMaterial = $ material
selectedMaterial.diffuse.compositeTexture[2].diffuse = colorArray[random 1 colorArray.count]
)
)
createDialog a 200 300

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

on btn pressed do
(
 
	for s in selection where s.material != undefined do
	(	
		if hasProperty s.material #diffusemap do
		(	
			if iskindof s.material.diffusemap CompositeTexturemap do
			(	
				for i=1 to s.material.diffusemap.mapList.count do
				(	
					-- check if map != undefined, check if it has needed property, set this property
 
				)
 
			)
 
		)
	)	
 
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.