summaryrefslogtreecommitdiffstats
path: root/editor/plugins/root_motion_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/root_motion_editor_plugin.cpp')
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 10b0b214ae..bc6507155a 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -29,9 +29,10 @@
/**************************************************************************/
#include "root_motion_editor_plugin.h"
+
#include "editor/editor_node.h"
-#include "scene/animation/animation_player.h"
-#include "scene/animation/animation_tree.h"
+#include "editor/editor_scale.h"
+#include "scene/animation/animation_mixer.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
@@ -50,31 +51,26 @@ void EditorPropertyRootMotion::_confirmed() {
}
void EditorPropertyRootMotion::_node_assign() {
- AnimationTree *atree = Object::cast_to<AnimationTree>(get_edited_object());
- if (!atree->has_node(atree->get_animation_player())) {
- EditorNode::get_singleton()->show_warning(TTR("AnimationTree has no path set to an AnimationPlayer"));
- return;
- }
- AnimationPlayer *player = Object::cast_to<AnimationPlayer>(atree->get_node(atree->get_animation_player()));
- if (!player) {
- EditorNode::get_singleton()->show_warning(TTR("Path to AnimationPlayer is invalid"));
+ AnimationMixer *mixer = Object::cast_to<AnimationMixer>(get_edited_object());
+ if (!mixer) {
+ EditorNode::get_singleton()->show_warning(TTR("Path to AnimationMixer is invalid"));
return;
}
- Node *base = player->get_node(player->get_root());
+ Node *base = mixer->get_node(mixer->get_root_node());
if (!base) {
- EditorNode::get_singleton()->show_warning(TTR("Animation player has no valid root node path, so unable to retrieve track names."));
+ EditorNode::get_singleton()->show_warning(TTR("AnimationMixer has no valid root node path, so unable to retrieve track names."));
return;
}
HashSet<String> paths;
{
List<StringName> animations;
- player->get_animation_list(&animations);
+ mixer->get_animation_list(&animations);
for (const StringName &E : animations) {
- Ref<Animation> anim = player->get_animation(E);
+ Ref<Animation> anim = mixer->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
String pathname = anim->track_get_path(i).get_concatenated_names();
if (!paths.has(pathname)) {
@@ -160,7 +156,7 @@ void EditorPropertyRootMotion::_node_assign() {
}
filters->ensure_cursor_is_visible();
- filter_dialog->popup_centered_ratio();
+ filter_dialog->popup_centered(Size2(500, 500) * EDSCALE);
}
void EditorPropertyRootMotion::_node_clear() {
@@ -232,7 +228,7 @@ bool EditorInspectorRootMotionPlugin::can_handle(Object *p_object) {
}
bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
- if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) {
+ if (p_path == "root_motion_track" && p_object->is_class("AnimationMixer") && p_type == Variant::NODE_PATH) {
EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion);
add_property_editor(p_path, editor);
return true;