PDA

View Full Version : Get maps and submaps of a material


Posativ
02-04-2008, 07:49 PM
Hi,

I need to find out how can I print all maps and submaps included of a material (mr Arch & Design).

I found out how can I get a map from a e.g. color map slot. But if there is a submap connected, then it will be not listed...

Tesctassa
02-04-2008, 08:01 PM
If by submaps you mean submaterials then try:
for i = 1 to myMaterial.getNumSubMtls() do
(
mySubMat = getSubMtl myMaterial i
--get maps of the subMaterial here and print them
)


Hope it helped :)


Regards,
Adriano

U.S.S. Speed
02-04-2008, 08:11 PM
MultiMaterial is only an array of other material.

You can access it like any array.
.count for the number of submaterial.
[x] for the specific material.

so :

if ((classof MyMat) == MultiMaterial)
then
(
for x in MyMat do
(
Whatever you want to do with it.
)
)

Posativ
02-04-2008, 08:43 PM
Hi U.S.S. Speed,

to get the submaterials of a Sub/Multi Mat is simpel.
But I need the maps of a material, for example MyObject.Material.color_map.... and all submaps in this slot.

The strange thing is, that with my current way to copy all material settings with an array copys the submaps, too. But in the array they are not listed....

My Test Script (Create a Copy from MeditMaterials[1] to [2]:
(

a = MeditMaterials[activeMeditSlot]
MyArray = getPropNames a --Property Array

Sphere name:"MyTestDummy"
$MyTestDummy.material = Arch___Design__mi name:"MyMiaTestMaterial"

for i in MyArray do
(
setproperty $MyTestDummy.material i (getProperty a i)
--format "% = %\n" i (getProperty a i)
)

meditMaterials[2] = $MyTestDummy.material
MatEditor.Close()
MatEditor.Open()
delete $MyTestDummy

)

But when you print the Array you will not find any submap...

PiXeL_MoNKeY
02-04-2008, 08:44 PM
On top of that you are going to have to create a way to handle nested submap/mat situations. What was posted will only grab the maps inside the searched map/mat, if that map/mat has a submapmat they will not be searched.

-Eric

Posativ
02-04-2008, 09:11 PM
What was posted will only grab the maps inside the searched map/mat, if that map/mat has a submapmat they will not be searched.


Exactly,

@ U.S.S. Speed and Tesctassa, I mean maps. Not materials ;-)

Tesctassa
02-04-2008, 09:19 PM
Exactly,

@ U.S.S. Speed and Tesctassa, I mean maps. Not materials ;-)

Oky... newby answer :P

U.S.S. Speed
02-05-2008, 12:52 AM
Oups. Missread.

By maps, you means the class of them? Not maps as bitmap?

Gravey
02-05-2008, 11:39 AM
tried and tested on an Arch & Design material with maps and submaps:
fn printSubMaps mat =
(
subMaps = #(mat) --
for s in subMaps do -- add all the maps that are not undefined to the subMaps array. This will work recursively
join subMaps ( for i = 1 to (getNumSubTexmaps s) where (theMap = getSubTexmap s i) != undefined collect theMap )
deleteItem subMaps 1 -- remove the material from the list since its not a map
print submaps
) This should do what you want. Let me know if there's any troubles

Posativ
02-05-2008, 04:13 PM
Hi Gravey,

your Script works very nice.
But for me it's quite useless because the Script don't write down where are these submaps connected.
E.g. a mix-map can contain about 3 submaps and which of Map #1:Noise - #5:Dent or #:Checker is in which slot?

It would be great if you can post a script which print out something like this:

MeditMaterials[activeMeditSlot].diff_color_map = map #1:Noise
(and it's first submap e.g.) ......diff_color_map.map1 = map #1:Dent

Do you have a solution for it :) ?

Gravey
02-06-2008, 12:32 PM
I've had a look at it again based on what you've asked and I can't seem to get my head around it. It's much more complicated to print out in the form you asked. Perhaps if you share your aim and purpose for this function, I (or someone) might be able to suggest an alternative.

Posativ
02-06-2008, 03:58 PM
I want find out all mr Arch & Design settings included maps and their submaps.
My only problem is that I can't find out how to get these submaps in a logical order.
With your code I get a list of all connected maps in the material, but I don't know, which one match to which slot or map.

My posted form was an example. The main thing is, that MaxScript can give out the submaps (ideally) with the settings from this submap and so on.

Gravey
02-06-2008, 08:59 PM
what will you do with this information once you have it? If you are trying to rebuild the material from scratch, I'd suggest looking at the export_material_tree function in bobo's bff script. Or is it something else?

Posativ
02-06-2008, 09:17 PM
I'll take a look to Bobos BFF, thanks for the hint.

I need it for a mr material database with max, maya and maybe xsi users. I have to read out all material informations and save it to a file and a Maya Script can read it out and so you can use in 3ds max created materials (mia materials) in Maya.

drdubosc
02-06-2008, 10:10 PM
I'll take a look to Bobos BFF, thanks for the hint. I need it for a mr material database with max, maya and maybe xsi users. I have to read out all material informations and save it to a file and a Maya Script can read it out and so you can use in 3ds max created materials (mia materials) in Maya.


Would one approach be to render to a .mi file and parse that? I don't know how you could force all the scene materials into it, including the hidden objects ....

Posativ
02-07-2008, 07:02 PM
Would one approach be to render to a .mi file and parse that? I don't know how you could force all the scene materials into it, including the hidden objects ....

I have no clue with mi-files.
I hope, I'll find a MaxScript solution...

CGTalk Moderation
02-07-2008, 07:02 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.