mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
work in progress: implementation of stash in MixingView
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include "ImageShader.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
#include "Resource.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
#include "Stream.h"
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "ImageShader.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
#include "Resource.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
#include "MediaPlayer.h"
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
78
Mixer.cpp
78
Mixer.cpp
@@ -382,10 +382,7 @@ void Mixer::deleteSource(Source *s)
|
||||
std::string name = s->name();
|
||||
|
||||
// remove source Nodes from all views
|
||||
mixing_.scene.ws()->detatch( s->group(View::MIXING) );
|
||||
geometry_.scene.ws()->detatch( s->group(View::GEOMETRY) );
|
||||
layer_.scene.ws()->detatch( s->group(View::LAYER) );
|
||||
transition_.scene.ws()->detatch( s->group(View::TRANSITION) );
|
||||
detach(s);
|
||||
|
||||
// delete source
|
||||
session_->deleteSource(s);
|
||||
@@ -404,6 +401,62 @@ void Mixer::deleteSource(Source *s)
|
||||
}
|
||||
|
||||
|
||||
void Mixer::attach(Source *s)
|
||||
{
|
||||
mixing_.scene.ws()->attach( s->group(View::MIXING) );
|
||||
geometry_.scene.ws()->attach( s->group(View::GEOMETRY) );
|
||||
layer_.scene.ws()->attach( s->group(View::LAYER) );
|
||||
}
|
||||
|
||||
void Mixer::detach(Source *s)
|
||||
{
|
||||
mixing_.scene.ws()->detatch( s->group(View::MIXING) );
|
||||
geometry_.scene.ws()->detatch( s->group(View::GEOMETRY) );
|
||||
layer_.scene.ws()->detatch( s->group(View::LAYER) );
|
||||
transition_.scene.ws()->detatch( s->group(View::TRANSITION) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Mixer::concealed(Source *s)
|
||||
{
|
||||
SourceList::iterator it = std::find(stash_.begin(), stash_.end(), s);
|
||||
return it != stash_.end();
|
||||
}
|
||||
|
||||
void Mixer::conceal(Source *s)
|
||||
{
|
||||
if ( !concealed(s) ) {
|
||||
// in case it was the current source...
|
||||
unsetCurrentSource();
|
||||
|
||||
// in case it was selected..
|
||||
selection().remove(s);
|
||||
|
||||
// store to stash
|
||||
stash_.push_front(s);
|
||||
|
||||
// remove from session
|
||||
session_->removeSource(s);
|
||||
|
||||
// detach from scene workspace, and put only in mixing background
|
||||
detach(s);
|
||||
mixing_.scene.bg()->attach( s->group(View::MIXING) );
|
||||
}
|
||||
}
|
||||
|
||||
void Mixer::uncover(Source *s)
|
||||
{
|
||||
SourceList::iterator it = std::find(stash_.begin(), stash_.end(), s);
|
||||
if ( it != stash_.end() ) {
|
||||
stash_.erase(it);
|
||||
|
||||
mixing_.scene.bg()->detatch( s->group(View::MIXING) );
|
||||
attach(s);
|
||||
session_->addSource(s);
|
||||
}
|
||||
}
|
||||
|
||||
void Mixer::deleteSelection()
|
||||
{
|
||||
while ( !selection().empty() )
|
||||
@@ -444,10 +497,10 @@ void Mixer::setCurrentSource(SourceList::iterator it)
|
||||
if ( current_source_ == it )
|
||||
return;
|
||||
|
||||
// clear current (even if it is invalid)
|
||||
// clear current (even if 'it' is invalid)
|
||||
unsetCurrentSource();
|
||||
|
||||
// change current if it is valid
|
||||
// change current if 'it' is valid
|
||||
if ( it != session_->end() ) {
|
||||
current_source_ = it;
|
||||
current_source_index_ = session_->index(current_source_);
|
||||
@@ -690,12 +743,7 @@ void Mixer::swap()
|
||||
selection().clear();
|
||||
// detatch current session's nodes from views
|
||||
for (auto source_iter = session_->begin(); source_iter != session_->end(); source_iter++)
|
||||
{
|
||||
mixing_.scene.ws()->detatch( (*source_iter)->group(View::MIXING) );
|
||||
geometry_.scene.ws()->detatch( (*source_iter)->group(View::GEOMETRY) );
|
||||
layer_.scene.ws()->detatch( (*source_iter)->group(View::LAYER) );
|
||||
transition_.scene.ws()->detatch( (*source_iter)->group(View::TRANSITION) );
|
||||
}
|
||||
detach(*source_iter);
|
||||
}
|
||||
|
||||
// swap back and front
|
||||
@@ -708,11 +756,7 @@ void Mixer::swap()
|
||||
|
||||
// attach new session's nodes to views
|
||||
for (auto source_iter = session_->begin(); source_iter != session_->end(); source_iter++)
|
||||
{
|
||||
mixing_.scene.ws()->attach( (*source_iter)->group(View::MIXING) );
|
||||
geometry_.scene.ws()->attach( (*source_iter)->group(View::GEOMETRY) );
|
||||
layer_.scene.ws()->attach( (*source_iter)->group(View::LAYER) );
|
||||
}
|
||||
attach(*source_iter);
|
||||
|
||||
// optional copy of views config
|
||||
mixing_.scene.root()->copyTransform( session_->config(View::MIXING) );
|
||||
|
||||
7
Mixer.h
7
Mixer.h
@@ -67,6 +67,10 @@ public:
|
||||
View *view (View::Mode m = View::INVALID);
|
||||
void setView (View::Mode m);
|
||||
|
||||
void conceal(Source *s);
|
||||
void uncover(Source *s);
|
||||
bool concealed(Source *s);
|
||||
|
||||
// manipulate, load and save sessions
|
||||
inline Session *session () const { return session_; }
|
||||
void clear ();
|
||||
@@ -90,7 +94,10 @@ protected:
|
||||
void swap();
|
||||
|
||||
SourceList candidate_sources_;
|
||||
SourceList stash_;
|
||||
void insertSource(Source *s, View::Mode m = View::INVALID);
|
||||
void attach(Source *s);
|
||||
void detach(Source *s);
|
||||
|
||||
void setCurrentSource(SourceList::iterator it);
|
||||
SourceList::iterator current_source_;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "defines.h"
|
||||
#include "ImageShader.h"
|
||||
#include "Resource.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
#include "Stream.h"
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "PickingVisitor.h"
|
||||
|
||||
#include "Log.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
|
||||
#include "GlmToolkit.h"
|
||||
|
||||
@@ -562,7 +562,6 @@ int RenderingWindow::pixelsforRealHeight(float milimeters)
|
||||
glfwGetMonitorPhysicalSize(mo, &mm_w, &mm_h);
|
||||
|
||||
float pixels = milimeters * static_cast<float>(glfwGetVideoMode(mo)->height) / static_cast<float>(mm_h);
|
||||
pixels *= dpi_scale_;
|
||||
|
||||
return static_cast<int>( pixels );
|
||||
}
|
||||
|
||||
38
Session.cpp
38
Session.cpp
@@ -113,10 +113,17 @@ SourceList::iterator Session::addSource(Source *s)
|
||||
// lock before change
|
||||
access_.lock();
|
||||
|
||||
// insert the source in the rendering
|
||||
render_.scene.ws()->attach(s->group(View::RENDERING));
|
||||
// insert the source to the beginning of the list
|
||||
sources_.push_front(s);
|
||||
// find the source
|
||||
SourceList::iterator its = find(s);
|
||||
// ok, its NOT in the list !
|
||||
if (its == sources_.end()) {
|
||||
|
||||
// insert the source in the rendering
|
||||
render_.scene.ws()->attach(s->group(View::RENDERING));
|
||||
|
||||
// insert the source to the beginning of the list
|
||||
sources_.push_front(s);
|
||||
}
|
||||
|
||||
// unlock access
|
||||
access_.unlock();
|
||||
@@ -152,6 +159,29 @@ SourceList::iterator Session::deleteSource(Source *s)
|
||||
return its;
|
||||
}
|
||||
|
||||
|
||||
void Session::removeSource(Source *s)
|
||||
{
|
||||
// lock before change
|
||||
access_.lock();
|
||||
|
||||
// find the source
|
||||
SourceList::iterator its = find(s);
|
||||
// ok, its in the list !
|
||||
if (its != sources_.end()) {
|
||||
|
||||
// remove Node from the rendering scene
|
||||
render_.scene.ws()->detatch( s->group(View::RENDERING) );
|
||||
|
||||
// erase the source from the update list & get next element
|
||||
sources_.erase(its);
|
||||
}
|
||||
|
||||
// unlock access
|
||||
access_.unlock();
|
||||
}
|
||||
|
||||
|
||||
Source *Session::popSource()
|
||||
{
|
||||
Source *s = nullptr;
|
||||
|
||||
@@ -20,6 +20,10 @@ public:
|
||||
// delete the source s from the session
|
||||
SourceList::iterator deleteSource (Source *s);
|
||||
|
||||
// remove this source from the session
|
||||
// Does not delete the source
|
||||
void removeSource(Source *s);
|
||||
|
||||
// get ptr to front most source and remove it from the session
|
||||
// Does not delete the source
|
||||
Source *popSource();
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include "ImageShader.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
#include "Resource.h"
|
||||
#include "Primitives.h"
|
||||
#include "Mesh.h"
|
||||
#include "Decorations.h"
|
||||
#include "SearchVisitor.h"
|
||||
#include "Session.h"
|
||||
#include "SessionCreator.h"
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "Log.h"
|
||||
#include "Scene.h"
|
||||
#include "Primitives.h"
|
||||
#include "Mesh.h"
|
||||
#include "Decorations.h"
|
||||
#include "Source.h"
|
||||
#include "MediaSource.h"
|
||||
#include "SessionSource.h"
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "defines.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
#include "Mesh.h"
|
||||
#include "Resource.h"
|
||||
#include "Session.h"
|
||||
#include "SearchVisitor.h"
|
||||
@@ -335,9 +333,7 @@ void Source::update(float dt)
|
||||
// CHANGE update status based on limbo
|
||||
bool a = glm::length(dist) < 1.3f;
|
||||
setActive( a );
|
||||
groups_[View::MIXING]->scale_ = glm::vec3(0.15f, 0.15f, 1.f) - ( a ? glm::vec3(0.f, 0.f, 0.f) : glm::vec3(0.03f, 0.03f, 0.f) );
|
||||
// TODO : find a use for a dynamic scaling of mixing source?
|
||||
// groups_[View::MIXING]->scale_ = glm::vec3(0.15f, 0.15f, 1.f) - glm::vec3(0.03 * blendingshader_->color.a, 0.03 * blendingshader_->color.a, 0.f);
|
||||
groups_[View::MIXING]->scale_ = glm::vec3(MIXING_ICON_SCALE) - ( a ? glm::vec3(0.f, 0.f, 0.f) : glm::vec3(0.03f, 0.03f, 0.f) );
|
||||
|
||||
// MODIFY geometry based on GEOMETRY node
|
||||
groups_[View::RENDERING]->translation_ = groups_[View::GEOMETRY]->translation_;
|
||||
|
||||
5
Source.h
5
Source.h
@@ -7,19 +7,16 @@
|
||||
#include <list>
|
||||
|
||||
#include "View.h"
|
||||
#include "Decorations.h"
|
||||
|
||||
class ImageShader;
|
||||
class ImageProcessingShader;
|
||||
class FrameBuffer;
|
||||
class FrameBufferSurface;
|
||||
class Surface;
|
||||
class Session;
|
||||
class Frame;
|
||||
class Source;
|
||||
class Handles;
|
||||
class CloneSource;
|
||||
|
||||
typedef std::list<Source *> SourceList;
|
||||
typedef std::list<CloneSource *> CloneList;
|
||||
|
||||
class Source
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "defines.h"
|
||||
#include "ImageShader.h"
|
||||
#include "Resource.h"
|
||||
#include "Primitives.h"
|
||||
#include "Decorations.h"
|
||||
#include "Stream.h"
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
29
View.cpp
29
View.cpp
@@ -15,6 +15,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
#include "View.h"
|
||||
#include "Mixer.h"
|
||||
#include "defines.h"
|
||||
#include "Settings.h"
|
||||
#include "Session.h"
|
||||
@@ -23,7 +24,7 @@
|
||||
#include "PickingVisitor.h"
|
||||
#include "BoundingBoxVisitor.h"
|
||||
#include "DrawVisitor.h"
|
||||
#include "Mesh.h"
|
||||
#include "Decorations.h"
|
||||
#include "Mixer.h"
|
||||
#include "UserInterfaceManager.h"
|
||||
#include "UpdateCallback.h"
|
||||
@@ -282,10 +283,10 @@ MixingView::MixingView() : View(MIXING), limbo_scale_(1.3f)
|
||||
slider_root_->attach(slider_);
|
||||
|
||||
|
||||
// stashCircle_ = new Disk();
|
||||
// stashCircle_->scale_ = glm::vec3(0.5f, 0.5f, 1.f);
|
||||
// stashCircle_->translation_ = glm::vec3(2.f, -1.0f, 0.f);
|
||||
// stashCircle_->color = glm::vec4( COLOR_STASH_CIRCLE, 0.6f );
|
||||
stashCircle_ = new Disk();
|
||||
stashCircle_->scale_ = glm::vec3(0.5f, 0.5f, 1.f);
|
||||
stashCircle_->translation_ = glm::vec3(2.f, -1.0f, 0.f);
|
||||
stashCircle_->color = glm::vec4( COLOR_STASH_CIRCLE, 0.6f );
|
||||
// scene.bg()->attach(stashCircle_);
|
||||
}
|
||||
|
||||
@@ -459,6 +460,22 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai
|
||||
// // diagonal translation with SHIFT
|
||||
// if (UserInterface::manager().shiftModifier()) {
|
||||
// s->group(mode_)->translation_.y = s->group(mode_)->translation_.x * s->stored_status_->translation_.y / s->stored_status_->translation_.x;
|
||||
// }
|
||||
|
||||
// // trying to enter stash
|
||||
// if ( glm::distance( glm::vec2(s->group(mode_)->translation_), glm::vec2(stashCircle_->translation_)) < stashCircle_->scale_.x) {
|
||||
|
||||
// // refuse to put an active source in stash
|
||||
// if (s->active())
|
||||
// s->group(mode_)->translation_ = s->stored_status_->translation_;
|
||||
// else {
|
||||
// Mixer::manager().conceal(s);
|
||||
// s->group(mode_)->scale_ = glm::vec3(MIXING_ICON_SCALE) - glm::vec3(0.1f, 0.1f, 0.f);
|
||||
// }
|
||||
// }
|
||||
// else if ( Mixer::manager().concealed(s) ) {
|
||||
// Mixer::manager().uncover(s);
|
||||
// s->group(mode_)->scale_ = glm::vec3(MIXING_ICON_SCALE);
|
||||
// }
|
||||
|
||||
// request update
|
||||
@@ -467,6 +484,8 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai
|
||||
std::ostringstream info;
|
||||
if (s->active())
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << s->blendingShader()->color.a;
|
||||
else if ( Mixer::manager().concealed(s) )
|
||||
info << "Stashed";
|
||||
else
|
||||
info << "Inactive";
|
||||
|
||||
|
||||
4
View.h
4
View.h
@@ -7,6 +7,8 @@
|
||||
#include "FrameBuffer.h"
|
||||
|
||||
class Source;
|
||||
typedef std::list<Source *> SourceList;
|
||||
|
||||
class SessionSource;
|
||||
class Surface;
|
||||
|
||||
@@ -117,8 +119,6 @@ private:
|
||||
class Disk *stashCircle_;
|
||||
class Mesh *mixingCircle_;
|
||||
|
||||
|
||||
// SourceList shash_;
|
||||
};
|
||||
|
||||
class RenderView : public View
|
||||
|
||||
35
defines.h
35
defines.h
@@ -32,6 +32,7 @@
|
||||
#define MIXING_DEFAULT_SCALE 2.4f
|
||||
#define MIXING_MIN_SCALE 0.8f
|
||||
#define MIXING_MAX_SCALE 7.0f
|
||||
#define MIXING_ICON_SCALE 0.15f, 0.15f, 1.f
|
||||
#define GEOMETRY_DEFAULT_SCALE 1.2f
|
||||
#define GEOMETRY_MIN_SCALE 0.2f
|
||||
#define GEOMETRY_MAX_SCALE 10.0f
|
||||
@@ -67,39 +68,7 @@
|
||||
#define COLOR_FRAME 0.8f, 0.f, 0.8f
|
||||
#define COLOR_LIMBO_CIRCLE 0.16f, 0.16f, 0.16f
|
||||
#define COLOR_SLIDER_CIRCLE 0.11f, 0.11f, 0.11f
|
||||
|
||||
// from glmixer
|
||||
#define TEXTURE_REQUIRED_MAXIMUM 2048
|
||||
#define CATALOG_TEXTURE_HEIGHT 96
|
||||
#define SELECTBUFSIZE 512
|
||||
#define CIRCLE_SIZE 8.0
|
||||
#define DEFAULT_LIMBO_SIZE 1.5
|
||||
#define MIN_LIMBO_SIZE 1.1
|
||||
#define MAX_LIMBO_SIZE 3.0
|
||||
#define DEFAULT_ICON_SIZE 1.75
|
||||
#define MIN_ICON_SIZE 1.0
|
||||
#define MAX_ICON_SIZE 2.5
|
||||
#define MIN_DEPTH_LAYER 0.0
|
||||
#define MAX_DEPTH_LAYER 40.0
|
||||
#define DEPTH_EPSILON 0.1
|
||||
#define DEPTH_DEFAULT_SPACING 1.0
|
||||
#define BORDER_SIZE 0.4
|
||||
#define CENTER_SIZE 1.2
|
||||
#define PROPERTY_DECIMALS 8
|
||||
#define COLOR_SOURCE 230, 230, 0
|
||||
#define COLOR_SOURCE_STATIC 230, 40, 40
|
||||
#define COLOR_SELECTION 10, 210, 40
|
||||
#define COLOR_SELECTION_AREA 50, 210, 50
|
||||
#define COLOR_CIRCLE 210, 30, 210
|
||||
#define COLOR_CIRCLE_MOVE 230, 30, 230
|
||||
#define COLOR_DRAWINGS 180, 180, 180
|
||||
#define COLOR_LIMBO 35, 35, 35
|
||||
//#define COLOR_LIMBO_CIRCLE 210, 160, 210
|
||||
#define COLOR_FADING 25, 25, 25
|
||||
#define COLOR_FLASHING 250, 250, 250
|
||||
#define COLOR_FRAME_MOVE 230, 30, 230
|
||||
#define COLOR_CURSOR 10, 100, 255
|
||||
|
||||
#define COLOR_STASH_CIRCLE 0.06f, 0.06f, 0.06f
|
||||
|
||||
|
||||
#endif // VMIX_DEFINES_H
|
||||
|
||||
Reference in New Issue
Block a user