// Static utility functions.
////////////////////////////////////////////////////////////////////////
+/**
+ * Locate a named SSG node in a branch.
+ */
static ssgEntity *
find_named_node (ssgEntity * node, const char * name)
{
const char * type = node->getStringValue("type");
if (!strcmp("none", type)) {
animation = new NullAnimation();
+ } else if (!strcmp("select", type)) {
+ animation = new SelectAnimation();
} else if (!strcmp("spin", type)) {
animation = new SpinAnimation();
} else if (!strcmp("rotate", type)) {
////////////////////////////////////////////////////////////////////////
FGAircraftModel::NullAnimation::NullAnimation ()
+ : _branch(new ssgBranch)
{
}
FGAircraftModel::NullAnimation::~NullAnimation ()
{
+ _branch = 0;
}
void
FGAircraftModel::NullAnimation::init (ssgEntity * object,
- SGPropertyNode * node)
+ SGPropertyNode * props)
{
+ splice_branch(_branch, object);
+ _branch->setName(props->getStringValue("name", 0));
}
void
}
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGAircraftModel::SelectAnimation
+////////////////////////////////////////////////////////////////////////
+
+FGAircraftModel::SelectAnimation::SelectAnimation ()
+ : _condition(0),
+ _selector(new ssgSelector)
+{
+}
+
+FGAircraftModel::SelectAnimation::~SelectAnimation ()
+{
+ delete _condition;
+ _selector = 0;
+}
+
+void
+FGAircraftModel::SelectAnimation::init (ssgEntity * object,
+ SGPropertyNode * props)
+{
+ splice_branch(_selector, object);
+ _selector->setName(props->getStringValue("name", 0));
+ SGPropertyNode * node = props->getChild("condition");
+ if (node != 0) {
+ _condition = fgReadCondition(node);
+ }
+}
+
+void
+FGAircraftModel::SelectAnimation::update (int dt)
+{
+ if (_condition != 0 && _condition->test())
+ _selector->select(0xffff);
+ else
+ _selector->select(0x0000);
+}
+
+
\f
////////////////////////////////////////////////////////////////////////
// Implementation of FGAircraftModel::SpinAnimation
{
// Splice in the new transform node
splice_branch(_transform, object);
+ _transform->setName(props->getStringValue("name", 0));
_prop = fgGetNode(props->getStringValue("property", "/null"), true);
_factor = props->getDoubleValue("factor", 1.0);
_position_deg = props->getDoubleValue("starting-position-deg", 0);
{
// Splice in the new transform node
splice_branch(_transform, object);
+ _transform->setName(props->getStringValue("name", 0));
_prop = fgGetNode(props->getStringValue("property", "/null"), true);
_offset_deg = props->getDoubleValue("offset-deg", 0.0);
_factor = props->getDoubleValue("factor", 1.0);
{
// Splice in the new transform node
splice_branch(_transform, object);
+ _transform->setName(props->getStringValue("name", 0));
_prop = fgGetNode(props->getStringValue("property", "/null"), true);
_offset_m = props->getDoubleValue("offset-m", 0.0);
_factor = props->getDoubleValue("factor", 1.0);
// end of model.cxx
-
-
-
-