Determine if an Object has UV Coordinates
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Determine if an Object has UV Coordinates
Anyone know how to do this?
-
Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 22:38
- Location: St. Thomas, Ontario
Re: Determine if an Object has UV Coordinates
Not in front of Softimage to confirm but check if their is a cluster with uvspace.
Texture UVs are stored in a cluster property of type 'sample'.
i.e. select the object, filter for cluster of type "sample"
then filter the sample result for type "uvspace". If none exist then you have no uvspace on the object.
Thread that talk about this subject in particular:
https://groups.google.com/forum/?fromgr ... ts2yCWRPYJ
http://xsisupport.com/2012/06/04/
Texture UVs are stored in a cluster property of type 'sample'.
i.e. select the object, filter for cluster of type "sample"
then filter the sample result for type "uvspace". If none exist then you have no uvspace on the object.
Thread that talk about this subject in particular:
https://groups.google.com/forum/?fromgr ... ts2yCWRPYJ
http://xsisupport.com/2012/06/04/
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
-
TwinSnakes007
- Posts: 316
- Joined: 06 Jun 2011, 14:00
Re: Determine if an Object has UV Coordinates
Thanks Daniel, I'll take a look at those.
Would filtering to see if there is a TextureProjection on the Object be enough? Because, all I want to know is if it exists or not because I need to set a flag in the header for my exporter.
I'm accessing the UV data itself thru Primitive.Geometry.Triangles.UVArray.
Thanks.
Would filtering to see if there is a TextureProjection on the Object be enough? Because, all I want to know is if it exists or not because I need to set a flag in the header for my exporter.
I'm accessing the UV data itself thru Primitive.Geometry.Triangles.UVArray.
Thanks.
-
Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 22:38
- Location: St. Thomas, Ontario
Re: Determine if an Object has UV Coordinates
If the texture projection is assigned to the entire object, then the object become the cluster and it should work.
If the texture projection is assigned to a cluster within the object and you sample some triangle outside the cluster you may miss the texture projection. In order to avoid this scenario, you will have to sample all the object's triangles which could be slow on large meshes.
It all depend on the intent of your script. It may work for your situation.
Maybe someone has a better suggestion.
If the texture projection is assigned to a cluster within the object and you sample some triangle outside the cluster you may miss the texture projection. In order to avoid this scenario, you will have to sample all the object's triangles which could be slow on large meshes.
It all depend on the intent of your script. It may work for your situation.
Maybe someone has a better suggestion.
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
-
myara
- Posts: 406
- Joined: 28 Sep 2011, 08:33
Re: Determine if an Object has UV Coordinates
I'm late but if you just want to know if the object has a T.Projection, just filter the sample clusters because TProjs are always there, but since sample cluster are not only for TProjs, you'll need to loop through them and filter the uvspace property.
Code: Select all
var obj = selection(0);
var cls = obj.ActivePrimitive.Geometry.Clusters.Filter("sample");
for ( var i=0; i < cls.count; i++ ) {
if (cls(i).properties.Filter("uvspace").count !=0) {
logmessage ("Texture Projection found : " + cls(i))
break;
}
}M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)