PDA

View Full Version : InstanceMgr - Modifier Instances


decapitator
06-05-2008, 01:42 PM
Hello,

I've ran into a problem with the Interface: InstanceMgr - It works fine on objects but I need to check modifier instances even those on non instanced objects (copy modifier/paste instance ones)

I tried:InstanceMgr.GetInstances $.modifiers[1] &instances
-- Unable to convert: meshsmooth:MeshSmooth to type: <node>But as you see that fails since it needs a node..

So how would that work with modifiers/or compare modifiers with eachother so I can generate a list of modifiers applied on all objects w/o duplicate's.

Edit:
ok $Box01.modifiers[1] == $Box02.modifiers[1] works so I can cross reference each object with eachother but thats quite intensive surely hope there is another way..

magicm
06-05-2008, 02:22 PM
Hi Jenne,

You could narrow down your search by filtering out all other modifier classes:

theMod = $.modifiers[1]
sameMods = getClassInstances (classOf theMod)
instancedMods = for m in sameMods where m == theMod collect m

Cheers,
Martijn

decapitator
06-05-2008, 03:06 PM
Hi Jenne,

You could narrow down your search by filtering out all other modifier classes:

theMod = $.modifiers[1]
sameMods = getClassInstances (classOf theMod)
instancedMods = for m in sameMods where m == theMod collect m

Cheers,
Martijn
Yeah thanks that shortens it up a bit. What im trying to do is create a list of modifiers with their objects behind it instead of the other way around. So its still quite intensive since Im looping through all objects to check for modifiers and then check back for the objects where the modifier is linked to.

The modlist is allready done just the instances are quite horrible. But it seems there isn't realy a shorter way from what I can tell.

magicm
06-05-2008, 03:22 PM
You could use refs.dependents to get an array of nodes that are dependent on the given modifier:

for obj in (refs.dependents $.modifiers[1]) where isValidNode obj collect obj

Hope this helps,
Martijn

decapitator
06-05-2008, 03:40 PM
You could use refs.dependents
...Ah yes thats sweet thanks. Also found makeUniqueArray (Im such a beginner to ms so never thought to look at something like that lol) which helps out alot since I dont have to crossreference between modifiers now. What I've done now ismodlist = #()
for obj in geometry do modList = join modList obj.modifiers
modlist = makeUniqueArray modListThis sets modList to a list of all unique modifiers in the scene. So together with the refs you just said im done with that part and it even runs smooth w/o douzens of loops..

CGTalk Moderation
06-05-2008, 03:40 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.