PDA

View Full Version : referenceReplace vs true reference


MichaelLevin
06-27-2011, 04:24 PM
Hello!
i've just found out some strange 'bug' (or it is a feature?) while using this function.
if i create two references from my simple sphere, one - by hand and one using 'referenceReplace', 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

denisT
06-27-2011, 05:53 PM
Hello!
i've just found out some strange 'bug' (or it is a feature?) while using this function.
if i create two references from my simple sphere, one - by hand ... :)


how do you do reference replace by hand? you can make reference copy or clone as reference. it's not the same as referencereplace.

MichaelLevin
06-27-2011, 08:26 PM
mmm, just shift+move, reference ))

denisT
06-27-2011, 08:31 PM
mmm, just shift+move, reference ))

shift+Move creates reference copy. It corresponds to max script reference method. It's not a reference replace. What do you really want - create a reference copy or do reference replace?

MichaelLevin
06-28-2011, 10:19 AM
hmm i think i want to know what's 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?

denisT
06-28-2011, 08:04 PM
hmm i think i want to know what's 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 ...

MichaelLevin
06-29-2011, 11:37 AM
thank you, Denis, everything works fine)

denisT
06-29-2011, 12:02 PM
thank you, Denis, everything works fine)

it works for sure. but it was not my point. any way... you are welcome

CGTalk Moderation
06-29-2011, 12:02 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.