Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / Getting the name of active texture projection?
  RSS 2.0 ATOM  

Getting the name of active texture projection?
Rate this thread
 
30176
 
Permlink of this thread  
avatar
  • mslaf
  • Posted: 27 March 2009 03:21 AM
  • Total Posts: 71
  • Joined: 10 December 2008 05:47 AM

I added some tools that operate on the UV’s to the Texture Editor’s Tools menu.

The question is: How to access the currently active texture projection: name,index whatever, from the tool that were selected from the menu? Is there a way to extract this information from the current context and if it is, then how to get it?



Replies: 0
avatar

You can get the active texture projection (actually ClusterProperty containing the active texture projection used for displaying in the viewports) using CurrentUV property of Material object.

var oMaterial Selection(0).Material;
var 
oUV oMaterial.CurrentUV;
LogMessage(oMaterial);
LogMessage(oUV);

It seems this will fail when no texture (image) node is connected to the material even if the object does have texture projections. 
I don’t know any other way than using Material object as a start point. There might be more elegant way....



Replies: 0
avatar
  • mslaf
  • Posted: 27 March 2009 04:58 AM

[quote=junki;20793]You can get the active texture projection (actually ClusterProperty containing the active texture projection used for displaying in the viewports) using CurrentUV property of Material object.

var oMaterial Selection(0).Material;
var 
oUV oMaterial.CurrentUV;
LogMessage(oMaterial);
LogMessage(oUV);

It seems this will fail when no texture (image) node is connected to the material even if the object does have texture projections. 
I don’t know any other way than using Material object as a start point. There might be more elegant way....

I’ve been hoping that this information is passed to the menu callback but the currentuv works fine as well. Thank you.



Replies: 0
avatar
  • mslaf
  • Posted: 27 March 2009 05:24 AM

Small correction. It works fine if the current selection reflects objects displayed by the TE. Otherwise as in case we locked the object update in TE and changed the selection, this approach won’t work. The selection is the problem and the method won’t work because we’re never sure, if we have access to correct materials and in results to correct UV’s.

Is there any way to get the collection of objects that is utilized by the property or a window like the TE window? Is this information passed with the current context?

BTW: Is there a way, other than guesting, what attributes have been passed with the context object. Is there something like GetAttributes() method or maybe the list of predefined attribute names I could check?



Replies: 0