summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-11-12 21:17:58 +0100
committerGitHub <noreply@github.com>2017-11-12 21:17:58 +0100
commit47e5b43160128ea6e466ad70952078ff386718cd (patch)
tree7f957c06e2e06419d35249a191b2b3693f8d55d8 /editor
parent858d3d4adc7e8ae80009ec61cc042d6c24e9e536 (diff)
parent2932cc79ee712a0cb5abe3b327ffc9aad4463c80 (diff)
Merge pull request #12852 from djrm/pr_import_fixes
Update meshes when reimporting,
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_file_system.cpp5
-rw-r--r--editor/editor_node.cpp11
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_resource_preview.cpp12
4 files changed, 8 insertions, 22 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index a6fc8dcddf..9e002bc73d 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -821,8 +821,6 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
scan_actions.push_back(ia);
}
}
-
- EditorResourcePreview::get_singleton()->check_for_invalidation(p_dir->get_file_path(i));
}
for (int i = 0; i < p_dir->subdirs.size(); i++) {
@@ -1266,7 +1264,6 @@ void EditorFileSystem::update_file(const String &p_file) {
fs->files[cpos]->deps = _get_dependencies(p_file);
fs->files[cpos]->import_valid = ResourceLoader::is_import_valid(p_file);
- EditorResourcePreview::get_singleton()->call_deferred("check_for_invalidation", p_file);
call_deferred("emit_signal", "filesystem_changed"); //update later
}
@@ -1436,6 +1433,8 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
r->set_import_last_modified_time(0);
}
}
+
+ EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}
void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9931f75314..e0cae7de57 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -872,7 +872,7 @@ void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) {
_find_node_types(p_node->get_child(i), count_2d, count_3d);
}
-void EditorNode::_save_scene_with_preview(String p_file) {
+void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
EditorProgress save("save", TTR("Saving Scene"), 4);
save.step(TTR("Analyzing"), 0);
@@ -938,7 +938,7 @@ void EditorNode::_save_scene_with_preview(String p_file) {
}
save.step(TTR("Saving Scene"), 4);
- _save_scene(p_file);
+ _save_scene(p_file, p_idx);
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}
@@ -1096,10 +1096,7 @@ void EditorNode::_dialog_action(String p_file) {
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
_save_default_environment();
- if (scene_idx != editor_data.get_edited_scene())
- _save_scene(p_file, scene_idx);
- else
- _save_scene_with_preview(p_file);
+ _save_scene_with_preview(p_file, scene_idx);
if (scene_idx != -1)
_discard_changes();
@@ -1826,7 +1823,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (scene && scene->get_filename() != "") {
if (scene_idx != editor_data.get_edited_scene())
- _save_scene(scene->get_filename(), scene_idx);
+ _save_scene_with_preview(scene->get_filename(), scene_idx);
else
_save_scene_with_preview(scene->get_filename());
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 7d0649cef3..81ff886228 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -503,7 +503,7 @@ private:
void _mark_unsaved_scenes();
void _find_node_types(Node *p_node, int &count_2d, int &count_3d);
- void _save_scene_with_preview(String p_file);
+ void _save_scene_with_preview(String p_file, int p_idx = -1);
Map<String, Set<String> > dependency_errors;
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index f92962a4cb..5b4bdb59d3 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -86,7 +86,6 @@ void EditorResourcePreview::_thread_func(void *ud) {
void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture> &p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
- //print_line("preview is ready");
preview_mutex->lock();
String path = p_str;
@@ -121,7 +120,6 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c
type = p_item.resource->get_class();
else
type = ResourceLoader::get_resource_type(p_item.path);
- //print_line("resource type is: "+type);
if (type == "")
return Ref<Texture>(); //could not guess type
@@ -144,7 +142,6 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c
if (!p_item.resource.is_valid()) {
// cache the preview in case it's a resource on disk
if (generated.is_valid()) {
- //print_line("was generated");
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
thumbnail_size *= EDSCALE;
//wow it generated a preview... save cache
@@ -164,15 +161,11 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c
void EditorResourcePreview::_thread() {
- //print_line("begin thread");
while (!exit) {
- //print_line("wait for semaphore");
preview_sem->wait();
preview_mutex->lock();
- //print_line("blue team go");
-
if (queue.size()) {
QueueItem item = queue.front()->get();
@@ -189,12 +182,11 @@ void EditorResourcePreview::_thread() {
preview_mutex->unlock();
} else {
+
preview_mutex->unlock();
Ref<ImageTexture> texture;
- //print_line("pop from queue "+item.path);
-
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
thumbnail_size *= EDSCALE;
@@ -304,7 +296,6 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p
cache.erase(path_id); //erase if exists, since it will be regen
- //print_line("send to thread "+p_path);
QueueItem item;
item.function = p_receiver_func;
item.id = p_receiver->get_instance_id();
@@ -328,7 +319,6 @@ void EditorResourcePreview::queue_resource_preview(const String &p_path, Object
return;
}
- //print_line("send to thread "+p_path);
QueueItem item;
item.function = p_receiver_func;
item.id = p_receiver->get_instance_id();