Camaron47
02-17-2010, 04:23 PM
I'm trying to build a very simple pose manager, so you can basically select the objects, set/name the pose, and it'll store the information in a text scroll list. I was able to store the actual attribute values in an array, but I can't wrap my mind around how to store those values into a name the user specifies. I've tried looking at the code for other pose managers and they're simply too long and confusing. Preferably there would also be an option to only pose what's selected within the channel box, including extra attributes other than translate, rotate, and scale. Here is what I have so far:
if (`window -exists poseWindow`)
deleteUI poseWindow;
window -title "Pose Manager" poseWindow;
formLayout poseForm;
textScrollList -h 200 -ams 1 poseList;
textScrollList -h 200 -ams 1 attrList;
button -label "Add Pose" -c addPose addBtn;
formLayout -edit
-af poseList left 5
-af poseList top 5
-ac attrList left 5 poseList
-af attrList top 5
-ap poseList right 0 33
-ap attrList right 0 66
-ac addBtn left 5 attrList
-aoc addBtn top 0 poseList
-af addBtn right 5
poseForm;
showWindow poseWindow;
global proc addPose()
{
textScrollList -e -ra -sc "appendAttr()" poseList;
textScrollList -e -ra attrList;
string $selection[] = `ls -sl`;
for ($objs in $selection)
{
textScrollList -edit
-append $objs
poseList;
}
}
global proc appendAttr()
{
textScrollList -e -ra attrList;
string $selection[] = `ls -sl`;
for ($objs in $selection)
{
float $getX = `getAttr ($objs + ".translateX")`;
textScrollList -edit
-append ("translate X = " + $getX)
attrList;
}
}
What I want it to do and what it's doing are two different things atm. What I want it to do is add a specified pose to the poseList, then based on the attributes stored in that pose, add them to the attrList. Currently it's adding the attributes to the attrList no matter what. That's the part I can't seem to wrap my mind around: how to add only the attributes of the selected pose in the poseList. The other thing is I need to figure out how to store the poses so it appends the attributes to the list regardless of what is selected.
So once again, the user creates a pose, names the pose, the pose is stored in the poseList while the attributes of that specific pose are stored in the attrList.
Hope it makes sense, and I look forward to any help. :)
if (`window -exists poseWindow`)
deleteUI poseWindow;
window -title "Pose Manager" poseWindow;
formLayout poseForm;
textScrollList -h 200 -ams 1 poseList;
textScrollList -h 200 -ams 1 attrList;
button -label "Add Pose" -c addPose addBtn;
formLayout -edit
-af poseList left 5
-af poseList top 5
-ac attrList left 5 poseList
-af attrList top 5
-ap poseList right 0 33
-ap attrList right 0 66
-ac addBtn left 5 attrList
-aoc addBtn top 0 poseList
-af addBtn right 5
poseForm;
showWindow poseWindow;
global proc addPose()
{
textScrollList -e -ra -sc "appendAttr()" poseList;
textScrollList -e -ra attrList;
string $selection[] = `ls -sl`;
for ($objs in $selection)
{
textScrollList -edit
-append $objs
poseList;
}
}
global proc appendAttr()
{
textScrollList -e -ra attrList;
string $selection[] = `ls -sl`;
for ($objs in $selection)
{
float $getX = `getAttr ($objs + ".translateX")`;
textScrollList -edit
-append ("translate X = " + $getX)
attrList;
}
}
What I want it to do and what it's doing are two different things atm. What I want it to do is add a specified pose to the poseList, then based on the attributes stored in that pose, add them to the attrList. Currently it's adding the attributes to the attrList no matter what. That's the part I can't seem to wrap my mind around: how to add only the attributes of the selected pose in the poseList. The other thing is I need to figure out how to store the poses so it appends the attributes to the list regardless of what is selected.
So once again, the user creates a pose, names the pose, the pose is stored in the poseList while the attributes of that specific pose are stored in the attrList.
Hope it makes sense, and I look forward to any help. :)