mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cosmetics and bugfix on UserInterface.
This commit is contained in:
@@ -53,7 +53,7 @@ void ImGuiVisitor::visit(Group &n)
|
||||
ImGui::SameLine(0, 10);
|
||||
float translation[2] = { n.translation_.x, n.translation_.y};
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if ( ImGui::SliderFloat2("position", translation, -5.0, 5.0) )
|
||||
if ( ImGui::SliderFloat2("Position", translation, -5.0, 5.0) )
|
||||
{
|
||||
n.translation_.x = translation[0];
|
||||
n.translation_.y = translation[1];
|
||||
@@ -63,7 +63,7 @@ void ImGuiVisitor::visit(Group &n)
|
||||
n.rotation_.z = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderAngle("angle", &(n.rotation_.z), -180.f, 180.f) ;
|
||||
ImGui::SliderAngle("Angle", &(n.rotation_.z), -180.f, 180.f) ;
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(3, 15)) {
|
||||
n.scale_.x = 1.f;
|
||||
@@ -72,7 +72,7 @@ void ImGuiVisitor::visit(Group &n)
|
||||
ImGui::SameLine(0, 10);
|
||||
float scale[2] = { n.scale_.x, n.scale_.y} ;
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if ( ImGui::SliderFloat2("scale", scale, -5.0, 5.0, "%.2f") )
|
||||
if ( ImGui::SliderFloat2("Scale", scale, -5.0, 5.0, "%.2f") )
|
||||
{
|
||||
n.scale_.x = scale[0];
|
||||
n.scale_.y = scale[1];
|
||||
@@ -196,20 +196,20 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Hue shift", &n.hueshift, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(8, 1)) n.threshold = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Threshold", &n.threshold, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(3, 1)) n.lumakey = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Lumakey", &n.lumakey, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(8, 1)) n.threshold = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Threshold", &n.threshold, 0.0, 1.0, n.threshold < 0.001 ? "None" : "%.2f");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(18, 1)) n.nbColors = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderInt("Posterize", &n.nbColors, 0, 16, "%d colors");
|
||||
ImGui::SliderInt("Posterize", &n.nbColors, 0, 16, n.nbColors == 0 ? "None" : "%d colors");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(1, 7)) n.filterid = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
@@ -229,7 +229,7 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
ImGui::ColorEdit3("Chroma color", glm::value_ptr(n.chromakey), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel ) ;
|
||||
ImGui::SameLine(0, 5);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Chromakey", &n.chromadelta, 0.0, 1.0, "%.2f tolerance");
|
||||
ImGui::SliderFloat("Chromakey", &n.chromadelta, 0.0, 1.0, n.chromadelta < 0.001 ? "None" : "Tolerance %.2f");
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
15
Source.cpp
15
Source.cpp
@@ -16,11 +16,13 @@
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
Source::Source(const std::string &name) : name_(name), initialized_(false), need_update_(true)
|
||||
Source::Source() : initialized_(false), need_update_(true)
|
||||
{
|
||||
sprintf(initials_, "__");
|
||||
name_ = "Source";
|
||||
|
||||
// create groups and overlays for each view
|
||||
|
||||
// create groups for each view
|
||||
// default rendering node
|
||||
groups_[View::RENDERING] = new Group;
|
||||
groups_[View::RENDERING]->visible_ = false;
|
||||
@@ -53,7 +55,7 @@ Source::Source(const std::string &name) : name_(name), initialized_(false), need
|
||||
groups_[View::GEOMETRY]->attach(overlays_[View::GEOMETRY]);
|
||||
|
||||
// default mixing nodes
|
||||
groups_[View::LAYER] = new Group;
|
||||
groups_[View::LAYER] = new Group;
|
||||
groups_[View::LAYER]->visible_ = false;
|
||||
frame = new Frame(Frame::ROUND_SHADOW);
|
||||
frame->translation_.z = 0.1;
|
||||
@@ -83,13 +85,14 @@ Source::~Source()
|
||||
delete renderbuffer_;
|
||||
|
||||
// all groups and their children are deleted in the scene
|
||||
// this includes rendersurface_ , overlay_, blendingshader_ and rendershader_
|
||||
// this includes rendersurface_, overlays, blendingshader_ and rendershader_
|
||||
delete groups_[View::RENDERING];
|
||||
delete groups_[View::MIXING];
|
||||
delete groups_[View::GEOMETRY];
|
||||
delete groups_[View::LAYER];
|
||||
|
||||
groups_.clear();
|
||||
overlays_.clear();
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +130,7 @@ void Source::update(float dt)
|
||||
groups_[View::RENDERING]->scale_ = groups_[View::GEOMETRY]->scale_;
|
||||
groups_[View::RENDERING]->rotation_ = groups_[View::GEOMETRY]->rotation_;
|
||||
|
||||
// MODIFY DEPTH
|
||||
// MODIFY depth based on LAYER node
|
||||
groups_[View::MIXING]->translation_.z = groups_[View::LAYER]->translation_.z;
|
||||
groups_[View::GEOMETRY]->translation_.z = groups_[View::LAYER]->translation_.z;
|
||||
groups_[View::RENDERING]->translation_.z = groups_[View::LAYER]->translation_.z;
|
||||
@@ -170,7 +173,7 @@ bool hasNode::operator()(const Source* elem) const
|
||||
return false;
|
||||
}
|
||||
|
||||
MediaSource::MediaSource(const std::string &name) : Source(name), path_("")
|
||||
MediaSource::MediaSource() : Source(), path_("")
|
||||
{
|
||||
// create media player
|
||||
mediaplayer_ = new MediaPlayer;
|
||||
|
||||
4
Source.h
4
Source.h
@@ -21,7 +21,7 @@ class Source
|
||||
public:
|
||||
// create a source and add it to the list
|
||||
// only subclasses of sources can actually be instanciated
|
||||
Source(const std::string &name = "");
|
||||
Source();
|
||||
virtual ~Source();
|
||||
|
||||
// manipulate name of source
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
class MediaSource : public Source
|
||||
{
|
||||
public:
|
||||
MediaSource(const std::string &name = "");
|
||||
MediaSource();
|
||||
~MediaSource();
|
||||
|
||||
// implementation of source API
|
||||
|
||||
@@ -580,8 +580,6 @@ void ToolBox::Render()
|
||||
case 3:
|
||||
{
|
||||
if ( Rendering::manager().CurrentScreenshot()->IsFull() ){
|
||||
std::time_t t = std::time(0); // get time now
|
||||
std::tm* now = std::localtime(&t);
|
||||
std::string filename = SystemToolkit::date_time_string() + "_vmixcapture.png";
|
||||
Rendering::manager().CurrentScreenshot()->SaveFile( filename.c_str() );
|
||||
Rendering::manager().CurrentScreenshot()->Clear();
|
||||
@@ -1052,6 +1050,8 @@ void Navigator::RenderSourcePannel(Source *s)
|
||||
// image processing pannel
|
||||
s->processingShader()->accept(v);
|
||||
s->groupNode(View::GEOMETRY)->accept(v);
|
||||
// ensure change is applied
|
||||
s->touch();
|
||||
// delete button
|
||||
ImGui::Text(" ");
|
||||
if ( ImGui::Button("Delete", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ) {
|
||||
|
||||
43
View.cpp
43
View.cpp
@@ -395,30 +395,15 @@ void LayerView::zoom (float factor)
|
||||
}
|
||||
|
||||
|
||||
void LayerView::grab (glm::vec2 from, glm::vec2 to, Source *s, std::pair<Node *, glm::vec2> pick)
|
||||
void LayerView::setDepth (Source *s, float d)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
Group *sourceNode = s->group(mode_);
|
||||
|
||||
static glm::vec3 start_translation = glm::vec3(0.f);
|
||||
static glm::vec2 start_position = glm::vec2(0.f);
|
||||
|
||||
if ( start_position != from ) {
|
||||
start_position = from;
|
||||
start_translation = sourceNode->translation_;
|
||||
}
|
||||
|
||||
// unproject
|
||||
glm::vec3 gl_Position_from = Rendering::manager().unProject(from, scene.root()->transform_);
|
||||
glm::vec3 gl_Position_to = Rendering::manager().unProject(to, scene.root()->transform_);
|
||||
|
||||
// compute delta translation
|
||||
sourceNode->translation_ = start_translation + gl_Position_to - gl_Position_from;
|
||||
|
||||
// diagonal movement only
|
||||
sourceNode->translation_.x = CLAMP( sourceNode->translation_.x, SCENE_DEPTH + 2.f, 0.f);
|
||||
sourceNode->translation_.x = CLAMP( -d, SCENE_DEPTH + 2.f, 0.f);
|
||||
sourceNode->translation_.y = sourceNode->translation_.x / aspect_ratio;
|
||||
|
||||
// change depth
|
||||
@@ -431,3 +416,27 @@ void LayerView::grab (glm::vec2 from, glm::vec2 to, Source *s, std::pair<Node *,
|
||||
View::need_reordering_ = true;
|
||||
}
|
||||
|
||||
void LayerView::grab (glm::vec2 from, glm::vec2 to, Source *s, std::pair<Node *, glm::vec2> pick)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
static glm::vec3 start_translation = glm::vec3(0.f);
|
||||
static glm::vec2 start_position = glm::vec2(0.f);
|
||||
|
||||
if ( start_position != from ) {
|
||||
start_position = from;
|
||||
start_translation = s->group(mode_)->translation_;
|
||||
}
|
||||
|
||||
// unproject
|
||||
glm::vec3 gl_Position_from = Rendering::manager().unProject(from, scene.root()->transform_);
|
||||
glm::vec3 gl_Position_to = Rendering::manager().unProject(to, scene.root()->transform_);
|
||||
|
||||
// compute delta translation
|
||||
glm::vec3 dest_translation = start_translation + gl_Position_to - gl_Position_from;
|
||||
|
||||
// apply change
|
||||
setDepth( s, -dest_translation.x );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user