Two Questions: One..scriptjob...two Maybe The Same

Hey guys-

I have created a script that toggles visibility of controllers within my scene through a scriptjob... However, I am having the students to have to source this script each time they open maya. Here is some pseudocode to understand what I am talkin about.

[codebox]global proc VsSw(){

functions...
}

scriptJob -e SelectionChange VsSw[/codebox]

How can I make the sourcing automatic. I have tried placing it in the scripts directory, but that does not seem to help. I have also put this into the expression editor.. and tried to save in into the scene, but to no avail...any ideas?

  1. I have had a request to enable "mirroring" of object transforms interactively with a hotkey. Is this a terrible Idea? and if so.. I understand that a scriptjob would be very dirty, but I am unexperienced wtih api, and want to give it a shot.

Thanks so much for any info

Sheriff

QUOTE(sheriffcica @ 04/06/07, 02:21 AM) [snapback]263603[/snapback]
How can I make the sourcing automatic. I have tried placing it in the scripts directory, but that does not seem to help. I have also put this into the expression editor.. and tried to save in into the scene, but to no avail...any ideas?

Well its not so much about where you put it but rather HOW you did. ive explained how it works before, Basically its becasue theres no inpoint named VsSw to look for.

But here it can also be because their maya environment differers form yours.

QUOTE
2. I have had a request to enable "mirroring" of object transforms interactively with a hotkey. Is this a terrible Idea?

Well you can implement this in 2 ways, one is to a make a hotkey for the transform tools reelection behavior (well if the guys are doing mirrored stuff why don't they use it in first place?).

Ok you can traverse up the undo queue.

example one that repeats last compound move. heres dirty example of fetching the values:

CODE
{
string $result[];
$break=1;
$last="select";
while ($break){
  $break=0;
  string $buffer[];
  string $a;
  $a =undoInfo -q -un;
  undo;
  tokenize $a " " $buffer;
  if (($last==$buffer[0]) || ($buffer[0]=="move")){
    $result[size($result)]=$a;
    $break=1;
    $last=$buffer[0];
  }
}
for ($item in $result){redo;
print $item;
}
redo; //undo the extra undo could be avoided
}