PDA

View Full Version : can you solve the question?


sunboy69
03-26-2008, 07:11 AM
Close```thx!!!

MoonDoggie
03-26-2008, 03:06 PM
I'm not sure I understand what you're asking.

RustyKnight
03-26-2008, 10:03 PM
Do you mean:

You have an OBJECT with map/material ID's
You want to "scan" that object and BUILT a multi/sub material with the appropriate id's assigned to the correct number of slots...or are we just completely confused...??

Shane

sunboy69
03-27-2008, 02:52 AM
Do you mean:

You have an OBJECT with map/material ID's
You want to "scan" that object and BUILT a multi/sub material with the appropriate id's assigned to the correct number of slots...or are we just completely confused...??

Shane
Oh, I'm sorry I didn't say clearly and thanks for your answer.For this:
Because in the Max,there're some objects,So in the material editor there're some materials and multi/sub-objs,now I want to make a new multi/sub-obj and put only all the scenematerials in the new multi/sub-object, If there're some multi/sub-objs in the material editor,please put all materials of them in the new multi/sub-obj,And the result is: in the material editor,there is only one multi/sub-object,and in the mult/sub-object, there is only scenematerials and could’t have some multi/sub-object.Notice:In the end it don't have the repeated materials,Can you help me to put the scenematerials of some multi/sub-objs in the new multi/sub-obj use the script?


http://img.jpg.name/hjytzvhwhhvythhystvwhzrsvsyvdvsvvzdhd.jpg

RustyKnight
03-27-2008, 04:35 AM
Yes, I have a solution. I'm some what disappointed by how easy that was...

Shane

sunboy69
03-27-2008, 05:32 AM
Yes, I have a solution. I'm some what disappointed by how easy that was...

Shane
Oh,thanks! It's hardly for me to write the script,Because I'm studing maxscritp now,waitting for you,honorific!!!

RustyKnight
03-27-2008, 05:56 AM
This is the basics
(

--local lstMaterials = #()

/*
Returns all the materials and sub materials contained by the parent material

The optional material list provides a means to weed out duplicates...
*/
fn getAllMaterialsFrom mParent materialList:#() = (

local lstTextures = #()

for iIndex = 1 to (getNumSubMtls mParent) do (

local subMtl = getSubMtl mParent iIndex

if subMtl != undefined do (

-- Makre sure our parent list doesn't already have the
-- material
if (finditem materialList subMtl) == 0 then (

append lstTextures subMtl

join lstTextures (getAllMaterialsFrom subMtl materialList:materialList)

)

)

)

lstTextures

)

-- Create the master material array
local lstMaterials = #()
for mat in sceneMaterials do (

join lstMaterials ((getAllMaterialsFrom mat materialList:lstMaterials))

)

-- Create the new multi material and place it in the material editor at slot 1
medit.PutMtlToMtlEditor (MultiMaterial name:"Super Multisub" numsubs:lstMaterials.count mm.materialList:lstMaterials) 1

)I'm sure there's room for improvement, but there's a start...

sunboy69
03-27-2008, 06:49 AM
Yes,dear RustyKnight!! Thank you so much for your great help all the time!
I can read it in a measure,but i could't accomplish the script still.

erilaz
04-08-2008, 04:01 PM
I can read it in a measure,but i could't accomplish the script still.

Please clarify what you mean. What is the script missing that it isn't doing for you?

RustyKnight
04-08-2008, 10:49 PM
I think he means that he doesn't yet know how to write the script himself...

CGTalk Moderation
04-08-2008, 10:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.