Do you basically want a list of all objects that use a certain material / material with a certain texture map (presumably diffuse map, bitmap), but only if that material / map is used more than once in the scene?

j-man

04-21-2008, 02:35 PM

Hi sunboy69!

Are you trying to find duplicated materials? if so, how would you know if it is duplicate? by having the same name? I know you#'re working with multi sub object materials, can you use the clean multi material utility?

There are many difficulties and pitfalls working with muklti materials that can make material scripts quite complex.

Regards,

Josh.

sunboy69

04-21-2008, 02:35 PM

not entirely clear what you're asking for..

Do you basically want a list of all objects that use a certain material / material with a certain texture map (presumably diffuse map, bitmap), but only if that material / map is used more than once in the scene?

Yes you speak right very much! that's the meaning!!
I want to find out the same diffuse,specular and bump map which some objs use it on the different material(multi/sub-obj)
The list contains:
Some different objs(use the same texture)---material(or multi/sub-obj material) on the some objs---repeated diffuse,specular and bump map.Bucause i just use the three type of maps!
Maybe i can use the texture to find out which materials use it,and the texutre is changeless!
When i find out,i can delete other materials,and use the only one on some objs!

sunboy69

04-21-2008, 02:51 PM

Hi sunboy69!

Are you trying to find duplicated materials? if so, how would you know if it is duplicate? by having the same name? I know you#'re working with multi sub object materials, can you use the clean multi material utility?

There are many difficulties and pitfalls working with muklti materials that can make material scripts quite complex.

Regards,

Josh.
ah!!Thanks for your advice j-man.

Snoelk

04-21-2008, 11:21 PM

you could loop to all objects and get there materials or submaterials
if they got submaterials loop throu the submaterials
then you can access each materials maps
<Standard>.diffuseMap TextureMap
<Standard>.specularMap TextureMap
<Standard>.opacityMap TextureMap
<Standard>.bumpMap TextureMap

now you can make an array with the objects and there corresponding texturemaps and compare those

only an idea

Teirz

04-22-2008, 04:08 AM

Am i right to say that this is the procedure that is possible for you to take to solve your problem?

1. Reading all material info that's been used inside the scene
2. Keep a record array of each and every map that's been used in every slot. And recall the function in order to dive into the multilayer submaterial etc.
3. Find out the item with equal or more than 2 counts, meaning they are duplicated.
4. Display them.

Regards,
Sean

sunboy69

04-22-2008, 06:02 AM

Am i right to say that this is the procedure that is possible for you to take to solve your problem?

1. Reading all material info that's been used inside the scene
2. Keep a record array of each and every map that's been used in every slot. And recall the function in order to dive into the multilayer submaterial etc.
3. Find out the item with more than 2 counts, meaning they are duplicated.
4. Display them.

Regards,
Sean

Yes, maybe you're right!

Kenzor

04-22-2008, 09:58 AM

I have a script that recurses through all the materials in the scene. Looking for blend materials

-- Events
on BUTTON_find pressed do (
foundMaps = #()
foundParents = #()
for i in meditMaterials where superClassOf i == Material do gSubMatsMaps i
for i in sceneMaterials where superClassOf i == Material do gSubMatsMaps i
local list = #()
for i in 1 to foundMaps.count where foundParents[i].count > 1 do (
local item = foundMaps[i].name + " : "
for j in foundParents[i] do item = item + j.name + ", "
append list item
)
format "list %\n" list
LISTBOX_found.items = list
)
)

CreateDialog findSharedMaps

sunboy69

04-22-2008, 02:25 PM

I have a script that recurses through all the materials in the scene. Looking for blend materials

Hi Kenzor! I'm very honoured that you help me to find the script,thanks!! but i'm mixed-up:
(1)The script i used in max8,9 is failing, it did't have any reflection.
(2)The script looks like to use for blend materials, can it work accurately on Standard or multi/sub-obj material?
I'm not sure if it worked accurately for you!

sunboy69

04-22-2008, 04:00 PM

Well I have a script that finds shared maps, but if you have several maps pointing to same bitmap texture then it wont detect it, building such detection shouldn't be too hard.

Oh dear Bercon,You're ingenious,the script was useful a certain extent, but there're any issue i'm not understand:
(1)When i run the script,it would delete many texture on objs(contain repeated or not), notice: the maps on my objs were only diffuse map!
(2)There're some repeated materials and textures that did't display in the script list, and it showed incomplete...

I did't know why?I hope you can help me to explain please. ^o^
However i must to thank you "Bercon".
Thanks!!

Bercon

04-22-2008, 06:03 PM

Its the other way around. On the left you have the name of the map. And entries after it are the materials that use that map.

And my script shouldn't do anything to the scene, it just lists the maps that are used in more than one material.

sunboy69

04-23-2008, 03:14 AM

Its the other way around. On the left you have the name of the map. And entries after it are the materials that use that map.

And my script shouldn't do anything to the scene, it just lists the maps that are used in more than one material.

If so ,but in my scene, there weren't some maps named "Map #5","Map#7","Map#10...and so on, i didn't know why?

And is it have an effect on multi/sub-obj ?

Teirz

04-23-2008, 03:32 AM

The Map #1,#2 etc are probably your submaterial's name that you might have miss out to change in your multi/sub material or submaps inside other material type e.g. blend, composite, shellac etc which Bercon has listed inside his script.

Try to use the map navigator to have a quick look on your material tree. From there you can probably spot those map easily.

sunboy69

04-23-2008, 07:47 AM

I'm very pleased that a great many master-hands help me!! Thanks very much```!
But there have a issue:
(1)
http://imgbj.jpg.name/hjytzvhwhhvythhyztswjtswhjjsdhzzwrzjy.jpg
(2)when i run the script ,i didn't know why it would delete any texture on any objs?
(3)Could the script have an effect on multi/sub-obj? if is, there were some multis that did't display in the list!
Can the script be amended, and how to amend?
(4)When i add this before running Rercon's script,the maps were decreasing,is it going to skip displaying some reduplicated materials?
For i = 1 to 24 do meditmaterials[i]=scenematerials[i]

CGTalk Moderation

04-23-2008, 07:47 AM

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.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us