@@ -503,6 +503,9 @@ bool FilterGraphEditor::DoRender()
503503
504504 nodeAdded = true ;
505505 newNode = GetID (f);
506+
507+ // Do an initial refresh so we can get error messages, an initial output if it's a waveform generation filter, etc
508+ m_parent->OnFilterReconfigured (f);
506509 }
507510 }
508511 }
@@ -1397,8 +1400,8 @@ void FilterGraphEditor::HandleLinkCreationRequests(Filter*& fReconfigure)
13971400{
13981401 // for some reason node editor wants colors as vec4 not ImU32
13991402 auto & prefs = m_session.GetPreferences ();
1400- auto validcolor = ImGui::ColorConvertU32ToFloat4 ( prefs.GetColor (" Appearance.Filter Graph.valid_link_color" ) );
1401- auto invalidcolor = ImGui::ColorConvertU32ToFloat4 ( prefs.GetColor (" Appearance.Filter Graph.invalid_link_color" ) );
1403+ auto validcolor = prefs.GetColorFloat4 (" Appearance.Filter Graph.valid_link_color" );
1404+ auto invalidcolor = prefs.GetColorFloat4 (" Appearance.Filter Graph.invalid_link_color" );
14021405
14031406 if (ax::NodeEditor::BeginCreate ())
14041407 {
@@ -2009,6 +2012,7 @@ void FilterGraphEditor::DoNodeForChannel(
20092012 displaycolor = " #808080" ;
20102013
20112014 auto & prefs = m_session.GetPreferences ();
2015+ auto errorColor = prefs.GetColor (" Appearance.Filter Graph.error_outline_color" );
20122016
20132017 // Get some configuration / style settings
20142018 auto color = ColorFromString (displaycolor);
@@ -2194,18 +2198,18 @@ void FilterGraphEditor::DoNodeForChannel(
21942198 headercolor,
21952199 headerText.c_str ());
21962200
2197- // TODO: add an option for toggling this
2198- // TODO: add preference for colors
2201+ auto bubbleColor = prefs. GetColor ( " Appearance.Filter Graph.infobubble_color " );
2202+
21992203 // Draw a bubble above the text with the runtime stats
2204+ // TODO: add an option for toggling this
22002205 float messageSpacing = 0.1 * headerheight;
22012206 float nextIconBot = pos.y - messageSpacing;
22022207 if (runtime > 0 )
22032208 {
22042209 auto runtimeText = fs.PrettyPrint (runtime, 3 );
22052210 auto runtimeSize = ImGui::CalcTextSize (runtimeText.c_str ());
22062211
2207- auto timebgColor = ColorFromString (" #404040" );
2208- auto timeTextColor = ColorFromString (" #ffffff" );
2212+ auto timeTextColor = ImGui::GetColorU32 (ImGui::GetStyleColorVec4 (ImGuiCol_Text));
22092213 float bubbleHeight = runtimeSize.y + 2 *ImGui::GetStyle ().FramePadding .y ;
22102214
22112215 ImVec2 clockiconpos (
@@ -2220,7 +2224,7 @@ void FilterGraphEditor::DoNodeForChannel(
22202224 bgList->AddRectFilled (
22212225 ImVec2 (pos.x + 1 , nextIconBot - bubbleHeight),
22222226 ImVec2 (textpos.x + runtimeSize.x + ImGui::GetStyle ().FramePadding .y , nextIconBot),
2223- timebgColor ,
2227+ bubbleColor ,
22242228 rounding,
22252229 ImDrawFlags_RoundCornersAll);
22262230
@@ -2234,7 +2238,7 @@ void FilterGraphEditor::DoNodeForChannel(
22342238 timeTextColor,
22352239 runtimeText.c_str ());
22362240
2237- nextIconBot -= runtimeSize. y + 3 *messageSpacing;
2241+ nextIconBot -= bubbleHeight + 2 *messageSpacing;
22382242 }
22392243
22402244 // Display errors
@@ -2243,10 +2247,8 @@ void FilterGraphEditor::DoNodeForChannel(
22432247 auto errorText = channel->GetErrorTitle ();
22442248 auto errorSize = ImGui::CalcTextSize (errorText.c_str ());
22452249
2246- // TODO: preferences?
2247- auto bgColor = ColorFromString (" #404040" );
2248- auto textColor = ColorFromString (" #ffffff" );
2249- float bubbleHeight = errorSize.y + 2 *ImGui::GetStyle ().FramePadding .y ;
2250+ auto textColor = ImGui::GetColorU32 (ImGui::GetStyleColorVec4 (ImGuiCol_Text));
2251+ float bubbleHeight = errorSize.y + 3 *ImGui::GetStyle ().FramePadding .y ;
22502252
22512253 ImVec2 erriconpos (
22522254 pos.x + ImGui::GetStyle ().FramePadding .x ,
@@ -2257,7 +2259,7 @@ void FilterGraphEditor::DoNodeForChannel(
22572259 ImVec2 rectStart (pos.x + 1 , nextIconBot - bubbleHeight);
22582260 ImVec2 rectEnd (textpos.x + errorSize.x + ImGui::GetStyle ().FramePadding .y , nextIconBot);
22592261
2260- bgList->AddRectFilled (rectStart, rectEnd, bgColor , rounding, ImDrawFlags_RoundCornersAll);
2262+ bgList->AddRectFilled (rectStart, rectEnd, bubbleColor , rounding, ImDrawFlags_RoundCornersAll);
22612263 bgList->AddImage (m_parent->GetTextureManager ()->GetTexture (" error" ), erriconpos, erriconpos + erriconsize );
22622264 bgList->AddText (textpos, textColor, errorText.c_str ());
22632265
@@ -2277,7 +2279,11 @@ void FilterGraphEditor::DoNodeForChannel(
22772279 ax::NodeEditor::Resume ();
22782280 }
22792281
2280- nextIconBot -= errorSize.y + 3 *messageSpacing;
2282+ nextIconBot -= bubbleHeight + 2 *messageSpacing;
2283+
2284+ // Draw outline rectangle around the entire filter
2285+ auto errorOutlineThickness = 0.4 * ImGui::GetFontSize ();
2286+ bgList->AddRect (pos, pos+size, errorColor, rounding, ImDrawFlags_RoundCornersAll, errorOutlineThickness);
22812287 }
22822288
22832289 ImGui::PopFont (); // headerfont
0 commit comments