From bb9b1ae3c73d0336835ab11d3d2725bcef6ec97b Mon Sep 17 00:00:00 2001 From: david Date: Wed, 13 Nov 2002 16:45:21 +0000 Subject: [PATCH] Correct offset-deg in a rotate animation so that it is added after the factor (otherwise, it's not in degrees). Allow 2D panel inclusions to be named (and further animated). --- src/Model/model.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Model/model.cxx b/src/Model/model.cxx index 895923bf9..fd1ea0095 100644 --- a/src/Model/model.cxx +++ b/src/Model/model.cxx @@ -179,7 +179,7 @@ make_animation (ssgBranch * model, SGPropertyNode_ptr node) { Animation * animation = 0; - const char * type = node->getStringValue("type"); + const char * type = node->getStringValue("type", "none"); if (!strcmp("none", type)) { animation = new NullAnimation(node); } else if (!strcmp("range", type)) { @@ -295,9 +295,19 @@ fgLoad3DModel (const string &path) props.getFloatValue("/offsets/z-m", 0.0)); align->setTransform(res_matrix); + // Load panels + unsigned int i; + vector panel_nodes = props.getChildren("panel"); + for (i = 0; i < panel_nodes.size(); i++) { + SG_LOG(SG_INPUT, SG_DEBUG, "Loading a panel"); + FGPanelNode * panel = new FGPanelNode(panel_nodes[i]); + if (panel_nodes[i]->hasValue("name")) + panel->setName((char *)panel_nodes[i]->getStringValue("name")); + model->addKid(panel); + } + // Load animations vector animation_nodes = props.getChildren("animation"); - unsigned int i; for (i = 0; i < animation_nodes.size(); i++) { const char * name = animation_nodes[i]->getStringValue("name", 0); vector name_nodes = @@ -305,14 +315,6 @@ fgLoad3DModel (const string &path) make_animation(model, name, name_nodes, animation_nodes[i]); } - // Load panels - vector panel_nodes = props.getChildren("panel"); - for (i = 0; i < panel_nodes.size(); i++) { - printf("Reading a panel in model.cxx\n"); - FGPanelNode * panel = new FGPanelNode(panel_nodes[i]); - model->addKid(panel); - } - // Load sub-models vector model_nodes = props.getChildren("model"); for (i = 0; i < model_nodes.size(); i++) { @@ -550,7 +552,7 @@ void RotateAnimation::update () { if (_table == 0) { - _position_deg = (_prop->getDoubleValue() + _offset_deg) * _factor; + _position_deg = _prop->getDoubleValue() * _factor + _offset_deg; if (_has_min && _position_deg < _min_deg) _position_deg = _min_deg; if (_has_max && _position_deg > _max_deg) -- 2.39.5