Commit a5c6c6a9 authored by Jan Möbius's avatar Jan Möbius
Browse files

Extend drawModesaction to include a force mode



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10108 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4bd8a851
......@@ -580,7 +580,15 @@ class SetDrawModesAction
{
public:
SetDrawModesAction(DrawModes::DrawMode _mode) : newModes_(_mode) {}
/** \brief Set draw modes for all nodes traversed with this action
*
* This action can be used to set the drawmodes for all nodes which
* are traversed using this action.
*
* @param _mode The draw mode set for the traversed nodes
* @param _force If true, the mode is set ignoring if its supported by the nodes
*/
SetDrawModesAction(DrawModes::DrawMode _mode, bool _force = false ) : newModes_(_mode),force_(_force) {}
bool operator()(BaseNode* _node)
{
......@@ -589,16 +597,25 @@ public:
DrawModes::DrawMode availableModes = _node->availableDrawModes();
if ( availableModes & newModes_ )
if ( force_ ) {
// if force, we ignore if the mode is supported by the node and set it
_node->drawMode( newModes_ );
} else if ( availableModes & newModes_ ) {
// If its supported, we set it
_node->drawMode( availableModes & newModes_ );
else
} else {
// otherwise we switch the node to default draw mode (which will use the global mode)
_node->drawMode( DrawModes::DEFAULT );
}
return true;
}
private:
DrawModes::DrawMode newModes_;
bool force_;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment