From cf135e372381f8d1c1af9e7b6f65587ab0836e9e Mon Sep 17 00:00:00 2001 From: Vasiliy Date: Wed, 1 Apr 2020 23:50:06 +0300 Subject: [PATCH] Add "preview_on_sphere" setting of material editor plugin (cherry picked from commit 48b144afb7c91b1156e5aad091fd41de4eb88657) --- editor/plugins/material_editor_plugin.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 750f814319b..48fe05061db 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -94,6 +94,7 @@ void MaterialEditor::_button_pressed(Node *p_button) { sphere_instance->hide(); box_switch->set_pressed(true); sphere_switch->set_pressed(false); + EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", false); } if (p_button == sphere_switch) { @@ -101,6 +102,7 @@ void MaterialEditor::_button_pressed(Node *p_button) { sphere_instance->show(); box_switch->set_pressed(false); sphere_switch->set_pressed(true); + EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", true); } } @@ -156,7 +158,6 @@ MaterialEditor::MaterialEditor() { sphere_instance->set_mesh(sphere_mesh); box_mesh.instance(); box_instance->set_mesh(box_mesh); - box_instance->hide(); set_custom_minimum_size(Size2(1, 150) * EDSCALE); @@ -195,6 +196,15 @@ MaterialEditor::MaterialEditor() { light_2_switch->connect("pressed", this, "_button_pressed", varray(light_2_switch)); first_enter = true; + + if (EditorSettings::get_singleton()->get_project_metadata("inspector_options", "material_preview_on_sphere", true)) { + box_instance->hide(); + } else { + box_instance->show(); + sphere_instance->hide(); + box_switch->set_pressed(true); + sphere_switch->set_pressed(false); + } } ///////////////////////