Skip to content

Commit b68cc30

Browse files
committed
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
1 parent 588cee2 commit b68cc30

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

editor/plugins/skeleton_3d_editor_plugin.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@
5151
#include "scene/scene_string_names.h"
5252

5353
void BoneTransformEditor::create_editors() {
54-
const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor"));
55-
5654
section = memnew(EditorInspectorSection);
57-
section->setup("trf_properties", label, this, section_color, true);
55+
section->setup("trf_properties", label, this, Color(0.0f, 0.0f, 0.0f), true);
5856
section->unfold();
5957
add_child(section);
6058

@@ -93,7 +91,7 @@ void BoneTransformEditor::create_editors() {
9391

9492
// Transform/Matrix section.
9593
rest_section = memnew(EditorInspectorSection);
96-
rest_section->setup("trf_properties_transform", "Rest", this, section_color, true);
94+
rest_section->setup("trf_properties_transform", "Rest", this, Color(0.0f, 0.0f, 0.0f), true);
9795
section->get_vbox()->add_child(rest_section);
9896

9997
// Transform/Matrix property.
@@ -106,8 +104,10 @@ void BoneTransformEditor::create_editors() {
106104

107105
void BoneTransformEditor::_notification(int p_what) {
108106
switch (p_what) {
109-
case NOTIFICATION_ENTER_TREE: {
110-
create_editors();
107+
case NOTIFICATION_THEME_CHANGED: {
108+
const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor"));
109+
section->set_bg_color(section_color);
110+
rest_section->set_bg_color(section_color);
111111
} break;
112112
}
113113
}
@@ -127,6 +127,7 @@ void BoneTransformEditor::_value_changed(const String &p_property, Variant p_val
127127

128128
BoneTransformEditor::BoneTransformEditor(Skeleton3D *p_skeleton) :
129129
skeleton(p_skeleton) {
130+
create_editors();
130131
}
131132

132133
void BoneTransformEditor::set_keyable(const bool p_keyable) {

0 commit comments

Comments
 (0)