SGPropertyNode::fireCreatedRecursive: don't fire for node itself by default
This commit is contained in:
@@ -63,7 +63,7 @@ namespace canvas
|
||||
typedef osg::ref_ptr<osgText::Font> FontPtr;
|
||||
|
||||
typedef std::vector<PlacementPtr> Placements;
|
||||
typedef boost::function<Placements( const SGPropertyNode*,
|
||||
typedef boost::function<Placements( SGPropertyNode*,
|
||||
CanvasPtr )> PlacementFactory;
|
||||
|
||||
} // namespace canvas
|
||||
|
||||
@@ -2139,15 +2139,18 @@ SGPropertyNode::fireChildAdded (SGPropertyNode * child)
|
||||
}
|
||||
|
||||
void
|
||||
SGPropertyNode::fireCreatedRecursive()
|
||||
SGPropertyNode::fireCreatedRecursive(bool fire_self)
|
||||
{
|
||||
_parent->fireChildAdded(this);
|
||||
if( fire_self )
|
||||
{
|
||||
_parent->fireChildAdded(this);
|
||||
|
||||
if( _children.empty() && getType() != simgear::props::NONE )
|
||||
return fireValueChanged();
|
||||
if( _children.empty() && getType() != simgear::props::NONE )
|
||||
return fireValueChanged();
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < _children.size(); ++i)
|
||||
_children[i]->fireCreatedRecursive();
|
||||
_children[i]->fireCreatedRecursive(true);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1597,12 +1597,14 @@ public:
|
||||
|
||||
/**
|
||||
* Trigger a child-added and value-changed event for every child (Unlimited
|
||||
* depth) and the node itself.
|
||||
* depth).
|
||||
*
|
||||
* @param fire_self Whether to trigger the events also for the node itself.
|
||||
*
|
||||
* It can be used to simulating the creation of a property tree, eg. for
|
||||
* (re)initializing a subsystem which is controlled through the property tree.
|
||||
*/
|
||||
void fireCreatedRecursive();
|
||||
void fireCreatedRecursive(bool fire_self = false);
|
||||
|
||||
/**
|
||||
* Fire a child-removed event to all listeners.
|
||||
|
||||
Reference in New Issue
Block a user