Notifications
Clear all

[Closed] Get maps and submaps of a material

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…

15 Replies

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

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.
   )
)

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 "% = %
" 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…

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

Exactly,

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

Oky… newby answer

Oups. Missread.

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

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

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 ?

Page 1 / 2