Discard source callback (e.g. OSC) when user controls source

Cancel the source callback for alpha, grab, rotation etc. if the source is current and the related view has initialized an action (which would mean the user is controlling the current source).
This commit is contained in:
Bruno Herbelin
2024-10-05 13:39:41 +02:00
parent f1a89a1c55
commit 2de9ca144d
2 changed files with 34 additions and 8 deletions

View File

@@ -28,6 +28,7 @@
#include "MediaPlayer.h"
#include "Visitor.h"
#include "Log.h"
#include "Mixer.h"
#include "SourceCallback.h"
@@ -216,7 +217,10 @@ void ResetGeometry::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::GEOMETRY
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// apply when ready
@@ -250,7 +254,10 @@ void SetAlpha::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::MIXING
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// set start position on first time it is ready
@@ -367,7 +374,10 @@ void Loom::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::MIXING
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// current position
@@ -429,7 +439,10 @@ void SetDepth::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::LAYER
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// set start position on first time it is ready
@@ -724,7 +737,10 @@ void SetGeometry::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::GEOMETRY
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// set start position on first time it is ready
@@ -791,7 +807,10 @@ void Grab::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::GEOMETRY
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// set start on first time it is ready
@@ -839,7 +858,10 @@ void Resize::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::GEOMETRY
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
if ( status_ == READY )
@@ -881,7 +903,10 @@ void Turn::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
if (s->locked())
if (s->locked() ||
(s->mode() == Source::CURRENT
&& Mixer::manager().view()->mode() == View::GEOMETRY
&& Mixer::manager().view()->initiated()) )
status_ = FINISHED;
// set start on first time it is ready

View File

@@ -78,6 +78,7 @@ public:
// grab a source provided a start and an end point in screen coordinates and the picking point
virtual void initiate ();
bool initiated() { return current_action_ongoing_; }
virtual void terminate (bool force = false);
virtual Cursor grab (Source*, glm::vec2, glm::vec2, std::pair<Node *, glm::vec2>) {
return Cursor ();