View Full Version : UV Planar placement/orientation by selecting a face ?
11-07-2005, 10:18 AM
I search an UV tool mel , that can be used simply and fast.
for exemple.. I want to Select many face.. and select the last face qho define the orientation of the Uv planar tool to create fast lightmap UV for a bunch of buildings.
As I want:
Select an object ( building polymesh )
Go to Face selection
Select multiple face
select the last face ( who will define the orientation of the planar UV tool )
launch the script.
wait and dada !!! it's done..
I want to define the Width and Height of the UV planar tool and that it works for the Second UVSet.
11-07-2005, 01:09 PM
I've find a beginning of solution trues this Mel Script created by Dru Abrams from http://www.persistentvisions.com/ (http://www.persistentvisions.com/) :
Maybe I need to add that line in the script:
global proc spFaceCam_Work_Proc()
if (`objExists faceCam`)
string $current=`ls -sl`;
string $object=`ls -hl`;
pointConstraint $cluster $locator;
string $camConstraint=`pointConstraint $locator $camera`;
parent $camera $locator;
select -add $locator;
normalConstraint -aimVector 0 0 1 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;
setAttr ($camera+".tz") 5;
parent -w $camera;
rename $camera faceCam;
//floatSliderGrp -e -v 5 spFaceCam_zoomSlider;
//connectControl spFaceCam_zoomSlider ("faceCam.translateZ");
hilite -r $object;
lookThroughModelPanel faceCam (`getPanel -wf`);
global proc spFaceCam_drawUIcontrols()
frameLayout -l "spFaceCam" -cll 1 -cl 0 spFaceCam_frameLayout;
button -l "make cam!" -c ("spFaceCam_Work_Proc()") spFaceCamButton;
// floatSliderGrp -f 1 -l "camZoom" -cat 1 "right" 0 -cw3 50 35 80 -adj 3 spFaceCam_zoomSlider;
-af spFaceCamButton "right" 0
-af spFaceCamButton "left" 0
// -af spFaceCam_zoomSlider "right" 0
// -af spFaceCam_zoomSlider "left" 0
// -af spFaceCam_zoomSlider "bottom" 0
global proc spFaceCam()
if (`window -ex spFaceCam`)
deleteUI -wnd spFaceCam;
tabLayout -e -tl spFaceCam_frameLayout "spFaceCam" spFaceCamTab;
Should I have to add this line:
setAttr "faceCamShape.orthographic" 1;
setAttr "faceCamShape.orthographicWidth" 50;
11-07-2005, 01:33 PM
as I use this script.. I think about that I need to specify the Y position of the UV planar projection to O by this command:
-projectionCenterY (-pcy) 0
And With that Script.. composed a new script who can position a camera on a selection of face, and aplly an UV Poly Planarby camera projection but with altitude define at 0.
So I define that mel script line:
polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -kir -md c -pcy 0
//but The Projection Center still doesn't want to be modify. So I have to return that line to modify it again to O in Y axe. and modify the Width and Height to 100 for UV unwrap convenience.
setAttr "polyPlanarProj10.projectionHeight" 100;
setAttr "polyPlanarProj10.projectionWidth" 100;
setAttr "polyPlanarProj10.projectionCenterY" 0;
11-07-2005, 02:10 PM
should I have to do that ?
polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -kir -md c
string $UVHeight= `projectionHeight`;
string $UVWidth= `projectionWidth`;
string $AltitudeY= `projectionCenterY`;
//setAttr "polyPlanarProj10.projectionHeight" 100;
$UVHeight = 100;
//setAttr "polyPlanarProj10.projectionWidth" 100;
$UVWidth = 100;
//setAttr "polyPlanarProj10.projectionCenterY" 0;
$AltitudeY = 100;
Please Help I'm a Newbie.. in mel scripting !
11-08-2005, 07:10 AM
Nobody can help me on that problem... I want to byPass the manual change of the width, heigth , and Projectioncenter Y, by using a script... Please Help, that repetitive process so I will lost to many hours.. or maybe 1 day !
11-08-2005, 09:31 AM
ah yes, i wrote that first script (spFaceCam) a few years ago (it's just hosted on dru's site). i shudder to remember my coding from then :eek:
the help for polyProjection will tell you that using mapDirection will override your placement flags. so if you want to set the placement again, you'll need to store the projection node in a variable (here the help is actually wrong - you can store the projectionNode in a string variable).
float $value = 100;
string $proj = `polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -kir -md c`;
setAttr ($proj+".projectionCenter") $value $value $value;
in this case, the command (polyProjection) returns a string array (string). We just need the first index of this array (string).
11-10-2005, 09:07 AM
can you explain a little bit more... I want to see the organization of the script with spDaceCamera, with polyprojection tweak !
11-11-2005, 10:45 AM
the problem is that the "ls" command will return the selection in alphabetical order, so it will be hard to define the last select face without clearly naming it..in an Ui for exemple, it could be possible.
I'll have a look sometime, but i'm very busy at the moment
11-11-2005, 10:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.