Property browser: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
m (→‎Verbose mode: Fixing odd looking table)
mNo edit summary
(6 intermediate revisions by 5 users not shown)
Line 2: Line 2:
{{PropertyTree}}
{{PropertyTree}}


The [[FlightGear]] '''property browser''' is a dialog used to browse, in-simulator, through all properties. Properties are internal, runtime state variables in FlightGear. The property browser cannot only be used to inspect all sorts of internal variables at runtime, but it can also be used to change the values of most properties easily (some being conceputally read-only, i.e. because they're exclusively written-to by a certain subsystem such as the FDM).
The [[FlightGear]] '''property browser''' is a dialog used to browse, in-simulator, through all properties. Properties are internal, runtime state variables in FlightGear. The property browser cannot only be used to inspect all sorts of internal variables at runtime, but it can also be used to change the values of most properties easily (some being conceputally read-only, i.e. because they're exclusively written-to by a certain subsystem such as the FDM). For instance, you cannot change your frame rate by changing the frame counter obviously.  


== Opening the property browser ==
== Opening the property browser ==
Line 11: Line 11:
Browse around to see the different data fields that are available. Just about everything interesting/useful is published in the property system. The browser allows you to inspect and even change values in the live running copy of FG.
Browse around to see the different data fields that are available. Just about everything interesting/useful is published in the property system. The browser allows you to inspect and even change values in the live running copy of FG.


Alternatively, if you have enabled the corresponding "development extension" (see the menu item in the Debug menu), after typing {{key press|/}} you can type in a path (e.g. <tt>/fdm/jsbsim</tt>) and type {{key press|:}} to open the property browser at that path or {{key press|!}} to display it in the list of properties. This method also features tab-completion similar to bash: it will cycle through a list of existing properties that match what has been typed already. See [[$FG_ROOT]]/[https://gitorious.org/fg/fgdata/source/master:Nasal/prop_key_handler.nas#L1-40 Nasal/prop_key_handler.nas] for more information.
Alternatively, if you have enabled the corresponding "development extension" (see the menu item in the Debug menu), after typing {{key press|/}} you can type in a path (e.g. <tt>/fdm/jsbsim</tt>) and type {{key press|:}} to open the property browser at that path or {{key press|!}} to display it in the list of properties. This method also features tab-completion similar to bash: it will cycle through a list of existing properties that match what has been typed already. See {{fg root file|path=Nasal/prop_key_handler.nas}} for more information.


== Tied properties ==
== Tied properties ==
Line 52: Line 52:
|-
|-
| T || Tied property || Only the C/C++ code that owns a tied property can write to it. Also, listeners will not be triggered.
| T || Tied property || Only the C/C++ code that owns a tied property can write to it. Also, listeners will not be triggered.
|-
| L<N> || Number of listeners
|-
|-
|}
|}
{{FGCquote
|1= <pre>props.globals.getNode("/sim/aircraft").getAttribute("references")
does now return the reference counter -- the number of co-owners
of the shared pointer. This is really only useful for debugging.
And here's again a summary of all the attribute names:
children    ... returns number of children (faster than size(n.getChildren()!)
listeners  ... return number of attached listeners
references  ... returns number of co-owners (+ 2 for own consumption)
tied        ... returns whether a node is "tied" (in which case listeners
                might not get triggered)
alias      ... whether the node is an alias to another node
read        ... whether the node is read-protected
write      ... whether the node is write-protected
archive    ... whether the "archive" flag is set, which makes the
                node saved with "Save Flight" in the menu
trace-read  ... whether the node is being traced for read operations
trace-write ... whether the node is being traced for write operations
userarchive ... whether the node will be saved to ~/.fgfs/autosave.xml
                on exit
</pre>
|2= {{cite web
  | url    = http://sourceforge.net/p/flightgear/mailman/message/15645291/
  | title  = <nowiki>Re: [Flightgear-devel] FlightGear/Plib periodic stutter notes</nowiki>
  | author = <nowiki>Melchior FRANZ</nowiki>
  | date  = Oct 21st, 2007
  | added  = Oct 21st, 2007
  | script_version = 0.25
  }}
}}


== Other ways to open the property browser ==
== Other ways to open the property browser ==
Line 73: Line 107:
</syntaxhighlight>
</syntaxhighlight>


=== Displaying On-Screen property values through nasal ===
Create a file (let's call it display-props.nas) with instructions such below
<syntaxhighlight lang="nasal">
# On-screen displays
var enableOSD = func {
    var left  = screen.display.new(20, 10);
    var right = screen.display.new(-300, 10);
   
    left.add("/orientation/heading-deg");
    left.add("/environment/wind-from-heading-deg");
    left.add("/environment/wind-speed-kt");
    right.add("/controls/flight/rudder");
}
enableOSD();
</syntaxhighlight>
Add the path/to/display-props.nas in your aircraft -set.xml,
or in your $FG_HOME/ inside a Nasal/ folder.
== Related content ==
=== Source code ===
* {{fgdata source|path=gui/dialogs/property-browser.xml}}
[[Category:Menubar]]
[[Category:Menubar]]
[[Category:Property Tree]]
[[Category:Property Tree]]

Navigation menu