Once upon a time, keyboard and joystick bindings were -- after reading them
into the property tree -- stored each as reference to its property address
in FGBinding. Then the panel code handling was changed and, because the panel
xml structure was only read, scanned and executed, but not stored in the
property tree, no references could be used. Someone fixed that problem
(input.cxx r1.9). And that's what we have now:

- FGBinding::read() does not store references to the property tree, but copies
  the bindings into cute little private property subtrees.
- These are kind-of secret and can't get inspected, unlike the joystick and
  keyboard bindings
- which are stored twice, once in /input/{joystick,keyboard}/, and once as
  cute little secret subtrees.



I would now like to suggest to change that as follows:

- let FGBinding store just references *again*
- only make copies of bindings that would otherwise get lost (affects the
  panel only, AFAIK)


Q: If it would be considered acceptable -- where would I put the copies?
   /sim/panel/ sounds obvious but is bad, because of the panel<->panel_2
   swapping. /sim/input/panel/ would be where all other bindings are, but
   the panel isn't really an input device. What else? /sim/panel-bindings ?




Consequences:
-------------
Q: is the new method faster?
A: maybe a bit (no need to make copies of all kbd/js bindings), but hardly
   worth it

Q: does it consume less memory?
A: sure, a bit (no need to have kbd/js bindings twice in memory), but
   hardly worth it

Q: so it is completely useless?
A: No. The main advantage is, that all bindings have meaningful addresses.
   So, in case of bugs in nasal bindings, you aren't told that there's
   a problem in "<command> line 4", but rather in
   "/input/joystick/js/axis[3]/binding[1]/script". This doesn't buy the
   *user* much, but it saves developers some time, and is simply saner.
   Also, we could finally remove Andy's comment in NasalSys.cxx:

   // Parse the Nasal source.  I'd love to use the property name of
   // the argument, but it's actually a *clone* of the original
   // location in the property tree.  arg->getPath() returns an empty
   // string.



Actually, I have already changed it, and would like to commit. Just want
to make some more tests. Worked well so far.  :-)

m.

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to