[Closed] referenceReplace vs true reference
Hello!
i鈥檝e just found out some strange 鈥榖ug鈥?(or it is a feature?) while using this function.
if i create two references from my simple sphere, one – by hand and one using 鈥榬eferenceReplace鈥? everything is ok and identical. but if i add and remove any modifier on these two references, the script-referenced sphere becomes an instance. why?
ps/ max 2009
how do you do reference replace by hand? you can make reference copy or clone as reference. it鈥檚 not the same as referencereplace.
shift+Move creates reference copy. It corresponds to max script reference method. It鈥檚 not a reference replace. What do you really want – create a reference copy or do reference replace?
hmm i think i want to know what鈥檚 the differ鈥?cause what i want is to replace instance objects to references. i use InstanceMgr.MakeObjectsUnique and referenceReplace. How else can i do this?
to get what you want do the trick:
mapped fn trueReferenceReplace node target =
(
local ref
maxops.clonenodes target newNodes:&ref cloneType:#reference
referenceReplace node ref[1]
delete ref
node
)
/* Sample:
delete objects
sp1 = sphere radius:10 pos:[0,20,0]
sp2 = sphere radius:15 pos:[0,40,0]
t = converttopoly (teapot radius:10)
addmodifier t (Unwrap_UVW())
trueReferenceReplace #(sp1,sp2) t
*/
try to understand yourself why it works 鈥?/p>