1
0
Fork 0
Commit graph

25 commits

Author SHA1 Message Date
mfranz
fd20d330ba props.Node: add remove() method that removes the node it was calleed on
from its property tree. The node remains accessible as long as references
to it are kept. Example:

  var cow_chain = func {
      var cow = geo.put_model("Models/Fauna/cow.ac", geo.aircraft_position());
      settimer(func { cow.remove() }, 10);
      settimer(cow_chain, 2);
  }
  cow_chain();
2007-08-07 11:30:30 +00:00
mfranz
a9b9c86750 - add Node.getValues() in analogy to Node.setValues(). Returns a hash with
all children, vectors for multiply used names, further hashes for subtrees
  etc. Meant for quickly pulling in config branches where (almost) all values
  are needed.
- usage of "var" keyword and named parameters in other (but not all) funcs
2007-05-14 15:15:00 +00:00
mfranz
38c170baa5 props.copy: add third argument that, if set, also copies the node attributes 2007-04-04 14:44:13 +00:00
andy
3bcfb0624a Add soft-coded utilites to the "io" and "math" modules. The math
stuff is, for the most part, already available in the geo module; but
it's small and this naming matches the evolvoing "standard nasal
library".
2007-03-29 22:09:25 +00:00
mfranz
0606fa3703 make condition() slightly faster and prettier (or not) 2007-03-21 18:37:06 +00:00
mfranz
7319f5e772 better condition() comment & cosmetics 2007-03-20 16:23:23 +00:00
mfranz
5b812986fb undefined <condition>s are "true" 2007-03-19 18:17:05 +00:00
mfranz
b2f57eab81 boolify <property> result 2007-03-18 15:49:11 +00:00
mfranz
0b4e6f934e add a props.condition(property) command that evaluates a property branch
as <condition> according to the rules set out in $FG_ROOT/Docs/README.condition
2007-03-18 13:57:32 +00:00
mfranz
b07ebf0dfa work around Nasal bug (and/or operators) 2007-02-07 17:31:41 +00:00
mfranz
0f07c14bd3 getBoolValue() on an undefined node shall return "false", not "true".
This isn't only more logical, it's also how SGPropertyNode::getBoolValue()
acts. The fix has potential to break code, but so far I haven't seen any
problems. I added a debug message to my copy and will for a while check
all cases that I run into. To check yourself, just add one line:

    getBoolValue : func {
        val = me.getValue();
+       if(val == nil) { debug.dump(me) }
        if(me.getType() == "STRING" and val == "false") { 0 }
        else { val != nil and val != 0 }
    }

This will output a debug message to the terminal for each case where
formerly "true" was returned, and now "false" is.
2007-02-05 11:40:49 +00:00
mfranz
7b6205d37b add props.Node.getAttribute() and props.Node.setAttribute() methods.
Examples:
  var tied = foo.getAttribute("TIED");
  foo.setAttribute("USERARCHIVE", 1);

Both methods accept attribute strings "READ", "WRITE", "ARCHIVE",
"TRACE_READ", "TRACE_WRITE", and "USERARCHIVE". getAttribute() does
additionally accept "TIED" (although this isn't an SGPropertyNode::Attribute).
Attribute "REMOVED" is not supported.
2007-01-12 18:06:50 +00:00
mfranz
bd327892d6 let getBoolValue() actually return a bool 2006-02-20 10:59:52 +00:00
mfranz
06fa115d86 add function that recursively copies property tree branches (ignoring aliases);
reviewed and OK'ed by Andy
2005-12-16 20:25:52 +00:00
mfranz
7f25352610 add support for removeChildren(): takes one name as optional argument
and removes all children with this name; if no name is given, removes
all children
2005-10-23 16:09:51 +00:00
andy
4718f2f8f0 Fix broken getPath() method 2005-03-27 17:30:51 +00:00
andy
ca0fa1c427 Changes from Melchior to make use of the spiffy new format feature in
the text widget; and a props.getPath() method.
2005-03-26 22:15:26 +00:00
andy
54954eb8de GUI layout management and a few visual/eye-candy modifications. See
DOCS/README.layout in the base package for details, along with the
modified dialog files.
2004-05-12 15:37:17 +00:00
andy
e2cf6d90d2 New fuel management code. Only works with YASim currently. It's a benign
no-op under other FDMs.
2004-03-27 04:07:56 +00:00
andy
a67c4113e8 Temporary implementation of props.getBoolValue() which correctly
interprets the string "false".  Eventually this needs to be an
extension function wrapping SGPropertyNode::getBoolValue().
2004-01-28 03:49:59 +00:00
andy
35ec004c5f Nasal bindings for Saitek X45.
Misc. fixes to Nasal command bindings.
2003-12-23 17:31:08 +00:00
andy
b2909de010 New Nasal code, with lots of input binding handlers in controls.nas.
Move the "tip popup" code from view.nas to a new gui.nas module, and
  make it generically useful.
Wire up flap steppings for the 747 as an example of per-aircraft
  flaps.
Realtime-based property slewing, to eliminate dependence of trim and
  view direction rates on frame rate.
2003-12-22 20:05:18 +00:00
andy
3677b96fad Bugfix to globals.fgcommand().
New Node.setValues() method which sets whole property trees from Nasal
data.

A view.nas module, which takes over handling of the X/x zoom keys.  It
clamps the FOV to a dynamically calculated maximum corresponding to
typical human visual accuity, and pops up a pretty dialog informing
you of the new FOV.
2003-12-08 02:09:19 +00:00
ehofman
2c92f74b9f Fix a typo 2003-12-02 17:54:15 +00:00
ehofman
0be80148c3 Add Nasal Vs. 1.5 2003-12-01 14:36:22 +00:00