PDA

View Full Version : Using an alias in TextScroll


doffer
11-07-2011, 07:33 PM
I have a list of controlers of a character rig in an IconTextScrollList, and whenever I select a controler in the list, it select it's equivilent in the scene. Pretty simple. I'm populating the list like this:
iconTextScrollList -allowMultiSelection true -h 600 -w 200

-append "Billy_ctrlIK_Lf_LegPV"

-append "Billy_ctrlIK_Rt_LegIK"


-selectCommand "doSelection"


And then soSelection is:
global proc doSelection() {

string $items[] = `iconTextScrollList -q -si selecter_scroll`;

select -r $items;

}


But sometimes controlers in a character rig can have funky names, and Billy_ctrlIK_Lf_LegPV could just be R_Knee for the sake of easy-to-readness. Is there a way to make this happen? So one thing on the list, just points to the real object, like an alias I guess.

Cheers

jaydru
11-07-2011, 08:25 PM
you could have another textScrollList, one would have the nice names the other the real names built so that they are in the same order and then query the idx of selected item on nice and select the matching real item, then hide the tsl with the real names in your gui

doffer
11-07-2011, 09:34 PM
Hi Jaydru.
Thanks a lot for your reply.
I tried to set it up as you explained but I can't find the right commands I think. Sorry for being such a noob on this.
Here is my new selection command

int $nicename[] = `textScrollList -q -selectIndexedItem nicename_scroll`;
string $realname[] = `textScrollList -q -selectIndexedItem $nicename realname_scroll`;

select -r $realname;


so i theory (mine anyways :D) $nicename[] should hold the itemIndex of the nicename_scroll list, right?
Then I want to grab that item number over at the realname_scroll list. I don't think I'm using the right command for this. At least it doesn't work right now.

jaydru
11-07-2011, 10:20 PM
something like this, although this would be a much easyer job in python

{
$nodeNames = {"prifix_arm_left_suffix", "prifix_foot_right_suffix", "prifix_spine_suffix"};
$niceNames = {"Left Arm Ctrl", "Right Foot Ctrl", "Spine Ctrl"};
$myWin = `window`;
$form = `formLayout`;
$niceTsl = `textScrollList -sc "tslSelectionProc()" -ams 1 "myWinNiceNamesTSL"`;
$nodeTsl = `textScrollList -ams 1 -vis 0 "myWinNodeNamesTSL"`;
formLayout -e -af $niceTsl top 0 -af $niceTsl left 0 -af $niceTsl right 0 -af $niceTsl bottom 0 $form;

for ($i=0; $i<size($nodeNames); $i++)
{
textScrollList -e -a $niceNames[$i] $niceTsl;
textScrollList -e -a $nodeNames[$i] $nodeTsl;
}
showWindow $myWin;
}
global proc tslSelectionProc(){
$idx = `textScrollList -q -sii "myWinNiceNamesTSL"`;
$nodeNames = `textScrollList -q -ai "myWinNodeNamesTSL"`;
for ($i in $idx)
print ($nodeNames[int($i)-1] + "\n");
}

Azrail
11-08-2011, 09:47 AM
Why don't you use treeView for example - then you can have unique name for the entry and different name which will be displayed in the UI

doffer
11-09-2011, 12:11 PM
Jaydru:
Thanks! I see that works. Perhaps I can find a good way to implement it.

Azrail: Did not know treeView. That sure looks interesting. I will do some testing, and see if it works for my tool.

Thanks! Very helpfull

NaughtyNathan
11-09-2011, 04:05 PM
...Did not know treeView. That sure looks interesting. I will do some testing, and see if it works for my tool.I can practically guarentee it won't! ;)

http://forums.cgsociety.org/showthread.php?f=89&t=865911

:nathaN

doffer
11-10-2011, 04:08 PM
Hehe aww... that's a shame. Thanks for the heads up :)

Azrail
11-10-2011, 11:17 PM
Did you even tried it? I know Nathan is the alpha around here, but can't agree this time. It all depends on the way you set up your things. I've build a few not quite simple interfaces myself and if you manage to set things up correct the TreeView can be useful.

NaughtyNathan
11-10-2011, 11:29 PM
I've tried it, and to be fair only in 2010, but it was pretty clunky and inflexible and, as I came to conclude, useless. It appears to have been designed for only one specific use, and I guess if you're using it for exactly that it may well be fine. But I wouldn't recommend it... unless they've updated it in 2011...?

:nathaN

CGTalk Moderation
11-10-2011, 11:29 PM
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.