Anyone know of or have a script to change shader types? I need to find all ward shaders in a scene and switch them to blinn or phong. The infamous "red dot" problem.
Announcement
Collapse
No announcement yet.
Script for mats
Collapse
X
-
Try the MaterialControl maxscript from the blur scripts collection.
http://www.neilblevins.com/blurscripts/blurscripts.htm
-
Run zis and select all the objects you want changed:
Code:Rollout changeBRDF "Change BRDF" ( global brdf = 0 radiobuttons brdf_type labels:#("Phong", "Blinn", "Ward") button applyIt "Apply" width:200 align:#right on brdf_type changed state do ( global brdf = brdf_type.state as integer - 1 ) on applyIt pressed do ( ObjArray = selection as array for m in 1 to ObjArray.count do ( if (classof ObjArray[m].material == VRayMtl) then ( ObjArray[m].material.brdf_type = brdf ) ) ) ) createdialog changeBRDF width:300
Comment
-
Try this then - select everything and evaluate the code:
Code:ObjArray = selection as array for m in 1 to ObjArray.count do ( if (classof ObjArray[m].material == VRayMtl) then ( ObjArray[m].material.brdf_type = 1 ) ) )
Code:ObjArray = selection as array for m in 1 to ObjArray.count do ( if (classof ObjArray[m].material == VRayMtl) then ( ObjArray[m].material.brdf_type = 0 ) ) )
Comment
-
this should do the trick..."refs.dependson" is a killer for recursive stuff!
Code:clearlistener() fn removeward mat = ( local mats = #() local scenemats = refs.dependsOn mat for r in scenemats do ( if (classof r == vraymtl) then append mats r join mats (removeward r) ) return mats ) for t in scenematerials do mymats = removeward scenematerials for i in mymats do ( print i if i.brdf_type == 2 then (i.brdf_type = 1) else() )
this script goes everywhere, no matter if your vraymaterial is inside a multimat,blend, whatever and how deep nested.
regards,michaelThis signature is only a temporary solution
Comment
-
Code:( Rollout changeBRDF "Change BRDF" ( global brdf = 0 radiobuttons brdf_type labels:#("Phong", "Blinn", "Ward") button applyIt "Apply" width:200 align:#right on brdf_type changed state do ( global brdf = brdf_type.state as integer - 1 ) on applyIt pressed do ( ObjArray = selection as array for m in 1 to ObjArray.count do ( if (classof ObjArray[m].material == VRayMtl) then ( ObjArray[m].material.brdf_type = brdf ) ) ) ) createdialog changeBRDF width:300 )
(additional wrapping parenthesis)Marc Lorenz
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
www.marclorenz.com
www.facebook.com/marclorenzvisualization
Comment
-
Originally posted by Sushidelicthis should do the trick..."refs.dependson" is a killer for recursive stuff!
Code:clearlistener() fn removeward mat = ( local mats = #() local scenemats = refs.dependsOn mat for r in scenemats do ( if (classof r == vraymtl) then append mats r join mats (removeward r) ) return mats ) for t in scenematerials do mymats = removeward scenematerials for i in mymats do ( print i if i.brdf_type == 2 then (i.brdf_type = 1) else() )
this script goes everywhere, no matter if your vraymaterial is inside a multimat,blend, whatever and how deep nested.
regards,michael
if I am executing it incorrectly or error in the script
-- Syntax error: at ), expected <factor>
-- In line: )"It's the rebels sir....They're here..."
Comment
-
oops, looks like i pasted the wrong code...
try this again:
Code:clearlistener() fn removeward mat = ( local mats = #() local scenemats = refs.dependsOn mat for r in scenemats do ( if (classof r == vraymtl) then append mats r join mats (removeward r) ) return mats ) mymats = removeward scenematerials for i in mymats do ( print i if i.brdf_type == 2 then (i.brdf_type = 1) else() )
This signature is only a temporary solution
Comment
Comment