ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
i wonder if it possible to write a scritp that would select all object including such or such instanced submaterial that stands in various multimaterials.
Try this tool for change :)
How it works:
Press "Pick MultiMaterial" button and from "Material/Map Browser" (in "Scene Material" Roll) pick multi material or any sub-material of some multimaterial.
This tool will check if picked material are assigned already and check wether is belongs to a multimaterial.
Spinner represents sub-material index.
try(DestroyDialog ::mmtlSelector)catch()
rollout mmtlSelector "Select by SubMtl"(
local mmtl
fn filtMtl mat = (isKindOf mat multimaterial or (for r in (refs.dependents mat) where isKindOf r multimaterial collect r).count != 0)
materialbutton choosemtl "Pick MultiMaterial" pos:[5,5] width:140
spinner mtlSubs "Sub Material:" type:#integer pos:[5,30] width:140 enabled:off
button btn "Select Object By Sub-Mtl" pos:[5,50] width:140 enabled:off
on choosemtl picked mtl do(if not filtMtl mtl then
(
messageBox "Pick Already Assigned Multimaterial Or Some Sub_Material " title:"Warning" beep:off
choosemtl.text = "Pick MultiMaterial" ; mtlSubs.value = 0 ; mtlSubs.enabled = btn.enabled = off ; mmtl = null
)else(
mmtl = if isKindOf mtl multimaterial then mtl else(for r in (refs.dependents mtl) where isKindOf r multimaterial collect r)[1]
choosemtl.text = if mmtl.name == "" then mmtl.name = ("MultiMtl_#"+(random 1000 2000) as string)else mmtl.name
mtlSubs.range = [1, (mmtl.materialList.count), 1] ; mtlSubs.enabled = btn.enabled = on
))
on btn pressed do(if isKindOf mmtl multimaterial do(if not MeditUtilities.isMaterialInUse (sub = mmtl.materialList[mtlSubs.value]) then
(
messageBox "This Material Is Not Assigned To Any Object!" title:"Warning" beep:off
)else(
select (refs.dependentNodes sub))))
on choosemtl rightclick do(choosemtl.text = "Pick MultiMaterial" ; mtlSubs.value = 0 ; mtlSubs.enabled = btn.enabled = off ; mmtl = null))
createDialog mmtlSelector 15075 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
I just don't understand what's the choice between instance and copy.
it's a detection method? if so, the copy method never get results, even if I copy a submat from a multimat into an other multimat and after renaming it with same name...
That's the default behavior of material/map buttons. Material Editor works also that way. U need to choose "Instance" because "Copy" will create new material which is unused in the scene
Comments
hello, try this one select (
hello, try this one
is this what you want ?
cheers !
...
Is not that simple.
He want to select by sub-Material not multimaterial
I'll post solution later
bga
oopss... ok :D
oopss... ok :D
...
Try this tool for change :)
How it works:
Press "Pick MultiMaterial" button and from "Material/Map Browser" (in "Scene Material" Roll) pick multi material or any sub-material of some multimaterial.
This tool will check if picked material are assigned already and check wether is belongs to a multimaterial.
Spinner represents sub-material index.
bga
...
I did not test this but you can try it :)
bga
waow!
waow! that was fast! you rock!
it seems to work fine. thanks a lot.
I just don't understand what's the choice between instance and copy.
it's a detection method? if so, the copy method never get results, even if I copy a submat from a multimat into an other multimat and after renaming it with same name...
...
That's the default behavior of material/map buttons. Material Editor works also that way. U need to choose "Instance" because "Copy" will create new material which is unused in the scene
bga
...
ok, thanks.
could you make it installable in user interface?