Skip to content

Commit

Permalink
Merge pull request #48567 from Calinou/editor-theme-less-opaque-viewp…
Browse files Browse the repository at this point in the history
…ort-focus

Make the focus outline translucent for editor viewports
  • Loading branch information
akien-mga authored Jul 30, 2021
2 parents 6d5c108 + e92297c commit ba274a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions editor/editor_themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {

// Focus
theme->set_stylebox("Focus", "EditorStyles", style_widget_focus);
// Use a less opaque color to be less distracting for the 2D and 3D editor viewports.
Ref<StyleBoxFlat> style_widget_focus_viewport = style_widget_focus->duplicate();
style_widget_focus_viewport->set_border_color(accent_color * Color(1, 1, 1, 0.5));
theme->set_stylebox("FocusViewport", "EditorStyles", style_widget_focus_viewport);

// Menu
Ref<StyleBoxFlat> style_menu = style_widget->duplicate();
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_posi
void CanvasItemEditor::_draw_focus() {
// Draw the focus around the base viewport
if (viewport->has_focus()) {
get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles"))->draw(viewport->get_canvas_item(), Rect2(Point2(), viewport->get_size()));
get_theme_stylebox(SNAME("FocusViewport"), SNAME("EditorStyles"))->draw(viewport->get_canvas_item(), Rect2(Point2(), viewport->get_size()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2871,7 +2871,7 @@ void Node3DEditorViewport::_draw() {
if (surface->has_focus()) {
Size2 size = surface->get_size();
Rect2 r = Rect2(Point2(), size);
get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles"))->draw(surface->get_canvas_item(), r);
get_theme_stylebox(SNAME("FocusViewport"), SNAME("EditorStyles"))->draw(surface->get_canvas_item(), r);
}

if (cursor.region_select) {
Expand Down

0 comments on commit ba274a6

Please sign in to comment.