Michael Selig writes: > > At 12/22/02, Norman Vine wrote: > >Michael Selig wrote: > > > > > > It seems to me like the property stuff is the most important part of > > > FGFS. If one does not understand how to use this and code for it (both in > > > xml and cpp), then you're never going to get anywhere. Ok, maybe I > > > exaggerate (some). > > > >For my own understanding of the properties I dump out the > >entire property tree every time the program starts > > > >This doesn't document where things are in the code or the config files > >but it at least lets you see what is there and is what I use in lieu of better > >documentation > > > >// main.cxx > >static bool fgMainInit( int argc, char **argv ) > >{ > > > >................... > > > > // ADD THIS LINE OF CODE TO DUMP THE PROPERTIES > > writeProperties ("props", globals->get_props(), true); > > Thanks. That's pretty handy. I notice that this does not seem to include > all of the property information in some files, eg sound.xml (and several > other .xml files seen when searching through the "props" file).
Yes I noticed that this is not a *complete* dump too :-( I find that massaging this file a little is even handier, for example the attached script creates this from the file the above patch produces and can be easily modified to do other things with the "properties" Norman ======== cut ======== FlightGear Key Map Key: 'Ctrl-A' Toggle autopilot altitude lock. Key: 'Ctrl-C' Toggle clickable panel hotspots Key: 'Ctrl-D' Dummy dialog Key: 'Ctrl-G' Toggle autopilot glide slope lock. Key: 'Ctrl-H' Toggle autopilot heading lock. Key: 'Enter' Move rudder right or increase autopilot heading. Key: 'Ctrl-N' Toggle autopilot nav1 lock. Key: 'Ctrl-R' (Temporary) Toggle winding-ccw Key: 'Ctrl-S' Toggle auto-throttle lock. Key: 'Ctrl-T' Toggle autopilot terrain lock. Key: 'Ctrl-U' [Cheat] Add 1000ft of emergency altitude. Key: 'ESC' Prompt and quit FlightGear. Key: 'SPACE' Fire Starter on Selected Engine(s) Key: '!' Select first engine Key: '#' Select third engine Key: '$' Select fourth engine Key: '+' zoom in (decrease field of view) Key: ',' Left brake Key: '-' zoom out (decrease field of view) Key: '.' Right brake Key: '0' Move rudder left or increase autopilot heading. Key: '1' Decrease elevator trim. mod-shift Look back left Key: '2' Increase elevator or autopilot altitude. mod-shift Look back. Key: '3' Decrease throttle or autopilot autothrottle. mod-shift Look back right. Key: '4' Move aileron left. mod-shift Look left. Key: '5' Center aileron, elevator, and rudder. Key: '6' Move aileron right. mod-shift Look right. Key: '7' Increase elevator trim. mod-shift Look front left. Key: '8' Decrease elevator or autopilot altitude. mod-shift Look forward. Key: '9' Increase throttle or autopilot autothrottle. mod-shift Look front right. Key: '=' Reset zoom to default Key: '@' Select second engine Key: 'A' Decrease speed-up. Key: 'B' Toggle parking brake on or off Key: 'M' Decrease warp. Key: 'P' Toggle panel. Key: 'T' Decrease warp delta. Key: 'W' (Temporary) Toggle fullscreen for 3DFX only. Key: 'X' Increase field of view. Key: 'Z' Decrease Visibility Key: '[' Decrease flaps. Key: ']' Increase flaps. Key: 'a' Increase speed-up. Key: 'b' Apply all brakes. mod-up Release all brakes. Key: 'c' Toggle 3D/2D cockpit Key: 'g' Toggle gear down. Key: 'l' Toggle tail-wheel lock. Key: 'm' Increase warp. Key: 'p' Toggle the pause state of the sim. Key: 's' Swap panels. Key: 't' Increase warp delta. Key: 'v' Cycle view Key: 'x' Decrease field of view. Key: 'z' Increase Visibility Key: '{' Decrease Magneto on Selected Engine Key: '}' Increase Magneto on Selected Engine Key: '~' Select all engines Key: 'F1' Key: 'F2' Key: 'F3' Capture screen. Key: 'F4' Key: 'F5' Key: 'F6' Key: 'F7' Key: 'F8' Key: 'F9' Key: 'F10' Key: 'Enter' Move rudder right or increase autopilot heading. Key: 'Keypad 5' Center aileron, elevator, and rudder. Key: 'Left' Move aileron left. mod-shift Look left. Key: 'Up' Increase elevator or autopilot altitude. mod-shift Look forward. Key: 'Right' Move aileron right. mod-shift Look right. Key: 'Down' Decrease elevator or autopilot altitude. mod-shift Look backwards. Key: 'PageUp' Increase throttle or autopilot autothrottle. mod-shift Look front right. Key: 'PageDown' Decrease throttle or autopilot autothrottle. mod-shift Look back right. Key: 'Home' Increase elevator trim. mod-shift Look front left. Key: 'End' Decrease elevator trim. mod-shift Look back left. Key: 'Insert' Move rudder left or decrease autopilot heading.
#! /usr/bin/env python """ $ID: fgfs_keymap.py Create the current KeyMap for FlightGear by parsing the property tree This requires Fredrik Lundh's (Simple)ElementTree available at http://effbot.org/downloads/ and expects the file 'props' created by the following patch to FlightGear see comment in python code to change 'props' file location and/or name // main.cxx static bool fgMainInit( int argc, char **argv ) { ................... // ADD THIS LINE OF CODE TO DUMP THE PROPERTIES writeProperties ("props", globals->get_props(), true); // pass control off to the master GLUT event handler glutMainLoop(); // we never actually get here ... but to avoid compiler warnings, // etc. return false; } Norman Vine [EMAIL PROTECTED] """ from elementtree.ElementTree import parse # change this to point to your properties dump props_file = "./props" def key_print(mylist): for node in mylist: name = "" desc = "" mod_name = "" mod_desc = "" for key in node: if key.tag == 'name': name = key.text if key.tag == 'desc': desc = key.text if key.tag[0:3] == "mod": mod_name = key.tag for mod in key: if mod.tag == 'desc': mod_desc = mod.text if name != "": print "\n Key: '%s' "%(name),"%s"%(desc) if mod_name != "" and mod_desc != "": print " %s "%(mod_name),"%s"%(mod_desc) def fgfs_keys(properties,indent=0): for node in properties: if node.tag == "keyboard": key_print(node) continue # recurse thru the tree fgfs_keys(node,indent+1) print "FlightGear Key Map" fgfs_keys(parse(props_file).getroot())