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 Willian Kim · 2012-05-28
Forum topic · General Scripting
By Willian Kim · 2012-05-28
I need a help, I tried a few ways ... As you select an object by material "Select by material" is there a code?
Comments (8)
Comment policy
Or if you want to have same wirecolor but different from others objects
then use next code
Simple and efficient...
Very very Thanks..
But what's the "refs.dependentNodes" ?
For more infos you can find
More infos about *Dependencies* you can find on this page
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil…
Thank you again
I understand that you want to change wirecolor to the objects that
share same materijal. If i'm wright then use this
smart select by material
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
)
)
)
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
Use tags < code>your code here .. < /code> when you post next time.
It's easyer to read, like this