Geuse
03-07-2008, 05:35 PM
Actually, I got it working as I wanted. If you'd be interested here's the code for it so it fires up when selecting an object you've named "ui_openwin". I created a text curve named UI which is parented to my character's "COG_ctrl". It's all placed inside the expression editor in a single code. I'm still new to this as you know so the tabs don't display as they should, I want them to extend to the whole view around them so there ought to be some command I don't know of. Also on the radio buttons I'd like to know if you can customize it, maybe push them together, cause there is no point in having them that much space between. Also how do you set a predefined mark in one of the radio buttons so when starting the script the character's mesh is already hidden.
The buttons are just for placeholders. Will be a picture of the body and the face with the controls marked out so it's easily selected and also some advanced ik fk matching switches etc. Also, I encontered when selecting "ui_openwin" object that the screen flashes for some seconds after a while when continue selecting the object to fire off the command. Not sure how to approach this since it still works, just seems there's something buggy? Yeah, there's a bunch of things concerning the interface code which I don't fully understand how to customize, for instance if you can set the top panel to be one size and not scale out with the view.
Well that's it for now, now I'm gonna get my belly filled up with pizza!
I sincerely appreciate your thought, inputs, comments so keeep 'em coming!
Au revoir!
if (`window -exists CharacterWinAdv`) deleteUI
CharacterWinAdv;
window -t "Character Controls"
CharacterWinAdv;
//This creates a large top panel, and a small bottom panel:
paneLayout -configuration "horizontal2" -paneSize 1 100 20
TopPanels;
setParent TopPanels;
columnLayout;
frameLayout -w 1000 -h 1000 -l "Visibility" -cll true -cl
false -bs "out";
columnLayout;
checkBoxGrp -l "Show Face Rig"
-onCommand "setAttr face_rig_ui.v 1"
-offCommand "setAttr face_rig_ui.v 0";
checkBoxGrp -l "Show Body Rig"
-onCommand "setAttr face_rig_ui.v 1"
-offCommand "setAttr face_rig_ui.v 0";
checkBoxGrp -l "Show Stand-In Geometry"
-onCommand "setAttr stand_in_geometry.v 1"
-offCommand "setAttr stand_in_geometry.v 0";
separator -width 1000 -horizontal 1;
radioButtonGrp -cal 1 left -numberOfRadioButtons 3 -l "Character Visibility"
-labelArray3 "Show" "Template" "Hide"
-on1 {"setAttr skin.v 1; toggle -state off -template rig"}
-on2 {"setAttr skin.v 1; toggle -state on -template rig"}
-on3 {"setAttr skin.v 0; toggle -state off -template rig"}
;
setParent TopPanels;
//create the tabs
scrollLayout;
string $form = `formLayout`;
string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`;
formLayout -edit
-attachForm $tabs "top" 0
-attachForm $tabs "left" 0
-attachForm $tabs "bottom" 0
-attachForm $tabs "right" 0
$form;
//create content of first tab:
string $tabcontent1 = `columnLayout`;
setParent..;
setParent..;
//create content of second tab:
string $tabcontent2 = `columnLayout`;
if (`window -exists CharacterWinAdv`) deleteUI
CharacterWinAdv;
window -t "Character Controls"
CharacterWinAdv;
//This creates a large top panel, and a small bottom panel:
paneLayout -configuration "horizontal2" -paneSize 1 100 20
TopPanels;
setParent TopPanels;
columnLayout;
frameLayout -w 1000 -h 1000 -l "Visibility" -cll true -cl
false -bs "out";
columnLayout;
checkBoxGrp -l "Show Face Rig"
-onCommand "setAttr face_rig_ui.v 1"
-offCommand "setAttr face_rig_ui.v 0";
checkBoxGrp -l "Show Body Rig"
-onCommand "setAttr face_rig_ui.v 1"
-offCommand "setAttr face_rig_ui.v 0";
checkBoxGrp -l "Show Stand-In Geometry"
-onCommand "setAttr stand_in_geometry.v 1"
-offCommand "setAttr stand_in_geometry.v 0";
separator -width 1000 -horizontal 1;
radioButtonGrp -cal 1 left -numberOfRadioButtons 3 -l "Character Visibility"
-labelArray3 "Show" "Template" "Hide"
-on1 {"setAttr skin.v 1; toggle -state off -template rig"}
-on2 {"setAttr skin.v 1; toggle -state on -template rig"}
-on3 {"setAttr skin.v 0; toggle -state off -template rig"}
;
setParent TopPanels;
//create the tabs
scrollLayout;
string $form = `formLayout`;
string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`;
formLayout -edit
-attachForm $tabs "top" 0
-attachForm $tabs "left" 0
-attachForm $tabs "bottom" 0
-attachForm $tabs "right" 0
$form;
//create content of first tab:
string $tabcontent1 = `columnLayout`;
setParent..;
setParent..;
//create content of second tab:
string $tabcontent2 = `columnLayout`;
if (`window -exists CharacterWinAdv`) deleteUI
CharacterWinAdv;
window -t "Character Controls"
CharacterWinAdv;
//This creates a large top panel, and a small bottom panel:
paneLayout -configuration "horizontal2" -paneSize 1 100 20
TopPanels;
setParent TopPanels;
columnLayout;
frameLayout -w 1000 -h 1000 -l "Visibility" -cll true -cl
false -bs "out";
columnLayout;
checkBoxGrp -l "Hide Face Rig"
-onCommand "setAttr face_rig_ui.v 0"
-offCommand "setAttr face_rig_ui.v 1";
checkBoxGrp -l "Hide Body Rig"
-onCommand "setAttr face_rig_ui.v 0"
-offCommand "setAttr face_rig_ui.v 1";
checkBoxGrp -l "Hide Stand-In Geometry"
-onCommand "setAttr stand_in_geometry.v 0"
-offCommand "setAttr stand_in_geometry.v 1";
separator -width 1000 -horizontal 1;
radioButtonGrp -cal 1 left -numberOfRadioButtons 3 -l "Character Visibility"
-labelArray3 "Show" "Template" "Hide"
-on1 {"setAttr skin.v 1; toggle -state off -template rig"}
-on2 {"setAttr skin.v 1; toggle -state on -template rig"}
-on3 {"setAttr skin.v 0; toggle -state off -template rig"}
;
setParent TopPanels;
//create the tabs
scrollLayout;
string $form = `formLayout`;
string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`;
formLayout -edit
-attachForm $tabs "top" 0
-attachForm $tabs "left" 0
-attachForm $tabs "bottom" 0
-attachForm $tabs "right" 0
$form;
//This creates the content of the first tab:
string $child1 = `rowColumnLayout -numberOfColumns 3`;
checkBox -label "Show Skin" -align left
-onCommand
"setAttr alien_cowboy_body.v 1"
-offCommand
"setAttr alien_cowboy_body.v 0"
button; button; button;
setParent..;
//This creates the content of the second tab:
string $child2 = `rowColumnLayout -numberOfColumns 2`;
checkBox -label "Show Face UI" -align left
-onCommand
"setAttr alien_cowboy_facial_ui.v 1"
-offCommand
"setAttr alien_cowboy_facial_ui.v 0"
button; button; button;
setParent..;
//This edits the tabLayout command to label each tab:
tabLayout -edit
-tabLabel $child1 "Body"
-tabLabel $child2 "Face"
$tabs;
//second panel
setParent TopPanels;
window -edit -wh 480 450 -topLeftCorner 200 1200
CharacterWinAdv;
showWindow;
Geuse
03-10-2008, 01:32 PM
I encountered a number of errors when following that guide. Somehow I must be doing something wrong, but I can't see what. I'd be most grateful if someone could take the some of their precious time to have a look at it.
I'll post the mel-code with the gui image and the html-file.
http://img2.putfile.com/thumb/3/6909291819.jpg (http://www.putfile.com/pic/7802931)
global proc RingoGUI ()
{
//loads the GUI
//declare global variables to hold namespace & file location
global string $RingoNameSpace;
global string $RingoGUIlocation;
string $chNode = "Ringo_all_anim"; //unique name of character's "Top Node"
//check for namespace
if (!(`objExists ($RingoNameSpace + $chNode)`))
RingogetNameSpace
//check for file location
if ($RingoGUIlocation == "")
RingoLocateGUI;
else
RingoGUIWin;
}
global proc RingoGUIWin ()
{
//builds the GUI window
global string $RingoGUIlocation;
//delete's the GUI window if it's already open
if (`window -exists "RingoGUI"`)
deleteUI "RingoGUI";
window -t "Ringo GUI" -w 300 -h 400 -rtf 1 "RingoGUI";
columnLayout -w 300
panelLayout -w 300 -h 400;
//width and height should match image
webBrowser -width 300 -height 400 -url ("file://" + $RingoGUIlocation);
setParent..;
setparent..;
showWindow "RingoGUI";
}
global proc RingoLocateGUI ()
{
//promts the user to locate the HTML file
//delete the window if for some crazy reason it exists
if(`window -exists "RingoFindWin"`)
deleteUI "RingoFindWin";
window -w 250 _t "Locate RingoGUI" -rtf 1 "RingoFindWin";
columnLayout -w 250;
//button calls RingoLocateFile and closes the window
button -w 250 -t "Locate RingoGUI.html"
-c "RingoLocateFile; deleteUI \"RingoFindWin\";";
setParent..;
showWindow "RingoFindWin";
}
global proc RingoLocateFile ()
{
//loads HTML file location into global variable
global string $RingoGUIlocation;
$RingoGUIlocation = `fileDialog -dm "RingoGUI.html"`;
RingoGUIWin;
}
global proc RingoGetNameSpace()
{
//finds character namespace (if present) and loads into global variavble
global string $RingoNameSpace;
string $chNode = "Ringo_all_anim"; //The unique name of the character's "top node"
string $ns;
string $lsBuffer[];
string $tokBuffer[];
if (`objExists $chNode`) //sets namespace as blank if nonamespace is present
{
$ns = "";
}
else //searches through every transform node 'til it finds the "top node"
{
$lsBuffer = `lsType "transform"`;
for ($i=0; $i<(size($lsBuffer)); $i++)
{
tokensize $lsBuffer[$i] ":" $tokBuffer;
for ($j=1; $j<(size($tokBuffer)); $j++=)
{
if ($tokBuffer [$j] == $chNode)
{
$ns = ($tokBuffer[0] + ":");
}
}
}
}
$RingoNameSpace = $ns;
}
global proc RingoSelect (string $control, int $tool)
{
//selects desired control and sets proper tool
global string $RingoNameSpace;
string $ns = $RingoNameSpace;
string $ctxMove = `manipMoveContext`;
string $ctxRot = `manipRotateContext`;
if (!(objExists ($ns + "Ringo_all_anim")`)) RingoGetNameSpace;
select -r ($ns + $control);
if ($tool == 1) setToolTO $ctxRot;
else if ($tool == 2) setToolTo $ctxMove;
}
<html>
<head>
<title>Ringo GUI
</head>
<div id="Layer1" style="position:absolute; width:300px; height:400px; z-index:1; top:0px; left:0px " >
<img src="Ringo_GUI_img.jpg" width="300" height="400" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="poly" coords="150,27,129,33,116,51,110,79,113,106,125,128,150,140,173,128,186,105,189,81,185,54,170,33" href="mel://Alien_Cowboy_Select("head_ctrl",1);">
<area shape="circle" coords="100,142,14" href="mel://RingoSelect(%22R_upper_shoulder_ctrl%22,1);">
<area shape="circle" coords="200,143,14" href="mel://RingoSelect(%22L_upper_shoulder_ctrl%22,1);">
<area shape="circle" coords="98,201,13" href="mel://RingoSelect(%22R_lower_shoulder_ctrl%22,1);">
<area shape="circle" coords="203,200,13" href="mel://RingoSelect(%22L_lower_shoulder_ctrl%22,1);">
<area shape="rect" coords="157,372,202,399" href="mel://RingoSelect(%22R_foot_IK_ctrl%22,1);">
<area shape="rect" coords="98,372,143,399" href="mel://RingoSelect(%22R_foot_IK_ctrl%22,1);">
<area shape="rect" coords="109,177,189,195" href="mel://RingoSelect(%22spine2_FK_ctrl%22,1);">
<area shape="rect" coords="109,203,189,224" href="mel://RingoSelect(%22spine1_FK_ctrl%22,1);">
<area shape="rect" coords="83,261,214,279" href="mel://RingoSelect(%22cog_ctrl%22,1);">
<area shape="rect" coords="99,235,197,260" href="mel://RingoSelect(%22hips_ctrl%22,1);">
<area shape="rect" coords="30,223,54,247" href="mel://RingoSelect(%22R_upper_arm_IK_ctrl%22,1);">
<area shape="rect" coords="247,223,270,246" href="mel://RingoSelect(%22L_upper_arm_IK_ctrl%22,1);">
<area shape="rect" coords="55,258,78,281" href="mel://RingoSelect(%22R_lower_arm_IK_ctrl%22,1);">
<area shape="rect" coords="222,258,244,280" href="mel://RingoSelect(%22L_lower_arm_IK_ctrl%22,1);">
<area shape="rect" coords="114,148,181,174" href="mel://RingoSelect(%22spine_offset_ctrl%22,1);">
<area shape="rect" coords="134,320,166,370" href="mel://RingoSelect(%22Alien_Cowboy_master_ctrl%22,1);">
<area shape="rect" coords="36,177,56,197" href="mel://RingoSelect(%22R_upper_arm_pole_vector_ctrl%22,1);">
<area shape="rect" coords="244,178,263,197" href="mel://RingoSelect(%22L_upper_arm_pole_vector_ctrl%22,1);">
<area shape="rect" coords="58,212,77,231" href="mel://RingoSelect(%22R_upper_arm_pole_vector_ctrl%22,1);" />
<area shape="rect" coords="222,212,242,232" href="mel://RingoSelect(%22R_upper_arm_pole_vector_ctrl%22,1);" />
<area shape="circle" coords="69,193,12" href="#" />
<area shape="circle" coords="24,257,12" href="#" />
<area shape="circle" coords="80,240,12" href="#" />
<area shape="circle" coords="60,295,12" href="#" />
<area shape="circle" coords="231,194,12" href="#" />
<area shape="circle" coords="275,257,11" href="#" />
<area shape="circle" coords="220,240,12" href="#" />
<area shape="circle" coords="240,296,12" href="#" />
<area shape="circle" coords="119,291,12" href="#" />
<area shape="circle" coords="119,324,12" href="#" />
<area shape="circle" coords="119,362,12" href="#" />
<area shape="circle" coords="181,291,12" href="#" />
<area shape="circle" coords="181,324,13" href="#" />
<area shape="circle" coords="181,361,12" href="#" />
<area shape="rect" coords="6,66,40,100" href="#" />
<area shape="rect" coords="46,66,80,100" href="#" />
<area shape="rect" coords="219,65,253,100" href="#" />
<area shape="rect" coords="260,66,294,100" href="#" />
<area shape="rect" coords="6,127,40,161" href="#" />
<area shape="rect" coords="46,127,80,161" href="#" />
<area shape="rect" coords="219,127,253,161" href="#" />
<area shape="rect" coords="260,127,293,161" href="#" />
<area shape="rect" coords="6,362,41,396" href="#" />
<area shape="rect" coords="46,362,80,396" href="#" />
<area shape="rect" coords="219,362,253,396" href="#" />
<area shape="rect" coords="260,362,294,396" href="#" />
</map>
</div>
</body>
</html>
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.