mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cleanup of Session loading, saving, embedding in source and added option
to make sessionSource the current Session.
This commit is contained in:
@@ -279,6 +279,7 @@ set(VMIX_RSC_FILES
|
||||
./rsc/mesh/circle.ply
|
||||
./rsc/mesh/icon_video.ply
|
||||
./rsc/mesh/icon_image.ply
|
||||
./rsc/mesh/icon_vimix.ply
|
||||
)
|
||||
|
||||
add_executable(${VMIX_BINARY}
|
||||
|
||||
@@ -265,18 +265,25 @@ void ImGuiVisitor::visit (Source& s)
|
||||
s.groupNode(View::GEOMETRY)->accept(*this);
|
||||
|
||||
// Action on source
|
||||
ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||
// ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit (MediaSource& s)
|
||||
{
|
||||
if ( s.mediaplayer()->duration() == GST_CLOCK_TIME_NONE) {
|
||||
ImGui::Text("Image");
|
||||
}
|
||||
else {
|
||||
ImGui::Text("Video");
|
||||
if (ImGui::Button("Open Media Player", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
Settings::application.media_player = !Settings::application.media_player;
|
||||
Settings::application.media_player = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit (SessionSource& s)
|
||||
{
|
||||
// ImGui::Button("Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||
ImGui::Text("Session");
|
||||
if (ImGui::Button("Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
Mixer::manager().open( s.path() );
|
||||
Mixer::manager().set( s.detach() );
|
||||
}
|
||||
|
||||
@@ -26,11 +26,9 @@ MediaSource::MediaSource() : Source(), path_("")
|
||||
|
||||
MediaSource::~MediaSource()
|
||||
{
|
||||
// TODO delete media surface with visitor
|
||||
// delete media surface & player
|
||||
delete mediasurface_;
|
||||
|
||||
delete mediaplayer_;
|
||||
// TODO verify that all surfaces and node is deleted in Source destructor
|
||||
}
|
||||
|
||||
void MediaSource::setPath(const std::string &p)
|
||||
|
||||
114
Mixer.cpp
114
Mixer.cpp
@@ -21,46 +21,43 @@ using namespace tinyxml2;
|
||||
|
||||
#include "Mixer.h"
|
||||
|
||||
// static objects for multithreaded session loading
|
||||
// static semaphore to prevent multiple threads for load / save
|
||||
static std::atomic<bool> sessionThreadActive_ = false;
|
||||
static std::string sessionThreadFilename_ = "";
|
||||
static std::atomic<bool> sessionLoadFinished_ = false;
|
||||
static std::atomic<bool> sessionSwapRequested_ = false;
|
||||
|
||||
// static multithreaded session loading
|
||||
static void loadSession(const std::string& filename, Session *session)
|
||||
{
|
||||
while (sessionThreadActive_)
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds(50));
|
||||
sessionThreadActive_ = true;
|
||||
sessionLoadFinished_ = false;
|
||||
sessionThreadFilename_ = "";
|
||||
|
||||
// actual loading of xml file
|
||||
SessionCreator creator( session );
|
||||
|
||||
if (!creator.load(filename)) {
|
||||
if (creator.load(filename)) {
|
||||
// loaded ok
|
||||
session->setFilename(filename);
|
||||
sessionSwapRequested_ = true;
|
||||
|
||||
// cosmetics load ok
|
||||
Log::Notify("Session %s loaded. %d source(s) created.", filename.c_str(), session->numSource());
|
||||
}
|
||||
else {
|
||||
// error loading
|
||||
Log::Warning("Failed to load Session file %s.", filename.c_str());
|
||||
}
|
||||
else {
|
||||
// loaded ok
|
||||
Log::Notify("Session %s loaded. %d source(s) created.", filename.c_str(), session->numSource());
|
||||
}
|
||||
|
||||
sessionThreadFilename_ = filename;
|
||||
sessionLoadFinished_ = true;
|
||||
sessionThreadActive_ = false;
|
||||
}
|
||||
|
||||
// static objects for multithreaded session saving
|
||||
static std::atomic<bool> sessionSaveFinished_ = false;
|
||||
// static multithreaded session saving
|
||||
static void saveSession(const std::string& filename, Session *session)
|
||||
{
|
||||
// reset
|
||||
while (sessionThreadActive_)
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds(50));
|
||||
sessionThreadActive_ = true;
|
||||
sessionSaveFinished_ = false;
|
||||
sessionThreadFilename_ = "";
|
||||
|
||||
// creation of XML doc
|
||||
XMLDocument xmlDoc;
|
||||
@@ -103,27 +100,33 @@ static void saveSession(const std::string& filename, Session *session)
|
||||
}
|
||||
|
||||
// save file to disk
|
||||
XMLSaveDoc(&xmlDoc, filename);
|
||||
|
||||
// loaded ok
|
||||
Log::Notify("Session %s saved.", filename.c_str());
|
||||
|
||||
if ( XMLSaveDoc(&xmlDoc, filename) ) {
|
||||
// all ok
|
||||
sessionThreadFilename_ = filename;
|
||||
sessionSaveFinished_ = true;
|
||||
session->setFilename(filename);
|
||||
// cosmetics saved ok
|
||||
Settings::application.recentSessions.push(filename);
|
||||
Log::Notify("Session %s saved.", filename.c_str());
|
||||
}
|
||||
else {
|
||||
// error loading
|
||||
Log::Warning("Failed to save Session file %s.", filename.c_str());
|
||||
}
|
||||
|
||||
sessionThreadActive_ = false;
|
||||
}
|
||||
|
||||
Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullptr)
|
||||
{
|
||||
// this initializes with a new empty session
|
||||
newSession();
|
||||
// unsused initial empty session
|
||||
session_ = new Session;
|
||||
|
||||
// auto load if Settings ask to
|
||||
if ( Settings::application.recentSessions.load_at_start ) {
|
||||
if ( Settings::application.recentSessions.filenames.size() > 0 )
|
||||
if ( Settings::application.recentSessions.load_at_start &&
|
||||
Settings::application.recentSessions.filenames.size() > 0 )
|
||||
open( Settings::application.recentSessions.filenames.back() );
|
||||
}
|
||||
else
|
||||
// initializes with a new empty session
|
||||
clear();
|
||||
|
||||
// this initializes with the current view
|
||||
setCurrentView( (View::Mode) Settings::application.current_view );
|
||||
@@ -132,26 +135,18 @@ Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullpt
|
||||
void Mixer::update()
|
||||
{
|
||||
// change session when threaded loading is finished
|
||||
if (sessionLoadFinished_) {
|
||||
sessionLoadFinished_ = false;
|
||||
if (sessionSwapRequested_) {
|
||||
sessionSwapRequested_ = false;
|
||||
// successfully loading
|
||||
if ( back_session_ ) {
|
||||
// swap front and back sessions
|
||||
swap();
|
||||
// set session filename and remember it
|
||||
sessionFilename_ = sessionThreadFilename_;
|
||||
Settings::application.recentSessions.push(sessionFilename_);
|
||||
// set session filename
|
||||
Rendering::manager().setWindowTitle(session_->filename());
|
||||
Settings::application.recentSessions.push(session_->filename());
|
||||
}
|
||||
}
|
||||
|
||||
// confirm when threaded saving is finished
|
||||
if (sessionSaveFinished_) {
|
||||
sessionSaveFinished_ = false;
|
||||
// set (new) session filename and remember it
|
||||
sessionFilename_ = sessionThreadFilename_;
|
||||
Settings::application.recentSessions.push(sessionFilename_);
|
||||
}
|
||||
|
||||
// compute dt
|
||||
if (update_time_ == GST_CLOCK_TIME_NONE)
|
||||
update_time_ = gst_util_get_timestamp ();
|
||||
@@ -166,7 +161,6 @@ void Mixer::update()
|
||||
mixing_.update(dt);
|
||||
geometry_.update(dt);
|
||||
layer_.update(dt);
|
||||
// TODO other views?
|
||||
|
||||
// optimize the reordering in depth for views
|
||||
View::need_reordering_ = false;
|
||||
@@ -195,7 +189,7 @@ void Mixer::createSourceFile(std::string path)
|
||||
{
|
||||
// create a session source
|
||||
SessionSource *ss = new SessionSource();
|
||||
ss->setPath(path);
|
||||
ss->load(path);
|
||||
s = ss;
|
||||
}
|
||||
else {
|
||||
@@ -358,7 +352,7 @@ void Mixer::setCurrentView(View::Mode m)
|
||||
Settings::application.current_view = (int) m;
|
||||
}
|
||||
|
||||
View *Mixer::getView(View::Mode m)
|
||||
View *Mixer::view(View::Mode m)
|
||||
{
|
||||
switch (m) {
|
||||
case View::GEOMETRY:
|
||||
@@ -379,8 +373,8 @@ View *Mixer::currentView()
|
||||
|
||||
void Mixer::save()
|
||||
{
|
||||
if (!sessionFilename_.empty())
|
||||
saveas(sessionFilename_);
|
||||
if (!session_->filename().empty())
|
||||
saveas(session_->filename());
|
||||
}
|
||||
|
||||
void Mixer::saveas(const std::string& filename)
|
||||
@@ -457,7 +451,7 @@ void Mixer::swap()
|
||||
back_session_ = nullptr;
|
||||
}
|
||||
|
||||
void Mixer::newSession()
|
||||
void Mixer::clear()
|
||||
{
|
||||
// delete previous back session if needed
|
||||
if (back_session_)
|
||||
@@ -467,13 +461,21 @@ void Mixer::newSession()
|
||||
back_session_ = new Session;
|
||||
|
||||
// swap current with empty
|
||||
swap();
|
||||
|
||||
// default view config
|
||||
mixing_.restoreSettings();
|
||||
geometry_.restoreSettings();
|
||||
layer_.restoreSettings();
|
||||
|
||||
// empty session file name (does not save)
|
||||
sessionFilename_ = "";
|
||||
sessionSwapRequested_ = true;
|
||||
}
|
||||
|
||||
void Mixer::set(Session *s)
|
||||
{
|
||||
if ( s == nullptr )
|
||||
return;
|
||||
|
||||
// delete previous back session if needed
|
||||
if (back_session_)
|
||||
delete back_session_;
|
||||
|
||||
// set to new given session
|
||||
back_session_ = s;
|
||||
|
||||
// swap current with given session
|
||||
sessionSwapRequested_ = true;
|
||||
}
|
||||
|
||||
28
Mixer.h
28
Mixer.h
@@ -35,12 +35,12 @@ public:
|
||||
|
||||
// manangement of sources
|
||||
void createSourceFile(std::string path);
|
||||
|
||||
void deleteSource(Source *s);
|
||||
void deleteCurrentSource();
|
||||
void createSourceRender() {}
|
||||
void createSourceClone() {}
|
||||
|
||||
// operations on sources
|
||||
void renameSource(Source *s, const std::string &newname);
|
||||
void deleteSource(Source *s);
|
||||
|
||||
// current source
|
||||
void setCurrentSource(std::string namesource);
|
||||
@@ -48,22 +48,25 @@ public:
|
||||
void setCurrentSource(int index);
|
||||
void setCurrentSource(Source *s);
|
||||
void unsetCurrentSource();
|
||||
void deleteCurrentSource();
|
||||
Source *currentSource();
|
||||
int indexCurrentSource();
|
||||
|
||||
// management of view
|
||||
View *getView(View::Mode m);
|
||||
View *view(View::Mode m);
|
||||
void setCurrentView(View::Mode m);
|
||||
View *currentView();
|
||||
|
||||
void setSession(Session *s) { session_ = s; }
|
||||
Session *session() { return session_; }
|
||||
|
||||
// load and save session
|
||||
void open(const std::string& filename);
|
||||
void saveas(const std::string& filename);
|
||||
// manipulate, load and save sessions
|
||||
inline Session *session() const { return session_; }
|
||||
void clear();
|
||||
void save();
|
||||
void newSession();
|
||||
void saveas(const std::string& filename);
|
||||
void open(const std::string& filename);
|
||||
void import(const std::string& filename) {}
|
||||
void import(Session *s) {}
|
||||
void set(Session *s);
|
||||
// inline std::string currentSessionFile() { return currentFilename_; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -72,11 +75,10 @@ protected:
|
||||
void swap();
|
||||
|
||||
// void validateFilename(const std::string& filename);
|
||||
std::string sessionFilename_;
|
||||
// std::string currentFilename_;
|
||||
|
||||
void insertSource(Source *s);
|
||||
void setCurrentSource(SourceList::iterator it);
|
||||
|
||||
SourceList::iterator current_source_;
|
||||
int current_source_index_;
|
||||
|
||||
|
||||
@@ -207,6 +207,13 @@ void Rendering::GrabWindow(int dx, int dy)
|
||||
glfwSetWindowPos(main_window_, xpos + dx, ypos + dy);
|
||||
}
|
||||
|
||||
|
||||
void Rendering::setWindowTitle(std::string title)
|
||||
{
|
||||
std::string window_title = std::string(APP_NAME " -- ") + title;
|
||||
glfwSetWindowTitle(main_window_, window_title.c_str());
|
||||
}
|
||||
|
||||
void Rendering::PushFrontDrawCallback(RenderingCallback function)
|
||||
{
|
||||
draw_callbacks_.push_front(function);
|
||||
|
||||
@@ -68,28 +68,27 @@ public:
|
||||
// get Screenshot
|
||||
class Screenshot *CurrentScreenshot();
|
||||
|
||||
// window management
|
||||
void setWindowTitle(std::string title);
|
||||
// request fullscreen
|
||||
bool IsFullscreen ();
|
||||
void ToggleFullscreen();
|
||||
void ToggleFullscreen ();
|
||||
// get width of rendering area
|
||||
float Width();
|
||||
// get height of rendering area
|
||||
float Height();
|
||||
// get aspect ratio of rendering area
|
||||
float AspectRatio();
|
||||
// monitor management
|
||||
float MonitorWidth();
|
||||
float MonitorHeight();
|
||||
inline float DPIScale() const { return dpi_scale_; }
|
||||
|
||||
// get projection matrix (for sharers) => Views
|
||||
glm::mat4 Projection();
|
||||
// unproject from window coordinate
|
||||
glm::vec3 unProject(glm::vec2 screen_coordinate, glm::mat4 modelview = glm::mat4(1.f));
|
||||
|
||||
// for opengl pipeline in gstreamer
|
||||
void LinkPipeline( GstPipeline *pipeline );
|
||||
|
||||
float MonitorWidth();
|
||||
float MonitorHeight();
|
||||
inline float DPIScale() const { return dpi_scale_; }
|
||||
|
||||
private:
|
||||
|
||||
// loop update to begin new frame
|
||||
@@ -110,7 +109,8 @@ private:
|
||||
Screenshot screenshot_;
|
||||
bool request_screenshot_;
|
||||
|
||||
|
||||
// for opengl pipeline in gstreamer
|
||||
void LinkPipeline( GstPipeline *pipeline );
|
||||
};
|
||||
|
||||
|
||||
|
||||
12
Session.cpp
12
Session.cpp
@@ -1,19 +1,29 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "defines.h"
|
||||
#include "Settings.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "Session.h"
|
||||
#include "GarbageVisitor.h"
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
Session::Session()
|
||||
Session::Session() : filename_("")
|
||||
{
|
||||
config_[View::RENDERING] = new Group;
|
||||
config_[View::RENDERING]->scale_ = render_.resolution();
|
||||
|
||||
config_[View::GEOMETRY] = new Group;
|
||||
config_[View::GEOMETRY]->scale_ = Settings::application.views[View::GEOMETRY].default_scale;
|
||||
config_[View::GEOMETRY]->translation_ = Settings::application.views[View::GEOMETRY].default_translation;
|
||||
|
||||
config_[View::LAYER] = new Group;
|
||||
config_[View::LAYER]->scale_ = Settings::application.views[View::LAYER].default_scale;
|
||||
config_[View::LAYER]->translation_ = Settings::application.views[View::LAYER].default_translation;
|
||||
|
||||
config_[View::MIXING] = new Group;
|
||||
config_[View::MIXING]->scale_ = Settings::application.views[View::MIXING].default_scale;
|
||||
config_[View::MIXING]->translation_ = Settings::application.views[View::MIXING].default_translation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,12 +19,11 @@ public:
|
||||
SourceList::iterator begin ();
|
||||
SourceList::iterator end ();
|
||||
SourceList::iterator find (int index);
|
||||
int index (SourceList::iterator it) const;
|
||||
SourceList::iterator find (Source *s);
|
||||
SourceList::iterator find (std::string name);
|
||||
SourceList::iterator find (Node *node);
|
||||
|
||||
uint numSource() const;
|
||||
int index (SourceList::iterator it) const;
|
||||
|
||||
// update all sources
|
||||
void update (float dt);
|
||||
@@ -36,10 +35,14 @@ public:
|
||||
// configuration for group nodes of views
|
||||
inline Group *config (View::Mode m) const { return config_.at(m); }
|
||||
|
||||
// name of file containing this session
|
||||
void setFilename(const std::string &filename) { filename_ = filename; }
|
||||
std::string filename() const { return filename_; }
|
||||
|
||||
protected:
|
||||
RenderView render_;
|
||||
SourceList sources_;
|
||||
|
||||
std::string filename_;
|
||||
std::map<View::Mode, Group*> config_;
|
||||
};
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ void SessionCreator::visit (SessionSource& s)
|
||||
XMLElement* pathNode = xmlCurrent_->FirstChildElement("path");
|
||||
if (pathNode) {
|
||||
std::string path = std::string ( pathNode->GetText() );
|
||||
s.setPath(path);
|
||||
s.load(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,17 @@ void SessionSource::loadSession(const std::string& filename, SessionSource *sour
|
||||
// actual loading of xml file
|
||||
SessionCreator creator( source->session_ );
|
||||
|
||||
if (!creator.load(filename)) {
|
||||
if (creator.load(filename)) {
|
||||
// all ok, validate session filename
|
||||
source->session_->setFilename(filename);
|
||||
}
|
||||
else {
|
||||
// error loading
|
||||
Log::Notify("Failed to load Session file %s.", filename.c_str());
|
||||
source->loadFailed_ = true;
|
||||
}
|
||||
|
||||
// end thread
|
||||
source->loadFinished_ = true;
|
||||
}
|
||||
|
||||
@@ -49,14 +54,15 @@ SessionSource::SessionSource() : Source(), path_("")
|
||||
|
||||
SessionSource::~SessionSource()
|
||||
{
|
||||
// TODO delete media surface with visitor
|
||||
// delete surface
|
||||
delete sessionsurface_;
|
||||
|
||||
// TODO close and delete session
|
||||
// delete session
|
||||
if (session_)
|
||||
delete session_;
|
||||
}
|
||||
|
||||
void SessionSource::setPath(const std::string &p)
|
||||
void SessionSource::load(const std::string &p)
|
||||
{
|
||||
path_ = p;
|
||||
|
||||
@@ -66,14 +72,15 @@ void SessionSource::setPath(const std::string &p)
|
||||
Log::Notify("Opening %s", p.c_str());
|
||||
}
|
||||
|
||||
std::string SessionSource::path() const
|
||||
Session *SessionSource::detach()
|
||||
{
|
||||
return path_;
|
||||
}
|
||||
// remember pointer to give away
|
||||
Session *giveaway = session_;
|
||||
|
||||
Session *SessionSource::session() const
|
||||
{
|
||||
return session_;
|
||||
// work on a new session
|
||||
session_ = new Session;
|
||||
|
||||
return giveaway;
|
||||
}
|
||||
|
||||
bool SessionSource::failed() const
|
||||
@@ -89,11 +96,15 @@ void SessionSource::init()
|
||||
// set resolution
|
||||
session_->setResolution( session_->config(View::RENDERING)->scale_ );
|
||||
|
||||
// update once
|
||||
session_->update(dt_);
|
||||
|
||||
// get the texture index from media player, apply it to the media surface
|
||||
sessionsurface_->setTextureIndex( session_->frame()->texture() );
|
||||
|
||||
// create Frame buffer matching size of media player
|
||||
renderbuffer_ = new FrameBuffer(session_->frame()->resolution());
|
||||
renderbuffer_->setClearColor(glm::vec4(0.f, 0.f, 0.f, 1.f));
|
||||
|
||||
// create the surfaces to draw the frame buffer in the views
|
||||
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
|
||||
@@ -108,8 +119,8 @@ void SessionSource::init()
|
||||
if (is) is->stipple = 1.0;
|
||||
groups_[View::MIXING]->attach(surfacemix);
|
||||
groups_[View::LAYER]->attach(surfacemix);
|
||||
// TODO icon session
|
||||
// overlays_[View::MIXING]->attach( new Mesh("mesh/icon_video.ply") );
|
||||
// icon session
|
||||
overlays_[View::MIXING]->attach( new Mesh("mesh/icon_vimix.ply") );
|
||||
|
||||
// scale all mixing nodes to match aspect ratio of the media
|
||||
for (NodeSet::iterator node = groups_[View::MIXING]->begin();
|
||||
@@ -141,13 +152,13 @@ void SessionSource::init()
|
||||
void SessionSource::render()
|
||||
{
|
||||
if (!initialized_)
|
||||
{
|
||||
init();
|
||||
}
|
||||
else {
|
||||
// update session
|
||||
session_->update(dt_);
|
||||
|
||||
sessionsurface_->setTextureIndex( session_->frame()->texture() );
|
||||
|
||||
// render the media player into frame buffer
|
||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f);
|
||||
renderbuffer_->begin();
|
||||
|
||||
@@ -16,10 +16,12 @@ public:
|
||||
void accept (Visitor& v) override;
|
||||
bool failed() const override;
|
||||
|
||||
// Media specific interface
|
||||
void setPath(const std::string &p);
|
||||
std::string path() const;
|
||||
Session *session() const;
|
||||
// Session Source specific interface
|
||||
void load(const std::string &p);
|
||||
Session *detach();
|
||||
|
||||
inline std::string path() const { return path_; }
|
||||
inline Session *session() const { return session_; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ struct Application
|
||||
current_view = 1;
|
||||
framebuffer_ar = 3;
|
||||
framebuffer_h = 1;
|
||||
windows.push_back(WindowConfig(APP_TITLE));
|
||||
windows.push_back(WindowConfig(APP_NAME APP_TITLE));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -212,11 +212,14 @@ void UserInterface::handleKeyboard()
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_S )) {
|
||||
// Save Session
|
||||
if (Mixer::manager().session()->filename().empty())
|
||||
std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach();
|
||||
else
|
||||
Mixer::manager().save();
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_W )) {
|
||||
// New Session
|
||||
Mixer::manager().newSession();
|
||||
Mixer::manager().clear();
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_L )) {
|
||||
// Logs
|
||||
@@ -237,6 +240,7 @@ void UserInterface::handleKeyboard()
|
||||
|
||||
}
|
||||
else {
|
||||
// TODO make sure no entry / window box is active
|
||||
keyboard_modifier_active = false;
|
||||
|
||||
// Action keys
|
||||
@@ -472,6 +476,9 @@ void UserInterface::showMenuFile()
|
||||
navigator.hidePannel();
|
||||
}
|
||||
if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) {
|
||||
if (Mixer::manager().session()->filename().empty())
|
||||
std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach();
|
||||
else
|
||||
Mixer::manager().save();
|
||||
navigator.hidePannel();
|
||||
}
|
||||
@@ -483,7 +490,7 @@ void UserInterface::showMenuFile()
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem( ICON_FA_FILE " New", "Ctrl+W")) {
|
||||
Mixer::manager().newSession();
|
||||
Mixer::manager().clear();
|
||||
navigator.hidePannel();
|
||||
}
|
||||
ImGui::SetNextItemWidth( ImGui::GetContentRegionAvail().x );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define VMIX_DEFINES_H
|
||||
|
||||
#define APP_NAME "vimix"
|
||||
#define APP_TITLE "vimix -- Video Live Mixer"
|
||||
#define APP_TITLE " -- Video Live Mixer"
|
||||
#define APP_SETTINGS "vimix.xml"
|
||||
#define APP_VERSION_MAJOR 0
|
||||
#define APP_VERSION_MINOR 1
|
||||
|
||||
24
main.cpp
24
main.cpp
@@ -45,29 +45,9 @@
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
|
||||
void drawCustomGui()
|
||||
{
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(200, 200), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(300, 300), ImGuiCond_FirstUseEver);
|
||||
|
||||
if ( !ImGui::Begin("Custom"))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
void drawScene()
|
||||
{
|
||||
// Mixer::manager().update();
|
||||
|
||||
Mixer::manager().draw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +82,7 @@ int main(int, char**)
|
||||
// test text editor
|
||||
UserInterface::manager().fillShaderEditor( Resource::getText("shaders/image.fs") );
|
||||
|
||||
// init the scene
|
||||
// draw the scene
|
||||
Rendering::manager().PushFrontDrawCallback(drawScene);
|
||||
|
||||
// init elements to the scene
|
||||
@@ -135,8 +115,6 @@ int main(int, char**)
|
||||
Rendering::manager().Draw();
|
||||
}
|
||||
|
||||
// Mixer::manager().save("./testsession.vmx");
|
||||
|
||||
UserInterface::manager().Terminate();
|
||||
Rendering::manager().Terminate();
|
||||
|
||||
|
||||
@@ -12,67 +12,67 @@ property uchar alpha
|
||||
element face 57
|
||||
property list uchar uint vertex_indices
|
||||
end_header
|
||||
-0.121622 1.052659 0.000000 255 255 255 255
|
||||
-0.101327 1.214990 0.000000 255 255 255 255
|
||||
-0.121622 1.235281 0.000000 255 255 255 255
|
||||
0.121924 1.235281 0.000000 255 255 255 255
|
||||
0.101629 1.214990 0.000000 255 255 255 255
|
||||
0.121924 1.052659 0.000000 255 255 255 255
|
||||
-0.101327 1.072951 0.000000 255 255 255 255
|
||||
0.101629 1.072951 0.000000 255 255 255 255
|
||||
-0.057726 1.194559 0.000000 255 255 255 255
|
||||
-0.053597 1.194559 0.000000 255 255 255 255
|
||||
-0.055662 1.194698 0.000000 255 255 255 255
|
||||
-0.051617 1.194155 0.000000 255 255 255 255
|
||||
-0.059707 1.194155 0.000000 255 255 255 255
|
||||
-0.049739 1.193502 0.000000 255 255 255 255
|
||||
-0.061585 1.193502 0.000000 255 255 255 255
|
||||
-0.047981 1.192620 0.000000 255 255 255 255
|
||||
-0.063343 1.192620 0.000000 255 255 255 255
|
||||
-0.046362 1.191526 0.000000 255 255 255 255
|
||||
-0.064961 1.191526 0.000000 255 255 255 255
|
||||
-0.044900 1.190239 0.000000 255 255 255 255
|
||||
-0.066424 1.190239 0.000000 255 255 255 255
|
||||
-0.043613 1.188778 0.000000 255 255 255 255
|
||||
-0.067711 1.188778 0.000000 255 255 255 255
|
||||
-0.042519 1.187159 0.000000 255 255 255 255
|
||||
-0.068804 1.187159 0.000000 255 255 255 255
|
||||
-0.041637 1.185402 0.000000 255 255 255 255
|
||||
-0.069687 1.185402 0.000000 255 255 255 255
|
||||
-0.040984 1.183524 0.000000 255 255 255 255
|
||||
-0.070339 1.183524 0.000000 255 255 255 255
|
||||
-0.040579 1.181544 0.000000 255 255 255 255
|
||||
-0.070744 1.181544 0.000000 255 255 255 255
|
||||
-0.040440 1.179480 0.000000 255 255 255 255
|
||||
-0.070883 1.179480 0.000000 255 255 255 255
|
||||
-0.070744 1.177414 0.000000 255 255 255 255
|
||||
-0.040579 1.177414 0.000000 255 255 255 255
|
||||
-0.070339 1.175432 0.000000 255 255 255 255
|
||||
-0.040984 1.175432 0.000000 255 255 255 255
|
||||
-0.069687 1.173554 0.000000 255 255 255 255
|
||||
-0.041637 1.173554 0.000000 255 255 255 255
|
||||
-0.005116 1.133825 0.000000 255 255 255 255
|
||||
0.071185 1.093242 0.000000 255 255 255 255
|
||||
0.020447 1.174407 0.000000 255 255 255 255
|
||||
-0.068804 1.171796 0.000000 255 255 255 255
|
||||
-0.042519 1.171796 0.000000 255 255 255 255
|
||||
-0.067711 1.170178 0.000000 255 255 255 255
|
||||
-0.043613 1.170178 0.000000 255 255 255 255
|
||||
-0.066424 1.168717 0.000000 255 255 255 255
|
||||
-0.044900 1.168717 0.000000 255 255 255 255
|
||||
-0.064961 1.167431 0.000000 255 255 255 255
|
||||
-0.046362 1.167431 0.000000 255 255 255 255
|
||||
-0.063343 1.166338 0.000000 255 255 255 255
|
||||
-0.047981 1.166338 0.000000 255 255 255 255
|
||||
-0.061585 1.165457 0.000000 255 255 255 255
|
||||
-0.049739 1.165457 0.000000 255 255 255 255
|
||||
-0.059707 1.164805 0.000000 255 255 255 255
|
||||
-0.051617 1.164805 0.000000 255 255 255 255
|
||||
-0.057726 1.164400 0.000000 255 255 255 255
|
||||
-0.053597 1.164400 0.000000 255 255 255 255
|
||||
-0.055662 1.164261 0.000000 255 255 255 255
|
||||
-0.070883 1.093242 0.000000 255 255 255 255
|
||||
-0.030292 1.153710 0.000000 255 255 255 255
|
||||
-0.121043 1.084839 0.000000 255 255 255 255
|
||||
-0.100747 1.247170 0.000000 255 255 255 255
|
||||
-0.121043 1.267461 0.000000 255 255 255 255
|
||||
0.122504 1.267461 0.000000 255 255 255 255
|
||||
0.102208 1.247170 0.000000 255 255 255 255
|
||||
0.122504 1.084839 0.000000 255 255 255 255
|
||||
-0.100747 1.105131 0.000000 255 255 255 255
|
||||
0.102208 1.105131 0.000000 255 255 255 255
|
||||
-0.057147 1.226739 0.000000 255 255 255 255
|
||||
-0.053018 1.226740 0.000000 255 255 255 255
|
||||
-0.055082 1.226879 0.000000 255 255 255 255
|
||||
-0.051037 1.226335 0.000000 255 255 255 255
|
||||
-0.059127 1.226335 0.000000 255 255 255 255
|
||||
-0.049159 1.225682 0.000000 255 255 255 255
|
||||
-0.061005 1.225682 0.000000 255 255 255 255
|
||||
-0.047402 1.224800 0.000000 255 255 255 255
|
||||
-0.062763 1.224800 0.000000 255 255 255 255
|
||||
-0.045783 1.223706 0.000000 255 255 255 255
|
||||
-0.064382 1.223706 0.000000 255 255 255 255
|
||||
-0.044321 1.222420 0.000000 255 255 255 255
|
||||
-0.065844 1.222420 0.000000 255 255 255 255
|
||||
-0.043034 1.220958 0.000000 255 255 255 255
|
||||
-0.067131 1.220958 0.000000 255 255 255 255
|
||||
-0.041940 1.219339 0.000000 255 255 255 255
|
||||
-0.068225 1.219339 0.000000 255 255 255 255
|
||||
-0.041057 1.217582 0.000000 255 255 255 255
|
||||
-0.069107 1.217582 0.000000 255 255 255 255
|
||||
-0.040405 1.215704 0.000000 255 255 255 255
|
||||
-0.069760 1.215704 0.000000 255 255 255 255
|
||||
-0.040000 1.213724 0.000000 255 255 255 255
|
||||
-0.070165 1.213724 0.000000 255 255 255 255
|
||||
-0.039861 1.211660 0.000000 255 255 255 255
|
||||
-0.070304 1.211660 0.000000 255 255 255 255
|
||||
-0.070165 1.209594 0.000000 255 255 255 255
|
||||
-0.040000 1.209594 0.000000 255 255 255 255
|
||||
-0.069760 1.207612 0.000000 255 255 255 255
|
||||
-0.040405 1.207612 0.000000 255 255 255 255
|
||||
-0.069107 1.205734 0.000000 255 255 255 255
|
||||
-0.041057 1.205734 0.000000 255 255 255 255
|
||||
-0.004536 1.166005 0.000000 255 255 255 255
|
||||
0.071765 1.125422 0.000000 255 255 255 255
|
||||
0.021026 1.206587 0.000000 255 255 255 255
|
||||
-0.068225 1.203976 0.000000 255 255 255 255
|
||||
-0.041940 1.203976 0.000000 255 255 255 255
|
||||
-0.067131 1.202358 0.000000 255 255 255 255
|
||||
-0.043034 1.202358 0.000000 255 255 255 255
|
||||
-0.065844 1.200897 0.000000 255 255 255 255
|
||||
-0.044321 1.200897 0.000000 255 255 255 255
|
||||
-0.064382 1.199611 0.000000 255 255 255 255
|
||||
-0.045783 1.199611 0.000000 255 255 255 255
|
||||
-0.062763 1.198518 0.000000 255 255 255 255
|
||||
-0.047402 1.198518 0.000000 255 255 255 255
|
||||
-0.061005 1.197637 0.000000 255 255 255 255
|
||||
-0.049159 1.197637 0.000000 255 255 255 255
|
||||
-0.059127 1.196985 0.000000 255 255 255 255
|
||||
-0.051037 1.196985 0.000000 255 255 255 255
|
||||
-0.057147 1.196580 0.000000 255 255 255 255
|
||||
-0.053018 1.196580 0.000000 255 255 255 255
|
||||
-0.055082 1.196442 0.000000 255 255 255 255
|
||||
-0.070304 1.125422 0.000000 255 255 255 255
|
||||
-0.029713 1.185890 0.000000 255 255 255 255
|
||||
3 0 1 2
|
||||
3 1 3 2
|
||||
3 1 4 3
|
||||
|
||||
@@ -12,70 +12,70 @@ property uchar alpha
|
||||
element face 80
|
||||
property list uchar uint vertex_indices
|
||||
end_header
|
||||
-0.119887 1.034463 0.000000 255 255 255 255
|
||||
-0.099881 1.254489 0.000000 255 255 255 255
|
||||
-0.119887 1.254489 0.000000 255 255 255 255
|
||||
-0.099881 1.234487 0.000000 255 255 255 255
|
||||
-0.079874 1.234487 0.000000 255 255 255 255
|
||||
-0.059867 1.254489 0.000000 255 255 255 255
|
||||
-0.079874 1.254489 0.000000 255 255 255 255
|
||||
-0.059867 1.214485 0.000000 255 255 255 255
|
||||
0.060172 1.214485 0.000000 255 255 255 255
|
||||
0.080179 1.254489 0.000000 255 255 255 255
|
||||
0.060172 1.254489 0.000000 255 255 255 255
|
||||
0.080179 1.234487 0.000000 255 255 255 255
|
||||
0.100185 1.234487 0.000000 255 255 255 255
|
||||
0.120192 1.254489 0.000000 255 255 255 255
|
||||
0.100185 1.254489 0.000000 255 255 255 255
|
||||
0.120192 1.034463 0.000000 255 255 255 255
|
||||
-0.099881 1.214485 0.000000 255 255 255 255
|
||||
0.080179 1.214485 0.000000 255 255 255 255
|
||||
0.100185 1.214485 0.000000 255 255 255 255
|
||||
-0.099881 1.194482 0.000000 255 255 255 255
|
||||
-0.079874 1.214485 0.000000 255 255 255 255
|
||||
-0.079874 1.194482 0.000000 255 255 255 255
|
||||
0.080179 1.194482 0.000000 255 255 255 255
|
||||
0.100185 1.194482 0.000000 255 255 255 255
|
||||
-0.099881 1.174480 0.000000 255 255 255 255
|
||||
-0.059867 1.184481 0.000000 255 255 255 255
|
||||
0.060172 1.184481 0.000000 255 255 255 255
|
||||
0.100185 1.174480 0.000000 255 255 255 255
|
||||
-0.079874 1.174480 0.000000 255 255 255 255
|
||||
-0.059867 1.104472 0.000000 255 255 255 255
|
||||
0.060172 1.104472 0.000000 255 255 255 255
|
||||
0.080179 1.174480 0.000000 255 255 255 255
|
||||
-0.099881 1.154478 0.000000 255 255 255 255
|
||||
-0.079874 1.154478 0.000000 255 255 255 255
|
||||
0.080179 1.154478 0.000000 255 255 255 255
|
||||
0.100185 1.154478 0.000000 255 255 255 255
|
||||
-0.099881 1.134475 0.000000 255 255 255 255
|
||||
-0.079874 1.134475 0.000000 255 255 255 255
|
||||
0.080179 1.134475 0.000000 255 255 255 255
|
||||
0.100185 1.134475 0.000000 255 255 255 255
|
||||
-0.099881 1.114473 0.000000 255 255 255 255
|
||||
-0.079874 1.114473 0.000000 255 255 255 255
|
||||
0.080179 1.114473 0.000000 255 255 255 255
|
||||
0.100185 1.114473 0.000000 255 255 255 255
|
||||
-0.099881 1.094470 0.000000 255 255 255 255
|
||||
0.100185 1.094470 0.000000 255 255 255 255
|
||||
-0.099881 1.074468 0.000000 255 255 255 255
|
||||
-0.079874 1.094470 0.000000 255 255 255 255
|
||||
-0.079874 1.074468 0.000000 255 255 255 255
|
||||
0.080179 1.094470 0.000000 255 255 255 255
|
||||
0.080179 1.074468 0.000000 255 255 255 255
|
||||
0.100185 1.074468 0.000000 255 255 255 255
|
||||
-0.099881 1.054466 0.000000 255 255 255 255
|
||||
-0.059867 1.074468 0.000000 255 255 255 255
|
||||
-0.079874 1.054466 0.000000 255 255 255 255
|
||||
-0.059867 1.034463 0.000000 255 255 255 255
|
||||
0.060172 1.074468 0.000000 255 255 255 255
|
||||
0.060172 1.034463 0.000000 255 255 255 255
|
||||
0.080179 1.054466 0.000000 255 255 255 255
|
||||
0.100185 1.054466 0.000000 255 255 255 255
|
||||
-0.099881 1.034463 0.000000 255 255 255 255
|
||||
-0.079874 1.034463 0.000000 255 255 255 255
|
||||
0.080179 1.034463 0.000000 255 255 255 255
|
||||
0.100185 1.034463 0.000000 255 255 255 255
|
||||
-0.119887 1.061288 0.000000 255 255 255 255
|
||||
-0.099881 1.281314 0.000000 255 255 255 255
|
||||
-0.119887 1.281314 0.000000 255 255 255 255
|
||||
-0.099881 1.261312 0.000000 255 255 255 255
|
||||
-0.079874 1.261312 0.000000 255 255 255 255
|
||||
-0.059867 1.281314 0.000000 255 255 255 255
|
||||
-0.079874 1.281314 0.000000 255 255 255 255
|
||||
-0.059867 1.241309 0.000000 255 255 255 255
|
||||
0.060172 1.241309 0.000000 255 255 255 255
|
||||
0.080179 1.281314 0.000000 255 255 255 255
|
||||
0.060172 1.281314 0.000000 255 255 255 255
|
||||
0.080179 1.261312 0.000000 255 255 255 255
|
||||
0.100185 1.261312 0.000000 255 255 255 255
|
||||
0.120192 1.281314 0.000000 255 255 255 255
|
||||
0.100185 1.281314 0.000000 255 255 255 255
|
||||
0.120192 1.061288 0.000000 255 255 255 255
|
||||
-0.099881 1.241309 0.000000 255 255 255 255
|
||||
0.080179 1.241309 0.000000 255 255 255 255
|
||||
0.100185 1.241309 0.000000 255 255 255 255
|
||||
-0.099881 1.221307 0.000000 255 255 255 255
|
||||
-0.079874 1.241309 0.000000 255 255 255 255
|
||||
-0.079874 1.221307 0.000000 255 255 255 255
|
||||
0.080179 1.221307 0.000000 255 255 255 255
|
||||
0.100185 1.221307 0.000000 255 255 255 255
|
||||
-0.099881 1.201305 0.000000 255 255 255 255
|
||||
-0.059867 1.211306 0.000000 255 255 255 255
|
||||
0.060172 1.211306 0.000000 255 255 255 255
|
||||
0.100185 1.201305 0.000000 255 255 255 255
|
||||
-0.079874 1.201305 0.000000 255 255 255 255
|
||||
-0.059867 1.131296 0.000000 255 255 255 255
|
||||
0.060172 1.131296 0.000000 255 255 255 255
|
||||
0.080179 1.201305 0.000000 255 255 255 255
|
||||
-0.099881 1.181302 0.000000 255 255 255 255
|
||||
-0.079874 1.181302 0.000000 255 255 255 255
|
||||
0.080179 1.181302 0.000000 255 255 255 255
|
||||
0.100185 1.181302 0.000000 255 255 255 255
|
||||
-0.099881 1.161300 0.000000 255 255 255 255
|
||||
-0.079874 1.161300 0.000000 255 255 255 255
|
||||
0.080179 1.161300 0.000000 255 255 255 255
|
||||
0.100185 1.161300 0.000000 255 255 255 255
|
||||
-0.099881 1.141298 0.000000 255 255 255 255
|
||||
-0.079874 1.141298 0.000000 255 255 255 255
|
||||
0.080179 1.141298 0.000000 255 255 255 255
|
||||
0.100185 1.141298 0.000000 255 255 255 255
|
||||
-0.099881 1.121295 0.000000 255 255 255 255
|
||||
0.100185 1.121295 0.000000 255 255 255 255
|
||||
-0.099881 1.101293 0.000000 255 255 255 255
|
||||
-0.079874 1.121295 0.000000 255 255 255 255
|
||||
-0.079874 1.101293 0.000000 255 255 255 255
|
||||
0.080179 1.121295 0.000000 255 255 255 255
|
||||
0.080179 1.101293 0.000000 255 255 255 255
|
||||
0.100185 1.101293 0.000000 255 255 255 255
|
||||
-0.099881 1.081290 0.000000 255 255 255 255
|
||||
-0.059867 1.101293 0.000000 255 255 255 255
|
||||
-0.079874 1.081290 0.000000 255 255 255 255
|
||||
-0.059867 1.061288 0.000000 255 255 255 255
|
||||
0.060172 1.101293 0.000000 255 255 255 255
|
||||
0.060172 1.061288 0.000000 255 255 255 255
|
||||
0.080179 1.081290 0.000000 255 255 255 255
|
||||
0.100185 1.081290 0.000000 255 255 255 255
|
||||
-0.099881 1.061288 0.000000 255 255 255 255
|
||||
-0.079874 1.061288 0.000000 255 255 255 255
|
||||
0.080179 1.061288 0.000000 255 255 255 255
|
||||
0.100185 1.061288 0.000000 255 255 255 255
|
||||
3 0 1 2
|
||||
3 0 3 1
|
||||
3 4 5 6
|
||||
|
||||
@@ -81,7 +81,7 @@ void tinyxml2::XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix)
|
||||
}
|
||||
}
|
||||
|
||||
void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
|
||||
bool tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
|
||||
{
|
||||
XMLDeclaration *pDec = doc->NewDeclaration();
|
||||
doc->InsertFirstChild(pDec);
|
||||
@@ -92,7 +92,7 @@ void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
|
||||
|
||||
// save session
|
||||
XMLError eResult = doc->SaveFile(filename.c_str());
|
||||
XMLResultError(eResult);
|
||||
return !XMLResultError(eResult);
|
||||
}
|
||||
|
||||
bool tinyxml2::XMLResultError(int result)
|
||||
|
||||
@@ -18,7 +18,7 @@ void XMLElementToGLM(XMLElement *elem, glm::vec4 &vector);
|
||||
void XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix);
|
||||
|
||||
|
||||
void XMLSaveDoc(tinyxml2::XMLDocument * const doc, std::string filename);
|
||||
bool XMLSaveDoc(tinyxml2::XMLDocument * const doc, std::string filename);
|
||||
bool XMLResultError(int result);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user