Skip to content

Commit

Permalink
Merge pull request godotengine#94934 from Hilderin/fix-no-validation-…
Browse files Browse the repository at this point in the history
…blender-path-on-import

Fix no validation on Blender path on import
  • Loading branch information
akien-mga committed Aug 19, 2024
2 parents 6bf6402 + 2dc9cf5 commit ce1ba73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/gltf/editor/editor_scene_importer_blend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,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.
Expand Down
1 change: 1 addition & 0 deletions modules/gltf/editor/editor_scene_importer_blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ce1ba73

Please sign in to comment.