ScriptSpot home

Forum topic · General Scripting

Adjusting Arch & Design Material Parameters within a Blend Material

By TSuess · 2012-08-15

Description

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 (3)
cynthiaporter

Their team provided transformative design ideas and actualized their concepts with impeccable code. Celebrated for their technical abilities and user experience agency, their management skills are equally impressive.

Branko Živković

#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
)
)
)

Branko Živković

#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
)
)
)