// ckUVCopy.mel
// Copyright © 2001 Secret Level Inc.
// Author: Chris Kniffen (kniffen@secretlevel.com)
// Created on: November 4, 2001
// 
// Performs the copy/paste UV command on all faces 
// in the objects. Objects must have exact facet indices
// for this script to work.
//
// Destructions:
// Select the object with the modified UV's first, then
// shift-select the original object, and run the script.
//
//
global proc ckUVCopy()
{
  string $selObjs[]=`ls -sl`;
  if (`size($selObjs)` != 2)
  {
    error "Must ONLY have 2 objects selected.\n";
  }
  else
  {
    int $modObjFacets[]=`polyEvaluate -f $selObjs[0]`;
    int $origObjFacets[]=`polyEvaluate -f $selObjs[1]`;
    if ($modObjFacets[0] != $origObjFacets[0])
    {
	error "Selected objects topologies do not match.\n";
    }
    else
    {
	waitCursor -state on;
	for ($i=0; $i<($modObjFacets[0]+1); $i++)
	    {
		polyClipboard -copy -uv ($selObjs[0] + ".f[" + $i + "]");
		polyClipboard -paste -uv ($selObjs[1] + ".f[" + $i + "]");
	    }
	waitCursor -state off;
	print "UV Copy Finished.\n";
    }
  }
}