Picking Nodes in Mixing view and grabbing associated source to modify

alpha
This commit is contained in:
brunoherbelin
2020-04-23 00:36:32 +02:00
parent cbc2eb4bdc
commit 5e58915282
12 changed files with 240 additions and 73 deletions

41
SearchVisitor.cpp Normal file
View File

@@ -0,0 +1,41 @@
#include "SearchVisitor.h"
#include "Scene.h"
SearchVisitor::SearchVisitor(Node *node) : Visitor(), node_(node), id_(0), found_(false)
{
id_ = node->id();
}
SearchVisitor::SearchVisitor(int id) : Visitor(), node_(nullptr), id_(id), found_(false)
{
}
void SearchVisitor::visit(Node &n)
{
if ( n.id() == id_ ){
found_ = true;
node_ = &n;
}
}
void SearchVisitor::visit(Group &n)
{
for (NodeSet::iterator node = n.begin(); node != n.end(); node++) {
(*node)->accept(*this);
if (found_)
break;
}
}
void SearchVisitor::visit(Switch &n)
{
(*n.activeChild())->accept(*this);
}
void SearchVisitor::visit(Scene &n)
{
n.root()->accept(*this);
}