Merge pull request #37509 from wazzy47/issue_36228

Add "preview_on_sphere" setting of material editor plugin
This commit is contained in:
Rémi Verschelde 2020-04-10 12:08:51 +02:00 committed by GitHub
commit 60f77fa059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,7 @@ void MaterialEditor::_button_pressed(Node *p_button) {
sphere_instance->hide(); sphere_instance->hide();
box_switch->set_pressed(true); box_switch->set_pressed(true);
sphere_switch->set_pressed(false); sphere_switch->set_pressed(false);
EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", false);
} }
if (p_button == sphere_switch) { if (p_button == sphere_switch) {
@ -102,6 +103,7 @@ void MaterialEditor::_button_pressed(Node *p_button) {
sphere_instance->show(); sphere_instance->show();
box_switch->set_pressed(false); box_switch->set_pressed(false);
sphere_switch->set_pressed(true); sphere_switch->set_pressed(true);
EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", true);
} }
} }
@ -155,7 +157,6 @@ MaterialEditor::MaterialEditor() {
sphere_instance->set_mesh(sphere_mesh); sphere_instance->set_mesh(sphere_mesh);
box_mesh.instance(); box_mesh.instance();
box_instance->set_mesh(box_mesh); box_instance->set_mesh(box_mesh);
box_instance->hide();
set_custom_minimum_size(Size2(1, 150) * EDSCALE); set_custom_minimum_size(Size2(1, 150) * EDSCALE);
@ -194,6 +195,15 @@ MaterialEditor::MaterialEditor() {
light_2_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(light_2_switch)); light_2_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(light_2_switch));
first_enter = true; 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);
}
} }
/////////////////////// ///////////////////////