PDA

View Full Version : Return all objects with morph modif. as array


Martin Andersen
06-27-2005, 12:04 PM
Hi, I'm allways trying to be a better scripter, so how do I return all objects with a morph modifier into an array, in the shortest form?

Here is how I would do it:
take all objects and check all there modifiers if they have a morpher in it..

But I guess I can do it something like this:
AllMorphObjects = morphersuperclass as array ????

is this possible?

JHaywood
06-27-2005, 03:51 PM
Here you go.

objArr = #()

for i in objects do (
for j = 1 to i.modifiers.count do (
if classOf i.modifiers[j] == Morpher then append objArr i else continue
)
)

If anything isn't clear just let me know. :)

ofer_z
06-27-2005, 07:48 PM
and in one line :):


for o in objects where (findItem (for m in o.modifiers collect classOf m) morpher > 0) collect o



cheers,
o

Martin Andersen
06-27-2005, 08:00 PM
wow cool.. where counting down on the words here :scream:

Thanks alot!

CGTalk Moderation
06-27-2005, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.