Adjusting Arch & Design Material Parameters within a Blend Material

I've hit a roadblock. I am creating a unverisal Ambient Occlusion controller. The following test script works perfectly.

--------------
for a in objects do

(
if (classof a.material == Arch___Design__mi) then
(
a.material.opts_ao_on = true
a.material.opts_ao_distance = 24
a.material.opts_ao_samples = 24
)

(
if (classof a.material == Multimaterial) then
(
for b = 1 to a.material.numsubs do
(

if (classof a.material.materialList[b] == Arch___Design__mi) then
(
a.material.materialList[b].opts_ao_on = true
a.material.materialList[b].opts_ao_distance = 24
a.material.materialList[b].opts_ao_samples = 24
)
)
)
)
)

-----------

I am able to adjust the parameters of a Arch & Design material within a Multimaterial. What I have not yet figured out is how to do the same within a Blend Material. It seems that something like this should work. See below.

----------

for a in objects do

(

(
if (classof a.material == blend) then
(
for b = 1 to a.material.numsubs do
(

if (classof a.material.materialList[b] == Arch___Design__mi) then
(
a.material.materialList[b].opts_ao_on = true
a.material.materialList[b].opts_ao_distance = 24
a.material.materialList[b].opts_ao_samples = 24
)
)
)
)
)

-----------------

can anyone show me the light? Thanks!!

Comments

Comment viewing options

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

Try this out. The maxScript

Try this out. The maxScript Reference says "MultiSubMaterial is obsolete and is visible only for backward compatibility." Hope it works.

for a in objects do
(
	if (classof a.material == blend) then
	(
		--Map 1
		if (classof a.material.map1 == Arch___Design__mi) then
		(
			a.material.map1.opts_ao_on = true
			a.material.map1.opts_ao_distance = 24
			a.material.map1.opts_ao_samples = 24
		)--End test Map 1
 
		--Map 2
		if (classof a.material.map2 == Arch___Design__mi) then
		(
			a.material.map2.opts_ao_on = true
			a.material.map2.opts_ao_distance = 24
			a.material.map2.opts_ao_samples = 24
		)--End test Map 2
	)
)--End a in objects
TSuess's picture

Perfect!

Thanks so much MK! Works perfectly!

Comment viewing options

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