bool pre(const scene::INodePtr& node) { // Don't clone root items if (node->isRoot()) { return true; } if (Node_isSelected(node)) { // Don't traverse children of cloned nodes return false; } return true; }
void post(const scene::INodePtr& node) { if (node->isRoot()) { return; } if (Node_isSelected(node)) { // Clone the current node scene::INodePtr clone = map::Node_Clone(node); // Add the cloned node and its parent to the list _cloned.insert(Map::value_type(clone, node->getParent())); // Insert this node in the root _cloneRoot->addChildNode(clone); } }
bool pre(const scene::INodePtr& node) { // Check the selection status bool isSelected = Node_isSelected(node); // greebo: Don't check root nodes for selected state if (!node->isRoot() && isSelected) { // We have a selected instance, "remember" this by setting the parent // stack element to TRUE if (!_stack.empty()) { _stack.top() = true; } } // We are going one level deeper, add a new stack element for this subtree _stack.push(false); // Try to go deeper, but don't do this for deselected instances return !isSelected; }