[Another] Get Material from Selected

0 votes
Version: 
1.2
Date Updated: 
11/16/2012
Author Name: 
fajar [wong solo]

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

Version Requirement: 
9 n Up
Other Software Required: 
3ds Max 9 -----> may be below can work too
AttachmentSize
get_material_from_selected.mcr478 bytes
get_material_from_selected-optimized_from_anubis.mcr461 bytes

Comments

Comment viewing options

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

:)

Yes, I was away from Max for a while

my recent MAXScripts RSS (archive here)

fajar's picture

thanks anubis for input

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

Anubis's picture

Hi Fajar

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

my recent MAXScripts RSS (archive here)

Comment viewing options

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