PDA

View Full Version : auto select from object select


ukyo
11-23-2006, 08:04 AM
is there a way to create a jobscript that would make it so that if i selected a characters arm geometry it would auto select the control curve. i hope that makes sense. thanx for any help.

brubin
11-24-2006, 11:02 AM
yes, one can - and you're lucky: it has been done! so there's a mel-project for you to snoop through. the basic concept is - i think- to setup a scriptJob with the event "selectionChanged", and when that happens (i.e. the selection changes) execute some mel script. the script can explain in hard code "if i select arm-geometry, select the control-curve 'arm' instead". this works well for one character with a countable amount of controls and surfaces, but if you're looking for a system then you should put some more effort into it... the idea then is to establish a lasting relationship between the armGeometry and the armControlCurve, that won't be disturbed or interfered with by the accidental existence of more than one character (=more arms) in your scene. so, we'd add an attribute to the surface, that indicates to the scriptJob-melscript (the one that gets executed once the scriptJob condition is met) that the selection needs to be replaced by some other node.
if found, the scriptJob-melscript looks for a type "message"-attribute on both the geo- and the curve-object, and that they're connected. if so, the selection is changed.

are you still with me?
sounds too complicated?
you feel you're not MEL enough to write a script like this yourself? :)
well, you don't have to, you can just look for the "zooTriggered"-scripts by the fabulous Hamish McKenzie (www.macaronikazoo.com (http://www.macaronikazoo.com)) and take it from there, since this collection of scripts do it all for you!

HIH
s.

ukyo
11-25-2006, 04:07 AM
i think im with you. for example i could write an if else statement in mel that gets luanched by the scriptjob trigger of selection change.

brubin
11-25-2006, 02:18 PM
yep, that'll do, good way to start!
good luck
s.

Sick Spider
11-25-2006, 11:45 PM
Here is ONE way out of many :)
Lets say:
arm geo = L/R_Arm_Geo
leg geo = L/R_Leg_Geo
arm control = L/R_Arm_CTRL
leg control = L/R_Leg_CTRL

global proc wexlerSelectCTRL()
{
string $mySel[] = `ls -sl`;
if ($mySel[0] == "L_Arm_Geo")
select "L_Arm_CTRL";
if ($mySel[0] == "R_Arm_Geo")
select "R_Arm_CTRL";
if ($mySel[0] == "L_Leg_Geo")
select "L_Leg_CTRL";
if ($mySel[0] == "R_Leg_Geo")
select "R_Leg_CTRL";
}
int $myScriptJob = `scriptJob -event "SelectionChanged" "wexlerSelectCTRL"`;

// scriptJob -listJobs ;
// scriptJob -kill $myScriptJob

CGTalk Moderation
11-25-2006, 11:45 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.