Difference between revisions of "Creating Hotkey"

From CRIPTWiki
Jump to: navigation, search
 
Line 12: Line 12:
  
 
Understand the following example code and you will be able to write your own:
 
Understand the following example code and you will be able to write your own:
 
 
  
 
  #F5 slot
 
  #F5 slot
Line 25: Line 23:
 
   Bones.surf setViewerMask 1
 
   Bones.surf setViewerMask 1
 
  }
 
  }
 +
 +
So that code there use F5 to turn Bones.surf visiblle and Ctrl-F5 to turn it invisible (or the other way around, I can't remember but they are in pairs)
 +
 +
So replace that with F1~F12... and you should be good to go!
 +
 +
Note certain keys might be restricted, etc F1 for help, cannot be used to assign hotkeys.
 +
 +
If you are savvy enough, you can even try to write using the IF statement to make life even easier but I'll leave that to you as homework :P.
 +
 +
NOTE THAT! Now, you have more than just the network to worry about! If you are giving a presentation, you need to make sure these things:
 +
#Your .hx file is packed and ready to go.
 +
#It is loading the VRconfig.txt properly.
 +
#Loading the hotkey.txt properly.\
 +
#Those txt confiugration file mentioned above are located at the folder where they are suppose to be at and if you move files across machines, don't forgot those txt configuration files are not being saved with the network!
 +
 +
however, if everything is done properly, you should be able to simply source these codes to activate their effect later on instead of rewriting everything again and just write loading statement like these: "source ${AMIRA_ROOT}/share/resources/hotkey.txt".

Latest revision as of 20:36, 27 August 2009

So, now you are trying to create a bunch of hotkeys for presentation, very easy. Follow these steps:

First, you need to finish editing your .hx network for presentation. So make whatever final change necessary and STOP TOUCHING it after you done saving it.

Then after that, you NEED to open the .hx file using an editor such as Notepad++ (if not installed, go hunt Tim down about it). When you open it up... it will look like File:Demo.pdf.

Yes, .hx file is essentially a text file telling Amira what to do... SO, by using that to our advantage, add a line at the very bottom: "source ${AMIRA_ROOT}/share/resources/hotkey.txt" without the quotation marks. This tells the amira to LOAD UP the file called "hotkey.txt at the location where Amira is installed within the folder tree /share/resources/.

So, add that, save and exist notepad++.

Now, you told the .hx network file where to load the hotkey file, you still NEED to make up that txt file to carry out the desired function.

Understand the following example code and you will be able to write your own:

#F5 slot
proc onKeyF5 {} {
  echo "F5 pressed"
  Bones.surf setViewerMask 0
}
#Ctrl-F5 slot
proc onKeyCtrlF5 {} {
  echo "Ctrl-F5 pressed"
  Bones.surf setViewerMask 1
}

So that code there use F5 to turn Bones.surf visiblle and Ctrl-F5 to turn it invisible (or the other way around, I can't remember but they are in pairs)

So replace that with F1~F12... and you should be good to go!

Note certain keys might be restricted, etc F1 for help, cannot be used to assign hotkeys.

If you are savvy enough, you can even try to write using the IF statement to make life even easier but I'll leave that to you as homework :P.

NOTE THAT! Now, you have more than just the network to worry about! If you are giving a presentation, you need to make sure these things:

  1. Your .hx file is packed and ready to go.
  2. It is loading the VRconfig.txt properly.
  3. Loading the hotkey.txt properly.\
  4. Those txt confiugration file mentioned above are located at the folder where they are suppose to be at and if you move files across machines, don't forgot those txt configuration files are not being saved with the network!

however, if everything is done properly, you should be able to simply source these codes to activate their effect later on instead of rewriting everything again and just write loading statement like these: "source ${AMIRA_ROOT}/share/resources/hotkey.txt".