Using + and - to scale regardless of tool selected
-
Hi,
I'm creating a simplified toolbar for my users and I'd like for them to be able to press + or - to adjust the scale of an object regardless of their selected tool.
I've figured out the code to scale using +/-, but I can't figure out how to make it apply to all tools (custom and default SU) like a global script. I know this is generally a no-no, but all of my users use SU in a very specific way.
Is there an easy way to do this?
Thank you.
-
(nono), because only the currently selected tool gets keyboard events.
But your users could set up keyboard shortcuts for the + and - key (I don't know if those are available) and set them to two menu entries that you define: One will zoom in by a certain amount and one will zoom out.
-
You would need to have the users assign the plus and minus keys as shortcut keys that trigger your scale method. I don't know if there is some trickery you can do to somehow write those shortcut keys into their system somehow. That might not be advisable though, if you happen to be overwriting a shortcut they had already setup. You might just tell them to assign your scale +10% and scale -10% methods to whatever keys they want. Typically most people prefer to choose that kind of thing for themselves anyhow.
-
Another thought, if you are planning to use the + and - keys on a regular English keyboard, you have to hold down shift for the + key (otherwise its an = sign) and you do not hold down shift for the minus key. So that's a bit awkward if really have to -/shift+
The numpad +/- work a little more smoothly. But some keyboards don't have numpads (especially laptops).
-
Thanks guys. I hadn't thought of simply using SU's built-in shortcuts.
Are shortcuts saved to a file I can distribute with each installation? My users aren't very comfortable with computers so it would be best if each person had the exact same setup. Overwriting user settings won't be an issue thankfully.
Also thank you for pointing out issues with laptop keyboards. That's definitely going to be a problem I'll have to work around.
-
@descoteaux said:
Are shortcuts saved to a file I can distribute with each installation?
YES you CAN save the shortcuts out to a file. (BUT you must then explain to users how to import the custom shortcut file.)
You use the "Import..." and "Export..." buttons, on the "Shortcuts" panel of the "Preferences" dialog.
UI.show_preferences( "Shortcuts" )
-
Problem is, you'll conflict with other tools that require VCB input - often one need to enter a negative number.
-
and the period and comma keys.PageUp and PageDown might be good choice, though they are already assigned to something. Maybe that would be an ok pair to overwrite.
-
Thanks again guys for steering me in the right direction. I think I've got it sorted out.
-
What about the up and down arrow keys instead?
-
up and down (well, up for sure) are used in inference locks. Up forces inferencing to the blue axis. Maybe add a ctrl to it? So ctrl-up ctrl-down? That could be nice.
-
@chris fullmer said:
up and down (well, up for sure) are used in inference locks. Up forces inferencing to the blue axis...
on mac they have been re-allocated to create new pages, annoyingly when you want to lock the blue axis...
john -
@driven said:
on mac they have been re-allocated to create new pages, annoyingly when you want to lock the blue axis...
This doesn't sound right... Sure it's not on your system?
-
@thomthom said:
This doesn't sound right...
it's not right, but possibly since M3, it's been driving me nuts..
@unknownuser said:
Sure it's not on your system?
I certainly haven't added it anywhere and it happens with
Plugins on or off,
Developer Tools on or off,
Advanced Camera tools on or off,
Dynamic Components on or off,
All off or All on...open a drawing new or old...
click up-arrow result new scene
click down-arrow result delete sceneopen a drawing new or old...
draw a rectangle select move tool grad a corner, start a move
click up-arrow result new scene
click down-arrow result delete scenejohn
-
@unknownuser said:
Sure it's not on your system?
@unknownuser said:
I certainly haven't added it anywhere and it happens with
johnbut, It was and I found it,
View/Animations/Update Scene
View/Animations/Delete Scene
View/Animations/Add Scene
View/Animations/Previous Scene
View/Animations/Next SceneAll had Shortcuts I've never assigned, using the arrow keys, must be a plugin I tested?
so cheers TT, I just got pissed off and didn't look, as I have never changed those...
john -
Could be an animation plugin or scene manager... If it is, then it's bad manners from the developer.
-
I test all 'Custom Toolbar' type rubies I find, to see if they work fully on mac and one of them probably set shortcut keys for some reason... I only dig deeper in ones that show promise...
So my advice to the OP is please inform you users if you assign/re-assign 'shortcut' keys for them.
john
-
@driven said:
So my advice to the OP is please inform you users if you assign/re-assign 'shortcut' keys for them.
Or rather, give them the option to decline such change.
-
Advertisement