summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuele Panzeri <samuele.panzeri@gmail.com>2023-04-29 23:17:47 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-05-12 12:31:22 +0200
commit07128ccb9d380dcaa090c1ea1c358af515fac20a (patch)
tree55c53460e108c5278cce6d3d6758dea96ae77acf
parent9d9b7511a0a92e7ecfcbb65b1bc0ee8aab820e31 (diff)
Fix skeleton_3d & physical_bone_3d editor errors
(cherry picked from commit 679ff6da0e5c5ee6637948e51ffa1a36064b71ae)
-rw-r--r--editor/plugins/physical_bone_3d_editor_plugin.cpp9
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp4
2 files changed, 6 insertions, 7 deletions
diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp
index b716cee3ff..a8d3ab948f 100644
--- a/editor/plugins/physical_bone_3d_editor_plugin.cpp
+++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp
@@ -96,8 +96,9 @@ void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) {
}
void PhysicalBone3DEditorPlugin::edit(Object *p_node) {
- selected = static_cast<PhysicalBone3D *>(p_node); // Trust it
- ERR_FAIL_COND(!selected);
-
- physical_bone_editor.set_selected(selected);
+ PhysicalBone3D *bone = Object::cast_to<PhysicalBone3D>(p_node);
+ if (bone) {
+ selected = bone;
+ physical_bone_editor.set_selected(selected);
+ }
}
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 120cfbdefb..285d2e77b2 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -831,8 +831,8 @@ void Skeleton3DEditor::create_editors() {
void Skeleton3DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
+ create_editors();
update_joint_tree();
- update_editors();
joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed));
joint_tree->connect("item_mouse_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_rmb_select));
@@ -945,8 +945,6 @@ void fragment() {
handles_mesh_instance->set_cast_shadows_setting(GeometryInstance3D::SHADOW_CASTING_SETTING_OFF);
handles_mesh.instantiate();
handles_mesh_instance->set_mesh(handles_mesh);
-
- create_editors();
}
void Skeleton3DEditor::update_bone_original() {