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.
barigazy's picture

#2 solution


for a in objects do
 
(
	if (classof a.material == Blend) then
	(
		local blendMtl = a.material
		for i = 4 to 5 where isKindof blendMtl[i] Arch___Design__mi do
		(
			blendMtl[i].opts_ao_on = true
			blendMtl[i].opts_ao_distance = 24
			blendMtl[i].opts_ao_samples = 24
		)
	)
)

barigazy

barigazy's picture

#1 solution


for a in objects do
(
	if (classof a.material == Blend) then
	(
		local blendMtl = a.material
		if isKindof blendMtl.map1 Arch___Design__mi do
		(
			blendMtl.map1.opts_ao_on = true
			blendMtl.map1.opts_ao_distance = 24
			blendMtl.map1.opts_ao_samples = 24
		)
		if isKindof blendMtl.map2 Arch___Design__mi do
		(
			blendMtl.map2.opts_ao_on = true
			blendMtl.map2.opts_ao_distance = 24
			blendMtl.map2.opts_ao_samples = 24
		)
	)
)

barigazy

Comment viewing options

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