Board index FlightGear Development

Who can tell me the property mechanism?

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Who can tell me the property mechanism?

Postby huidefeng » Sun Mar 24, 2013 8:20 am

I want to understand the property mechanism in flightgear.

But i can't find how to read and write the property,and can't understand such as "/sim/dimensions/radius-m" in source code from where?

Who can tell me?

Thanks.
huidefeng
 
Posts: 12
Joined: Wed Mar 20, 2013 10:45 am

Re: Who can tell me the property mechanism?

Postby Hooray » Sun Mar 24, 2013 10:59 am

Hi & welcome.

Regarding the property tree, please see: http://wiki.flightgear.org/Property_Tree and $FG_ROOT/Docs/README.introduction.
Properties can be manipulated using various different means, including so called fgcommands, GUI dialogs and Nasal scripting using getprop/setprop: http://wiki.flightgear.org/List_of_Nasa ... prop.28.29

Various OO-Nasal helpers can be found in $FG_ROOT/Nasal/props.nas

If you are looking at modifying the C++ code, the C++ APIs are documented at: http://simgear.sourceforge.net/doxygen/ ... yNode.html (slightly outdated).
Also make sure to check out the wiki docs: http://wiki.flightgear.org/Howto:Work_w ... y_Tree_API
And: http://wiki.flightgear.org/Howto:Use_Pr ... ee_Objects
Property objects being the most recent and most modern (and most future-proof) way of dealing with the property tree, you should avoid using "tied" properties and their related APIs for all the reasons mentioned in the wiki article.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am

Re: Who can tell me the property mechanism?

Postby huidefeng » Sun Mar 24, 2013 11:47 am

Thank Hooray's answer.

I had known http://wiki.flightgear.org/Property_Tree.

But I can't see the whole Property Tree. Is there a list of Property Tree?

How relationship is the Property Tree with XML?

Could you tell me the string of "/sim/dimensions/radius-m" can find from which XML?
huidefeng
 
Posts: 12
Joined: Wed Mar 20, 2013 10:45 am

Re: Who can tell me the property mechanism?

Postby Hooray » Sun Mar 24, 2013 12:39 pm

There's a navigation sidebar with additional pointers to related articles, you should have a look at all of them.

But I can't see the whole Property Tree.

Use the property tree browser: http://wiki.flightgear.org/Property_browser
Image

Is there a list of Property Tree?

Many properties will be aircraft-specific, and availability may even depend on the startup/runtime settings you are using.
There are a bunch of "common" properties - especially among similar FDMs and aircraft.
Obviously, different FDMs/aircraft will use different properties (single piston, helicopter, jet, twin turbine helicopter etc).

You may want to have a look at $FG_ROOT/Docs/README.properties

How relationship is the Property Tree with XML?

The PropertyList-XML format is the serialization format used by the property tree, to save a property tree to an XML file or populate a property tree(or branch) from an XML file.
Again, please check out the wiki resources I mentioned earlier: http://wiki.flightgear.org/PropertyList_XML_File

Could you tell me the string of "/sim/dimensions/radius-m" can find from which XML?

See: http://www.mail-archive.com/flightgear- ... 33913.html
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am

Re: Who can tell me the property mechanism?

Postby Philosopher » Sun Mar 24, 2013 12:53 pm

No, this is no "official" list of Property Tree other than those that Hooray mentioned (which have not been updated in a while as far as I know). There are a couple ways that they are set, but a fair amount of them just "appear" without being documented anywhere. There are several places to look for properties; one is in the aircraft files, another is all Nasal files, and the last place (and often most useful!) is grepping (searching) through the C++ code. To determine how a property works and what it does often requires looking through any code that uses it. This is a part of FlightGear that we could certainly document better :P.

As for the relationship between XML and the Property Tree, in some cases in FG (most notably preferences.xml and each AIRCRAFT-set.xml file), the <PropertyList> format directly defines properties in FlightGear's global property tree. In other cases, like the animation files given by /sim/model/path, those do not define properties but the <PropertyList> format is used as a matter of convenience so that FG can parse all of its XML files using the same mechanism and to keep the fundamental structure the same. XML has a lot of different dialects, and having only one for FlightGear really makes it easier, especially since it is very intuitive :D.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Who can tell me the property mechanism?

Postby Hooray » Sun Mar 24, 2013 1:21 pm

Philosopher wrote in Sun Mar 24, 2013 12:53 pm:This is a part of FlightGear that we could certainly document better :P.


Agreed, and now just look at what they were talking about 11 years ago: http://www.mail-archive.com/flightgear- ... 10759.html
http://www.mail-archive.com/flightgear- ... 10778.html (see the whole discussion, including opinions from key people back then)

Personally, I just don't believe that this can/should be done manually (see Curt's posting at http://www.mail-archive.com/flightgear- ... 10994.html ). We would be far better off by adding runtime attributes to properties depending on how they ended up being initialized, i.e. via C++ APIs, Nasal, read_properties, property objects, fgcommands - and maybe even adding subsystem info (fdm, ai, scripting, gui etc).

Once we have that info directly in the runtime tree, it would be trivial to dump the complete property tree to a text file as a reference, and directly document where and how a property is initialized, read and written to.

As you know, we can even trivially document where initialization took place by using __FILE__ and __FUNCTION__ preprocessor macros

P: copied your response to the wiki, thanks!
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am

Re: Who can tell me the property mechanism?

Postby huidefeng » Mon Mar 25, 2013 10:26 am

Thanks.

At first, I can't visit such as "http://www.mail-archive.com/....".

I agree with Philosopher' said.

I know some properties from preferences.xml and each AIRCRAFT-set.xml file,but I can't find others from where?

I fell puzzle how many properties I can process?
huidefeng
 
Posts: 12
Joined: Wed Mar 20, 2013 10:45 am

Re: Who can tell me the property mechanism?

Postby Hooray » Mon Mar 25, 2013 10:42 am

You need to CLICK those links, and not copy/paste them - they are shortened by the forum software. If you want to use copy/paste, just quote the posting with the links, and find them in the quote part, where you can easily copy/paste things.

I know some properties from preferences.xml and each AIRCRAFT-set.xml file,but I can't find others from where?

There are tons of properties that do not come directly from an XML file, but which are initialized and updated by code, such as Nasal code, but also lots of C/C++ code. Which is why Philosopher suggested to grep -inr through the FG/FGDATA repositories to find what you are looking for.

In general, you will find that certain locations are likely to be updated by certain components, e.g. /ai or /fdm or /environment or /nasal and so on

I fell puzzle how many properties I can process?

It all boils down to what it is that you want to do, to come up with a list of required properties - some of which may be easy find in the base package, others will only be found in the source tree. It's hard to provide more details without you first providing a little more background information about your project.

It is true (and a long-standing issue) that we need to document the various properties better, especially their runtime effect/mutability, related subsystems etc - please file a feature request: https://code.google.com/p/flightgear-bu ... %20request
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am


Return to Development

Who is online

Users browsing this forum: MSN [Bot] and 1 guest

cron