mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 10:49:59 +01:00
Loading and saving SessionSource in vmx session file.
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
#include "ImageShader.h"
|
#include "ImageShader.h"
|
||||||
#include "ImageProcessingShader.h"
|
#include "ImageProcessingShader.h"
|
||||||
#include "MediaPlayer.h"
|
#include "MediaPlayer.h"
|
||||||
|
#include "MediaSource.h"
|
||||||
|
#include "SessionSource.h"
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "ImGuiToolkit.h"
|
#include "ImGuiToolkit.h"
|
||||||
@@ -99,6 +101,15 @@ void ImGuiVisitor::visit(Animation &n)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGuiVisitor::visit(Scene &n)
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||||
|
if (ImGui::CollapsingHeader("Scene Property Tree"))
|
||||||
|
{
|
||||||
|
n.root()->accept(*this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ImGuiVisitor::visit(Primitive &n)
|
void ImGuiVisitor::visit(Primitive &n)
|
||||||
{
|
{
|
||||||
ImGui::PushID(n.id());
|
ImGui::PushID(n.id());
|
||||||
@@ -234,13 +245,34 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiVisitor::visit(Scene &n)
|
|
||||||
|
void ImGuiVisitor::visit (Source& s)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
// blending
|
||||||
if (ImGui::CollapsingHeader("Scene Property Tree"))
|
s.blendingShader()->accept(*this);
|
||||||
{
|
|
||||||
n.root()->accept(*this);
|
// preview
|
||||||
}
|
float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
|
||||||
|
ImVec2 imagesize ( preview_width, preview_width / s.frame()->aspectRatio());
|
||||||
|
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), imagesize);
|
||||||
|
|
||||||
|
// image processing pannel
|
||||||
|
s.processingShader()->accept(*this);
|
||||||
|
|
||||||
|
// geometry direct control
|
||||||
|
s.groupNode(View::GEOMETRY)->accept(*this);
|
||||||
|
|
||||||
|
// Action on source
|
||||||
|
ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGuiVisitor::visit (MediaSource& s)
|
||||||
|
{
|
||||||
|
ImGui::Button("Open Media Player", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiVisitor::visit (SessionSource& s)
|
||||||
|
{
|
||||||
|
ImGui::Button("Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||||
|
ImGui::Button("Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0));
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public:
|
|||||||
void visit(Shader& n) override;
|
void visit(Shader& n) override;
|
||||||
void visit(ImageShader& n) override;
|
void visit(ImageShader& n) override;
|
||||||
void visit(ImageProcessingShader& n) override;
|
void visit(ImageProcessingShader& n) override;
|
||||||
|
void visit (Source& s) override;
|
||||||
|
void visit (MediaSource& s) override;
|
||||||
|
void visit (SessionSource& s) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IMGUIVISITOR_H
|
#endif // IMGUIVISITOR_H
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Mesh.h"
|
#include "Mesh.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
#include "MediaSource.h"
|
#include "MediaSource.h"
|
||||||
|
#include "SessionSource.h"
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "ImageShader.h"
|
#include "ImageShader.h"
|
||||||
#include "ImageProcessingShader.h"
|
#include "ImageProcessingShader.h"
|
||||||
@@ -67,11 +68,18 @@ void SessionCreator::loadSession(XMLElement *sessionNode)
|
|||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
const char *pType = xmlCurrent_->Attribute("type");
|
const char *pType = xmlCurrent_->Attribute("type");
|
||||||
|
if (!pType)
|
||||||
|
continue;
|
||||||
if ( std::string(pType) == "MediaSource") {
|
if ( std::string(pType) == "MediaSource") {
|
||||||
MediaSource *new_media_source = new MediaSource();
|
MediaSource *new_media_source = new MediaSource();
|
||||||
new_media_source->accept(*this);
|
new_media_source->accept(*this);
|
||||||
session_->addSource(new_media_source);
|
session_->addSource(new_media_source);
|
||||||
}
|
}
|
||||||
|
if ( std::string(pType) == "SessionSource") {
|
||||||
|
SessionSource *new_session_source = new SessionSource();
|
||||||
|
new_session_source->accept(*this);
|
||||||
|
session_->addSource(new_session_source);
|
||||||
|
}
|
||||||
// TODO : create other types of source
|
// TODO : create other types of source
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -220,6 +228,17 @@ void SessionCreator::visit (MediaSource& s)
|
|||||||
s.mediaplayer()->accept(*this);
|
s.mediaplayer()->accept(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionCreator::visit (SessionSource& s)
|
||||||
|
{
|
||||||
|
// set uri
|
||||||
|
XMLElement* pathNode = xmlCurrent_->FirstChildElement("path");
|
||||||
|
if (pathNode) {
|
||||||
|
std::string path = std::string ( pathNode->GetText() );
|
||||||
|
s.setPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
void visit (Source& s) override;
|
void visit (Source& s) override;
|
||||||
void visit (MediaSource& s) override;
|
void visit (MediaSource& s) override;
|
||||||
|
void visit (SessionSource& s) override;
|
||||||
|
|
||||||
static void XMLToNode(tinyxml2::XMLElement *xml, Node &n);
|
static void XMLToNode(tinyxml2::XMLElement *xml, Node &n);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "Mesh.h"
|
#include "Mesh.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
#include "MediaSource.h"
|
#include "MediaSource.h"
|
||||||
|
#include "SessionSource.h"
|
||||||
#include "ImageShader.h"
|
#include "ImageShader.h"
|
||||||
#include "ImageProcessingShader.h"
|
#include "ImageProcessingShader.h"
|
||||||
#include "MediaPlayer.h"
|
#include "MediaPlayer.h"
|
||||||
@@ -338,3 +339,13 @@ void SessionVisitor::visit (MediaSource& s)
|
|||||||
|
|
||||||
s.mediaplayer()->accept(*this);
|
s.mediaplayer()->accept(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionVisitor::visit (SessionSource& s)
|
||||||
|
{
|
||||||
|
xmlCurrent_->SetAttribute("type", "SessionSource");
|
||||||
|
|
||||||
|
XMLElement *path = xmlDoc_->NewElement("path");
|
||||||
|
xmlCurrent_->InsertEndChild(path);
|
||||||
|
XMLText *text = xmlDoc_->NewText( s.path().c_str() );
|
||||||
|
path->InsertEndChild( text );
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
void visit (Source& s) override;
|
void visit (Source& s) override;
|
||||||
void visit (MediaSource& s) override;
|
void visit (MediaSource& s) override;
|
||||||
|
void visit (SessionSource& s) override;
|
||||||
|
|
||||||
static tinyxml2::XMLElement *NodeToXML(Node &n, tinyxml2::XMLDocument *doc);
|
static tinyxml2::XMLElement *NodeToXML(Node &n, tinyxml2::XMLDocument *doc);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1028,16 +1028,9 @@ void Navigator::RenderSourcePannel(Source *s)
|
|||||||
if (ImGui::InputText("Name", buf5, 64, ImGuiInputTextFlags_CharsNoBlank)){
|
if (ImGui::InputText("Name", buf5, 64, ImGuiInputTextFlags_CharsNoBlank)){
|
||||||
Mixer::manager().renameSource(s, buf5);
|
Mixer::manager().renameSource(s, buf5);
|
||||||
}
|
}
|
||||||
// blending pannel
|
// Source pannel
|
||||||
static ImGuiVisitor v;
|
static ImGuiVisitor v;
|
||||||
s->blendingShader()->accept(v);
|
s->accept(v);
|
||||||
// preview
|
|
||||||
float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
|
|
||||||
ImVec2 imagesize ( preview_width, preview_width / s->frame()->aspectRatio());
|
|
||||||
ImGui::Image((void*)(uintptr_t) s->frame()->texture(), imagesize);
|
|
||||||
// image processing pannel
|
|
||||||
s->processingShader()->accept(v);
|
|
||||||
s->groupNode(View::GEOMETRY)->accept(v);
|
|
||||||
// ensure change is applied
|
// ensure change is applied
|
||||||
s->touch();
|
s->touch();
|
||||||
// delete button
|
// delete button
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ImageShader;
|
|||||||
class ImageProcessingShader;
|
class ImageProcessingShader;
|
||||||
class Source;
|
class Source;
|
||||||
class MediaSource;
|
class MediaSource;
|
||||||
|
class SessionSource;
|
||||||
|
|
||||||
// Declares the interface for the visitors
|
// Declares the interface for the visitors
|
||||||
class Visitor {
|
class Visitor {
|
||||||
@@ -58,6 +59,7 @@ public:
|
|||||||
// utility
|
// utility
|
||||||
virtual void visit (Source&) {}
|
virtual void visit (Source&) {}
|
||||||
virtual void visit (MediaSource&) {}
|
virtual void visit (MediaSource&) {}
|
||||||
|
virtual void visit (SessionSource&) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user