Fix graph node sizing regression, improve blend tree contrast/margins
This commit is contained in:
parent
3978628c6c
commit
9bcbcc873d
|
@ -164,6 +164,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
|
||||||
name->set_text(E);
|
name->set_text(E);
|
||||||
name->set_editable(!read_only);
|
name->set_editable(!read_only);
|
||||||
name->set_expand_to_text_length_enabled(true);
|
name->set_expand_to_text_length_enabled(true);
|
||||||
|
name->set_custom_minimum_size(Vector2(100, 0) * EDSCALE);
|
||||||
node->add_child(name);
|
node->add_child(name);
|
||||||
node->set_slot(0, false, 0, Color(), true, read_only ? -1 : 0, get_theme_color(SceneStringName(font_color), SNAME("Label")));
|
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);
|
name->connect("text_submitted", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed).bind(agnode), CONNECT_DEFERRED);
|
||||||
|
@ -203,6 +204,14 @@ void AnimationNodeBlendTreeEditor::update_graph() {
|
||||||
prop->update_property();
|
prop->update_property();
|
||||||
prop->set_name_split_ratio(0);
|
prop->set_name_split_ratio(0);
|
||||||
prop->connect("property_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_property_changed));
|
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);
|
node->add_child(prop);
|
||||||
visible_properties.push_back(prop);
|
visible_properties.push_back(prop);
|
||||||
}
|
}
|
||||||
|
@ -264,17 +273,14 @@ void AnimationNodeBlendTreeEditor::update_graph() {
|
||||||
mb->get_popup()->connect("index_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_anim_selected).bind(options, E), CONNECT_DEFERRED);
|
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<StyleBox> sb_panel = node->get_theme_stylebox(SceneStringName(panel), "GraphNode")->duplicate();
|
||||||
Ref<StyleBoxFlat> sb = node->get_theme_stylebox(SceneStringName(panel));
|
if (sb_panel.is_valid()) {
|
||||||
Color c = sb->get_border_color();
|
sb_panel->set_content_margin(SIDE_TOP, 12 * EDSCALE);
|
||||||
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);
|
sb_panel->set_content_margin(SIDE_BOTTOM, 12 * EDSCALE);
|
||||||
mono_color.a = 0.85;
|
node->add_theme_style_override(SceneStringName(panel), sb_panel);
|
||||||
c = mono_color;
|
}
|
||||||
|
|
||||||
node->add_theme_color_override("title_color", c);
|
node->add_theme_constant_override("separation", 4 * EDSCALE);
|
||||||
c.a = 0.7;
|
|
||||||
node->add_theme_color_override("close_color", c);
|
|
||||||
node->add_theme_color_override("resizer_color", c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AnimationNodeBlendTree::NodeConnection> node_connections;
|
List<AnimationNodeBlendTree::NodeConnection> node_connections;
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "editor/plugins/curve_editor_plugin.h"
|
#include "editor/plugins/curve_editor_plugin.h"
|
||||||
#include "editor/plugins/shader_editor_plugin.h"
|
#include "editor/plugins/shader_editor_plugin.h"
|
||||||
#include "editor/themes/editor_scale.h"
|
#include "editor/themes/editor_scale.h"
|
||||||
|
#include "editor/themes/editor_theme_manager.h"
|
||||||
#include "scene/animation/tween.h"
|
#include "scene/animation/tween.h"
|
||||||
#include "scene/gui/button.h"
|
#include "scene/gui/button.h"
|
||||||
#include "scene/gui/check_box.h"
|
#include "scene/gui/check_box.h"
|
||||||
|
@ -570,6 +571,10 @@ void VisualShaderGraphPlugin::update_theme() {
|
||||||
Ref<Font> label_bold_font = EditorNode::get_singleton()->get_editor_theme()->get_font("main_bold_msdf", EditorStringName(EditorFonts));
|
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), "Label", label_font);
|
||||||
vs_msdf_fonts_theme->set_font(SceneStringName(font), "GraphNodeTitleLabel", label_bold_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), "LineEdit", label_font);
|
||||||
vs_msdf_fonts_theme->set_font(SceneStringName(font), "Button", label_font);
|
vs_msdf_fonts_theme->set_font(SceneStringName(font), "Button", label_font);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1633,8 +1633,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
|
||||||
// GraphNode's title Label.
|
// GraphNode's title Label.
|
||||||
p_theme->set_type_variation("GraphNodeTitleLabel", "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_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", p_config.shadow_color);
|
||||||
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0.35));
|
|
||||||
p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4);
|
p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4);
|
||||||
p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0);
|
p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0);
|
||||||
p_theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", 1);
|
p_theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", 1);
|
||||||
|
|
Loading…
Reference in New Issue