[Closed] AmbiantOcc absolute settings
I wish to create a script to adjust the AO settings of current selected objects.
or more simple, adjust several materials AO settings
recorded action:
meditMaterials[9].opts_ao_samples = 17
meditMaterials[9].opts_ao_distance = 4.04
meditMaterials[9].opts_ao_dark = color 0 0 0 255
meditMaterials[9].opts_ao_ambient = color 255 255 255 255
meditMaterials[9].opts_ao_use_global_ambient = off
is there any script to do that?
you should be able to just swap out the meditMaterials[9] part with the current objects material like:
$.material.opts_ao_samples = 17
($ effectivley standing for ‘my selection’)
or if you have multiple objects selected, put them into an array like so:
obarray = $ as array
and then loop though it like so:
for i in obarray do
(
i.material.opts_ao_samples = 17
)
thank you for your answer but I just cant get it
even
$.material.opts_ao_samples = 17
return error
for i in selection do
(
i.material.opts_ao_on = on
i.material.opts_ao_samples = 18
i.material.opts_ao_distance = 3.97638
i.material.opts_ao_exact = off
i.material.opts_ao_dark = color 105 105 105 255
i.material.opts_ao_ambient = color 0 0 0 255
i.material.opts_ao_use_global_ambient = off
)
My script failed when a group is in the selection.
How to pick objects of group + individual objects in the script?
( for i in selection do i.material.opts_ao_on = on)
You could limit your loop to geometry objects:
for i in selection where superclassof s == GeometryClass do
(
)
that works thx!!
I just want to filter non Arch&Design material from the selection. Actualy the script return an error if a standartmaterial obj is in the selection.
here is my failed test:
global mysel= selection
for obj in mysel do
(
if obj.material != Arch___Design__mi ()
then (deselect obj)
)
if obj.material != Arch___Design__mi ()
is incorrect, you’ll want to test the classof for the assigned object’s materials
so
if (classof $.material) != Arch___Design__mi then
print "NO, it isn't"
else
print "YES, it is"
is correct, try it on some objects with different materials
if (classof $.material) != Arch___Design__mi then
print “NO, it isn’t”
else
print “YES, it is”
Do you try this?
It doesn’t work
Works fine here You could try using something along these lines to filter your Arch&Design objects:
tmpArr = #()
for s in selection do
(
if (classof s.material) == Arch___Design__mi then append tmpArr s
)
select tmpArr
Thank you for help. This is not very good scripted but it works!
http://laurent.renaud.free.fr/loran-maxscript.html