summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-07-05 04:20:40 +0200
committerGitHub <noreply@github.com>2018-07-05 04:20:40 +0200
commit073e77454dccb08d56f837f809eef43d57f09819 (patch)
treeb014126ac62046a1d82f37277549a1641f610137
parented61bdd2ae16c3d81b8aa1cdd9df7d769e44c49c (diff)
parentb4f60ae3acaddfcc3cae02c7f9e804b1909a8f02 (diff)
Merge pull request #19713 from volzhs/fix-crash-nodepath-animation-edit
Fix crash when assigning a node on editing animation key
-rw-r--r--editor/animation_track_editor.cpp5
-rw-r--r--editor/editor_properties.cpp9
2 files changed, 13 insertions, 1 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 293684f48e..f665ae88de 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -25,6 +25,7 @@ public:
ClassDB::bind_method("_update_obj", &AnimationTrackKeyEdit::_update_obj);
ClassDB::bind_method("_key_ofs_changed", &AnimationTrackKeyEdit::_key_ofs_changed);
ClassDB::bind_method("_hide_script_from_inspector", &AnimationTrackKeyEdit::_hide_script_from_inspector);
+ ClassDB::bind_method("get_root_path", &AnimationTrackKeyEdit::get_root_path);
}
//PopupDialog *ke_dialog;
@@ -612,6 +613,10 @@ public:
_change_notify();
}
+ Node *get_root_path() {
+ return root_path;
+ }
+
AnimationTrackKeyEdit() {
hidden = true;
key_ofs = 0;
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f3d3cc8cbc..064569dea0 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1522,8 +1522,15 @@ EditorPropertyColor::EditorPropertyColor() {
void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
+ NodePath path = p_path;
Node *base_node = Object::cast_to<Node>(get_edited_object());
- emit_signal("property_changed", get_edited_property(), base_node->get_path().rel_path_to(p_path));
+ if (base_node == NULL && get_edited_object()->has_method("get_root_path")) {
+ base_node = get_edited_object()->call("get_root_path");
+ }
+ if (base_node) { // for AnimationTrackKeyEdit
+ path = base_node->get_path().rel_path_to(p_path);
+ }
+ emit_signal("property_changed", get_edited_property(), path);
update_property();
}