[Closed] Instance or Reference
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
–[size=2]obj without texture and UV map object[/size]
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…
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.
Hi,
I used this line :
instanceReplace obj mesh_mat
[size=2]Instead of these:[/size]
[font=Verdana]w = copy mesh_mat
w.rotation = obj.rotation
w.pos = obj.pos
delete obj [/font]
[size=2][font=Verdana]obj = object I want to change
[font=Courier New]mesh_mat = object I want to change it to (with texture and UV mapping)[/font][/size][/font]
[font=Verdana][size=2][/size][/font]
[font=Verdana][size=2]It didn’t replace my obj with texture and UV maping.[/size][/font]
[font=Verdana][size=2][/size][/font]
[font=Verdana][size=2]What seems to be the problem?[/size][/font]
[font=Verdana][size=2][/size][/font]
[font=Verdana][size=2]Thanks.
[/size][/font]
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.
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…