View Full Version : Instance or Reference


igor333
01 January 2005, 03:34 PM
Hi,
I'm using now this code to replace an object without texture and UV map
with an object that has texture and UV map:

w = copy mesh_mat

w.rotation = obj.rotation

w.pos = obj.pos

delete obj
--mesh_mat with texture and UV map object

--obj without texture and UV map object

the code is working fine , but i want to use the Replace function instead.

What is the different between instanceReplace() to referenceReplace() ?
How to use the function instead of the copy function?

Thanks...

Wahooney
01 January 2005, 05:52 AM
Basically, instanceReplace() makes your object an instance of the original object (ie. They're exactly the same) and referenceReplace() makes your object a a reference of the original (ie. exactly the same, except that the reference can have additional modifiers at the top of it's stack)

The usage is simple:

objDest = object you want to change
objSrc = object you want to change it to

instanceReplace objDest objSrc
referenceReplace objDest objSrc

Hope this helps.

igor333
01 January 2005, 06:56 AM
Hi,
I used this line :

instanceReplace obj mesh_mat

Instead of these:

w = copy mesh_mat

w.rotation = obj.rotation

w.pos = obj.pos

delete obj

obj = object I want to change
mesh_mat = object I want to change it to (with texture and UV mapping)

It didn't replace my obj with texture and UV maping.

What seems to be the problem?

Thanks.

Wahooney
01 January 2005, 10:12 AM
Do you mean that you want your original object to retain it's old mapping?

Cos instanceReplace() should make an exact duplicate of the source object.

igor333
01 January 2005, 01:13 PM
Wahooney,
I have an obj with texture and UV mapping on it ,and I have
few other objects without any texture on it or uv map.
I want to replace the objects to be with textures on.
for each obj to do :
instanceReplace obj mesh_mat_with_texture

but it doesn't work...

CGTalk Moderation
01 January 2006, 03:00 AM
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.


1