today i found out a very interesting thing. On my way to find out which tool is active in the modeler (i.e. MOVE | SCALE | ROTATE ) i played a bit around with the Icon Helper and the Hotkeys for this.
My idea was to define hotkeys so that my plugin can activate this functions. Problem: I never know if the user has changed his hotkeys for this functions and the plugin doesn't should overwrite the user defined keys.
The next idea was to readout the truespace.key file and to find out which keys are defined for this. Problem: The file is just refreshed on the end of a trueSpace session. This means if the user changed the hotkeys until my plugin runs - i can not recognize the new keys.
Then i inspect the truespace.key file a bit more and played around and found the following interesting thing:
A few keys, or better functions, in trueSpace have always the same hotkeys - no matter if the user defines new keys for it !!!!!!!!
As example: The MOVE OBJECT tool has predefined the key "Z". If you open the Hotkey Editor and define 3 new keys for this function, let's say: "3","4" and "5". Then this keys will work. BUT, also the predefined key "Z" will work - very interesting !!!! You never can change this - it's a DEFAULT.
And this is THE solution to switch on one of these tools from within your plugin. It is easy to simulate a keystroke from within your plugin to choose the function you need
BUT and here comes the "lame" thingy. The resisting problem is: how can i recoginze which function is still active? Well, if the user uses his hotkey(s) (or the standard hotkey) i could intercept all keystrokes sended to the trueSpace main window. After interpreting the truespace.keys file i could recognize which function the user has choosen.
The problem is: What if the user choose the function thrue the mouse (which are the most users will do)? In this case no flag, or whatever, is active to tells me (my plugin) what tool are active - and this is BAD - and i need a solution for this.
So please help me - give me ideas for this - thanks for reading - DD
