[Bf-committers] I've made a custom hotkey system for Blender!

joeedh joeeagar at prodigy.net
Mon Dec 6 07:34:03 CET 2004


Alexander Ewering wrote:

>
> On Sun, 5 Dec 2004, joeedh wrote:
>
>> IF THIS IS NOT ALREADY BEING WORKED ON (don't you just hate all caps):
>>
>> I added a char keybinding[24][3] member to the user def struct.  For 
>> each member of the array, [0] is the key code, [1] is NULL (because 
>> the UI expects null-terminated strings) and [2] is the qualifyer  for 
>> it (such as shift, alt, whatever, based on the values in BKE_global.h).
>
>
> I'm not sure if you know what you're doing ;)
>
> For example, G.qual is a short. How do you plan to represent all possible
> values should it once get extended beyond bit 5? 

A char is one byte, that's 8 bits, isn't it?   *8* modifyer keys? I 
doubt that that'll ever happen.  And G.qual is an unsigned short, as I 
knew when I began coding this.  All event codes are unsigned shorts.  
Hm, are unsigned chars 7 bits?  Still, I doubt we'll ever go past 5.

> And did you care for
> endianness issues while converting between char and short? ;-)

No.  But there shouldn't be any, if you typecast properly.

>
> And there cannot be more than 24 custom keybindings?
>
Of course there can.  You simple leave room in the struct for expansion, 
a lot of room if it makes you feel better.  After all, we make 6000 byte 
char arrays for storing UI menu strings all the time, and that could 
probably store every hotkey in blender.

joeedh


More information about the Bf-committers mailing list