BugFix Source panel

Disable bundle source for clones, select correct panel for replace + show shader editor with icon clic
This commit is contained in:
Bruno Herbelin
2025-04-21 15:16:58 +02:00
parent 28943adac8
commit 57b89bef0a

View File

@@ -71,6 +71,7 @@
#include "MediaSource.h" #include "MediaSource.h"
#include "PatternSource.h" #include "PatternSource.h"
#include "DeviceSource.h" #include "DeviceSource.h"
#include "ShaderSource.h"
#include "ScreenCaptureSource.h" #include "ScreenCaptureSource.h"
#include "MultiFileSource.h" #include "MultiFileSource.h"
#include "ShmdataBroadcast.h" #include "ShmdataBroadcast.h"
@@ -1374,7 +1375,13 @@ void UserInterface::showSourceEditor(Source *s)
if (s) { if (s) {
Mixer::manager().setCurrentSource( s ); Mixer::manager().setCurrentSource( s );
if (!s->failed()) { if (!s->failed()) {
// show player
sourcecontrol.setVisible(true); sourcecontrol.setVisible(true);
// show code editor for shader sources
ShaderSource *sc = dynamic_cast<ShaderSource *>(s);
if (sc != nullptr)
shadercontrol.setVisible(true);
// select
sourcecontrol.resetActiveSelection(); sourcecontrol.resetActiveSelection();
} }
else else
@@ -3598,7 +3605,7 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
} }
// bundle button // bundle button
if ( s->failed() ) if ( s->failed() || s->cloned() || s->icon() == glm::ivec2(ICON_SOURCE_CLONE) )
ImGuiToolkit::ButtonDisabled( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)); ImGuiToolkit::ButtonDisabled( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0));
else if ( ImGui::Button( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) { else if ( ImGui::Button( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) {
Mixer::manager().groupCurrent(); Mixer::manager().groupCurrent();
@@ -3608,18 +3615,20 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
// replace button // replace button
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
if ( ImGui::Button( ICON_FA_PLUS_SQUARE " Replace", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) { if ( ImGui::Button( ICON_FA_PLUS_SQUARE " Replace", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) {
// prepare panel for new source of same type // prepare panel for new source of same type
MediaSource *file = dynamic_cast<MediaSource *>(s); glm::ivec2 i = s->icon();
MultiFileSource *sequence = dynamic_cast<MultiFileSource *>(s); if ( i == glm::ivec2(ICON_SOURCE_VIDEO) || i == glm::ivec2(ICON_SOURCE_IMAGE)
PatternSource *generated = dynamic_cast<PatternSource *>(s); || i == glm::ivec2(ICON_SOURCE_CLONE) )
if (file != nullptr)
Settings::application.source.new_type = SOURCE_FILE; Settings::application.source.new_type = SOURCE_FILE;
else if (sequence != nullptr) else if ( i == glm::ivec2(ICON_SOURCE_SEQUENCE) )
Settings::application.source.new_type = SOURCE_SEQUENCE; Settings::application.source.new_type = SOURCE_SEQUENCE;
else if (generated != nullptr) else if ( i == glm::ivec2(ICON_SOURCE_PATTERN) || i == glm::ivec2(ICON_SOURCE_TEXT)
|| i == glm::ivec2(ICON_SOURCE_GSTREAMER) || i == glm::ivec2(ICON_SOURCE_SHADER) )
Settings::application.source.new_type = SOURCE_GENERATED; Settings::application.source.new_type = SOURCE_GENERATED;
else else
Settings::application.source.new_type = SOURCE_CONNECTED; Settings::application.source.new_type = SOURCE_CONNECTED;
// switch to panel new source // switch to panel new source
showPannelSource(NAV_NEW); showPannelSource(NAV_NEW);
// set source to be replaced // set source to be replaced