mirror of https://github.com/godotengine/godot
Merge pull request #84678 from aaronfranke/blend-name
Use the Blender file name instead of the generated GLTF file name
This commit is contained in:
commit
9df6491853
|
|
@ -130,8 +130,9 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
||||||
// Get global paths for source and sink.
|
// Get global paths for source and sink.
|
||||||
// Escape paths to be valid Python strings to embed in the script.
|
// Escape paths to be valid Python strings to embed in the script.
|
||||||
const String source_global = ProjectSettings::get_singleton()->globalize_path(p_path).c_escape();
|
const String source_global = ProjectSettings::get_singleton()->globalize_path(p_path).c_escape();
|
||||||
|
const String blend_basename = p_path.get_file().get_basename();
|
||||||
const String sink = ProjectSettings::get_singleton()->get_imported_files_path().path_join(
|
const String sink = ProjectSettings::get_singleton()->get_imported_files_path().path_join(
|
||||||
vformat("%s-%s.gltf", p_path.get_file().get_basename(), p_path.md5_text()));
|
vformat("%s-%s.gltf", blend_basename, p_path.md5_text()));
|
||||||
const String sink_global = ProjectSettings::get_singleton()->globalize_path(sink).c_escape();
|
const String sink_global = ProjectSettings::get_singleton()->globalize_path(sink).c_escape();
|
||||||
|
|
||||||
// Handle configuration options.
|
// Handle configuration options.
|
||||||
|
|
@ -282,6 +283,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
|
||||||
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
|
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
|
||||||
base_dir = sink.get_base_dir();
|
base_dir = sink.get_base_dir();
|
||||||
}
|
}
|
||||||
|
state->set_scene_name(blend_basename);
|
||||||
err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir);
|
err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
if (r_err) {
|
if (r_err) {
|
||||||
|
|
|
||||||
|
|
@ -573,7 +573,7 @@ Error GLTFDocument::_parse_scenes(Ref<GLTFState> p_state) {
|
||||||
// Determine what to use for the scene name.
|
// Determine what to use for the scene name.
|
||||||
if (scene_dict.has("name") && !String(scene_dict["name"]).is_empty() && !((String)scene_dict["name"]).begins_with("Scene")) {
|
if (scene_dict.has("name") && !String(scene_dict["name"]).is_empty() && !((String)scene_dict["name"]).begins_with("Scene")) {
|
||||||
p_state->scene_name = scene_dict["name"];
|
p_state->scene_name = scene_dict["name"];
|
||||||
} else {
|
} else if (p_state->scene_name.is_empty()) {
|
||||||
p_state->scene_name = p_state->filename;
|
p_state->scene_name = p_state->filename;
|
||||||
}
|
}
|
||||||
if (_naming_version == 0) {
|
if (_naming_version == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue