mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Picking Nodes in Mixing view and grabbing associated source to modify
alpha
This commit is contained in:
41
SearchVisitor.cpp
Normal file
41
SearchVisitor.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user