mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 10:19:59 +01:00
Fixed behavior in GeometryView for multiple sources selected.
This commit is contained in:
10
Mixer.cpp
10
Mixer.cpp
@@ -454,8 +454,6 @@ void Mixer::setCurrentNext()
|
||||
|
||||
void Mixer::unsetCurrentSource()
|
||||
{
|
||||
Log::Info("unsetCurrentSource");
|
||||
|
||||
// discard overlay for previously current source
|
||||
if ( current_source_ != session_->end() ) {
|
||||
|
||||
@@ -469,11 +467,11 @@ void Mixer::unsetCurrentSource()
|
||||
// remove from selection
|
||||
selection().remove( *current_source_ );
|
||||
}
|
||||
}
|
||||
|
||||
// deselect current source
|
||||
current_source_ = session_->end();
|
||||
current_source_index_ = -1;
|
||||
// deselect current source
|
||||
current_source_ = session_->end();
|
||||
current_source_index_ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int Mixer::indexCurrentSource()
|
||||
|
||||
@@ -86,6 +86,10 @@ Source::Source() : initialized_(false), need_update_(true)
|
||||
handle_[Handles::ROTATE]->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f);
|
||||
handle_[Handles::ROTATE]->translation_.z = 0.1;
|
||||
overlays_[View::GEOMETRY]->attach(handle_[Handles::ROTATE]);
|
||||
frame = new Frame(Frame::SHARP, Frame::THIN, Frame::NONE);
|
||||
frame->translation_.z = 0.1;
|
||||
frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 0.7f);
|
||||
overlays_[View::GEOMETRY]->attach(frame);
|
||||
groups_[View::GEOMETRY]->attach(overlays_[View::GEOMETRY]);
|
||||
|
||||
// default layer nodes
|
||||
|
||||
@@ -379,10 +379,10 @@ void UserInterface::handleMouse()
|
||||
//
|
||||
if ( ImGui::IsMouseDown(ImGuiMouseButton_Left) ) {
|
||||
|
||||
if ( !mousedown)
|
||||
if ( !mousedown )
|
||||
{
|
||||
Log::Info("LMB down");
|
||||
mousedown = true;
|
||||
Log::Info("LMB %d", mousedown);
|
||||
|
||||
// ask the view what was picked
|
||||
picked = Mixer::manager().view()->pick(mousepos);
|
||||
@@ -430,27 +430,27 @@ void UserInterface::handleMouse()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) )
|
||||
else if ( ImGui::IsMouseReleased(ImGuiMouseButton_Left) )
|
||||
{
|
||||
Log::Info("LMB release");
|
||||
mousedown = false;
|
||||
// picked = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
|
||||
if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) )
|
||||
{
|
||||
Log::Info("LMB double clic");
|
||||
// display source in left pannel
|
||||
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||
// discard current to select front most source
|
||||
// (because single clic maintains same source active)
|
||||
Mixer::manager().unsetCurrentSource();
|
||||
}
|
||||
else if ( ImGui::IsMouseReleased(ImGuiMouseButton_Left) )
|
||||
{
|
||||
mousedown = false;
|
||||
Log::Info("LMB %d", mousedown);
|
||||
|
||||
picked = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
|
||||
// if ( mousedown && glm::distance(mouseclic[ImGuiMouseButton_Left], mousepos) > 3.f )
|
||||
if ( ImGui::IsMouseDragging(ImGuiMouseButton_Left, 5.0f) )
|
||||
{
|
||||
// Log::Info("LMB drag %f", glm::distance(mouseclic[ImGuiMouseButton_Left], mousepos));
|
||||
|
||||
Source *current = Mixer::manager().currentSource();
|
||||
if (current)
|
||||
{
|
||||
|
||||
18
View.cpp
18
View.cpp
@@ -370,14 +370,24 @@ void GeometryView::zoom( float factor )
|
||||
|
||||
void GeometryView::draw()
|
||||
{
|
||||
// hack to prevent source manipulation (scale and rotate)
|
||||
// when multiple sources are selected: simply do not draw overlay in scene
|
||||
Source *s = Mixer::manager().currentSource();
|
||||
if (s != nullptr) {
|
||||
if ( Mixer::selection().size() > 1) {
|
||||
s->setMode(Source::SELECTED);
|
||||
s = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// draw scene of this view
|
||||
scene.root()->draw(glm::identity<glm::mat4>(), Rendering::manager().Projection());
|
||||
|
||||
// draw overlay of current source
|
||||
Source *s = Mixer::manager().currentSource();
|
||||
// re-draw overlay of current source on top
|
||||
// (allows manipulation current source even when hidden below others)
|
||||
if (s != nullptr) {
|
||||
|
||||
DrawVisitor dv(s->overlays_[View::GEOMETRY], Rendering::manager().Projection());
|
||||
s->setMode(Source::CURRENT);
|
||||
DrawVisitor dv(s->overlays_[mode_], Rendering::manager().Projection());
|
||||
scene.accept(dv);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user