Notifications
Clear all

[Closed] InstanceMgr – Modifier Instances

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…

4 Replies

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

1 Reply
(@decapitator)
Joined: 11 months ago

Posts: 0

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.

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

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 is

modlist = #()
for obj in geometry do modList = join modList obj.modifiers
modlist = makeUniqueArray modList

This 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…