summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f73eb81473..cc35be1732 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -47,6 +47,7 @@
#include "core/version.h"
#include "editor/editor_string_names.h"
#include "main/main.h"
+#include "scene/3d/bone_attachment_3d.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h"
@@ -6066,6 +6067,27 @@ void EditorNode::_file_access_close_error_notify_impl(const String &p_str) {
add_io_error(vformat(TTR("Unable to write to file '%s', file in use, locked or lacking permissions."), p_str));
}
+// Since we felt that a bespoke NOTIFICATION might not be desirable, this function
+// provides the hardcoded callbacks to address known bugs which occur on certain
+// nodes during reimport.
+// Ideally, we should probably agree on a standardized method name which could be
+// called from here instead.
+void EditorNode::_notify_scene_updated(Node *p_node) {
+ Skeleton3D *skel_3d = Object::cast_to<Skeleton3D>(p_node);
+ if (skel_3d) {
+ skel_3d->reset_bone_poses();
+ } else {
+ BoneAttachment3D *attachment = Object::cast_to<BoneAttachment3D>(p_node);
+ if (attachment) {
+ attachment->notify_rebind_required();
+ }
+ }
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ _notify_scene_updated(p_node->get_child(i));
+ }
+}
+
void EditorNode::reload_scene(const String &p_path) {
int scene_idx = -1;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
@@ -6449,10 +6471,11 @@ void EditorNode::reload_instances_with_path_in_edited_scenes(const String &p_ins
}
}
}
+
// Cleanup the history of the changes.
editor_history.cleanup_history();
- current_edited_scene->propagate_notification(NOTIFICATION_NODE_RECACHE_REQUESTED);
+ _notify_scene_updated(current_edited_scene);
}
edited_scene_map.clear();
}