mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-19 14:19:57 +01:00
New Geometry view option to show only visible sources
View setting to ignore mixing visibility applied to Geometry view, with a button to complement the workspace selection.
This commit is contained in:
Binary file not shown.
@@ -143,7 +143,9 @@ GeometryView::GeometryView() : View(GEOMETRY)
|
|||||||
|
|
||||||
// replace grid with appropriate one
|
// replace grid with appropriate one
|
||||||
translation_grid_ = new TranslationGrid(scene.root());
|
translation_grid_ = new TranslationGrid(scene.root());
|
||||||
|
translation_grid_->root()->visible_ = false;
|
||||||
rotation_grid_ = new RotationGrid(scene.root());
|
rotation_grid_ = new RotationGrid(scene.root());
|
||||||
|
rotation_grid_->root()->visible_ = false;
|
||||||
if (grid) delete grid;
|
if (grid) delete grid;
|
||||||
grid = translation_grid_;
|
grid = translation_grid_;
|
||||||
}
|
}
|
||||||
@@ -230,20 +232,25 @@ void GeometryView::draw()
|
|||||||
std::vector<Node *> surfaces;
|
std::vector<Node *> surfaces;
|
||||||
std::vector<Node *> overlays;
|
std::vector<Node *> overlays;
|
||||||
uint workspaces_counts_[Source::WORKSPACE_ANY+1] = {0};
|
uint workspaces_counts_[Source::WORKSPACE_ANY+1] = {0};
|
||||||
|
uint hidden_count_ = 0;
|
||||||
for (auto source_iter = Mixer::manager().session()->begin();
|
for (auto source_iter = Mixer::manager().session()->begin();
|
||||||
source_iter != Mixer::manager().session()->end(); ++source_iter) {
|
source_iter != Mixer::manager().session()->end(); ++source_iter) {
|
||||||
// if it is in the current workspace
|
// count if it is visible
|
||||||
if (Settings::application.current_workspace == Source::WORKSPACE_ANY ||
|
if (Settings::application.views[mode_].ignore_mix || (*source_iter)->visible()) {
|
||||||
(*source_iter)->workspace() == Settings::application.current_workspace) {
|
// if it is in the current workspace
|
||||||
// will draw its surface
|
if (Settings::application.current_workspace == Source::WORKSPACE_ANY
|
||||||
surfaces.push_back((*source_iter)->groups_[mode_]);
|
|| (*source_iter)->workspace() == Settings::application.current_workspace) {
|
||||||
// will draw its frame and locker icon
|
// will draw its surface
|
||||||
overlays.push_back((*source_iter)->frames_[mode_]);
|
surfaces.push_back((*source_iter)->groups_[mode_]);
|
||||||
overlays.push_back((*source_iter)->locker_);
|
// will draw its frame and locker icon
|
||||||
|
overlays.push_back((*source_iter)->frames_[mode_]);
|
||||||
|
overlays.push_back((*source_iter)->locker_);
|
||||||
|
}
|
||||||
|
// count number of sources per workspace
|
||||||
|
workspaces_counts_[(*source_iter)->workspace()]++;
|
||||||
|
workspaces_counts_[Source::WORKSPACE_ANY]++;
|
||||||
}
|
}
|
||||||
// count number of sources per workspace
|
hidden_count_ += (*source_iter)->visible() ? 0 : 1;
|
||||||
workspaces_counts_[(*source_iter)->workspace()]++;
|
|
||||||
workspaces_counts_[Source::WORKSPACE_ANY]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0. prepare projection for draw visitors
|
// 0. prepare projection for draw visitors
|
||||||
@@ -262,8 +269,11 @@ void GeometryView::draw()
|
|||||||
scene.accept(draw_overlays);
|
scene.accept(draw_overlays);
|
||||||
|
|
||||||
// 4. Draw control overlays of current source on top (if selected)
|
// 4. Draw control overlays of current source on top (if selected)
|
||||||
if (s != nullptr && (Settings::application.current_workspace == Source::WORKSPACE_ANY ||
|
if (s != nullptr &&
|
||||||
s->workspace() == Settings::application.current_workspace) ) {
|
(Settings::application.current_workspace == Source::WORKSPACE_ANY ||
|
||||||
|
s->workspace() == Settings::application.current_workspace) &&
|
||||||
|
(Settings::application.views[mode_].ignore_mix || s->visible()))
|
||||||
|
{
|
||||||
DrawVisitor dv(s->overlays_[mode_], projection);
|
DrawVisitor dv(s->overlays_[mode_], projection);
|
||||||
scene.accept(dv);
|
scene.accept(dv);
|
||||||
// Always restore current source after draw
|
// Always restore current source after draw
|
||||||
@@ -299,11 +309,17 @@ void GeometryView::draw()
|
|||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.4f, 0.4f, 0.4f, 0.56f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.4f, 0.4f, 0.4f, 0.56f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
|
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
|
||||||
|
|
||||||
|
// toggle sources visibility flag
|
||||||
|
std::string _label = std::to_string(hidden_count_) + " source" + (hidden_count_>1?"s ":" ")
|
||||||
|
+ "outside mixing circle " + ICON_FA_MOON;
|
||||||
|
ImGuiToolkit::ButtonIconToggle(12, 0, &Settings::application.views[mode_].ignore_mix, _label.c_str());
|
||||||
|
|
||||||
|
// select layers visibility
|
||||||
static std::vector< std::string > _tooltips = {
|
static std::vector< std::string > _tooltips = {
|
||||||
{"Sources in Background layers"},
|
{"Sources in Background layer"},
|
||||||
{"Sources in Workspace layers"},
|
{"Sources in Workspace layer"},
|
||||||
{"Sources in Foreground layers"},
|
{"Sources in Foreground layer"},
|
||||||
{"Sources in every layers (total)"}
|
{"Sources in all layers (total)"}
|
||||||
};
|
};
|
||||||
std::vector< std::tuple<int, int, std::string> > _workspaces = {
|
std::vector< std::tuple<int, int, std::string> > _workspaces = {
|
||||||
{ICON_WORKSPACE_BACKGROUND, std::to_string( workspaces_counts_[Source::WORKSPACE_BACKGROUND] )},
|
{ICON_WORKSPACE_BACKGROUND, std::to_string( workspaces_counts_[Source::WORKSPACE_BACKGROUND] )},
|
||||||
@@ -311,6 +327,7 @@ void GeometryView::draw()
|
|||||||
{ICON_WORKSPACE_FOREGROUND, std::to_string( workspaces_counts_[Source::WORKSPACE_FOREGROUND] )},
|
{ICON_WORKSPACE_FOREGROUND, std::to_string( workspaces_counts_[Source::WORKSPACE_FOREGROUND] )},
|
||||||
{ICON_WORKSPACE, std::to_string( workspaces_counts_[Source::WORKSPACE_ANY] )}
|
{ICON_WORKSPACE, std::to_string( workspaces_counts_[Source::WORKSPACE_ANY] )}
|
||||||
};
|
};
|
||||||
|
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||||
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
|
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
|
||||||
if ( ImGuiToolkit::ComboIcon ("##WORKSPACE", &Settings::application.current_workspace, _workspaces, _tooltips) ){
|
if ( ImGuiToolkit::ComboIcon ("##WORKSPACE", &Settings::application.current_workspace, _workspaces, _tooltips) ){
|
||||||
// need full update
|
// need full update
|
||||||
@@ -548,8 +565,10 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
|||||||
// keep current source active if it is clicked
|
// keep current source active if it is clicked
|
||||||
Source *current = Mixer::manager().currentSource();
|
Source *current = Mixer::manager().currentSource();
|
||||||
if (current != nullptr) {
|
if (current != nullptr) {
|
||||||
if (Settings::application.current_workspace < Source::WORKSPACE_ANY &&
|
if ((Settings::application.current_workspace < Source::WORKSPACE_ANY &&
|
||||||
current->workspace() != Settings::application.current_workspace){
|
current->workspace() != Settings::application.current_workspace) ||
|
||||||
|
(!Settings::application.views[mode_].ignore_mix && !current->visible()) )
|
||||||
|
{
|
||||||
current = nullptr;
|
current = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -631,8 +650,11 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
|||||||
// get if a source was picked
|
// get if a source was picked
|
||||||
Source *s = Mixer::manager().findSource((*itp).first);
|
Source *s = Mixer::manager().findSource((*itp).first);
|
||||||
// accept picked sources in current workspaces
|
// accept picked sources in current workspaces
|
||||||
if ( s!=nullptr && (Settings::application.current_workspace == Source::WORKSPACE_ANY ||
|
if ( s!=nullptr &&
|
||||||
s->workspace() == Settings::application.current_workspace) ) {
|
(Settings::application.current_workspace == Source::WORKSPACE_ANY ||
|
||||||
|
s->workspace() == Settings::application.current_workspace) &&
|
||||||
|
(Settings::application.views[mode_].ignore_mix || s->visible()) )
|
||||||
|
{
|
||||||
if ( !UserInterface::manager().ctrlModifier() ) {
|
if ( !UserInterface::manager().ctrlModifier() ) {
|
||||||
// source is locked; can't move
|
// source is locked; can't move
|
||||||
if ( s->locked() )
|
if ( s->locked() )
|
||||||
@@ -674,7 +696,8 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
|||||||
|
|
||||||
bool GeometryView::canSelect(Source *s) {
|
bool GeometryView::canSelect(Source *s) {
|
||||||
|
|
||||||
return ( s!=nullptr && View::canSelect(s) && s->ready() && s->active() &&
|
return ( s!=nullptr && View::canSelect(s) && s->ready() &&
|
||||||
|
(Settings::application.views[mode_].ignore_mix || s->visible()) &&
|
||||||
(Settings::application.current_workspace == Source::WORKSPACE_ANY || s->workspace() == Settings::application.current_workspace) );
|
(Settings::application.current_workspace == Source::WORKSPACE_ANY || s->workspace() == Settings::application.current_workspace) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ void ImGuiVisitor::visit (Source& s)
|
|||||||
if (s.blendingShader()->color.a > 0.f)
|
if (s.blendingShader()->color.a > 0.f)
|
||||||
ImGuiToolkit::Indication("Visible", ICON_FA_SUN);
|
ImGuiToolkit::Indication("Visible", ICON_FA_SUN);
|
||||||
else
|
else
|
||||||
ImGuiToolkit::Indication("Not visible", ICON_FA_CLOUD_SUN);
|
ImGuiToolkit::Indication("not Visible", ICON_FA_MOON);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ImGuiToolkit::Indication("Inactive", ICON_FA_SNOWFLAKE);
|
ImGuiToolkit::Indication("Inactive", ICON_FA_SNOWFLAKE);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ void LayerView::update(float dt)
|
|||||||
|
|
||||||
bool LayerView::canSelect(Source *s) {
|
bool LayerView::canSelect(Source *s) {
|
||||||
|
|
||||||
return ( View::canSelect(s) && s->active() );
|
return ( View::canSelect(s) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerView::resize ( int scale )
|
void LayerView::resize ( int scale )
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ MixingView::MixingView() : View(MIXING), limbo_scale_(MIXING_MIN_THRESHOLD)
|
|||||||
// replace grid with appropriate one
|
// replace grid with appropriate one
|
||||||
if (grid) delete grid;
|
if (grid) delete grid;
|
||||||
grid = new MixingGrid(scene.root());
|
grid = new MixingGrid(scene.root());
|
||||||
|
grid->root()->visible_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -596,7 +597,7 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai
|
|||||||
std::ostringstream info;
|
std::ostringstream info;
|
||||||
if (s->active()) {
|
if (s->active()) {
|
||||||
info << "Alpha " << std::fixed << std::setprecision(3) << s->blendingShader()->color.a << " ";
|
info << "Alpha " << std::fixed << std::setprecision(3) << s->blendingShader()->color.a << " ";
|
||||||
info << ( (s->blendingShader()->color.a > 0.f) ? ICON_FA_SUN : ICON_FA_CLOUD_SUN);
|
info << ( (s->blendingShader()->color.a > 0.f) ? ICON_FA_SUN : ICON_FA_MOON);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info << "Inactive " << ICON_FA_SNOWFLAKE;
|
info << "Inactive " << ICON_FA_SNOWFLAKE;
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ void Settings::Save(uint64_t runtime)
|
|||||||
XMLElement *view = xmlDoc.NewElement( "View" );
|
XMLElement *view = xmlDoc.NewElement( "View" );
|
||||||
view->SetAttribute("name", view_config.name.c_str());
|
view->SetAttribute("name", view_config.name.c_str());
|
||||||
view->SetAttribute("id", iter->first);
|
view->SetAttribute("id", iter->first);
|
||||||
|
view->SetAttribute("ignore_mix", view_config.ignore_mix);
|
||||||
|
|
||||||
XMLElement *scale = xmlDoc.NewElement("default_scale");
|
XMLElement *scale = xmlDoc.NewElement("default_scale");
|
||||||
scale->InsertEndChild( XMLElementFromGLM(&xmlDoc, view_config.default_scale) );
|
scale->InsertEndChild( XMLElementFromGLM(&xmlDoc, view_config.default_scale) );
|
||||||
@@ -614,6 +615,7 @@ void Settings::Load()
|
|||||||
int id = 0;
|
int id = 0;
|
||||||
viewNode->QueryIntAttribute("id", &id);
|
viewNode->QueryIntAttribute("id", &id);
|
||||||
application.views[id].name = viewNode->Attribute("name");
|
application.views[id].name = viewNode->Attribute("name");
|
||||||
|
viewNode->QueryBoolAttribute("ignore_mix", &application.views[id].ignore_mix);
|
||||||
|
|
||||||
XMLElement* scaleNode = viewNode->FirstChildElement("default_scale");
|
XMLElement* scaleNode = viewNode->FirstChildElement("default_scale");
|
||||||
if (scaleNode)
|
if (scaleNode)
|
||||||
|
|||||||
@@ -87,10 +87,12 @@ struct ViewConfig
|
|||||||
std::string name;
|
std::string name;
|
||||||
glm::vec3 default_scale;
|
glm::vec3 default_scale;
|
||||||
glm::vec3 default_translation;
|
glm::vec3 default_translation;
|
||||||
|
bool ignore_mix;
|
||||||
|
|
||||||
ViewConfig() : name("") {
|
ViewConfig() : name("") {
|
||||||
default_scale = glm::vec3(1.f);
|
default_scale = glm::vec3(1.f);
|
||||||
default_translation = glm::vec3(0.f);
|
default_translation = glm::vec3(0.f);
|
||||||
|
ignore_mix = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -648,10 +648,8 @@ void Source::setActive (bool on)
|
|||||||
// activate
|
// activate
|
||||||
active_ = on;
|
active_ = on;
|
||||||
|
|
||||||
// an inactive source is visible only in the MIXING view
|
// an inactive source is not rendered
|
||||||
groups_[View::RENDERING]->visible_ = active_;
|
groups_[View::RENDERING]->visible_ = active_;
|
||||||
groups_[View::GEOMETRY]->visible_ = active_;
|
|
||||||
groups_[View::LAYER]->visible_ = active_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Source::setActive (float threshold)
|
void Source::setActive (float threshold)
|
||||||
@@ -704,6 +702,12 @@ float Source::alpha() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Source::visible() const
|
||||||
|
{
|
||||||
|
return blendingShader()->color.a > 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Source::textureTransformed () const
|
bool Source::textureTransformed () const
|
||||||
{
|
{
|
||||||
return frame()->projectionArea() != glm::vec4(-1.f, 1.f, 1.f, -1.f) || // cropped
|
return frame()->projectionArea() != glm::vec4(-1.f, 1.f, 1.f, -1.f) || // cropped
|
||||||
|
|||||||
@@ -221,7 +221,8 @@ public:
|
|||||||
// get properties
|
// get properties
|
||||||
float depth () const;
|
float depth () const;
|
||||||
float alpha () const;
|
float alpha () const;
|
||||||
bool textureTransformed () const;
|
bool visible() const;
|
||||||
|
bool textureTransformed () const;
|
||||||
|
|
||||||
// groups for mixing
|
// groups for mixing
|
||||||
MixingGroup *mixingGroup() const { return mixinggroup_; }
|
MixingGroup *mixingGroup() const { return mixinggroup_; }
|
||||||
|
|||||||
Reference in New Issue
Block a user