Could you believe this function was exist, but undocumented?


And which are the four parameters it expects?

addmodifierwithlocaldata <destination node>  <the modifier> <source node> <modifier index in source stack>

it’s pretty cool … i didn’t know about it.

as i can guess the 3rd and 4th arguments tell where to get Local Data.


It is documented now:
Node Common Properties, Operators, and Methods

addModifierWithLocalData <destnode> <dest modifier> <srcnode> <src modifier_or_index> [before:index]

This method copies an existing modifier, including its local data (including modifications such as vertex positions), to a destination node. The two modifiers must be of the same type. The local data of the source (if any) is cloned and attached to the destination modifier. If the source modifier has no local data, the destination modifier will contain whatever its default local data is (just as if it had been added by the addModifier() method).


I really shocked! why this important function is hidden! There are some more here:

Next one which I think should be cool is :
dontRepeatMessages Context


Does this works with Edit Poly modifier?


Yes, it seems it does work.


Then I am doing something wrong.

  1. Create a plane
  2. Copy the plane
  3. Add Edit Poly modifeir to plane001 and extrude some faces
  4. Add Edit Poly modifier to plane002
  5. Execute this:
	addModifierWithLocalData $Plane002 $Plane002.modifiers[1] $Plane001 $Plane001.modifiers[1] 

This comes out:

-- Error occurred in anonymous codeblock; filename: ; position: 2; line: 1
-- Runtime error: Modifier is not appropriate: Edit_Poly:Edit Poly
-- MAXScript callstack:
--	thread data: threadID:5088
--	------------------------------------------------------
--	[stack level: 0]
--	In anonymous codeblock; filename: ; position: 48; line: 2
--		Locals:
--		Externals:
--	------------------------------------------------------
--	[stack level: 1]
--	called from top-level

	delete objects
	b1 = converttopoly (box isselected:on)
	b2 = converttopoly (box pos:[50,0,0])
	mod1 = edit_poly()
	mod2 = edit_poly()
	addmodifier b1 mod1
	mod1.buttonop #MeshSmooth
	addmodifierwithlocaldata b2 mod1 b1 mod1	-- instanced modifier
	--addmodifierwithlocaldata b2 mod2 b1 mod1	-- unique modifier


Thank you.