feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -41,7 +41,7 @@
|
|||
#include "editor/import/3d/scene_import_settings.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
String SceneExporterGLTFPlugin::get_name() const {
|
||||
String SceneExporterGLTFPlugin::get_plugin_name() const {
|
||||
return "ConvertGLTF2";
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ void SceneExporterGLTFPlugin::_popup_gltf_export_dialog() {
|
|||
}
|
||||
_file_dialog->set_current_file(filename + String(".gltf"));
|
||||
// Generate and refresh the export settings.
|
||||
_export_settings->generate_property_list(_gltf_document);
|
||||
_export_settings->generate_property_list(_gltf_document, root);
|
||||
_settings_inspector->edit(nullptr);
|
||||
_settings_inspector->edit(_export_settings.ptr());
|
||||
// Show the file dialog.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class SceneExporterGLTFPlugin : public EditorPlugin {
|
|||
void _export_scene_as_gltf(const String &p_file_path);
|
||||
|
||||
public:
|
||||
virtual String get_name() const override;
|
||||
virtual String get_plugin_name() const override;
|
||||
bool has_main_screen() const override;
|
||||
SceneExporterGLTFPlugin();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const uint32_t PROP_EDITOR_SCRIPT_VAR = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_S
|
|||
|
||||
bool EditorSceneExporterGLTFSettings::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String name_str = String(p_name);
|
||||
if (name_str.contains("/")) {
|
||||
if (name_str.contains_char('/')) {
|
||||
return _set_extension_setting(name_str, p_value);
|
||||
}
|
||||
if (p_name == StringName("image_format")) {
|
||||
|
|
@ -55,7 +55,7 @@ bool EditorSceneExporterGLTFSettings::_set(const StringName &p_name, const Varia
|
|||
|
||||
bool EditorSceneExporterGLTFSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
String name_str = String(p_name);
|
||||
if (name_str.contains("/")) {
|
||||
if (name_str.contains_char('/')) {
|
||||
return _get_extension_setting(name_str, r_ret);
|
||||
}
|
||||
if (p_name == StringName("image_format")) {
|
||||
|
|
@ -129,7 +129,7 @@ String get_friendly_config_prefix(Ref<GLTFDocumentExtension> p_extension) {
|
|||
}
|
||||
|
||||
// Run this before popping up the export settings, because the extensions may have changed.
|
||||
void EditorSceneExporterGLTFSettings::generate_property_list(Ref<GLTFDocument> p_document) {
|
||||
void EditorSceneExporterGLTFSettings::generate_property_list(Ref<GLTFDocument> p_document, Node *p_root) {
|
||||
_property_list.clear();
|
||||
_document = p_document;
|
||||
String image_format_hint_string = "None,PNG,JPEG";
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ protected:
|
|||
bool _get_extension_setting(const String &p_name_str, Variant &r_ret) const;
|
||||
|
||||
public:
|
||||
void generate_property_list(Ref<GLTFDocument> p_document);
|
||||
void generate_property_list(Ref<GLTFDocument> p_document, Node *p_root = nullptr);
|
||||
|
||||
String get_copyright() const;
|
||||
void set_copyright(const String &p_copyright);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ static bool _get_blender_version(const String &p_path, int &r_major, int &r_mino
|
|||
}
|
||||
pipe = pipe.substr(bl);
|
||||
pipe = pipe.replace_first("Blender ", "");
|
||||
int pp = pipe.find(".");
|
||||
int pp = pipe.find_char('.');
|
||||
if (pp == -1) {
|
||||
if (r_err) {
|
||||
*r_err = vformat(TTR("Couldn't extract version information from Blender executable at: %s."), p_path);
|
||||
|
|
@ -96,16 +96,12 @@ static bool _get_blender_version(const String &p_path, int &r_major, int &r_mino
|
|||
return false;
|
||||
}
|
||||
|
||||
int pp2 = pipe.find(".", pp + 1);
|
||||
int pp2 = pipe.find_char('.', pp + 1);
|
||||
r_minor = pp2 > pp ? pipe.substr(pp + 1, pp2 - pp - 1).to_int() : 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t EditorSceneFormatImporterBlend::get_import_flags() const {
|
||||
return ImportFlags::IMPORT_SCENE | ImportFlags::IMPORT_ANIMATION;
|
||||
}
|
||||
|
||||
void EditorSceneFormatImporterBlend::get_extensions(List<String> *r_extensions) const {
|
||||
r_extensions->push_back("blend");
|
||||
}
|
||||
|
|
@ -115,8 +111,15 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
List<String> *r_missing_deps, Error *r_err) {
|
||||
String blender_path = EDITOR_GET("filesystem/import/blender/blender_path");
|
||||
|
||||
if (blender_major_version == -1 || blender_minor_version == -1) {
|
||||
_get_blender_version(blender_path, blender_major_version, blender_minor_version, nullptr);
|
||||
ERR_FAIL_COND_V_MSG(blender_path.is_empty(), nullptr, "Blender path is empty, check your Editor Settings.");
|
||||
ERR_FAIL_COND_V_MSG(!FileAccess::exists(blender_path), nullptr, vformat("Invalid Blender path: %s, check your Editor Settings.", blender_path));
|
||||
|
||||
if (blender_major_version == -1 || blender_minor_version == -1 || last_tested_blender_path != blender_path) {
|
||||
String error;
|
||||
if (!_get_blender_version(blender_path, blender_major_version, blender_minor_version, &error)) {
|
||||
ERR_FAIL_V_MSG(nullptr, error);
|
||||
}
|
||||
last_tested_blender_path = blender_path;
|
||||
}
|
||||
|
||||
// Get global paths for source and sink.
|
||||
|
|
@ -136,6 +139,10 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
const String sink = ProjectSettings::get_singleton()->get_imported_files_path().path_join(
|
||||
vformat("%s-%s.gltf", blend_basename, p_path.md5_text()));
|
||||
const String sink_global = ProjectSettings::get_singleton()->globalize_path(sink);
|
||||
// If true, unpack the original images to the Godot file system and use them. Allows changing image import settings like VRAM compression.
|
||||
// If false, allow Blender to convert the original images, such as re-packing roughness and metallic into one roughness+metallic texture.
|
||||
// In most cases this is desired, but if the .blend file's images are not in the correct format, this must be disabled for correct behavior.
|
||||
const bool unpack_original_images = p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")];
|
||||
|
||||
// Handle configuration options.
|
||||
|
||||
|
|
@ -143,7 +150,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
Dictionary parameters_map;
|
||||
|
||||
parameters_map["filepath"] = sink_global;
|
||||
parameters_map["export_keep_originals"] = true;
|
||||
parameters_map["export_keep_originals"] = unpack_original_images;
|
||||
parameters_map["export_format"] = "GLTF_SEPARATE";
|
||||
parameters_map["export_yup"] = true;
|
||||
|
||||
|
|
@ -227,6 +234,18 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
} else {
|
||||
parameters_map["export_normals"] = false;
|
||||
}
|
||||
|
||||
if (blender_major_version > 4 || (blender_major_version == 4 && blender_minor_version >= 1)) {
|
||||
if (p_options.has(SNAME("blender/meshes/export_geometry_nodes_instances")) && p_options[SNAME("blender/meshes/export_geometry_nodes_instances")]) {
|
||||
parameters_map["export_gn_mesh"] = true;
|
||||
if (blender_major_version == 4 && blender_minor_version == 1) {
|
||||
// There is a bug in Blender 4.1 where it can't export lights and geometry nodes at the same time, one must be disabled.
|
||||
parameters_map["export_lights"] = false;
|
||||
}
|
||||
} else {
|
||||
parameters_map["export_gn_mesh"] = false;
|
||||
}
|
||||
}
|
||||
if (p_options.has(SNAME("blender/meshes/tangents")) && p_options[SNAME("blender/meshes/tangents")]) {
|
||||
parameters_map["export_tangents"] = true;
|
||||
} else {
|
||||
|
|
@ -266,12 +285,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
parameters_map["export_apply"] = false;
|
||||
}
|
||||
|
||||
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
|
||||
request_options["unpack_all"] = true;
|
||||
} else {
|
||||
request_options["unpack_all"] = false;
|
||||
}
|
||||
|
||||
request_options["unpack_all"] = unpack_original_images;
|
||||
request_options["path"] = source_global;
|
||||
request_options["gltf_options"] = parameters_map;
|
||||
|
||||
|
|
@ -292,15 +306,13 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
Ref<GLTFState> state;
|
||||
state.instantiate();
|
||||
|
||||
String base_dir;
|
||||
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
|
||||
base_dir = sink.get_base_dir();
|
||||
}
|
||||
if (p_options.has(SNAME("nodes/import_as_skeleton_bones")) ? (bool)p_options[SNAME("nodes/import_as_skeleton_bones")] : false) {
|
||||
state->set_import_as_skeleton_bones(true);
|
||||
}
|
||||
state->set_scene_name(blend_basename);
|
||||
err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir);
|
||||
state->set_extract_path(p_path.get_base_dir());
|
||||
state->set_extract_prefix(blend_basename);
|
||||
err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, sink.get_base_dir());
|
||||
if (err != OK) {
|
||||
if (r_err) {
|
||||
*r_err = FAILED;
|
||||
|
|
@ -317,7 +329,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
|||
#endif
|
||||
}
|
||||
|
||||
Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option,
|
||||
Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, const String &p_scene_import_type, const String &p_option,
|
||||
const HashMap<StringName, Variant> &p_options) {
|
||||
if (p_path.get_extension().to_lower() != "blend") {
|
||||
return true;
|
||||
|
|
@ -350,6 +362,7 @@ void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, Li
|
|||
ADD_OPTION_BOOL("blender/meshes/colors", false);
|
||||
ADD_OPTION_BOOL("blender/meshes/uvs", true);
|
||||
ADD_OPTION_BOOL("blender/meshes/normals", true);
|
||||
ADD_OPTION_BOOL("blender/meshes/export_geometry_nodes_instances", false);
|
||||
ADD_OPTION_BOOL("blender/meshes/tangents", true);
|
||||
ADD_OPTION_ENUM("blender/meshes/skins", "None,4 Influences (Compatible),All Influences", BLEND_BONE_INFLUENCES_ALL);
|
||||
ADD_OPTION_BOOL("blender/meshes/export_bones_deforming_mesh_only", false);
|
||||
|
|
@ -483,7 +496,7 @@ void EditorFileSystemImportFormatSupportQueryBlend::_browse_install() {
|
|||
}
|
||||
|
||||
void EditorFileSystemImportFormatSupportQueryBlend::_update_icons() {
|
||||
blender_path_browse->set_icon(blender_path_browse->get_editor_theme_icon(SNAME("FolderBrowse")));
|
||||
blender_path_browse->set_button_icon(blender_path_browse->get_editor_theme_icon(SNAME("FolderBrowse")));
|
||||
}
|
||||
|
||||
bool EditorFileSystemImportFormatSupportQueryBlend::query() {
|
||||
|
|
@ -557,7 +570,6 @@ bool EditorFileSystemImportFormatSupportQueryBlend::query() {
|
|||
confirmed = false;
|
||||
|
||||
while (true) {
|
||||
OS::get_singleton()->delay_usec(1);
|
||||
DisplayServer::get_singleton()->process_events();
|
||||
Main::iteration();
|
||||
if (!configure_blender_dialog->is_visible() || confirmed) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class EditorSceneFormatImporterBlend : public EditorSceneFormatImporter {
|
|||
|
||||
int blender_major_version = -1;
|
||||
int blender_minor_version = -1;
|
||||
String last_tested_blender_path;
|
||||
|
||||
public:
|
||||
enum {
|
||||
|
|
@ -66,14 +67,13 @@ public:
|
|||
BLEND_MODIFIERS_ALL
|
||||
};
|
||||
|
||||
virtual uint32_t get_import_flags() const override;
|
||||
virtual void get_extensions(List<String> *r_extensions) const override;
|
||||
virtual Node *import_scene(const String &p_path, uint32_t p_flags,
|
||||
const HashMap<StringName, Variant> &p_options,
|
||||
List<String> *r_missing_deps, Error *r_err = nullptr) override;
|
||||
virtual void get_import_options(const String &p_path,
|
||||
List<ResourceImporter::ImportOption> *r_options) override;
|
||||
virtual Variant get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option,
|
||||
virtual Variant get_option_visibility(const String &p_path, const String &p_scene_import_type, const String &p_option,
|
||||
const HashMap<StringName, Variant> &p_options) override;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
#include "../gltf_defines.h"
|
||||
#include "../gltf_document.h"
|
||||
|
||||
uint32_t EditorSceneFormatImporterGLTF::get_import_flags() const {
|
||||
return ImportFlags::IMPORT_SCENE | ImportFlags::IMPORT_ANIMATION;
|
||||
}
|
||||
|
||||
void EditorSceneFormatImporterGLTF::get_extensions(List<String> *r_extensions) const {
|
||||
r_extensions->push_back("gltf");
|
||||
r_extensions->push_back("glb");
|
||||
|
|
@ -62,6 +58,9 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
|
|||
if (p_options.has(SNAME("nodes/import_as_skeleton_bones")) ? (bool)p_options[SNAME("nodes/import_as_skeleton_bones")] : false) {
|
||||
state->set_import_as_skeleton_bones(true);
|
||||
}
|
||||
if (p_options.has(SNAME("extract_path"))) {
|
||||
state->set_extract_path(p_options["extract_path"]);
|
||||
}
|
||||
state->set_bake_fps(p_options["animation/fps"]);
|
||||
Error err = gltf->append_from_file(p_path, state, p_flags);
|
||||
if (err != OK) {
|
||||
|
|
@ -100,7 +99,7 @@ void EditorSceneFormatImporterGLTF::handle_compatibility_options(HashMap<StringN
|
|||
}
|
||||
}
|
||||
|
||||
Variant EditorSceneFormatImporterGLTF::get_option_visibility(const String &p_path, bool p_for_animation,
|
||||
Variant EditorSceneFormatImporterGLTF::get_option_visibility(const String &p_path, const String &p_scene_import_type,
|
||||
const String &p_option, const HashMap<StringName, Variant> &p_options) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ class EditorSceneFormatImporterGLTF : public EditorSceneFormatImporter {
|
|||
GDCLASS(EditorSceneFormatImporterGLTF, EditorSceneFormatImporter);
|
||||
|
||||
public:
|
||||
virtual uint32_t get_import_flags() const override;
|
||||
virtual void get_extensions(List<String> *r_extensions) const override;
|
||||
virtual Node *import_scene(const String &p_path, uint32_t p_flags,
|
||||
const HashMap<StringName, Variant> &p_options,
|
||||
|
|
@ -50,7 +49,7 @@ public:
|
|||
virtual void get_import_options(const String &p_path,
|
||||
List<ResourceImporter::ImportOption> *r_options) override;
|
||||
virtual void handle_compatibility_options(HashMap<StringName, Variant> &p_import_params) const override;
|
||||
virtual Variant get_option_visibility(const String &p_path, bool p_for_animation,
|
||||
virtual Variant get_option_visibility(const String &p_path, const String &p_scene_import_type,
|
||||
const String &p_option, const HashMap<StringName, Variant> &p_options) override;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue