Instance Replace - How to keep materials?

Instance Replace - How to keep materials?

TJMGoodwin
Contributor Contributor
386 Views
2 Replies
Message 1 of 3

Instance Replace - How to keep materials?

TJMGoodwin
Contributor
Contributor
Hi All,

I'm using instance replace to ... errmm obviously replace a series of objects with an instanced one.

The issue I have is that it doesn't keep the materials for the original object but uses the object to be replaced material.

Am i just being blind and missing something obvious or does it not transfer the material as well?

To demonstrate, the original script that I cannibalised is as follows.




-- Author : HanyElTiby mailto:Ha_tiby@Hotm*****
-- Version: 3ds max 4
--
--
--***********************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK

rollout Instance_Replace "Make instances" width:200 height:100
(
pickbutton btn1 "Pick_master" pos: width:100 height:23
label lbl1 "Master Object :" pos: width:75 height:20
button btn3 "Make Instances" pos: width:176 height:23
on btn1 picked obj do
(
global Master_Obj = obj
btn1.text = obj.name
)
on btn3 pressed do
for i in selection do instancereplace i Master_Obj
)
rollout Help "Help" width:200 Height:60
(
label lbl5 "1 : Pick master Object first 2 : Select Objects to be instances then press Make Instances button" pos: width:180 height:45

)
-- create the rollout window and add the rollout
if InstanceReplaceFloater != undefined do
(
closerolloutfloater InstanceReplaceFloater
)
InstanceReplaceFloater = newRolloutFloater "InstanceReplace" 210 120
addRollout Instance_Replace InstanceReplaceFloater
addRollout Help InstanceReplaceFloater rolledup:true



Cheers

El-d
0 Likes
387 Views
2 Replies
Replies (2)
Message 2 of 3

Steve_Curley
Mentor
Mentor
I'm afraid the help is quite clear on this. Materials are NOT instanced from the source object to the destination object.

All you should need to do is assign the material from the one to the other:-

on btn3 pressed do
(
for i in selection do
(
instancereplace i Master_Obj
i.material = Master_Obj.material
)
)

Material assignments like that are automatically instances unless you specifically ask for a copy.


Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 3

TJMGoodwin
Contributor
Contributor
Thanks again... a bad habit of mine just skimming text.
El-d
0 Likes