summaryrefslogtreecommitdiff
path: root/editor/editor_file_system.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_file_system.h')
-rw-r--r--editor/editor_file_system.h55
1 files changed, 26 insertions, 29 deletions
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index d5ae046c36..6f4f058503 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -34,6 +34,7 @@
#include "core/os/dir_access.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
+#include "core/templates/safe_refcount.h"
#include "core/templates/set.h"
#include "scene/main/node.h"
class FileAccess;
@@ -52,12 +53,12 @@ class EditorFileSystemDirectory : public Object {
struct FileInfo {
String file;
StringName type;
- uint64_t modified_time;
- uint64_t import_modified_time;
- bool import_valid;
+ uint64_t modified_time = 0;
+ uint64_t import_modified_time = 0;
+ bool import_valid = false;
String import_group_file;
Vector<String> deps;
- bool verified; //used for checking changes
+ bool verified = false; //used for checking changes
String script_class_name;
String script_class_extends;
String script_class_icon_path;
@@ -119,22 +120,15 @@ class EditorFileSystem : public Node {
ACTION_FILE_RELOAD
};
- Action action;
- EditorFileSystemDirectory *dir;
+ Action action = ACTION_NONE;
+ EditorFileSystemDirectory *dir = nullptr;
String file;
- EditorFileSystemDirectory *new_dir;
- EditorFileSystemDirectory::FileInfo *new_file;
-
- ItemAction() {
- action = ACTION_NONE;
- dir = nullptr;
- new_dir = nullptr;
- new_file = nullptr;
- }
+ EditorFileSystemDirectory *new_dir = nullptr;
+ EditorFileSystemDirectory::FileInfo *new_file = nullptr;
};
bool use_threads;
- Thread *thread;
+ Thread thread;
static void _thread_func(void *_userdata);
EditorFileSystemDirectory *new_filesystem;
@@ -162,10 +156,10 @@ class EditorFileSystem : public Node {
/* Used for reading the filesystem cache file */
struct FileCache {
String type;
- uint64_t modification_time;
- uint64_t import_modification_time;
+ uint64_t modification_time = 0;
+ uint64_t import_modification_time = 0;
Vector<String> deps;
- bool import_valid;
+ bool import_valid = false;
String import_group_file;
String script_class_name;
String script_class_extends;
@@ -175,9 +169,9 @@ class EditorFileSystem : public Node {
HashMap<String, FileCache> file_cache;
struct ScanProgress {
- float low;
- float hi;
- mutable EditorProgressBG *progress;
+ float low = 0;
+ float hi = 0;
+ mutable EditorProgressBG *progress = nullptr;
void update(int p_current, int p_total) const;
ScanProgress get_sub(int p_current, int p_total) const;
};
@@ -196,7 +190,7 @@ class EditorFileSystem : public Node {
void _scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess *da, const ScanProgress &p_progress);
- Thread *thread_sources;
+ Thread thread_sources;
bool scanning_changes;
bool scanning_changes_done;
@@ -209,7 +203,7 @@ class EditorFileSystem : public Node {
void _update_extensions();
- void _reimport_file(const String &p_file);
+ void _reimport_file(const String &p_file, const Map<StringName, Variant> *p_custom_options = nullptr, const String &p_custom_importer = String());
Error _reimport_group(const String &p_group_file, const Vector<String> &p_files);
bool _test_for_reimport(const String &p_path, bool p_only_imported_files);
@@ -220,14 +214,14 @@ class EditorFileSystem : public Node {
struct ImportFile {
String path;
- int order;
+ int order = 0;
bool operator<(const ImportFile &p_if) const {
return order < p_if.order;
}
};
void _scan_script_classes(EditorFileSystemDirectory *p_dir);
- volatile bool update_script_classes_queued;
+ SafeFlag update_script_classes_queued;
void _queue_update_script_classes();
String _get_global_script_class(const String &p_type, const String &p_path, String *r_extends, String *r_icon_path) const;
@@ -255,7 +249,6 @@ public:
float get_scanning_progress() const;
void scan();
void scan_changes();
- void get_changed_sources(List<String> *r_changed);
void update_file(const String &p_file);
EditorFileSystemDirectory *get_filesystem_path(const String &p_path);
@@ -264,11 +257,15 @@ public:
void reimport_files(const Vector<String> &p_files);
+ void reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const Map<StringName, Variant> &p_custom_params);
+
void update_script_classes();
bool is_group_file(const String &p_path) const;
void move_group_file(const String &p_path, const String &p_new_path);
+ static bool _should_skip_directory(const String &p_path);
+
EditorFileSystem();
~EditorFileSystem();
};