diff options
-rw-r--r-- | editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space2d_editor.cpp (renamed from editor/plugins/animation_blend_space_editor.cpp) | 110 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space2d_editor.h (renamed from editor/plugins/animation_blend_space_editor.h) | 34 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | scene/animation/animation_blend_space2d.cpp (renamed from scene/animation/animation_blend_space.cpp) | 136 | ||||
-rw-r--r-- | scene/animation/animation_blend_space2d.h (renamed from scene/animation/animation_blend_space.h) | 12 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 4 |
7 files changed, 151 insertions, 151 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 53e5ae73cc..0cf5e94f4c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -66,7 +66,7 @@ #include "editor/import/resource_importer_scene.h" #include "editor/import/resource_importer_texture.h" #include "editor/import/resource_importer_wav.h" -#include "editor/plugins/animation_blend_space_editor.h" +#include "editor/plugins/animation_blend_space2d_editor.h" #include "editor/plugins/animation_blend_tree_editor_plugin.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/animation_state_machine_editor.h" @@ -5401,7 +5401,7 @@ EditorNode::EditorNode() { // FIXME: Disabled for Godot 3.0 as made incompatible, it needs to be ported to the new API. //add_editor_plugin(memnew(ShaderGraphEditorPlugin(this))); add_editor_plugin(memnew(AnimationNodeBlendTreeEditorPlugin(this))); - add_editor_plugin(memnew(AnimationNodeBlendSpaceEditorPlugin(this))); + add_editor_plugin(memnew(AnimationNodeBlendSpace2DEditorPlugin(this))); add_editor_plugin(memnew(AnimationNodeStateMachineEditorPlugin(this))); add_editor_plugin(memnew(CameraEditorPlugin(this))); diff --git a/editor/plugins/animation_blend_space_editor.cpp b/editor/plugins/animation_blend_space2d_editor.cpp index 96093db00d..de72bd5198 100644 --- a/editor/plugins/animation_blend_space_editor.cpp +++ b/editor/plugins/animation_blend_space2d_editor.cpp @@ -1,4 +1,4 @@ -#include "animation_blend_space_editor.h" +#include "animation_blend_space2d_editor.h" #include "core/io/resource_loader.h" #include "core/project_settings.h" @@ -11,14 +11,14 @@ #include "scene/gui/panel.h" #include "scene/main/viewport.h" -void AnimationNodeBlendSpaceEditor::edit(AnimationNodeBlendSpace *p_blend_space) { +void AnimationNodeBlendSpace2DEditor::edit(AnimationNodeBlendSpace2D *p_blend_space) { if (blend_space.is_valid()) { blend_space->disconnect("removed_from_graph", this, "_removed_from_graph"); } if (p_blend_space) { - blend_space = Ref<AnimationNodeBlendSpace>(p_blend_space); + blend_space = Ref<AnimationNodeBlendSpace2D>(p_blend_space); } else { blend_space.unref(); } @@ -32,7 +32,7 @@ void AnimationNodeBlendSpaceEditor::edit(AnimationNodeBlendSpace *p_blend_space) } } -void AnimationNodeBlendSpaceEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) { +void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) { @@ -242,7 +242,7 @@ void AnimationNodeBlendSpaceEditor::_blend_space_gui_input(const Ref<InputEvent> } } -void AnimationNodeBlendSpaceEditor::_add_menu_type(int p_index) { +void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) { String type = menu->get_item_metadata(p_index); @@ -265,7 +265,7 @@ void AnimationNodeBlendSpaceEditor::_add_menu_type(int p_index) { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_add_animation_type(int p_index) { +void AnimationNodeBlendSpace2DEditor::_add_animation_type(int p_index) { Ref<AnimationNodeAnimation> anim; anim.instance(); @@ -284,7 +284,7 @@ void AnimationNodeBlendSpaceEditor::_add_animation_type(int p_index) { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_update_tool_erase() { +void AnimationNodeBlendSpace2DEditor::_update_tool_erase() { tool_erase->set_disabled(!(selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) && !(selected_triangle >= 0 && selected_triangle < blend_space->get_triangle_count())); if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) { Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point); @@ -299,7 +299,7 @@ void AnimationNodeBlendSpaceEditor::_update_tool_erase() { } } -void AnimationNodeBlendSpaceEditor::_tool_switch(int p_tool) { +void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) { making_triangle.clear(); if (p_tool == 2) { @@ -325,7 +325,7 @@ void AnimationNodeBlendSpaceEditor::_tool_switch(int p_tool) { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_blend_space_draw() { +void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { Color linecolor = get_color("font_color", "Label"); Color linecolor_soft = linecolor; @@ -515,12 +515,12 @@ void AnimationNodeBlendSpaceEditor::_blend_space_draw() { } } -void AnimationNodeBlendSpaceEditor::_snap_toggled() { +void AnimationNodeBlendSpace2DEditor::_snap_toggled() { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_update_space() { +void AnimationNodeBlendSpace2DEditor::_update_space() { if (updating) return; @@ -558,12 +558,12 @@ void AnimationNodeBlendSpaceEditor::_update_space() { updating = false; } -void AnimationNodeBlendSpaceEditor::_config_changed(double) { +void AnimationNodeBlendSpace2DEditor::_config_changed(double) { if (updating) return; updating = true; - undo_redo->create_action("Change BlendSpace Limits"); + undo_redo->create_action("Change BlendSpace2D Limits"); undo_redo->add_do_method(blend_space.ptr(), "set_max_space", Vector2(max_x_value->get_value(), max_y_value->get_value())); undo_redo->add_undo_method(blend_space.ptr(), "set_max_space", blend_space->get_max_space()); undo_redo->add_do_method(blend_space.ptr(), "set_min_space", Vector2(min_x_value->get_value(), min_y_value->get_value())); @@ -578,12 +578,12 @@ void AnimationNodeBlendSpaceEditor::_config_changed(double) { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_labels_changed(String) { +void AnimationNodeBlendSpace2DEditor::_labels_changed(String) { if (updating) return; updating = true; - undo_redo->create_action("Change BlendSpace Labels", UndoRedo::MERGE_ENDS); + undo_redo->create_action("Change BlendSpace2D Labels", UndoRedo::MERGE_ENDS); undo_redo->add_do_method(blend_space.ptr(), "set_x_label", label_x->get_text()); undo_redo->add_undo_method(blend_space.ptr(), "set_x_label", blend_space->get_x_label()); undo_redo->add_do_method(blend_space.ptr(), "set_y_label", label_y->get_text()); @@ -594,12 +594,12 @@ void AnimationNodeBlendSpaceEditor::_labels_changed(String) { updating = false; } -void AnimationNodeBlendSpaceEditor::_erase_selected() { +void AnimationNodeBlendSpace2DEditor::_erase_selected() { if (selected_point != -1) { updating = true; - undo_redo->create_action("Remove BlendSpace Point"); + undo_redo->create_action("Remove BlendSpace2D Point"); undo_redo->add_do_method(blend_space.ptr(), "remove_blend_point", selected_point); undo_redo->add_undo_method(blend_space.ptr(), "add_blend_point", blend_space->get_blend_point_node(selected_point), blend_space->get_blend_point_position(selected_point), selected_point); @@ -622,7 +622,7 @@ void AnimationNodeBlendSpaceEditor::_erase_selected() { } else if (selected_triangle != -1) { updating = true; - undo_redo->create_action("Remove BlendSpace Triangle"); + undo_redo->create_action("Remove BlendSpace2D Triangle"); undo_redo->add_do_method(blend_space.ptr(), "remove_triangle", selected_triangle); undo_redo->add_undo_method(blend_space.ptr(), "add_triangle", blend_space->get_triangle_point(selected_triangle, 0), blend_space->get_triangle_point(selected_triangle, 1), blend_space->get_triangle_point(selected_triangle, 2), selected_triangle); @@ -635,7 +635,7 @@ void AnimationNodeBlendSpaceEditor::_erase_selected() { } } -void AnimationNodeBlendSpaceEditor::_update_edited_point_pos() { +void AnimationNodeBlendSpace2DEditor::_update_edited_point_pos() { if (updating) return; @@ -655,7 +655,7 @@ void AnimationNodeBlendSpaceEditor::_update_edited_point_pos() { } } -void AnimationNodeBlendSpaceEditor::_edit_point_pos(double) { +void AnimationNodeBlendSpace2DEditor::_edit_point_pos(double) { if (updating) return; updating = true; @@ -672,7 +672,7 @@ void AnimationNodeBlendSpaceEditor::_edit_point_pos(double) { blend_space_draw->update(); } -void AnimationNodeBlendSpaceEditor::_notification(int p_what) { +void AnimationNodeBlendSpace2DEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); @@ -694,7 +694,7 @@ void AnimationNodeBlendSpaceEditor::_notification(int p_what) { String error; if (!blend_space->get_graph_player()) { - error = TTR("BlendSpace does not belong to an AnimationGraphPlayer node."); + error = TTR("BlendSpace2D does not belong to an AnimationGraphPlayer node."); } else if (!blend_space->get_graph_player()->is_active()) { error = TTR("AnimationGraphPlayer is inactive.\nActivate to enable playback, check node warnings if activation fails."); } else if (blend_space->get_graph_player()->is_state_invalid()) { @@ -714,7 +714,7 @@ void AnimationNodeBlendSpaceEditor::_notification(int p_what) { } } -void AnimationNodeBlendSpaceEditor::_open_editor() { +void AnimationNodeBlendSpace2DEditor::_open_editor() { if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) { Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point); @@ -723,16 +723,16 @@ void AnimationNodeBlendSpaceEditor::_open_editor() { } } -void AnimationNodeBlendSpaceEditor::_goto_parent() { +void AnimationNodeBlendSpace2DEditor::_goto_parent() { EditorNode::get_singleton()->edit_item(blend_space->get_parent().ptr()); } -void AnimationNodeBlendSpaceEditor::_removed_from_graph() { +void AnimationNodeBlendSpace2DEditor::_removed_from_graph() { EditorNode::get_singleton()->edit_item(NULL); } -void AnimationNodeBlendSpaceEditor::_auto_triangles_toggled() { +void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() { undo_redo->create_action("Toggle Auto Triangles"); undo_redo->add_do_method(blend_space.ptr(), "set_auto_triangles", auto_triangles->is_pressed()); @@ -742,35 +742,35 @@ void AnimationNodeBlendSpaceEditor::_auto_triangles_toggled() { undo_redo->commit_action(); } -void AnimationNodeBlendSpaceEditor::_bind_methods() { +void AnimationNodeBlendSpace2DEditor::_bind_methods() { - ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpaceEditor::_blend_space_gui_input); - ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpaceEditor::_blend_space_draw); - ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpaceEditor::_config_changed); - ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpaceEditor::_labels_changed); - ClassDB::bind_method("_update_space", &AnimationNodeBlendSpaceEditor::_update_space); - ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpaceEditor::_snap_toggled); - ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpaceEditor::_tool_switch); - ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpaceEditor::_erase_selected); - ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpaceEditor::_update_tool_erase); - ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpaceEditor::_edit_point_pos); + ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpace2DEditor::_blend_space_gui_input); + ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpace2DEditor::_blend_space_draw); + ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpace2DEditor::_config_changed); + ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpace2DEditor::_labels_changed); + ClassDB::bind_method("_update_space", &AnimationNodeBlendSpace2DEditor::_update_space); + ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpace2DEditor::_snap_toggled); + ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpace2DEditor::_tool_switch); + ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpace2DEditor::_erase_selected); + ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpace2DEditor::_update_tool_erase); + ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpace2DEditor::_edit_point_pos); - ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpaceEditor::_add_menu_type); - ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpaceEditor::_add_animation_type); + ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpace2DEditor::_add_menu_type); + ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpace2DEditor::_add_animation_type); - ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpaceEditor::_update_edited_point_pos); + ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpace2DEditor::_update_edited_point_pos); - ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpaceEditor::_open_editor); - ClassDB::bind_method("_goto_parent", &AnimationNodeBlendSpaceEditor::_goto_parent); + ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace2DEditor::_open_editor); + ClassDB::bind_method("_goto_parent", &AnimationNodeBlendSpace2DEditor::_goto_parent); - ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpaceEditor::_removed_from_graph); + ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph); - ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpaceEditor::_auto_triangles_toggled); + ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled); } -AnimationNodeBlendSpaceEditor *AnimationNodeBlendSpaceEditor::singleton = NULL; +AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; -AnimationNodeBlendSpaceEditor::AnimationNodeBlendSpaceEditor() { +AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { singleton = this; updating = false; @@ -982,17 +982,17 @@ AnimationNodeBlendSpaceEditor::AnimationNodeBlendSpaceEditor() { dragging_selected_attempt = false; } -void AnimationNodeBlendSpaceEditorPlugin::edit(Object *p_object) { +void AnimationNodeBlendSpace2DEditorPlugin::edit(Object *p_object) { - anim_tree_editor->edit(Object::cast_to<AnimationNodeBlendSpace>(p_object)); + anim_tree_editor->edit(Object::cast_to<AnimationNodeBlendSpace2D>(p_object)); } -bool AnimationNodeBlendSpaceEditorPlugin::handles(Object *p_object) const { +bool AnimationNodeBlendSpace2DEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("AnimationNodeBlendSpace"); + return p_object->is_class("AnimationNodeBlendSpace2D"); } -void AnimationNodeBlendSpaceEditorPlugin::make_visible(bool p_visible) { +void AnimationNodeBlendSpace2DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { //editor->hide_animation_player_editors(); @@ -1009,15 +1009,15 @@ void AnimationNodeBlendSpaceEditorPlugin::make_visible(bool p_visible) { } } -AnimationNodeBlendSpaceEditorPlugin::AnimationNodeBlendSpaceEditorPlugin(EditorNode *p_node) { +AnimationNodeBlendSpace2DEditorPlugin::AnimationNodeBlendSpace2DEditorPlugin(EditorNode *p_node) { editor = p_node; - anim_tree_editor = memnew(AnimationNodeBlendSpaceEditor); + anim_tree_editor = memnew(AnimationNodeBlendSpace2DEditor); anim_tree_editor->set_custom_minimum_size(Size2(0, 300)); - button = editor->add_bottom_panel_item(TTR("BlendSpace"), anim_tree_editor); + button = editor->add_bottom_panel_item(TTR("BlendSpace2D"), anim_tree_editor); button->hide(); } -AnimationNodeBlendSpaceEditorPlugin::~AnimationNodeBlendSpaceEditorPlugin() { +AnimationNodeBlendSpace2DEditorPlugin::~AnimationNodeBlendSpace2DEditorPlugin() { } diff --git a/editor/plugins/animation_blend_space_editor.h b/editor/plugins/animation_blend_space2d_editor.h index 66d2ec6cae..47b1ce13ad 100644 --- a/editor/plugins/animation_blend_space_editor.h +++ b/editor/plugins/animation_blend_space2d_editor.h @@ -1,10 +1,10 @@ -#ifndef ANIMATION_BLEND_SPACE_EDITOR_H -#define ANIMATION_BLEND_SPACE_EDITOR_H +#ifndef ANIMATION_BLEND_SPACE2D_EDITOR_H +#define ANIMATION_BLEND_SPACE2D_EDITOR_H #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "editor/property_editor.h" -#include "scene/animation/animation_blend_space.h" +#include "scene/animation/animation_blend_space2d.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/popup.h" @@ -13,11 +13,11 @@ @author Juan Linietsky <reduzio@gmail.com> */ -class AnimationNodeBlendSpaceEditor : public VBoxContainer { +class AnimationNodeBlendSpace2DEditor : public VBoxContainer { - GDCLASS(AnimationNodeBlendSpaceEditor, VBoxContainer); + GDCLASS(AnimationNodeBlendSpace2DEditor, VBoxContainer); - Ref<AnimationNodeBlendSpace> blend_space; + Ref<AnimationNodeBlendSpace2D> blend_space; HBoxContainer *goto_parent_hb; ToolButton *goto_parent; @@ -59,7 +59,7 @@ class AnimationNodeBlendSpaceEditor : public VBoxContainer { UndoRedo *undo_redo; - static AnimationNodeBlendSpaceEditor *singleton; + static AnimationNodeBlendSpace2DEditor *singleton; void _blend_space_gui_input(const Ref<InputEvent> &p_event); void _blend_space_draw(); @@ -104,27 +104,27 @@ protected: static void _bind_methods(); public: - static AnimationNodeBlendSpaceEditor *get_singleton() { return singleton; } - void edit(AnimationNodeBlendSpace *p_blend_space); - AnimationNodeBlendSpaceEditor(); + static AnimationNodeBlendSpace2DEditor *get_singleton() { return singleton; } + void edit(AnimationNodeBlendSpace2D *p_blend_space); + AnimationNodeBlendSpace2DEditor(); }; -class AnimationNodeBlendSpaceEditorPlugin : public EditorPlugin { +class AnimationNodeBlendSpace2DEditorPlugin : public EditorPlugin { - GDCLASS(AnimationNodeBlendSpaceEditorPlugin, EditorPlugin); + GDCLASS(AnimationNodeBlendSpace2DEditorPlugin, EditorPlugin); - AnimationNodeBlendSpaceEditor *anim_tree_editor; + AnimationNodeBlendSpace2DEditor *anim_tree_editor; EditorNode *editor; Button *button; public: - virtual String get_name() const { return "BlendSpace"; } + virtual String get_name() const { return "BlendSpace2D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); - AnimationNodeBlendSpaceEditorPlugin(EditorNode *p_node); - ~AnimationNodeBlendSpaceEditorPlugin(); + AnimationNodeBlendSpace2DEditorPlugin(EditorNode *p_node); + ~AnimationNodeBlendSpace2DEditorPlugin(); }; -#endif // ANIMATION_BLEND_SPACE_EDITOR_H +#endif // ANIMATION_BLEND_SPACE2D_EDITOR_H diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index fcd6a18c35..0dda65fcfb 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -774,7 +774,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { add_options.push_back(AddOption("TimeScale", "AnimationNodeTimeScale")); add_options.push_back(AddOption("Transition", "AnimationNodeTransition")); add_options.push_back(AddOption("BlendTree", "AnimationNodeBlendTree")); - add_options.push_back(AddOption("BlendSpace", "AnimationNodeBlendSpace")); + add_options.push_back(AddOption("BlendSpace2D", "AnimationNodeBlendSpace2D")); add_options.push_back(AddOption("StateMachine", "AnimationNodeStateMachine")); _update_options_menu(); diff --git a/scene/animation/animation_blend_space.cpp b/scene/animation/animation_blend_space2d.cpp index c2d76a9fb4..6db4a6976c 100644 --- a/scene/animation/animation_blend_space.cpp +++ b/scene/animation/animation_blend_space2d.cpp @@ -1,7 +1,7 @@ -#include "animation_blend_space.h" +#include "animation_blend_space2d.h" #include "math/delaunay.h" -void AnimationNodeBlendSpace::add_blend_point(const Ref<AnimationRootNode> &p_node, const Vector2 &p_position, int p_at_index) { +void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_node, const Vector2 &p_position, int p_at_index) { ERR_FAIL_COND(blend_points_used >= MAX_BLEND_POINTS); ERR_FAIL_COND(p_node.is_null()); ERR_FAIL_COND(p_node->get_parent().is_valid()); @@ -33,14 +33,14 @@ void AnimationNodeBlendSpace::add_blend_point(const Ref<AnimationRootNode> &p_no } } -void AnimationNodeBlendSpace::set_blend_point_position(int p_point, const Vector2 &p_position) { +void AnimationNodeBlendSpace2D::set_blend_point_position(int p_point, const Vector2 &p_position) { ERR_FAIL_INDEX(p_point, blend_points_used); blend_points[p_point].position = p_position; if (auto_triangles) { trianges_dirty = true; } } -void AnimationNodeBlendSpace::set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node) { +void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node) { ERR_FAIL_INDEX(p_point, blend_points_used); ERR_FAIL_COND(p_node.is_null()); @@ -52,15 +52,15 @@ void AnimationNodeBlendSpace::set_blend_point_node(int p_point, const Ref<Animat blend_points[p_point].node->set_parent(this); blend_points[p_point].node->set_graph_player(get_graph_player()); } -Vector2 AnimationNodeBlendSpace::get_blend_point_position(int p_point) const { +Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const { ERR_FAIL_INDEX_V(p_point, blend_points_used, Vector2()); return blend_points[p_point].position; } -Ref<AnimationRootNode> AnimationNodeBlendSpace::get_blend_point_node(int p_point) const { +Ref<AnimationRootNode> AnimationNodeBlendSpace2D::get_blend_point_node(int p_point) const { ERR_FAIL_INDEX_V(p_point, blend_points_used, Ref<AnimationRootNode>()); return blend_points[p_point].node; } -void AnimationNodeBlendSpace::remove_blend_point(int p_point) { +void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); blend_points[p_point].node->set_parent(NULL); @@ -89,12 +89,12 @@ void AnimationNodeBlendSpace::remove_blend_point(int p_point) { blend_points_used--; } -int AnimationNodeBlendSpace::get_blend_point_count() const { +int AnimationNodeBlendSpace2D::get_blend_point_count() const { return blend_points_used; } -bool AnimationNodeBlendSpace::has_triangle(int p_x, int p_y, int p_z) const { +bool AnimationNodeBlendSpace2D::has_triangle(int p_x, int p_y, int p_z) const { ERR_FAIL_INDEX_V(p_x, blend_points_used, false); ERR_FAIL_INDEX_V(p_y, blend_points_used, false); @@ -123,7 +123,7 @@ bool AnimationNodeBlendSpace::has_triangle(int p_x, int p_y, int p_z) const { return false; } -void AnimationNodeBlendSpace::add_triangle(int p_x, int p_y, int p_z, int p_at_index) { +void AnimationNodeBlendSpace2D::add_triangle(int p_x, int p_y, int p_z, int p_at_index) { ERR_FAIL_INDEX(p_x, blend_points_used); ERR_FAIL_INDEX(p_y, blend_points_used); @@ -156,7 +156,7 @@ void AnimationNodeBlendSpace::add_triangle(int p_x, int p_y, int p_z, int p_at_i triangles.insert(p_at_index, t); } } -int AnimationNodeBlendSpace::get_triangle_point(int p_triangle, int p_point) { +int AnimationNodeBlendSpace2D::get_triangle_point(int p_triangle, int p_point) { _update_triangles(); @@ -164,17 +164,17 @@ int AnimationNodeBlendSpace::get_triangle_point(int p_triangle, int p_point) { ERR_FAIL_INDEX_V(p_triangle, triangles.size(), -1); return triangles[p_triangle].points[p_point]; } -void AnimationNodeBlendSpace::remove_triangle(int p_triangle) { +void AnimationNodeBlendSpace2D::remove_triangle(int p_triangle) { ERR_FAIL_INDEX(p_triangle, triangles.size()); triangles.remove(p_triangle); } -int AnimationNodeBlendSpace::get_triangle_count() const { +int AnimationNodeBlendSpace2D::get_triangle_count() const { return triangles.size(); } -void AnimationNodeBlendSpace::set_min_space(const Vector2 &p_min) { +void AnimationNodeBlendSpace2D::set_min_space(const Vector2 &p_min) { min_space = p_min; if (min_space.x >= max_space.x) { @@ -184,11 +184,11 @@ void AnimationNodeBlendSpace::set_min_space(const Vector2 &p_min) { min_space.y = max_space.y - 1; } } -Vector2 AnimationNodeBlendSpace::get_min_space() const { +Vector2 AnimationNodeBlendSpace2D::get_min_space() const { return min_space; } -void AnimationNodeBlendSpace::set_max_space(const Vector2 &p_max) { +void AnimationNodeBlendSpace2D::set_max_space(const Vector2 &p_max) { max_space = p_max; if (max_space.x <= min_space.x) { @@ -198,39 +198,39 @@ void AnimationNodeBlendSpace::set_max_space(const Vector2 &p_max) { max_space.y = min_space.y + 1; } } -Vector2 AnimationNodeBlendSpace::get_max_space() const { +Vector2 AnimationNodeBlendSpace2D::get_max_space() const { return max_space; } -void AnimationNodeBlendSpace::set_snap(const Vector2 &p_snap) { +void AnimationNodeBlendSpace2D::set_snap(const Vector2 &p_snap) { snap = p_snap; } -Vector2 AnimationNodeBlendSpace::get_snap() const { +Vector2 AnimationNodeBlendSpace2D::get_snap() const { return snap; } -void AnimationNodeBlendSpace::set_blend_position(const Vector2 &p_pos) { +void AnimationNodeBlendSpace2D::set_blend_position(const Vector2 &p_pos) { blend_pos = p_pos; } -Vector2 AnimationNodeBlendSpace::get_blend_position() const { +Vector2 AnimationNodeBlendSpace2D::get_blend_position() const { return blend_pos; } -void AnimationNodeBlendSpace::set_x_label(const String &p_label) { +void AnimationNodeBlendSpace2D::set_x_label(const String &p_label) { x_label = p_label; } -String AnimationNodeBlendSpace::get_x_label() const { +String AnimationNodeBlendSpace2D::get_x_label() const { return x_label; } -void AnimationNodeBlendSpace::set_y_label(const String &p_label) { +void AnimationNodeBlendSpace2D::set_y_label(const String &p_label) { y_label = p_label; } -String AnimationNodeBlendSpace::get_y_label() const { +String AnimationNodeBlendSpace2D::get_y_label() const { return y_label; } -void AnimationNodeBlendSpace::_add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node) { +void AnimationNodeBlendSpace2D::_add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node) { if (p_index == blend_points_used) { add_blend_point(p_node, Vector2()); } else { @@ -238,7 +238,7 @@ void AnimationNodeBlendSpace::_add_blend_point(int p_index, const Ref<AnimationR } } -void AnimationNodeBlendSpace::_set_triangles(const Vector<int> &p_triangles) { +void AnimationNodeBlendSpace2D::_set_triangles(const Vector<int> &p_triangles) { if (auto_triangles) return; @@ -248,7 +248,7 @@ void AnimationNodeBlendSpace::_set_triangles(const Vector<int> &p_triangles) { } } -Vector<int> AnimationNodeBlendSpace::_get_triangles() const { +Vector<int> AnimationNodeBlendSpace2D::_get_triangles() const { Vector<int> t; if (auto_triangles && trianges_dirty) @@ -263,7 +263,7 @@ Vector<int> AnimationNodeBlendSpace::_get_triangles() const { return t; } -void AnimationNodeBlendSpace::_update_triangles() { +void AnimationNodeBlendSpace2D::_update_triangles() { if (!auto_triangles || !trianges_dirty) return; @@ -286,7 +286,7 @@ void AnimationNodeBlendSpace::_update_triangles() { } } -Vector2 AnimationNodeBlendSpace::get_closest_point(const Vector2 &p_point) { +Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) { _update_triangles(); @@ -323,7 +323,7 @@ Vector2 AnimationNodeBlendSpace::get_closest_point(const Vector2 &p_point) { return best_point; } -void AnimationNodeBlendSpace::_blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights) { +void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights) { if (p_pos.distance_squared_to(p_points[0]) < CMP_EPSILON2) { r_weights[0] = 1; @@ -369,7 +369,7 @@ void AnimationNodeBlendSpace::_blend_triangle(const Vector2 &p_pos, const Vector r_weights[2] = w; } -float AnimationNodeBlendSpace::process(float p_time, bool p_seek) { +float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) { _update_triangles(); @@ -453,11 +453,11 @@ float AnimationNodeBlendSpace::process(float p_time, bool p_seek) { return mind; } -String AnimationNodeBlendSpace::get_caption() const { - return "BlendSpace"; +String AnimationNodeBlendSpace2D::get_caption() const { + return "BlendSpace2D"; } -void AnimationNodeBlendSpace::_validate_property(PropertyInfo &property) const { +void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &property) const { if (property.name.begins_with("blend_point_")) { String left = property.name.get_slicec('/', 0); int idx = left.get_slicec('_', 2).to_int(); @@ -468,57 +468,57 @@ void AnimationNodeBlendSpace::_validate_property(PropertyInfo &property) const { AnimationRootNode::_validate_property(property); } -void AnimationNodeBlendSpace::set_auto_triangles(bool p_enable) { +void AnimationNodeBlendSpace2D::set_auto_triangles(bool p_enable) { auto_triangles = p_enable; if (auto_triangles) { trianges_dirty = true; } } -bool AnimationNodeBlendSpace::get_auto_triangles() const { +bool AnimationNodeBlendSpace2D::get_auto_triangles() const { return auto_triangles; } -void AnimationNodeBlendSpace::_bind_methods() { +void AnimationNodeBlendSpace2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_blend_point", "node", "pos", "at_index"), &AnimationNodeBlendSpace::add_blend_point, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("set_blend_point_position", "point", "pos"), &AnimationNodeBlendSpace::set_blend_point_position); - ClassDB::bind_method(D_METHOD("get_blend_point_position", "point"), &AnimationNodeBlendSpace::get_blend_point_position); - ClassDB::bind_method(D_METHOD("set_blend_point_node", "point", "node"), &AnimationNodeBlendSpace::set_blend_point_node); - ClassDB::bind_method(D_METHOD("get_blend_point_node", "point"), &AnimationNodeBlendSpace::get_blend_point_node); - ClassDB::bind_method(D_METHOD("remove_blend_point", "point"), &AnimationNodeBlendSpace::remove_blend_point); - ClassDB::bind_method(D_METHOD("get_blend_point_count"), &AnimationNodeBlendSpace::get_blend_point_count); + ClassDB::bind_method(D_METHOD("add_blend_point", "node", "pos", "at_index"), &AnimationNodeBlendSpace2D::add_blend_point, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("set_blend_point_position", "point", "pos"), &AnimationNodeBlendSpace2D::set_blend_point_position); + ClassDB::bind_method(D_METHOD("get_blend_point_position", "point"), &AnimationNodeBlendSpace2D::get_blend_point_position); + ClassDB::bind_method(D_METHOD("set_blend_point_node", "point", "node"), &AnimationNodeBlendSpace2D::set_blend_point_node); + ClassDB::bind_method(D_METHOD("get_blend_point_node", "point"), &AnimationNodeBlendSpace2D::get_blend_point_node); + ClassDB::bind_method(D_METHOD("remove_blend_point", "point"), &AnimationNodeBlendSpace2D::remove_blend_point); + ClassDB::bind_method(D_METHOD("get_blend_point_count"), &AnimationNodeBlendSpace2D::get_blend_point_count); - ClassDB::bind_method(D_METHOD("add_triangle", "x", "y", "z", "at_index"), &AnimationNodeBlendSpace::add_triangle, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("get_triangle_point", "triangle", "point"), &AnimationNodeBlendSpace::get_triangle_point); - ClassDB::bind_method(D_METHOD("remove_triangle", "triangle"), &AnimationNodeBlendSpace::remove_triangle); - ClassDB::bind_method(D_METHOD("get_triangle_count"), &AnimationNodeBlendSpace::get_triangle_count); + ClassDB::bind_method(D_METHOD("add_triangle", "x", "y", "z", "at_index"), &AnimationNodeBlendSpace2D::add_triangle, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_triangle_point", "triangle", "point"), &AnimationNodeBlendSpace2D::get_triangle_point); + ClassDB::bind_method(D_METHOD("remove_triangle", "triangle"), &AnimationNodeBlendSpace2D::remove_triangle); + ClassDB::bind_method(D_METHOD("get_triangle_count"), &AnimationNodeBlendSpace2D::get_triangle_count); - ClassDB::bind_method(D_METHOD("set_min_space", "min_space"), &AnimationNodeBlendSpace::set_min_space); - ClassDB::bind_method(D_METHOD("get_min_space"), &AnimationNodeBlendSpace::get_min_space); + ClassDB::bind_method(D_METHOD("set_min_space", "min_space"), &AnimationNodeBlendSpace2D::set_min_space); + ClassDB::bind_method(D_METHOD("get_min_space"), &AnimationNodeBlendSpace2D::get_min_space); - ClassDB::bind_method(D_METHOD("set_max_space", "max_space"), &AnimationNodeBlendSpace::set_max_space); - ClassDB::bind_method(D_METHOD("get_max_space"), &AnimationNodeBlendSpace::get_max_space); + ClassDB::bind_method(D_METHOD("set_max_space", "max_space"), &AnimationNodeBlendSpace2D::set_max_space); + ClassDB::bind_method(D_METHOD("get_max_space"), &AnimationNodeBlendSpace2D::get_max_space); - ClassDB::bind_method(D_METHOD("set_snap", "snap"), &AnimationNodeBlendSpace::set_snap); - ClassDB::bind_method(D_METHOD("get_snap"), &AnimationNodeBlendSpace::get_snap); + ClassDB::bind_method(D_METHOD("set_snap", "snap"), &AnimationNodeBlendSpace2D::set_snap); + ClassDB::bind_method(D_METHOD("get_snap"), &AnimationNodeBlendSpace2D::get_snap); - ClassDB::bind_method(D_METHOD("set_blend_position", "pos"), &AnimationNodeBlendSpace::set_blend_position); - ClassDB::bind_method(D_METHOD("get_blend_position"), &AnimationNodeBlendSpace::get_blend_position); + ClassDB::bind_method(D_METHOD("set_blend_position", "pos"), &AnimationNodeBlendSpace2D::set_blend_position); + ClassDB::bind_method(D_METHOD("get_blend_position"), &AnimationNodeBlendSpace2D::get_blend_position); - ClassDB::bind_method(D_METHOD("set_x_label", "text"), &AnimationNodeBlendSpace::set_x_label); - ClassDB::bind_method(D_METHOD("get_x_label"), &AnimationNodeBlendSpace::get_x_label); + ClassDB::bind_method(D_METHOD("set_x_label", "text"), &AnimationNodeBlendSpace2D::set_x_label); + ClassDB::bind_method(D_METHOD("get_x_label"), &AnimationNodeBlendSpace2D::get_x_label); - ClassDB::bind_method(D_METHOD("set_y_label", "text"), &AnimationNodeBlendSpace::set_y_label); - ClassDB::bind_method(D_METHOD("get_y_label"), &AnimationNodeBlendSpace::get_y_label); + ClassDB::bind_method(D_METHOD("set_y_label", "text"), &AnimationNodeBlendSpace2D::set_y_label); + ClassDB::bind_method(D_METHOD("get_y_label"), &AnimationNodeBlendSpace2D::get_y_label); - ClassDB::bind_method(D_METHOD("_add_blend_point", "index", "node"), &AnimationNodeBlendSpace::_add_blend_point); + ClassDB::bind_method(D_METHOD("_add_blend_point", "index", "node"), &AnimationNodeBlendSpace2D::_add_blend_point); - ClassDB::bind_method(D_METHOD("_set_triangles", "triangles"), &AnimationNodeBlendSpace::_set_triangles); - ClassDB::bind_method(D_METHOD("_get_triangles"), &AnimationNodeBlendSpace::_get_triangles); + ClassDB::bind_method(D_METHOD("_set_triangles", "triangles"), &AnimationNodeBlendSpace2D::_set_triangles); + ClassDB::bind_method(D_METHOD("_get_triangles"), &AnimationNodeBlendSpace2D::_get_triangles); - ClassDB::bind_method(D_METHOD("set_auto_triangles", "enable"), &AnimationNodeBlendSpace::set_auto_triangles); - ClassDB::bind_method(D_METHOD("get_auto_triangles"), &AnimationNodeBlendSpace::get_auto_triangles); + ClassDB::bind_method(D_METHOD("set_auto_triangles", "enable"), &AnimationNodeBlendSpace2D::set_auto_triangles); + ClassDB::bind_method(D_METHOD("get_auto_triangles"), &AnimationNodeBlendSpace2D::get_auto_triangles); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_triangles", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_auto_triangles", "get_auto_triangles"); @@ -537,7 +537,7 @@ void AnimationNodeBlendSpace::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "y_label", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_y_label", "get_y_label"); } -AnimationNodeBlendSpace::AnimationNodeBlendSpace() { +AnimationNodeBlendSpace2D::AnimationNodeBlendSpace2D() { auto_triangles = true; blend_points_used = 0; @@ -549,7 +549,7 @@ AnimationNodeBlendSpace::AnimationNodeBlendSpace() { trianges_dirty = false; } -AnimationNodeBlendSpace::~AnimationNodeBlendSpace() { +AnimationNodeBlendSpace2D::~AnimationNodeBlendSpace2D() { for (int i = 0; i < blend_points_used; i++) { blend_points[i].node->set_parent(this); diff --git a/scene/animation/animation_blend_space.h b/scene/animation/animation_blend_space2d.h index 921ad40981..582140c97d 100644 --- a/scene/animation/animation_blend_space.h +++ b/scene/animation/animation_blend_space2d.h @@ -1,10 +1,10 @@ -#ifndef ANIMATION_BLEND_SPACE_H -#define ANIMATION_BLEND_SPACE_H +#ifndef ANIMATION_BLEND_SPACE2D_H +#define ANIMATION_BLEND_SPACE2D_H #include "scene/animation/animation_graph_player.h" -class AnimationNodeBlendSpace : public AnimationRootNode { - GDCLASS(AnimationNodeBlendSpace, AnimationRootNode) +class AnimationNodeBlendSpace2D : public AnimationRootNode { + GDCLASS(AnimationNodeBlendSpace2D, AnimationRootNode) enum { MAX_BLEND_POINTS = 64 @@ -87,8 +87,8 @@ public: void set_auto_triangles(bool p_enable); bool get_auto_triangles() const; - AnimationNodeBlendSpace(); - ~AnimationNodeBlendSpace(); + AnimationNodeBlendSpace2D(); + ~AnimationNodeBlendSpace2D(); }; #endif // ANIMATION_BLEND_SPACE_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 5708d3fb4a..54a72aba87 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -63,7 +63,7 @@ #include "scene/2d/tile_map.h" #include "scene/2d/visibility_notifier_2d.h" #include "scene/2d/y_sort.h" -#include "scene/animation/animation_blend_space.h" +#include "scene/animation/animation_blend_space2d.h" #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_graph_player.h" #include "scene/animation/animation_node_state_machine.h" @@ -390,7 +390,7 @@ void register_scene_types() { ClassDB::register_class<AnimationNode>(); ClassDB::register_class<AnimationRootNode>(); ClassDB::register_class<AnimationNodeBlendTree>(); - ClassDB::register_class<AnimationNodeBlendSpace>(); + ClassDB::register_class<AnimationNodeBlendSpace2D>(); ClassDB::register_class<AnimationNodeStateMachine>(); ClassDB::register_class<AnimationNodeStateMachineTransition>(); ClassDB::register_class<AnimationNodeOutput>(); |