Notifications
Clear all

[Closed] Store information in a Material ?

Hi I’m going to store a simple True/false variable in a material.

It is important that it can do it FAST! Cause its going to be on a lot of materials.

What is the best way to do it?

I could store it in the material Filename… and use a Findstring, but thats slow (of what i know).

Should i use Custom Attributes or ? …something that works with instance’d materials.

5 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

I would suggest looking into using AppData (see MAXScript Reference for details).
AddData can attach any amount of string-based data to any object incl. scene nodes, modifiers, materials, maps, controllers etc. Just convert your boolean value to string and store at a user-defined integer address in your material. It is fast, it is stored with the .MAX scene automatically, will survive merging etc.

Fantastic !! Thanks alot

But that info will be just for the respective scene, right? If you merge that material in a different scene will come in without the appdata. Which way would it be best to do it so it’s stored in a material?

What I have in mind is to have a script apply a material from a library but for each material to apply mapping with the right size, apply a vray displacement if the material is grass for example etc. Any ideas?

Thanks!

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

If the material is assigned to an object and you merge the object, the appData will be there in the material. If you simply store the material to a library, the AppData will NOT be stored.

That’s wat I was thinking too. Any way you can store all that info in a material by itself?