auto instance modifiers script for max 2014 adaptation

Hello
i have old script which instance certain modifiers with same names different from default ones.
for example if both Shell modifiers on two objects to Shell_Glass - two objects will get instance Shell modifier Shell_Glass

this script supposed to be in scripts/startup folder but apparently not working in max2014/ any chance to fix it?

thank you in advance

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
harumscarum's picture

now i see! macro is working

it is working as macroscript. need to off/on button (re-activate script) when working new set of objects.
have a better idea -is it possible at all? to rename two same type modifiers in order to instance them. or clone object as Copy with custom named modifier will cause Copy but with instanced modifier.
will appreciate for any help.

miauu's picture

.

The script works when the name of the object is changed.

harumscarum's picture

thanks, but not working

nothing happens when i rename both modifiers. unfortunatelly i dont remember way it worked before. was soooo long time ago)

miauu's picture

.

I don't have time to test it, but try only with this part:

when names geometry changes id:#nameChange do
			(
				if getCommandPanelTaskMode() == #modify do
				(
					curMod = (modPanel.getCurrentObject())
					cnt = true
					for i in geometry where i.modifiers[curMod.name] != undefined while cnt == true do
					(
						replaceInstances selection[1].modifiers[curMod.name] i.modifiers[curMod.name]
						cnt = false
					)
				)
			)

By the way, the script, as you posted is not for the startup folder. It have to be used as macro for toolbar button/hotkey.

harumscarum's picture

script

(
local isOpen = false
on execute do
(
if isOpen == true then isOpen = false else isOpen = true
deleteAllChangeHandlers id:#nameChange
if isOpen == true then
(
when names geometry changes id:#nameChange do
(
if getCommandPanelTaskMode() == #modify do
(
curMod = (modPanel.getCurrentObject())
cnt = true
for i in geometry where i.modifiers[curMod.name] != undefined while cnt == true do
(
replaceInstances selection[1].modifiers[curMod.name] i.modifiers[curMod.name]
cnt = false
)
)
)
)
else (deleteAllChangeHandlers id:#nameChange)
)
on isChecked do
(
if isOpen == false then return false else return true
)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.