Create and assign material - mr - why its duplicating ?
Heya I want to create and assign material to selected object. But If I'm assigning the same material to 2 objects I'm creating 2 materials instead of assignign 1 mat to 2 objects. Can some1 look at my errors?
[CODE]
fn mats =
(
(
for o in getCurrentSelection() do (
try (
o.material = Arch___Design__mi ()
o.material.name ="TestMat"
o.material.diff_weight = 0.02
o.material.refl_weight = 1
o.material.refr_weight = 0.9
o.material.refl_func_fresnel = on
o.material.opts_1sided = on
o.material.opts_propagate_alpha = on
o.material.opts_refl_depth = 10
o.material.opts_refr_depth = 10
) catch()
)
)
)
mats()
[\CODE]
Comments
Yeah I thought I would script
Yeah
I thought I would script in python, but looking how little info of it is on internet I decided to move back to maxscript :(
...
Python scripting is very similar to mxs. But I not found any use in max for now.
.NET is very well integrated in max. I hope that AD will add Python IDE to work inside max side by side with mxs editor
bga
Wow that was simple... damn
Wow that was simple... damn thanks ! Ure the best! :- ))))
...
bga
Hey Thanks! So this "almost"
Hey
Thanks!
So this "almost" (:-))works great if I select all objects and assign a material. But if I select 3 objects, assign and then another 2 objects and assign I'm still getting duplicated material.
I was thinking that I need an if statement so
That works if material exists but the else function fails to create material if it dont exists.
Also this test :
Also this test function seems to have a weird problem.
If I DONT have the material in scene I get undefined. But when I have the material in scene on 1st execution I get undefined and on second execution I get "mat exists" printed. Is that normal that I need to run it 2x so that I get accurate value? :-(
I come from python scripting pipeline. I did MS for max 5 years ago and the code I posted originally worked for Vray just fine. Its frustrating how MR works :(
Can you hint me out how to fix the if statement? I want to avoid duplication of materials.
...
For better readability of any posted code folow this rule
http://www.scriptspot.com/forums/3ds-max/general-scripting/kredka-strike...
bga
...
assign material as copy to all selected objects
assign material as instance to all selected objects
bga