Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve blend tree contrast/margins #94721

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions editor/plugins/animation_blend_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
name->set_text(E);
name->set_editable(!read_only);
name->set_expand_to_text_length_enabled(true);
name->set_custom_minimum_size(Vector2(100, 0) * EDSCALE);
node->add_child(name);
node->set_slot(0, false, 0, Color(), true, read_only ? -1 : 0, get_theme_color(SceneStringName(font_color), SNAME("Label")));
name->connect("text_submitted", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed).bind(agnode), CONNECT_DEFERRED);
Expand Down Expand Up @@ -206,6 +207,14 @@ void AnimationNodeBlendTreeEditor::update_graph() {
prop->update_property();
prop->set_name_split_ratio(0);
prop->connect("property_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_property_changed));

if (F.hint == PROPERTY_HINT_RESOURCE_TYPE) {
// Give the resource editor some more space to make the inside readable.
prop->set_custom_minimum_size(Vector2(180, 0) * EDSCALE);
// Align the size of the node with the resource editor, its un-expanding does not trigger a resize.
prop->connect(SceneStringName(resized), Callable(node, "reset_size"));
}

node->add_child(prop);
visible_properties.push_back(prop);
}
Expand Down Expand Up @@ -267,17 +276,14 @@ void AnimationNodeBlendTreeEditor::update_graph() {
mb->get_popup()->connect("index_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_anim_selected).bind(options, E), CONNECT_DEFERRED);
}

// TODO: Avoid using strings, expose a method on GraphNode instead.
Ref<StyleBoxFlat> sb = node->get_theme_stylebox(SceneStringName(panel));
Color c = sb->get_border_color();
Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0);
mono_color.a = 0.85;
c = mono_color;

node->add_theme_color_override("title_color", c);
c.a = 0.7;
node->add_theme_color_override("close_color", c);
node->add_theme_color_override("resizer_color", c);
Ref<StyleBox> sb_panel = node->get_theme_stylebox(SceneStringName(panel), "GraphNode")->duplicate();
if (sb_panel.is_valid()) {
sb_panel->set_content_margin(SIDE_TOP, 12 * EDSCALE);
sb_panel->set_content_margin(SIDE_BOTTOM, 12 * EDSCALE);
node->add_theme_style_override(SceneStringName(panel), sb_panel);
}

node->add_theme_constant_override("separation", 4 * EDSCALE);
}

List<AnimationNodeBlendTree::NodeConnection> node_connections;
Expand Down
5 changes: 5 additions & 0 deletions editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "editor/plugins/material_editor_plugin.h"
#include "editor/plugins/shader_editor_plugin.h"
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
#include "scene/animation/tween.h"
#include "scene/gui/button.h"
#include "scene/gui/check_box.h"
Expand Down Expand Up @@ -572,6 +573,10 @@ void VisualShaderGraphPlugin::update_theme() {
Ref<Font> label_bold_font = EditorNode::get_singleton()->get_editor_theme()->get_font("main_bold_msdf", EditorStringName(EditorFonts));
vs_msdf_fonts_theme->set_font(SceneStringName(font), "Label", label_font);
vs_msdf_fonts_theme->set_font(SceneStringName(font), "GraphNodeTitleLabel", label_bold_font);
if (!EditorThemeManager::is_dark_theme()) {
// Override the color to white for light themes.
vs_msdf_fonts_theme->set_color(SceneStringName(font_color), "GraphNodeTitleLabel", Color(1, 1, 1));
}
vs_msdf_fonts_theme->set_font(SceneStringName(font), "LineEdit", label_font);
vs_msdf_fonts_theme->set_font(SceneStringName(font), "Button", label_font);
}
Expand Down
3 changes: 1 addition & 2 deletions editor/themes/editor_theme_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,8 +1681,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// GraphNode's title Label.
p_theme->set_type_variation("GraphNodeTitleLabel", "Label");
p_theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0));
p_theme->set_color(SceneStringName(font_color), "GraphNodeTitleLabel", p_config.dark_theme ? p_config.font_color : Color(1, 1, 1)); // Also use a bright font color for light themes.
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0.35));
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", p_config.shadow_color);
p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4);
p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0);
p_theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", 1);
Expand Down