diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-02 13:51:52 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-02 13:51:52 +0200 |
commit | fe2cf6e406a0dfc02516ac3d03911d8863f0dce4 (patch) | |
tree | f3dadf1a6c2acb4c67e9fbc51d3512b5dcb125de /editor/plugins/mesh_editor_plugin.cpp | |
parent | ef34c411db6f6f09cf5c98b4e7a0fc565a8f3b4c (diff) | |
parent | fc7cef8dec91f30e563ec1fac2b81c44f656a580 (diff) |
Merge pull request #65210 from YuriSizov/control-customizable-cache-p3
Diffstat (limited to 'editor/plugins/mesh_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/mesh_editor_plugin.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index d8977ea6fc..be26baaea5 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -49,20 +49,22 @@ void MeshEditor::gui_input(const Ref<InputEvent> &p_event) { } } +void MeshEditor::_update_theme_item_cache() { + SubViewportContainer::_update_theme_item_cache(); + + theme_cache.light_1_on = get_theme_icon(SNAME("MaterialPreviewLight1"), SNAME("EditorIcons")); + theme_cache.light_1_off = get_theme_icon(SNAME("MaterialPreviewLight1Off"), SNAME("EditorIcons")); + theme_cache.light_2_on = get_theme_icon(SNAME("MaterialPreviewLight2"), SNAME("EditorIcons")); + theme_cache.light_2_off = get_theme_icon(SNAME("MaterialPreviewLight2Off"), SNAME("EditorIcons")); +} + void MeshEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_READY: { - //get_scene()->connect("node_removed",this,"_node_removed"); - - if (first_enter) { - //it's in propertyeditor so. could be moved around - - light_1_switch->set_normal_texture(get_theme_icon(SNAME("MaterialPreviewLight1"), SNAME("EditorIcons"))); - light_1_switch->set_pressed_texture(get_theme_icon(SNAME("MaterialPreviewLight1Off"), SNAME("EditorIcons"))); - light_2_switch->set_normal_texture(get_theme_icon(SNAME("MaterialPreviewLight2"), SNAME("EditorIcons"))); - light_2_switch->set_pressed_texture(get_theme_icon(SNAME("MaterialPreviewLight2Off"), SNAME("EditorIcons"))); - first_enter = false; - } + case NOTIFICATION_THEME_CHANGED: { + light_1_switch->set_normal_texture(theme_cache.light_1_on); + light_1_switch->set_pressed_texture(theme_cache.light_1_off); + light_2_switch->set_normal_texture(theme_cache.light_2_on); + light_2_switch->set_pressed_texture(theme_cache.light_2_off); } break; } } @@ -160,8 +162,6 @@ MeshEditor::MeshEditor() { vb_light->add_child(light_2_switch); light_2_switch->connect("pressed", callable_mp(this, &MeshEditor::_button_pressed).bind(light_2_switch)); - first_enter = true; - rot_x = 0; rot_y = 0; } |