About Instance material i need hlep!!

I have 100 book material, which joined the channel in vray reflection falloff, I want to instance reflection channel 100 books, how to do, I made one, how to batch instance
meditMaterials[10].material1.texmap_reflection = sceneMaterials["MT_book_089"].material1.texmap_reflection

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pixamoon's picture

~

Hi,

Do they have specific names (MT_book_001, MT_book_002 ... MT_book_100) or you want to do it by selected objects ?
What is a material structure - I see you have some "material1" after meditMaterials[10]

cloves's picture

help

yes,they have specific names(MT_book_001, MT_book_002 ... MT_book_100) and i want to do it by selected objects
i use Multi/Sub-Object material,hope you help me,thanks

pixamoon's picture

`

Are they all inside one Multi/Sub Material ? So you want to change reflectionMap in first one and instance to rest?

Just need to know how to get Array of materials to instance refMap in

But also if you use Vray you can use one VRayMultiSubTex as diffuse with 100 different bitmaps and just one Bitmap as refMap

cloves's picture

hi

Are they all not inside one Multi/Sub Material。for example:one book model one Multi/Sub Material,I have more than 500 book model ,so i want to change reflectionMap in first one and instance to all material

pixamoon's picture

`

oki,

try this one:

1. put your first VRayMtl with correct reflection texturemap into 1st slot in Material Editor (it has to be just VRayMtl and not Multi/Sub Mtl)
2. select all objects you want to instance reflection map in
3. run the script:

tm = meditMaterials[1].texmap_reflection
 
for o in selection where o.material != undefined do (
	m = o.material
	if classof m == VRayMtl and findstring m.name "MT_book_" == 1 do m.texmap_reflection = tm
	if classof m == Multimaterial do
		for mm in m.materialList where mm != undefined and classof mm == VRayMtl and findstring mm.name "MT_book_" == 1 do mm.texmap_reflection = tm
	)	

Script finds all VRayMtls in selected objects with name starting "MT_book_" and than instance Reflection_texture Map.

Hope it helps.
Pixamoon

cloves's picture

2

hi,i want to rename sub-material script,copy object the model name to name the name of the material
for example
object name:MT_book_001
Sub-material name:MT_book_001
Sub-material(1) name:MT_book_001_mtl_01
Sub-material(2) name:MT_book_001_mtl_02
Sub-material(3) name:MT_book_001_mtl_03
hope you help me thanks
sorry my bad english

pixamoon's picture

`

Hi, sure, try this one:

for o in selection where o.material != undefined and classof o.material == Multimaterial do 
(
	local m = o.material
	m.name = o.name
	for i = 1 to m.materialList.count where m.materialList[i] != undefined do m.materialList[i].name = o.name + "_mtl_" + (formattedPrint i format:"02d") 
)
--to refres Meditor if its open:
if MatEditor.isOpen() do (MatEditor.Close(); MatEditor.Open())
cloves's picture

3

thanks

cloves's picture

1

wow,it's cool thank you vrey much

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.