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 , but I need to get selected materials from the material manager itself exclusively..
Thanks for your time..
Matarial Manager
-
- Posts: 94
- Joined: 09 Jun 2009, 23:47
Re: Matarial Manager
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)
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);
-
- Posts: 94
- Joined: 09 Jun 2009, 23:47
Re: Matarial Manager
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.
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.
Who is online
Users browsing this forum: No registered users and 34 guests