Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

From a selected material is possible to know each slot type?

From a selected material is possible to know each slot type?

alexandre_bisewski
Enthusiast Enthusiast
995 Views
11 Replies
Message 1 of 12

From a selected material is possible to know each slot type?

alexandre_bisewski
Enthusiast
Enthusiast

Hello!

 

Using the ShowProperties in a vray material I can get values like this:  ".texmap_diffuse (Diffuse_map) : texturemap"

 

I am using this function to get all TextMap in a Material selected: getNumSubTexmaps. In vray for example I have 31 slots...

 

With this function (getSubTexmapSlotName _matsel 1) I get the value like: "Diffuse"

 

But I need to get the type of this slot like "texturemap" that I can get in with ShowProperties. 

 

This value is a ClassOf I guess but I dont know how to get it. 

 

Probably I need to get a material > do a loop in all slots and test if is a texturemap.

 

It is possible? Thank you!

0 Likes
Accepted solutions (1)
996 Views
11 Replies
Replies (11)
Message 2 of 12

denisT.MaxDoctor
Advisor
Advisor

There are different ways to do what you need to do, but the most convenient is to call instances of the texturemap class of the specified target material:

tvps = getclassinstances bitmaptexture target:meditmaterials[1] astrackviewpick:on

see the Help for details

0 Likes
Message 3 of 12

alexandre_bisewski
Enthusiast
Enthusiast

Hi Mr Denis...

 

Thank you for your attention. 

 

I tried this function many times but I can get result using it.

tvps = getclassinstances bitmaptexture target:_matsel astrackviewpick:on
		print tvps.count

Always the result is zero. 

 

I got the _matsel using this:

((sme.getview 1).GetSelectedNodes())[1].reference

 

Is strange because I can get results using getNumSubTexmaps or getSubTexmapSlotName with the same _matsel...

 

Thank you

0 Likes
Message 4 of 12

denisT.MaxDoctor
Advisor
Advisor

I only showed an example... In your case you may have a different class of texture maps. What class of texture maps do you use in VRay materials?

 

0 Likes
Message 5 of 12

alexandre_bisewski
Enthusiast
Enthusiast

I just created a vray material direct in Slate Material.  

 

When I try to get more info I have it:

 

--classof _matsel= "VRayMtl"
--superclassof _matsel = "material"

--(getPropNames _matsel)[i] = "#texmap_diffuse"

 

 

0 Likes
Message 6 of 12

denisT.MaxDoctor
Advisor
Advisor

What do you want to get?
all possible slots where a texture map can be used?

0 Likes
Message 7 of 12

denisT.MaxDoctor
Advisor
Advisor

@alexandre_bisewski wrote:

I just created a vray material direct in Slate Material.  

 

When I try to get more info I have it:

 

--classof _matsel= "VRayMtl"


not everyone, like you, has VRay..... I don't, for example. 

0 Likes
Message 8 of 12

alexandre_bisewski
Enthusiast
Enthusiast

Yes Denis, exactly. 

 

And now using (getSubTexmapSlotName _matsel i) I can do it, easy...

 

But I need to get also the map name like _matsel.texmap_diffuse...

 

But to get this info I need to use this function:(getPropNames _matsel)[i] but here is the problem. This "i" index is different from the getSubTexmapSlotName.

 

In the getPropNames I need to pass over all slots, including that slots that arent texture maps. So for example in Diffuse texture map using getSubTexmapSlotName the "i" is like 1 but to get the same slot using getPropNames the "i" is like 150...

 

So here is so crazy and that is why I need to get the texturemap value. So I can get over all slots and filter based on the class

 

 

0 Likes
Message 9 of 12

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

I believe I understand the essence of your problem. It seems that you would like to obtain a property name that corresponds to the texture slot name, possibly for the purpose of accessing or modifying that property.

 

However, in the general case, it does not work that way. The name of a property is a virtual concept, determined by the developer's choice. Developers decide how to label each property and what name it responds to. To provide clarity, developers typically provide a list when asked about the available properties (showProperties).

 

In any case, it is more appropriate to utilize the setSubTexmap and getSubTexmap methods by passing the desired index, rather than assigning values directly to properties based on their names.

Message 10 of 12

alexandre_bisewski
Enthusiast
Enthusiast

Man, you are really good...Unbelievable. That is the exactly what I want.

But I get your point and I will think in my objective little more. 

 

I have some doubt about getsubtextmap baucause only return different from unfinined in the slot that I have a bitmap map attached. If this function at least give us all the texturemaps slot in the material will be nice...

0 Likes
Message 11 of 12

denisT.MaxDoctor
Advisor
Advisor

@alexandre_bisewski wrote:

I have some doubt about getsubtextmap baucause only return different from unfinined in the slot that I have a bitmap map attached. If this function at least give us all the texturemaps slot in the material will be nice...


The type of a texture slot is unambiguously defined as TextureMap. However, there are multiple TextureMap classes available, and the specific class assigned to a slot can only be determined once that slot has been assigned.

Once a slot is assigned, it becomes an object entity known as SubAnim. At that point, we can identify the type (subclass of TextureMap) associated with this entity.

0 Likes
Message 12 of 12

denisT.MaxDoctor
Advisor
Advisor

The texturemap slot is akin to a watch pocket in a vest - it has a specific purpose: accommodating a watch or nothing at all. While the limitations of a pocket are dictated by etiquette and common sense, the restrictions of a texturemap slot are defined by the data type itself. It's all about adhering to the definition. 😉

0 Likes