|
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?
|
|
|
|
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....
|
|
|
|
[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.
|
|
|
|
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?
|
|
|