Skip to content

Commit

Permalink
Improve the material preview in the inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
ydeltastar committed Dec 4, 2024
1 parent 893bbdf commit 22f52b7
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 66 deletions.
21 changes: 21 additions & 0 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,27 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);

List<String> exts;
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
String ext_hint;
for (const String &E : exts) {
if (!ext_hint.is_empty()) {
ext_hint += ",";
}
ext_hint += "*." + E;
}
GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/environment/material_preview/environment", PROPERTY_HINT_FILE, ext_hint), "");
List<String> mat_exts;
ResourceLoader::get_recognized_extensions_for_type("BaseMaterial3D", &mat_exts);
String mat_ext_hint;
for (const String &E : mat_exts) {
if (!mat_ext_hint.is_empty()) {
mat_ext_hint += ",";
}
mat_ext_hint += "*." + E;
}
GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/environment/material_preview/floor_material", PROPERTY_HINT_FILE, mat_ext_hint), "");

GLOBAL_DEF("collada/use_ambient", false);

// Input settings
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2464,6 +2464,12 @@
<member name="rendering/environment/glow/upscale_mode.mobile" type="int" setter="" getter="" default="0">
Lower-end override for [member rendering/environment/glow/upscale_mode] on mobile devices, due to performance concerns or driver support.
</member>
<member name="rendering/environment/material_preview/environment" type="String" setter="" getter="" default="&quot;&quot;">
Path to the [Environment] resource that will be used in the Inspector's material preview. If this is not set, a default environment will be used instead.
</member>
<member name="rendering/environment/material_preview/floor_material" type="String" setter="" getter="" default="&quot;&quot;">
Path to the [BaseMaterial3D] resource that will be assigned to the floor of the Inspector's material preview. If this is not set, a default material will be used instead.
</member>
<member name="rendering/environment/screen_space_reflection/roughness_quality" type="int" setter="" getter="" default="1">
Sets the quality for rough screen-space reflections. Turning off will make all screen space reflections sharp, while higher values make rough reflections look better.
</member>
Expand Down
6 changes: 6 additions & 0 deletions editor/dependency_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,12 @@ void DependencyRemoveDialog::ok_pressed() {
} else if (files_to_delete[i] == String(GLOBAL_GET("rendering/environment/defaults/default_environment"))) {
ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", "");
project_settings_modified = true;
} else if (files_to_delete[i] == String(GLOBAL_GET("rendering/environment/material_preview/environment"))) {
ProjectSettings::get_singleton()->set("rendering/environment/material_preview/environment", "");
project_settings_modified = true;
} else if (files_to_delete[i] == String(GLOBAL_GET("rendering/environment/material_preview/floor_material"))) {
ProjectSettings::get_singleton()->set("rendering/environment/material_preview/floor_material", "");
project_settings_modified = true;
} else if (files_to_delete[i] == String(GLOBAL_GET("display/mouse_cursor/custom_image"))) {
ProjectSettings::get_singleton()->set("display/mouse_cursor/custom_image", "");
project_settings_modified = true;
Expand Down
Loading

0 comments on commit 22f52b7

Please sign in to comment.