simgear/scene/model/SGReaderWriterXML.cxx: Added optional auto-generated tooltips for moving objects.

This allows one to see what properties are being used to control moving objects
such as needles and dials in the cockpit, or external moving objects such as
bomb doors.

The system works by optionally creating new animations with type=pick for all
animated objects. A side affect of this is that yellow highlighting of controls
from Ctrl-C will also highlight instrument needles in the cockpit and external
animations such as flaps, rudder, gear etc.

src/Model/acmodel.cxx:simgear::SGModelLib::loadModel() takes new param bool
autoTooltipsMaster and int autoTooltipsMasterMax, which is added into the
SGReaderWriterOptions that is passed to loadFile(). autoTooltipsMasterMax
limits the maximum number of tooltips, which appears to be necessary on 777 -
more than 45 can cause fg to fail to make progress.

The auto-generated tooltips show the name of the object and also the names and
values of the properties that control the animation. For example the tooltip
for a fuel gauge might say 'consumables/fuel/tank[1]/level-gal_imp=0.23456789'.
This commit is contained in:
Julian Smith
2020-06-20 11:09:35 +01:00
parent 9ccbf539c1
commit d9470c1407
4 changed files with 235 additions and 2 deletions
@@ -55,6 +55,8 @@ public:
_load_panel(0),
_instantiateEffects(false),
_instantiateMaterialEffects(false),
_autoTooltipsMaster(false),
_autoTooltipsMasterMax(0),
_LoadOriginHint(ORIGIN_MODEL)
{ }
SGReaderWriterOptions(const std::string& str) :
@@ -63,6 +65,8 @@ public:
_load_panel(0),
_instantiateEffects(false),
_instantiateMaterialEffects(false),
_autoTooltipsMaster(false),
_autoTooltipsMasterMax(0),
_LoadOriginHint(ORIGIN_MODEL)
{ }
SGReaderWriterOptions(const osgDB::Options& options,
@@ -72,6 +76,8 @@ public:
_load_panel(0),
_instantiateEffects(false),
_instantiateMaterialEffects(false),
_autoTooltipsMaster(false),
_autoTooltipsMasterMax(0),
_LoadOriginHint(ORIGIN_MODEL)
{ }
SGReaderWriterOptions(const SGReaderWriterOptions& options,
@@ -88,6 +94,8 @@ public:
_instantiateMaterialEffects(options._instantiateMaterialEffects),
_materialName(options._materialName),
_sceneryPathSuffixes(options._sceneryPathSuffixes),
_autoTooltipsMaster(options._autoTooltipsMaster),
_autoTooltipsMasterMax(options._autoTooltipsMasterMax),
_LoadOriginHint(ORIGIN_MODEL)
{ }
@@ -142,6 +150,16 @@ public:
void setSceneryPathSuffixes(const string_list& suffixes)
{ _sceneryPathSuffixes = suffixes; }
bool getAutoTooltipsMaster() const
{ return _autoTooltipsMaster; }
void setAutoTooltipsMaster(bool autoTooltipsMaster)
{ _autoTooltipsMaster = autoTooltipsMaster; }
int getAutoTooltipsMasterMax() const
{ return _autoTooltipsMasterMax; }
void setAutoTooltipsMasterMax(int autoTooltipsMasterMax)
{ _autoTooltipsMasterMax = autoTooltipsMasterMax; }
static SGReaderWriterOptions* copyOrCreate(const osgDB::Options* options);
static SGReaderWriterOptions* fromPath(const SGPath& path);
@@ -176,6 +194,8 @@ private:
bool _instantiateMaterialEffects;
string _materialName;
string_list _sceneryPathSuffixes;
bool _autoTooltipsMaster;
int _autoTooltipsMasterMax;
SGGeod _geod;
mutable LoadOriginHint _LoadOriginHint;
};