Skip to content
Closed
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
6 changes: 6 additions & 0 deletions doc/classes/AnimationNode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@
Emitted by nodes that inherit from this class and that have an internal tree when one of their animation node names changes. The animation nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and [AnimationNodeBlendTree].
</description>
</signal>
<signal name="node_updated" experimental="">
<param index="0" name="object_id" type="int" />
<description>
Emitted by [AnimationNodeAnimation] when its [member AnimationNodeAnimation.animation] resource is changed, or by [AnimationNodeBlendTree] when its connections change.
</description>
</signal>
<signal name="tree_changed">
<description>
Emitted by nodes that inherit from this class and that have an internal tree when one of their animation nodes changes. The animation nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], [AnimationNodeBlendTree] and [AnimationNodeTransition].
Expand Down
26 changes: 6 additions & 20 deletions editor/animation/animation_blend_space_1d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"

Expand Down Expand Up @@ -77,15 +78,12 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
animations_to_add.clear();

LocalVector<StringName> classes;
ClassDB::get_inheriters_from_class("AnimationRootNode", classes);
ClassDB::get_inheriters_from_class(SNAME("AnimationRootNode"), classes);
classes.sort_custom<StringName::AlphCompare>();

menu->add_submenu_node_item(TTR("Add Animation"), animations_menu);

List<StringName> names;
tree->get_animation_list(&names);

for (const StringName &E : names) {
for (const StringName &E : tree->get_sorted_animation_list()) {
animations_menu->add_icon_item(get_editor_theme_icon(SNAME("Animation")), E);
animations_to_add.push_back(E);
}
Expand Down Expand Up @@ -588,7 +586,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
error_label->add_theme_color_override(SNAME("default_color"), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
tool_blend->set_button_icon(get_editor_theme_icon(SNAME("EditPivot")));
tool_select->set_button_icon(get_editor_theme_icon(SNAME("ToolSelect")));
Expand All @@ -608,18 +606,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
return;
}

String error;

error = tree->get_editor_error_message();

if (error != error_label->get_text()) {
error_label->set_text(error);
if (!error.is_empty()) {
error_panel->show();
} else {
error_panel->hide();
}
}
update_error_message(tree, error_panel, error_label);
} break;

case NOTIFICATION_VISIBILITY_CHANGED: {
Expand Down Expand Up @@ -809,8 +796,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
error_panel = memnew(PanelContainer);
add_child(error_panel);

error_label = memnew(Label);
error_label->set_focus_mode(FOCUS_ACCESSIBILITY);
error_label = create_error_label_node();
error_panel->add_child(error_label);
error_panel->hide();

Expand Down
4 changes: 2 additions & 2 deletions editor/animation/animation_blend_space_1d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
Control *blend_space_draw = nullptr;

PanelContainer *error_panel = nullptr;
Label *error_label = nullptr;
RichTextLabel *error_label = nullptr;

bool updating = false;

Expand All @@ -91,7 +91,7 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {

PopupMenu *menu = nullptr;
PopupMenu *animations_menu = nullptr;
Vector<String> animations_to_add;
Vector<StringName> animations_to_add;
float add_point_pos = 0.0f;
Vector<real_t> points;

Expand Down
27 changes: 5 additions & 22 deletions editor/animation/animation_blend_space_2d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/main/window.h"
Expand Down Expand Up @@ -126,9 +127,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven

menu->add_submenu_node_item(TTR("Add Animation"), animations_menu);

List<StringName> names;
tree->get_animation_list(&names);
for (const StringName &E : names) {
for (const StringName &E : tree->get_sorted_animation_list()) {
animations_menu->add_icon_item(get_editor_theme_icon(SNAME("Animation")), E);
animations_to_add.push_back(E);
}
Expand Down Expand Up @@ -813,7 +812,7 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
error_label->add_theme_color_override(SNAME("default_color"), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
tool_blend->set_button_icon(get_editor_theme_icon(SNAME("EditPivot")));
tool_select->set_button_icon(get_editor_theme_icon(SNAME("ToolSelect")));
Expand All @@ -835,22 +834,7 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
return;
}

String error;

error = tree->get_editor_error_message();

if (error.is_empty() && blend_space->get_triangle_count() == 0) {
error = TTR("No triangles exist, so no blending can take place.");
}

if (error != error_label->get_text()) {
error_label->set_text(error);
if (!error.is_empty()) {
error_panel->show();
} else {
error_panel->hide();
}
}
update_error_message(tree, error_panel, error_label);
} break;

case NOTIFICATION_VISIBILITY_CHANGED: {
Expand Down Expand Up @@ -1096,8 +1080,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {

error_panel = memnew(PanelContainer);
add_child(error_panel);
error_label = memnew(Label);
error_label->set_focus_mode(FOCUS_ACCESSIBILITY);
error_label = create_error_label_node();
error_panel->add_child(error_label);
error_panel->hide();

Expand Down
4 changes: 2 additions & 2 deletions editor/animation/animation_blend_space_2d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {
Control *blend_space_draw = nullptr;

PanelContainer *error_panel = nullptr;
Label *error_label = nullptr;
RichTextLabel *error_label = nullptr;

bool updating;

Expand All @@ -99,7 +99,7 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {

PopupMenu *menu = nullptr;
PopupMenu *animations_menu = nullptr;
Vector<String> animations_to_add;
Vector<StringName> animations_to_add;
Vector2 add_point_pos;
Vector<Vector2> points;

Expand Down
Loading