diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/dependency_editor.cpp | 1 | ||||
-rw-r--r-- | tools/editor/editor_help.cpp | 3 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 15 | ||||
-rw-r--r-- | tools/editor/editor_resource_preview.cpp | 132 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_mesh_import_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 9 |
6 files changed, 93 insertions, 69 deletions
diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp index ef667b75e1..049bcefc75 100644 --- a/tools/editor/dependency_editor.cpp +++ b/tools/editor/dependency_editor.cpp @@ -418,6 +418,7 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) { exist=false; owners->clear(); files.clear(); + owners->create_item(); // root for(int i=0;i<to_erase.size();i++) { files[to_erase[i]]=NULL; } diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 0b60db5ee3..1fc157098c 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -332,7 +332,7 @@ EditorHelpSearch::EditorHelpSearch() { register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); - set_title(TTR("Search Classes")); + set_title(TTR("Search Help")); // search_options->set_hide_root(true); @@ -526,6 +526,7 @@ EditorHelpIndex::EditorHelpIndex() { class_list->connect("item_activated",this,"_tree_item_selected"); get_ok()->set_text(TTR("Open")); + set_title(TTR("Search Classes")); } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 001a94f251..89d7f8f3ce 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1611,6 +1611,7 @@ void EditorNode::_edit_current() { object_menu->set_disabled(true); bool is_resource = current_obj->is_type("Resource"); + bool is_node = current_obj->is_type("Node"); resource_save_button->set_disabled(!is_resource); if (is_resource) { @@ -1627,7 +1628,7 @@ void EditorNode::_edit_current() { //top_pallete->set_current_tab(1); - } else if (current_obj->is_type("Node")) { + } else if (is_node) { Node * current_node = current_obj->cast_to<Node>(); ERR_FAIL_COND(!current_node); @@ -1723,10 +1724,14 @@ void EditorNode::_edit_current() { p->add_shortcut(ED_SHORTCUT("property_editor/copy_resource",TTR("Copy Resource")),RESOURCE_COPY); p->add_shortcut(ED_SHORTCUT("property_editor/unref_resource",TTR("Make Built-In")),RESOURCE_UNREF); } - p->add_separator(); - p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique",TTR("Make Sub-Resources Unique")),OBJECT_UNIQUE_RESOURCES); - p->add_separator(); - p->add_icon_shortcut(gui_base->get_icon("Help","EditorIcons"),ED_SHORTCUT("property_editor/open_help",TTR("Open in Help")),OBJECT_REQUEST_HELP); + + if (is_resource || is_node) { + p->add_separator(); + p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique",TTR("Make Sub-Resources Unique")),OBJECT_UNIQUE_RESOURCES); + p->add_separator(); + p->add_icon_shortcut(gui_base->get_icon("Help","EditorIcons"),ED_SHORTCUT("property_editor/open_help",TTR("Open in Help")),OBJECT_REQUEST_HELP); + } + List<MethodInfo> methods; current_obj->get_method_list(&methods); diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 6e38d6460b..a02fe2a531 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -33,6 +33,7 @@ #include "io/resource_saver.h" #include "globals.h" #include "editor_scale.h" +#include "message_queue.h" Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String& p_path) { @@ -83,12 +84,10 @@ void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture cache[path]=item; - Object *recv = ObjectDB::get_instance(id); - if (recv) { - recv->call_deferred(p_func,path,p_texture,p_ud); - } - preview_mutex->unlock(); + + MessageQueue::get_singleton()->push_call(id,p_func,path,p_texture,p_ud); + } Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,const String& cache_base) { @@ -107,6 +106,7 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co Ref<Texture> generated; for(int i=0;i<preview_generators.size();i++) { + if (!preview_generators[i]->handles(type)) continue; if (p_item.resource.is_valid()) { @@ -157,99 +157,107 @@ void EditorResourcePreview::_thread() { QueueItem item = queue.front()->get(); queue.pop_front(); - preview_mutex->unlock(); - - Ref<Texture> texture; - - //print_line("pop from queue "+item.path); - - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); - thumbnail_size*=EDSCALE; if (cache.has(item.path)) { //already has it because someone loaded it, just let it know it's ready if (item.resource.is_valid()) { item.path+=":"+itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below) } - call_deferred("_preview_ready",item.path,cache[item.path].preview,item.id,item.function,item.userdata); - - } else if (item.resource.is_valid()){ - texture=_generate_preview(item,String()); - //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred - call_deferred("_preview_ready",item.path+":"+itos(item.resource->hash_edited_version()),texture,item.id,item.function,item.userdata); + _preview_ready(item.path,cache[item.path].preview,item.id,item.function,item.userdata); + preview_mutex->unlock(); } else { + preview_mutex->unlock(); + + Ref<Texture> texture; - String temp_path=EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); - String cache_base = Globals::get_singleton()->globalize_path(item.path).md5_text(); - cache_base = temp_path.plus_file("resthumb-"+cache_base); + //print_line("pop from queue "+item.path); - //does not have it, try to load a cached thumbnail + int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; - String file = cache_base+".txt"; - //print_line("cachetxt at "+file); - FileAccess *f=FileAccess::open(file,FileAccess::READ); - if (!f) { - //print_line("generate because not cached"); + if (item.resource.is_valid()){ + + texture=_generate_preview(item,String()); + //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred + _preview_ready(item.path+":"+itos(item.resource->hash_edited_version()),texture,item.id,item.function,item.userdata); - //generate - texture=_generate_preview(item,cache_base); } else { - uint64_t modtime = FileAccess::get_modified_time(item.path); - int tsize = f->get_line().to_int64(); - uint64_t last_modtime = f->get_line().to_int64(); - bool cache_valid = true; + String temp_path=EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); + String cache_base = Globals::get_singleton()->globalize_path(item.path).md5_text(); + cache_base = temp_path.plus_file("resthumb-"+cache_base); + + //does not have it, try to load a cached thumbnail - if (tsize!=thumbnail_size) { - cache_valid=false; - memdelete(f); - } else if (last_modtime!=modtime) { + String file = cache_base+".txt"; + //print_line("cachetxt at "+file); + FileAccess *f=FileAccess::open(file,FileAccess::READ); + if (!f) { + + //print_line("generate because not cached"); + + //generate + texture=_generate_preview(item,cache_base); + } else { - String last_md5 = f->get_line(); - String md5 = FileAccess::get_md5(item.path); - memdelete(f); + uint64_t modtime = FileAccess::get_modified_time(item.path); + int tsize = f->get_line().to_int64(); + uint64_t last_modtime = f->get_line().to_int64(); - if (last_md5!=md5) { + bool cache_valid = true; + if (tsize!=thumbnail_size) { cache_valid=false; - } else { - //update modified time + memdelete(f); + } else if (last_modtime!=modtime) { - f=FileAccess::open(file,FileAccess::WRITE); - f->store_line(itos(modtime)); - f->store_line(md5); + String last_md5 = f->get_line(); + String md5 = FileAccess::get_md5(item.path); + memdelete(f); + + if (last_md5!=md5) { + + cache_valid=false; + } else { + //update modified time + + f=FileAccess::open(file,FileAccess::WRITE); + f->store_line(itos(modtime)); + f->store_line(md5); + memdelete(f); + } + } else { memdelete(f); } - } else { - memdelete(f); - } - if (cache_valid) { + if (cache_valid) { - texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); - if (!texture.is_valid()) { - //well fuck - cache_valid=false; + texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); + if (!texture.is_valid()) { + //well fuck + cache_valid=false; + } } - } - if (!cache_valid) { + if (!cache_valid) { - texture=_generate_preview(item,cache_base); - } + texture=_generate_preview(item,cache_base); + } - } + } - //print_line("notify of preview ready"); - call_deferred("_preview_ready",item.path,texture,item.id,item.function,item.userdata); + //print_line("notify of preview ready"); + _preview_ready(item.path,texture,item.id,item.function,item.userdata); + } } + } else { preview_mutex->unlock(); } diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index 095c56a373..2c3ed2afd6 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -520,7 +520,7 @@ Error EditorMeshImportPlugin::import(const String& p_path, const Ref<ResourceImp //new object/surface if (generate_normals || force_smooth) surf_tool->generate_normals(); - if (uvs.size() && (normals.size() || generate_normals)) + if (uvs.size() && (normals.size() || generate_normals) && generate_tangents) surf_tool->generate_tangents(); surf_tool->index(); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index d7d495ff5d..3b095d15f9 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -874,6 +874,15 @@ void ScriptEditor::_reload_scripts(){ } + uint64_t last_date = script->get_last_modified_time(); + uint64_t date = FileAccess::get_modified_time(script->get_path()); + + //printf("last date: %lli vs date: %lli\n",last_date,date); + if (last_date==date) { + continue; + } + + Ref<Script> rel_script = ResourceLoader::load(script->get_path(),script->get_type(),true); ERR_CONTINUE(!rel_script.is_valid()); script->set_source_code( rel_script->get_source_code() ); |