From 300ecfab8940215b57a70777d7fac54095f8aa2b Mon Sep 17 00:00:00 2001 From: KurtBliss Date: Mon, 14 Aug 2023 05:38:44 -0400 Subject: [PATCH] Fixed editor filesystem/import properties not being caught by the doctool Defined glft editor properties in editor_settings Added documentation descriptions and entries --- doc/classes/EditorSettings.xml | 16 ++++++++++++++++ editor/editor_settings.cpp | 6 ++++++ modules/gltf/register_types.cpp | 17 +---------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 5ca89dc03ed..30e173ff752 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -477,6 +477,22 @@ The thumbnail size to use in the editor's file dialogs (in pixels). See also [member docks/filesystem/thumbnail_size]. + + The path to the directory containing the Blender executable used for converting the Blender 3D scene files [code].blend[/code] to glTF 2.0 format during import. Blender 3.0 or later is required. + To enable this feature for your specific project, use [member ProjectSettings.filesystem/import/blender/enabled]. + + + The port number used for Remote Procedure Call (RPC) communication with Godot's created process of the blender executable. + Setting this to 0 effectively disables communication with Godot and the blender process, making performance slower. + + + The maximum idle uptime (in seconds) of the Blender process. + This prevents Godot from having to create a new process for each import within the given seconds. + + + The path to the FBX2glTF executable used for converting Autodesk FBX 3D scene files [code].fbx[/code] to glTF 2.0 format during import. + To enable this feature for your specific project, use [member ProjectSettings.filesystem/import/fbx/enabled]. + If [code]true[/code], uses lossless compression for binary resources. diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5a490fcfc01..b923566bfac 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -513,6 +513,12 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "filesystem/file_dialog/display_mode", 0, "Thumbnails,List") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "filesystem/file_dialog/thumbnail_size", 64, "32,128,16") + // Import (for glft module) + EDITOR_SETTING_USAGE(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/import/blender/blender3_path", "", "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_RANGE, "filesystem/import/blender/rpc_port", 6011, "0,65535,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "filesystem/import/blender/rpc_server_uptime", 5, "0,300,1,or_greater,suffix:s", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + EDITOR_SETTING_USAGE(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "filesystem/import/fbx/fbx2gltf_path", "", "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + /* Docks */ // SceneTree diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index 1788ffac3ae..7891de6be11 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -55,18 +55,7 @@ static void _editor_init() { // Blend to glTF importer. bool blend_enabled = GLOBAL_GET("filesystem/import/blender/enabled"); - // Defined here because EditorSettings doesn't exist in `register_gltf_types` yet. - EDITOR_DEF_RST("filesystem/import/blender/rpc_port", 6011); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, - "filesystem/import/blender/rpc_port", PROPERTY_HINT_RANGE, "0,65535,1")); - - EDITOR_DEF_RST("filesystem/import/blender/rpc_server_uptime", 5); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, - "filesystem/import/blender/rpc_server_uptime", PROPERTY_HINT_RANGE, "0,300,1,or_greater,suffix:s")); - - String blender3_path = EDITOR_DEF_RST("filesystem/import/blender/blender3_path", ""); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, - "filesystem/import/blender/blender3_path", PROPERTY_HINT_GLOBAL_DIR)); + String blender3_path = EDITOR_GET("filesystem/import/blender/blender3_path"); if (blend_enabled) { Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (blender3_path.is_empty()) { @@ -89,10 +78,6 @@ static void _editor_init() { // FBX to glTF importer. bool fbx_enabled = GLOBAL_GET("filesystem/import/fbx/enabled"); - // Defined here because EditorSettings doesn't exist in `register_gltf_types` yet. - String fbx2gltf_path = EDITOR_DEF_RST("filesystem/import/fbx/fbx2gltf_path", ""); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, - "filesystem/import/fbx/fbx2gltf_path", PROPERTY_HINT_GLOBAL_FILE)); if (fbx_enabled) { Ref importer; importer.instantiate();