mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 11:19:58 +01:00
Fixed picking in geometry view.
This commit is contained in:
@@ -132,6 +132,5 @@ void PickingVisitor::visit(LineCircle &n)
|
|||||||
|
|
||||||
void PickingVisitor::visit(Scene &n)
|
void PickingVisitor::visit(Scene &n)
|
||||||
{
|
{
|
||||||
// TODO : maybe pick only foreground ?
|
|
||||||
n.root()->accept(*this);
|
n.root()->accept(*this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,11 +374,11 @@ void UserInterface::handleMouse()
|
|||||||
// ask the view what was picked
|
// ask the view what was picked
|
||||||
picked = Mixer::manager().currentView()->pick(point);
|
picked = Mixer::manager().currentView()->pick(point);
|
||||||
|
|
||||||
if (picked.first == nullptr){
|
if ( picked.first == nullptr ) {
|
||||||
// nothing picked, unset current
|
// nothing picked, unset current
|
||||||
Mixer::manager().unsetCurrentSource();
|
Mixer::manager().unsetCurrentSource();
|
||||||
navigator.hidePannel();
|
navigator.hidePannel();
|
||||||
} else {
|
} else {
|
||||||
Mixer::manager().setCurrentSource( picked.first );
|
Mixer::manager().setCurrentSource( picked.first );
|
||||||
if (navigator.pannelVisible())
|
if (navigator.pannelVisible())
|
||||||
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||||
|
|||||||
9
View.cpp
9
View.cpp
@@ -314,20 +314,21 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec3 point)
|
|||||||
scene.accept(pv);
|
scene.accept(pv);
|
||||||
|
|
||||||
// picking visitor found nodes?
|
// picking visitor found nodes?
|
||||||
if ( !pv.picked().empty()) {
|
if ( pv.picked().size() > 0) {
|
||||||
|
|
||||||
Source *s = Mixer::manager().currentSource();
|
Source *s = Mixer::manager().currentSource();
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
|
|
||||||
// find if the current source was picked
|
// find if the current source was picked
|
||||||
auto itp = pv.picked().begin();
|
auto itp = pv.picked().rbegin();
|
||||||
for (; itp != pv.picked().end(); itp++){
|
for (; itp != pv.picked().rend(); itp++){
|
||||||
if ( s->contains( (*itp).first ) ){
|
if ( s->contains( (*itp).first ) ){
|
||||||
pick = *itp;
|
pick = *itp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not found: the current source was not clicked
|
// not found: the current source was not clicked
|
||||||
if (itp == pv.picked().end())
|
if (itp == pv.picked().rend())
|
||||||
s = nullptr;
|
s = nullptr;
|
||||||
}
|
}
|
||||||
// maybe the source changed
|
// maybe the source changed
|
||||||
|
|||||||
Reference in New Issue
Block a user