diff options
author | Samuele Panzeri <samuele.panzeri@gmail.com> | 2023-05-15 12:23:55 +0200 |
---|---|---|
committer | Samuele Panzeri <samuele.panzeri@gmail.com> | 2023-05-15 14:07:55 +0200 |
commit | 55db54a9f0151e15fb6c830cce3aa95d3aee785d (patch) | |
tree | 2984a90edf4618aa1dcb4a7475312e85da8eae90 | |
parent | 5c653c27cdf779e1e70a16ec9514435537a01779 (diff) | |
download | redot-engine-55db54a9f0151e15fb6c830cce3aa95d3aee785d.tar.gz |
Additional cleanup of editor bones
As discussed in the editor channel in RC, additional cleanup for BoneTransformEditor to move editor creation in construction and access theme in NOTIFICATION_THEME_CHANGED
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 90f054275a..afcfc69d8f 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -51,10 +51,8 @@ #include "scene/scene_string_names.h" void BoneTransformEditor::create_editors() { - const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor")); - section = memnew(EditorInspectorSection); - section->setup("trf_properties", label, this, section_color, true); + section->setup("trf_properties", label, this, Color(0.0f, 0.0f, 0.0f), true); section->unfold(); add_child(section); @@ -93,7 +91,7 @@ void BoneTransformEditor::create_editors() { // Transform/Matrix section. rest_section = memnew(EditorInspectorSection); - rest_section->setup("trf_properties_transform", "Rest", this, section_color, true); + rest_section->setup("trf_properties_transform", "Rest", this, Color(0.0f, 0.0f, 0.0f), true); section->get_vbox()->add_child(rest_section); // Transform/Matrix property. @@ -106,8 +104,10 @@ void BoneTransformEditor::create_editors() { void BoneTransformEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - create_editors(); + case NOTIFICATION_THEME_CHANGED: { + const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor")); + section->set_bg_color(section_color); + rest_section->set_bg_color(section_color); } break; } } @@ -127,6 +127,7 @@ void BoneTransformEditor::_value_changed(const String &p_property, Variant p_val BoneTransformEditor::BoneTransformEditor(Skeleton3D *p_skeleton) : skeleton(p_skeleton) { + create_editors(); } void BoneTransformEditor::set_keyable(const bool p_keyable) { |