[Bf-funboard] Command Line

Janek Kozicki bf-funboard@blender.org
Wed, 2 Jun 2004 10:22:56 +0200


Tom Musgrove said:     (by the date of Wed, 02 Jun 2004 01:55:59 +0000)

> >oh. so you are making #define for each of those commands?
> 
> Yes, for the first iteration.  A file command_definitions.h that is just 
> assigning the keybinding to the key combinations.

what you see as a second iteration ?

> >forces every keybinding to have SPACE_TYPE defined for all keybindings.
> >Which is not always true (like general keybindings).
> 
> ?? I think you must have misunderstood.  Only the keybindings that are in 
> the SPACE_TYPE scope are defined within that scope.  If it isn't within 
> scope, then it drops through the switch, the flag is set to UNHANDLED, and 
> it calls the next broader scope.

ahh. ok. sorry :>

> I really think you need to look at the current code to see where we are 
> starting from. We have around 400 key/mouse combinations not including those 
> that are related to modifying button events.  (Perhaps 800 in total?)

you're right ;> I'd also like to see your modifications, to get the
correct view of the current state of things. I guess that example 
from your previous post is not enough for me to 'get it' :)
 
> I plan to switch to a lookup table shortly after I get the basic 
> functionality in place.  However, that still doesn't eliminate the need for 
> a scope check.

ok. now this sounds like something I would be up to.
 
> I'm not really sure what you have against Switch statements.  The need for a 
> lookup table/dictionary/etc. is because switches have to use constants, a 
> lookup table isn't particularly more elegant for our intentions, but it does 
> allow dynamic definition of keybindings (because of the switch restriction 
> on constants).  From a developers perspective things will look largely the 
> same.

well. I just must fully understand your method. I'm sorry for starting
out with criticizing. I really don't have to pass 'my method' and I
don't care how we do that. The thing I care for are 
1. "blender commands"[*], I need them for command line to work.
2. The second thing I care about is the clarity of .Bkeymap file.
3. The third thing is the ability to custom change of keybindings,
4. and ability to assign keybindings to commands from python scripts,
   which should be treated equally to "blender commands"

[*] "blender commands" is that thing you called "very long function
name". I need blender to understand the commands written in text.
Because this is the whole idea of command line (to write commands using
text) and aliases (to assign aliases to the commands).

I simply have not understood all you have done. Just tell me then:
are "bledner commands" written in text, compatibile with what you have
already done?

Eg. I want blender to do "toggle_face_display" or I want blender to 
do "f" within a certain scope.
 
> I really don't see how you are 'getting rid of countless switches' - my 
> method has about a dozen or so which is a fairly small number (a typical 
> command I think will pass through 2, and probably have 6 as a worst case 
> scenario...).  I suspect your method needs many many hundereds of if else if 
> statements, with probably 10 being a typical scenario and worst case being 
> about 20.  Even if you used switch statements for your proposal (which would 
> be far more efficient).  

not exactly. but there is no point in arguing about thing we both want
to do. You also didn't understood me :) But the homework is mine ;)
Please send me files you have modified with diffs, so I will get the
picture. After I read that, I'll be able to speak out :)


PS: sorry, it was stupid from me. anyone would get upset if someone
criticised his month of work. I _want_ to work out a solution for this
whole keybinding stuff.

-- 
Janek Kozicki                                                         |