Skip to content

Commit 93c74cc

Browse files
committed
Improve the material preview in the inspector
1 parent 99a39ce commit 93c74cc

File tree

4 files changed

+280
-101
lines changed

4 files changed

+280
-101
lines changed

core/config/project_settings.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,27 @@ ProjectSettings::ProjectSettings() {
17031703
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
17041704
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
17051705

1706+
List<String> exts;
1707+
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
1708+
String ext_hint;
1709+
for (const String &E : exts) {
1710+
if (!ext_hint.is_empty()) {
1711+
ext_hint += ",";
1712+
}
1713+
ext_hint += "*." + E;
1714+
}
1715+
GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/3d/preview_environment", PROPERTY_HINT_FILE, ext_hint), "");
1716+
List<String> mat_exts;
1717+
ResourceLoader::get_recognized_extensions_for_type("BaseMaterial3D", &mat_exts);
1718+
String mat_ext_hint;
1719+
for (const String &E : mat_exts) {
1720+
if (!mat_ext_hint.is_empty()) {
1721+
mat_ext_hint += ",";
1722+
}
1723+
mat_ext_hint += "*." + E;
1724+
}
1725+
GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/3d/preview_floor_material", PROPERTY_HINT_FILE, mat_ext_hint), "");
1726+
17061727
GLOBAL_DEF("collada/use_ambient", false);
17071728

17081729
// Input settings

doc/classes/ProjectSettings.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,12 @@
10721072
Directory that contains the [code].sln[/code] file. By default, the [code].sln[/code] files is in the root of the project directory, next to the [code]project.godot[/code] and [code].csproj[/code] files.
10731073
Changing this value allows setting up a multi-project scenario where there are multiple [code].csproj[/code]. Keep in mind that the Godot project is considered one of the C# projects in the workspace and it's root directory should contain the [code]project.godot[/code] and [code].csproj[/code] next to each other.
10741074
</member>
1075+
<member name="editor/3d/preview_environment" type="String" setter="" getter="" default="&quot;&quot;">
1076+
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.
1077+
</member>
1078+
<member name="editor/3d/preview_floor_material" type="String" setter="" getter="" default="&quot;&quot;">
1079+
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.
1080+
</member>
10751081
<member name="editor/export/convert_text_resources_to_binary" type="bool" setter="" getter="" default="true">
10761082
If [code]true[/code], text resource ([code]tres[/code]) and text scene ([code]tscn[/code]) files are converted to their corresponding binary format on export. This decreases file sizes and speeds up loading slightly.
10771083
[b]Note:[/b] Because a resource's file extension may change in an exported project, it is heavily recommended to use [method @GDScript.load] or [ResourceLoader] instead of [FileAccess] to load resources dynamically.

0 commit comments

Comments
 (0)