Fix text files constantly asking for reload as no last modified time
This commit is contained in:
parent
ca28c455bf
commit
69fe17639e
3 changed files with 11 additions and 0 deletions
|
@ -123,6 +123,7 @@ public:
|
||||||
static int get_import_order(const String &p_path);
|
static int get_import_order(const String &p_path);
|
||||||
|
|
||||||
static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load = p_timestamp; }
|
static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load = p_timestamp; }
|
||||||
|
static bool get_timestamp_on_load() { return timestamp_on_load; }
|
||||||
|
|
||||||
static void notify_load_error(const String &p_err) {
|
static void notify_load_error(const String &p_err) {
|
||||||
if (err_notify) err_notify(err_notify_ud, p_err);
|
if (err_notify) err_notify(err_notify_ud, p_err);
|
||||||
|
|
|
@ -76,6 +76,8 @@ public:
|
||||||
static void add_resource_format_saver(ResourceFormatSaver *p_format_saver, bool p_at_front = false);
|
static void add_resource_format_saver(ResourceFormatSaver *p_format_saver, bool p_at_front = false);
|
||||||
|
|
||||||
static void set_timestamp_on_save(bool p_timestamp) { timestamp_on_save = p_timestamp; }
|
static void set_timestamp_on_save(bool p_timestamp) { timestamp_on_save = p_timestamp; }
|
||||||
|
static bool get_timestamp_on_save() { return timestamp_on_save; }
|
||||||
|
|
||||||
static void set_save_callback(ResourceSavedCallback p_callback);
|
static void set_save_callback(ResourceSavedCallback p_callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1815,6 +1815,10 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error
|
||||||
text_file->set_file_path(local_path);
|
text_file->set_file_path(local_path);
|
||||||
text_file->set_path(local_path, true);
|
text_file->set_path(local_path, true);
|
||||||
|
|
||||||
|
if (ResourceLoader::get_timestamp_on_load()) {
|
||||||
|
text_file->set_last_modified_time(FileAccess::get_modified_time(path));
|
||||||
|
}
|
||||||
|
|
||||||
if (r_error) {
|
if (r_error) {
|
||||||
*r_error = OK;
|
*r_error = OK;
|
||||||
}
|
}
|
||||||
|
@ -1844,6 +1848,10 @@ Error ScriptEditor::_save_text_file(Ref<TextFile> p_text_file, const String &p_p
|
||||||
file->close();
|
file->close();
|
||||||
memdelete(file);
|
memdelete(file);
|
||||||
|
|
||||||
|
if (ResourceSaver::get_timestamp_on_save()) {
|
||||||
|
p_text_file->set_last_modified_time(FileAccess::get_modified_time(p_path));
|
||||||
|
}
|
||||||
|
|
||||||
_res_saved_callback(sqscr);
|
_res_saved_callback(sqscr);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue