I need a help, I tried a few ways ... As you select an object by material "Select by material" is there a code?
Forum topic · General Scripting
Select by material
By kimarotta · 2012-05-28
Description
Comments (8)
barigazy · 2012-05-28
Or if you want to have same wirecolor but different from others objects
then use next code
for m in scenematerials do
(
(refs.dependentNodes m).wirecolor = random black white
)
kimarotta · 2012-05-28
Simple and efficient...
Very very Thanks..
But what's the "refs.dependentNodes" ?
For more infos you can find
barigazy · 2012-05-28
More infos about *Dependencies* you can find on this page
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil…
kimarotta · 2012-05-29
Thank you again
barigazy · 2012-05-29
I understand that you want to change wirecolor to the objects that
share same materijal. If i'm wright then use this
for m in scenematerials do
(
local objArr = refs.dependentNodes m
for o in objArr do o.wirecolor = random black white
)
smart select by material
barigazy · 2012-05-28
Try to modify this because i plan to use it in the next update of
Select Objects By BitmapTex script.
fn getGrandParent obj = (while obj.parent != undefined do obj = obj.parent)
if selection.count == 0 then (messageBox "You must select at least one object!" title:"Warning" beep:false) else
(
local obj = selection[1]
if obj.material == undefined then (messageBox "This object don't have assigned material!" title:"Warning" beep:false) else
(
local mat = obj.material
local objArr = refs.dependentNodes mat
if objArr.count == 1 then (messageBox "Material of this object is unique!" title:"Warning" beep:false) else
(
for itm in objArr do
(
if (isGroupMember itm == true and isOpenGroupMember itm == false) do
(
local grandParent = getGrandParent itm
try (setGroupOpen (getGrandParentName itm) true) catch()
)
) ; select objArr
)
)
)
kimarotta · 2012-05-28
Hey Barigazy, thanks for the help, but could not get in my need, see if you can help me ...
I am writing a tool and want to put color in random objects in the scene by the material objects with the same material have the same color ... see if I'm in a right way... lol
fn matWire =
(
matObj = #()
for obj in objects do (
m = obj.material
appendIfUnique matObj m
)
for obj in objects do(
for x = 1 to matObj.count do(
if matObj[x] == obj.material then(
obj.wirecolor = random black white
)
)
)
)
Thanks
barigazy · 2012-05-29
Use tags < code>your code here .. < /code> when you post next time.
It's easyer to read, like this
fn matWire =
(
local matObj = #()
for obj in objects do
(
m = obj.material
appendIfUnique matObj m
)
for obj in objects do
(
for x = 1 to matObj.count do
(
if matObj[x] == obj.material then
(
obj.wirecolor = random black white
)
)
)
)