Fix skeleton 3d editor crash in RC3
Control notifies a theme changed before the editor has entered the tree
(cherry picked from commit a103cd76bb
)
This commit is contained in:
parent
fd8f38c240
commit
912b3afb96
@ -1516,6 +1516,11 @@ void EditorInspectorSection::fold() {
|
|||||||
queue_redraw();
|
queue_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorInspectorSection::set_bg_color(const Color &p_bg_color) {
|
||||||
|
bg_color = p_bg_color;
|
||||||
|
queue_redraw();
|
||||||
|
}
|
||||||
|
|
||||||
bool EditorInspectorSection::has_revertable_properties() const {
|
bool EditorInspectorSection::has_revertable_properties() const {
|
||||||
return !revertable_properties.is_empty();
|
return !revertable_properties.is_empty();
|
||||||
}
|
}
|
||||||
|
@ -297,6 +297,7 @@ public:
|
|||||||
VBoxContainer *get_vbox();
|
VBoxContainer *get_vbox();
|
||||||
void unfold();
|
void unfold();
|
||||||
void fold();
|
void fold();
|
||||||
|
void set_bg_color(const Color &p_bg_color);
|
||||||
|
|
||||||
bool has_revertable_properties() const;
|
bool has_revertable_properties() const;
|
||||||
void property_can_revert_changed(const String &p_path, bool p_can_revert);
|
void property_can_revert_changed(const String &p_path, bool p_can_revert);
|
||||||
|
@ -695,9 +695,6 @@ void Skeleton3DEditor::update_joint_tree() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton3DEditor::update_editors() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void Skeleton3DEditor::create_editors() {
|
void Skeleton3DEditor::create_editors() {
|
||||||
set_h_size_flags(SIZE_EXPAND_FILL);
|
set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
set_focus_mode(FOCUS_ALL);
|
set_focus_mode(FOCUS_ALL);
|
||||||
@ -797,10 +794,8 @@ void Skeleton3DEditor::create_editors() {
|
|||||||
animation_hb->add_child(key_insert_all_button);
|
animation_hb->add_child(key_insert_all_button);
|
||||||
|
|
||||||
// Bone tree.
|
// Bone tree.
|
||||||
const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor"));
|
bones_section = memnew(EditorInspectorSection);
|
||||||
|
bones_section->setup("bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true);
|
||||||
EditorInspectorSection *bones_section = memnew(EditorInspectorSection);
|
|
||||||
bones_section->setup("bones", "Bones", skeleton, section_color, true);
|
|
||||||
add_child(bones_section);
|
add_child(bones_section);
|
||||||
bones_section->unfold();
|
bones_section->unfold();
|
||||||
|
|
||||||
@ -831,7 +826,6 @@ void Skeleton3DEditor::create_editors() {
|
|||||||
void Skeleton3DEditor::_notification(int p_what) {
|
void Skeleton3DEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
create_editors();
|
|
||||||
update_joint_tree();
|
update_joint_tree();
|
||||||
|
|
||||||
joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed));
|
joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed));
|
||||||
@ -857,6 +851,7 @@ void Skeleton3DEditor::_notification(int p_what) {
|
|||||||
key_scale_button->set_icon(get_theme_icon(SNAME("KeyScale"), SNAME("EditorIcons")));
|
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_button->set_icon(get_theme_icon(SNAME("Key"), SNAME("EditorIcons")));
|
||||||
key_insert_all_button->set_icon(get_theme_icon(SNAME("NewKey"), 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();
|
update_joint_tree();
|
||||||
} break;
|
} break;
|
||||||
@ -945,6 +940,8 @@ void fragment() {
|
|||||||
handles_mesh_instance->set_cast_shadows_setting(GeometryInstance3D::SHADOW_CASTING_SETTING_OFF);
|
handles_mesh_instance->set_cast_shadows_setting(GeometryInstance3D::SHADOW_CASTING_SETTING_OFF);
|
||||||
handles_mesh.instantiate();
|
handles_mesh.instantiate();
|
||||||
handles_mesh_instance->set_mesh(handles_mesh);
|
handles_mesh_instance->set_mesh(handles_mesh);
|
||||||
|
|
||||||
|
create_editors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton3DEditor::update_bone_original() {
|
void Skeleton3DEditor::update_bone_original() {
|
||||||
|
@ -132,6 +132,8 @@ class Skeleton3DEditor : public VBoxContainer {
|
|||||||
Button *key_insert_button = nullptr;
|
Button *key_insert_button = nullptr;
|
||||||
Button *key_insert_all_button = nullptr;
|
Button *key_insert_all_button = nullptr;
|
||||||
|
|
||||||
|
EditorInspectorSection *bones_section = nullptr;
|
||||||
|
|
||||||
EditorFileDialog *file_dialog = nullptr;
|
EditorFileDialog *file_dialog = nullptr;
|
||||||
|
|
||||||
bool keyable = false;
|
bool keyable = false;
|
||||||
@ -146,7 +148,6 @@ class Skeleton3DEditor : public VBoxContainer {
|
|||||||
EditorFileDialog *file_export_lib = nullptr;
|
EditorFileDialog *file_export_lib = nullptr;
|
||||||
|
|
||||||
void update_joint_tree();
|
void update_joint_tree();
|
||||||
void update_editors();
|
|
||||||
|
|
||||||
void create_editors();
|
void create_editors();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user