Property browser: Difference between revisions

Jump to navigation Jump to search
Apply templates; internal formatting; move Olsen quote and improve citation; typo fix
m (Add availability note for new prop browser features)
(Apply templates; internal formatting; move Olsen quote and improve citation; typo fix)
 
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). For instance, you cannot change your frame rate by changing the frame counter obviously.  
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 conceptually 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 16: Line 16:


== Tied properties ==
== Tied properties ==
{{Note|The origin of tied properties was largely to address
Some properties are so called ''tied'' properties which are directly mapped to internal C++ variables and they cannot be modified using the property browser, we are currently trying to get rid of tied properties, see [[Howto:Use Property Tree Objects]] for details.
"hypothetical" performance concerns in the early days.  Coders could
continue to use native compiled variables and simultaneously expose them to
the property system.  Early property system skepticism included issues like
performance and use of global structures.  Those have largely not proven
out to be actual issues.  So without looking deep into how much
effort/change/impact this would require, I think for the most part the
whole tied property aspect of the api could go away and the property system
api would simplify quite a bit.<ref>https://sourceforge.net/p/flightgear/mailman/message/37280934/</ref>
}}
Some properties are so called ''tied'' properties which are directly mapped to internal C++ variables and they cannot be modified using the property browser, we are currently trying to get rid of tied properties, see [[Howto:Use_Property_Tree_Objects]] for details.


In addition, even some non-tied properties cannot be modified because they are by default constantly written/modified by another subsystem (in C++/Nasal space), possibly updating properties at frame rate, this applies for example to the frame rate counter, which is constantly updated by C++ code - so trying to set it from Nasal would be kind of pointless.
In addition, even some non-tied properties cannot be modified because they are by default constantly written/modified by another subsystem (in C++/Nasal space), possibly updating properties at frame rate, this applies for example to the frame rate counter, which is constantly updated by C++ code - so trying to set it from Nasal would be kind of pointless.


Also certain properties are only read/applied during initialization/re-initialization (startup/reset) of the sim, while others require the corresponding subsystems to be reinitialized.
Also certain properties are only read/applied during initialization/re-initialization (startup/reset) of the sim, while others require the corresponding subsystems to be reinitialized.
{{Note|{{cquote|1=
The origin of tied properties was largely to address "hypothetical" performance concerns in the early days. Coders could continue to use native compiled variables and simultaneously expose them to the property system. Early property system skepticism included issues like performance and use of global structures. Those have largely not proven out to be actual issues. So without looking deep into how much effort/change/impact this would require, I think for the most part the whole tied property aspect of the API could go away and the property system API would simplify quite a bit.
|2={{cite web|url=https://sourceforge.net/p/flightgear/mailman/message/37280934/|author=Curtis Olson|title=Re: &lsqb;Flightgear-devel&rsqb; Making Simgear properties threadsafe|date=12<sup>th</sup> May 2021}}}}}}


== Tips and tricks ==
== Tips and tricks ==
Apart from setting a property by clicking it and using the text field and Set button, there is many things that can be done through the property browser:
Apart from setting a property by clicking it and using the text field and Set button, there is many things that can be done through the property browser:
{| class="wikitable"
{| class="wikitable"
|+
! Mouse click while holding on keyboard !! Function !! Comment
!Mouse click while holding on keyboard
!Function
!Comment
|-
|-
|ctrl
| {{key press|Ctrl}}
|on '.' toggle verbose mode
| on '.' toggle verbose mode
on '..' goto root
on '..' goto root
on any bool property: toggle true/false value
on any bool property: toggle true/false value
|Verbose mode is explained below
| Verbose mode is explained below
|-
|-
|shift
| {{key press|Shift}}
|on '.' dump properties to console
| on '.' dump properties to console
display property in top left corner of the flightgear screen
display property in top left corner of the flightgear screen
|To ''remove the property'' ctrl-shift-click another property
| To ''remove the property'', {{key press|Ctrl|Shift}} and click on another property
|-
|-
|alt
| {{key press|Alt}}
|toggle trace_write attribute of the selected property
| toggle trace_write attribute of the selected property
|Since 04/2024 on 'next'; details below in 'verbose mode'
| Since 04/2024 on 'next'; details below in 'verbose mode'
|-
|-
|ctrl+alt
| {{key press|Ctrl|Alt}}
|toggle trace_read attribute of the selected property
| toggle trace_read attribute of the selected property
|Since 04/2024 on 'next'; details below in 'verbose mode'
| Since 04/2024 on 'next'; details below in 'verbose mode'
|}
|}


Line 63: Line 54:
In verbose mode, toggled by ctrl-clicking an "<tt>.</tt>" entry or toggling <code>/sim/gui/dialogs/property-browser/show-flags</code>, some additional information is shown as flags like this
In verbose mode, toggled by ctrl-clicking an "<tt>.</tt>" entry or toggling <code>/sim/gui/dialogs/property-browser/show-flags</code>, some additional information is shown as flags like this


  <code>foo = '123.456' (double; AT)</code>. 
  foo = '123.456' (double; AT)  


{| class="wikitable" border="1" cellspacing="0"  
{| class="wikitable"
! Flag
! Flag !! Meaning !! Comment
! Meaning
! Comment
|-
|-
| r || Read protected || Showing that a property can not be read.
| r || Read protected || Showing that a property can not be read.
Line 145: Line 134:


=== Displaying On-Screen property values through nasal ===
=== Displaying On-Screen property values through nasal ===
Create a file (let's call it display-props.nas) with instructions such below
Create a file (let's call it display-props.nas) with instructions such below:


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
Line 152: Line 141:
     var left  = screen.display.new(20, 10);
     var left  = screen.display.new(20, 10);
     var right = screen.display.new(-300, 10);
     var right = screen.display.new(-300, 10);
   
 
     left.add("/orientation/heading-deg");
     left.add("/orientation/heading-deg");
     left.add("/environment/wind-from-heading-deg");
     left.add("/environment/wind-from-heading-deg");
Line 161: Line 150:
</syntaxhighlight>
</syntaxhighlight>


Add the path/to/display-props.nas in your aircraft -set.xml,
Add the path/to/display-props.nas in your aircraft-set.xml or in your $FG_HOME/ inside a Nasal/ folder.
 
or in your $FG_HOME/ inside a Nasal/ folder.


== Related content ==
== Related content ==

Navigation menu