ScriptSpot

Script

[Another] Get Material from Selected

By fajar · Credited author: fajar [wong solo] · 2012-11-16

Version
1.2
Version requirement
9 n Up
Other software required
3ds Max 9 -----> may be below can work too
Date updated
2012-11-16
Votes
15
Description

Well everybody already know what it is . its put selected object (many object) material to medit [material editor]. I make the script as small as posible so the script work faster n efficient as posible. check the script for the source.

thanks and happy scripting.

Edit : Thanks as always to anubis to give me a support

Attachments

Tags: Material Editor, Get Material

Comments (3)

fajar · 2012-11-17

thanks anubis for input ....so long not see you.

:)

Anubis · 2012-11-18

Yes, I was away from Max for a while

Hi Fajar

Anubis · 2012-11-16

Here is 2 notes from me ;)

1)

selection.count

return integer number, so testing for undefined:

selection.count != undefined

will always return True, so better compare with "> 0".

2) the mat edior slots are 24, so you need to check the amount of collected materials, something like:

objMats = for obj in selection where \
	obj.mat != undefined collect obj.mat
maxIndex = objMats.count
if maxIndex > 24 do maxIndex = 24
for i = 1 to maxIndex do
	setMeditMaterial i objMats[i]

..or just collect maximum 24 materials:

matIndex = 0
objMats = for obj in selection while matIndex < 24 where \
obj.mat != undefined collect (matIndex += 1; obj.mat)
for i = 1 to matIndex do
	setMeditMaterial matIndex objMats[matIndex]

best regards,
Anubis