  | | | UV copy and cluster indecies mismatch with samples | UV copy and cluster indecies mismatch with samples 2004-03-11 - By Graham D Clark
Back I have two meshes with same position of mesh components but different poly order, different point order, and different sample orders, and I need to copy UV maps from one to the other.
So far I have a script that matches all polys, then points, and samples. (Various versions with slow loops and sorting array by postion in global space etc. all same result) Then I want to set the sample UV positions of ObjA to ObjB but I am not understanding access to the cluster indecies.
The clusters and arrays are set up like in the docs:
aUVWA = clusterAprop.elements.array aClusterIndicesA = clusterAprop.owners(0).elements.array
And then I run some loops to compare polys postions and samples and according to my tests it is working ocrrectly up to this point, the corresponding/nearest sample from object A is found on ObjectB.
But once I have the list of samples and corresponding samples on other object I am having trouble understanding how to set the UVS postions of object A to the other object B
I get all the the samples of object A as nsampleA and their corresponding/nearest sampel in object B as nsampleB
The following does not work:
aUVWA(0,aClusterIndicesA(clusterAprop.owners(0).FindIndex(nSampleA.index ))) = aUVWB(0,aClusterIndicesB(clusterBprop.owners(0).FindIndex(nSampleB.index )))
aUVWA(1,aClusterIndicesA(clusterAprop.owners(0).FindIndex(nSampleA.index ))) = aUVWB(1,aClusterIndicesB(clusterBprop.owners(0).FindIndex(nSampleB.index )))
The script does work on two meshes both created in XSI with one of the objects rotated so that the next polys line up, but the script will not work transfering UVs from the disordered meshes from max and wherever else they have been getting reordered in the pipeline.
PS the UV copy script on XSI net doesn't work for us either, but almost, not that many stray UVs.
Thank you for any advise, Graham -- ---- ---- ---- ---- ---- -- http://www.grahamdclark.com
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4630.0"> <TITLE>[script] UV copy and cluster indecies mismatch with samples</TITLE> </HEAD> <BODY> <!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I have two meshes with same position of mesh components but different poly order, different point order, and different sample orders, and I need to copy UV maps from one to the other.</FONT>< /P>
<P><FONT SIZE=2 FACE="Arial">So far I have a script that matches all polys, then points, and samples. (Various versions with slow loops and sorting array by postion in global space etc. all same result) </FONT></P>
<P><FONT SIZE=2 FACE="Arial">Then I want to set the sample UV positions of ObjA to ObjB but I am not understanding access to the cluster indecies.</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">The clusters and arrays are set up like in the docs:</FONT> </P>
<P><FONT SIZE=2 FACE="courier">aUVWA = clusterAprop.elements.array</FONT>
<BR><FONT SIZE=2 FACE="courier">aClusterIndicesA = clusterAprop.owners(0) .elements.array</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">And then I run some loops to compare polys postions and samples and according to my tests it is working ocrrectly up to this point, the corresponding/nearest sample from object A is found on ObjectB. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">But once I have the list of samples and corresponding samples on other object I am having trouble understanding how to set the UVS postions of object A to the other object B </FONT></P>
<P><FONT SIZE=2 FACE="Arial">I get all the the samples of object A as nsampleA and their corresponding/nearest sampel in object B as nsampleB</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">The following does not work:</FONT> </P>
<P><FONT SIZE=2 FACE="courier">aUVWA(0,aClusterIndicesA(clusterAprop.owners(0) .FindIndex(nSampleA.index))) = aUVWB(0,aClusterIndicesB(clusterBprop.owners(0) .FindIndex(nSampleB.index)))</FONT></P>
<P><FONT SIZE=2 FACE="courier">aUVWA(1,aClusterIndicesA(clusterAprop.owners(0) .FindIndex(nSampleA.index))) = aUVWB(1,aClusterIndicesB(clusterBprop.owners(0) .FindIndex(nSampleB.index))) </FONT></P>
<P><FONT SIZE=2 FACE="Arial">The script does work on two meshes both created in XSI with one of the objects rotated so that the next polys line up, but the script will not work transfering UVs from the disordered meshes from max and wherever else they have been getting reordered in the pipeline.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">PS the UV copy script on XSI net doesn't work for us either, but almost, not that many stray UVs.</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">Thank you for any advise, Graham</FONT>
<BR><FONT SIZE=2 FACE="courier"></FONT> <FONT FACE="Times New Roman">-- -- -- ---- ---- ---- ---- --</FONT>
<BR><A HREF="http://www.grahamdclark.com"><U><FONT COLOR="#0000FF" FACE="Times New Roman">http://www.grahamdclark.com</FONT></U></A> </P> <BR>
</BODY> </HTML>
|
|
 |