[Closed] Select objects by modifier – possible?
Is it possible to select objects by modifier? What I’m trying to do right now is have a script that takes existing objects and applies a modifier to them with some set values that the user can use spinners to manipulate… all objects that are modified go to a list, which the user can click between and manipulate. The problem of course is that when you close MAX, say you want to go back into that scene and manipulate the objects further, and you can’t, because they were stored in the globals of the script during the last session, which were wiped when you closed max!
I could script an option where the user could go in and ‘pick’ the objects back into the list, but I just wish they could press a button and have it done for them! A select by modifier function would be great, but I just can’t seem to write it… and am wondering if its possible? Or is there a possible workaround that you guys can see?
have a nice day! hope you can help.
here’s a little functions to do this:
-- get a list of object that has a modifier of class mod from the objs list
fn getObjsUsingMod objs mod =
(
for o in objs where ((findItem (for m in o.modifiers collect classOf m) mod) > 0)collect o
)
-- example of usage: get all objects with bend modifier
getObjsUsingMod $objects bend
-- example of usage: get all objects in selection with bend modifier
getObjsUsingMod selection bend
hOpe this helps,
o
this is just what I was looking for, thanks so much –
hard to grasp at first, but after a few readthroughs it started to make sense… thanks so much, just this little line opens up the world of for loops for me; I never quite understood their capacity until now. I’ve just gotten by on if loops and simple functions until now.
thanks again!
Shameless plug, I know, but just yesterday CG Academy released a MAXScript DVD where this and much more is explained in 3 hours and 13 minutes of practical examples by yours truly.
When I saw your question, I was like “Hey, people really ask about these things!”
FOR loops are MIGHTY, the more objects/materials/controllers/whatever in the scene, the more time they save you!