-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Skeleton3D editor crash regression after #76592 #77074
Fix Skeleton3D editor crash regression after #76592 #77074
Conversation
@lyuma thanks for pitching in. I did test with is_inside_tree and that worked for me in latest master, so I am not sure why it is behaving differently. |
5e63d0d
to
fc1a2be
Compare
Control notifies a theme changed before the editor has entered the tree
fc1a2be
to
a103cd7
Compare
Looks good. This change effectively reverts the Skeleton3DEditor portion of #76592 and replaces it with using a temporary theme color, and updating the editor's color in Here is the actual diff relative to 4.0.2 git diff 4.0.2-stable..spanzeri/fix-theme-crash-skeleton-editor editor/plugins/skeleton_3d_editor_plugin.cpp
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 120cfbdefb..90f054275a 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -43,6 +43,7 @@
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/gui/separator.h"
+#include "scene/gui/texture_rect.h"
#include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/skeleton_profile.h"
#include "scene/resources/sphere_shape_3d.h"
@@ -695,9 +696,6 @@ void Skeleton3DEditor::update_joint_tree() {
}
}
-void Skeleton3DEditor::update_editors() {
-}
-
void Skeleton3DEditor::create_editors() {
set_h_size_flags(SIZE_EXPAND_FILL);
set_focus_mode(FOCUS_ALL);
@@ -797,10 +795,8 @@ void Skeleton3DEditor::create_editors() {
animation_hb->add_child(key_insert_all_button);
// Bone tree.
- const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor"));
-
- EditorInspectorSection *bones_section = memnew(EditorInspectorSection);
- bones_section->setup("bones", "Bones", skeleton, section_color, true);
+ bones_section = memnew(EditorInspectorSection);
+ bones_section->setup("bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true);
add_child(bones_section);
bones_section->unfold();
@@ -832,7 +828,6 @@ void Skeleton3DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
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));
@@ -857,6 +852,7 @@ void Skeleton3DEditor::_notification(int p_what) {
key_scale_button->set_icon(get_theme_icon(SNAME("KeyScale"), SNAME("EditorIcons")));
key_insert_button->set_icon(get_theme_icon(SNAME("Key"), SNAME("EditorIcons")));
key_insert_all_button->set_icon(get_theme_icon(SNAME("NewKey"), SNAME("EditorIcons")));
+ bones_section->set_bg_color(get_theme_color(SNAME("prop_subsection"), SNAME("Editor")));
update_joint_tree();
} break; |
Nitpick, but the commit message and PR title are slightly wrong, as it's not crashing in RC3, but in 4.0.3 RC2. Generally speaking the version isn't really that relevant to mention in the commit log, and the bug also happens in 4.1 dev. It could just be "Fix Skeleton3D editor crash regression". |
Thanks! |
…eleton-editor Fix Skeleton3D editor crash regression after godotengine#76592
Cherry-picked for 4.0.3. |
Control notifies a theme changed before the editor has entered the tree,
Fixes: #77046
However, I am not sure why Control notifies THEME_CHANGED before propagating ENTER_TREE to subclasses.
Note that moving the editor creating back to where it was before my change cause theme resources to be accessed before they are ready.
I could use someone with more expertise on theme changes and UI to double check if the fix makes sense or if there is a better way to handle this :)