Matarial Manager

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 11:23

Matarial Manager

Post by islasyr » 29 Sep 2009, 13:31

Hi..

How can I get a material that is selected in Material Manager..?

It's so useful to apply some commands on seleced materials inside the Material Manager..

It's obvious that material manager selection is indepent.. *-:)
So what is the way to read selection from it??

I know I can use Explorer to select what I need :D , but I need to get selected materials from the material manager itself exclusively.. B-)

Thanks for your time.. :)

fabricio.chamon
Posts: 94
Joined: 09 Jun 2009, 23:47

Re: Matarial Manager

Post by fabricio.chamon » 30 Nov 2009, 04:39

Hi,

I had a similar problem some time ago, but with ice tree.
What you have to do is search for the Material Manager View inside the ViewCollection, then try to read its attributes. Here's the code I wrote to retrieve the selected ice node in the icetree, maybe you'll have to do something similar:

(javascript)

Code: Select all

var desktop = Application.Desktop;
var views = desktop.ActiveLayout.Views;
try{ 
	var icetree = views("ICE Tree"); 
	selectedNodeFullname = icetree.getattributevalue("selection");
}catch(e){
	var viewManager = views("vm");
	var currentViewPort = viewManager.getAttributeValue("layout");
	selectedNodeFullname = viewManager.views(2).getattributevalue("selection")
}
logmessage(selectedNodeFullname);

fabricio.chamon
Posts: 94
Joined: 09 Jun 2009, 23:47

Re: Matarial Manager

Post by fabricio.chamon » 30 Nov 2009, 04:44

forgot to say that the try/catch section of the above code checks if the floating ice tree window is opened. If not, the user may have changed any viewport display to Ice Tree, in this case you'll have to do some search inside the viewmanager (which holds the 4 default viewports).

also, the number 2 in the "viewManager.views(2).getattributevalue("selection")", means it will search in the viewport C. In my case this worked, but you'll have to check if this is the right viewport the user changed.

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests