From 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 13 Mar 2014 22:57:24 -0300 Subject: -fix bug in cache for atlas import/export -fix some menus -fixed bug in out transition curves -detect and remove file:/// in collada -remove multiscript for now -remove dependencies on mouse in OS, moved to Input -avoid fscache from screwing up (fix might make it slower, but it works) -funcref was missing, it's there now --- tools/editor/editor_file_system.cpp | 4 +- tools/editor/editor_import_export.cpp | 88 +++++++++++++++++++++- tools/editor/editor_node.cpp | 6 +- .../io_plugins/editor_font_import_plugin.cpp | 43 +++++++++++ .../io_plugins/editor_texture_import_plugin.cpp | 18 +++-- tools/editor/project_export.cpp | 4 +- tools/editor/resources_dock.cpp | 2 - tools/editor/scene_tree_editor.cpp | 9 +++ tools/editor/scene_tree_editor.h | 2 + 9 files changed, 156 insertions(+), 20 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 52b195b23..861b6a9e3 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -227,7 +227,7 @@ EditorFileSystem::DirItem* EditorFileSystem::_scan_dir(DirAccess *da,Set DirCache *dc = dir_cache.getptr(path); - if (dc && dc->modification_time==mtime) { + if (false && dc && dc->modification_time==mtime) { //use the cached files, since directory did not change for (Set::Element *E=dc->subdirs.front();E;E=E->next()) { dirs.push_back(E->get()); @@ -542,6 +542,7 @@ bool EditorFileSystem::_check_meta_sources(EditorFileSystemDirectory::ImportMeta for(int j=0;j *p_list) con +static void _exp_add_dep(Map > &deps,const StringName& p_path) { + + + if (deps.has(p_path)) + return; //already done + + deps.insert(p_path,List()); + + List &deplist=deps[p_path]; + Set depset; + + List dl; + ResourceLoader::get_dependencies(p_path,&dl); + + //added in order so child dependencies are always added bfore parent dependencies + for (List::Element *E=dl.front();E;E=E->next()) { + + + if (!deps.has(E->get())) + _exp_add_dep(deps,E->get()); + + for(List::Element *F=deps[E->get()].front();F;F=F->next()) { + + + if (!depset.has(F->get())) { + depset.insert(F->get()); + deplist.push_back(F->get()); + } + } + + if (!depset.has(E->get())) { + depset.insert(E->get()); + deplist.push_back(E->get()); + } + + } +} + + + Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func, void* p_udata,bool p_make_bundles) { /* ALL FILES AND DEPENDENCIES */ Vector files=get_dependencies(p_make_bundles); + Map > deps; + + if (false) { + for(int i=0;i::Element *F=atlas_images.front();F;F=F->next()) { - imd->add_source(EditorImportPlugin::validate_source_path(F->get())); + imd->add_source(EditorImportPlugin::validate_source_path(F->get()),FileAccess::get_md5(F->get())); } @@ -683,7 +735,6 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func rects.resize(r_rects.size()); for(int i=0;i custom; + if (remap_files.size()) { Vector remapsprop; for(Map::Element *E=remap_files.front();E;E=E->next()) { + print_line("REMAP: "+String(E->key())+" -> "+E->get()); remapsprop.push_back(E->key()); remapsprop.push_back(E->get()); } custom["remap/all"]=remapsprop; } + + //add presaved dependencies + for(Map >::Element *E=deps.front();E;E=E->next()) { + + if (E->get().size()==0) + continue; //no deps + String key; + Vector deps; + //if bundle continue (when bundles supported obviously) + + if (remap_files.has(E->key())) { + key=remap_files[E->key()]; + } else { + key=E->key(); + } + + deps.resize(E->get().size()); + int i=0; + + for(List::Element *F=E->get().front();F;F=F->next()) { + deps[i++]=F->get(); + print_line(" -"+String(F->get())); + } + + NodePath prop(deps,true,String()); //seems best to use this for performance + + custom["deps/"+key.md5_text()]=prop; + + } + String remap_file="engine.cfb"; String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+remap_file; Globals::get_singleton()->save_custom(engine_cfb,custom); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index d8f9dcc94..af61022af 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -723,8 +723,6 @@ void EditorNode::_save_scene(String p_file) { flg|=ResourceSaver::FLAG_COMPRESS; if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) flg|=ResourceSaver::FLAG_RELATIVE_PATHS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_without_extension")) - flg|=ResourceSaver::FLAG_NO_EXTENSION; err = ResourceSaver::save(p_file,sdata,flg); @@ -1005,8 +1003,6 @@ void EditorNode::_dialog_action(String p_file) { flg|=ResourceSaver::FLAG_COMPRESS; if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) flg|=ResourceSaver::FLAG_RELATIVE_PATHS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_without_extension")) - flg|=ResourceSaver::FLAG_NO_EXTENSION; err = ResourceSaver::save(p_file,sdata,flg); @@ -3455,7 +3451,7 @@ EditorNode::EditorNode() { p->add_item("Undo",EDIT_UNDO,KEY_MASK_CMD+KEY_Z); p->add_item("Redo",EDIT_REDO,KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_Z); p->add_separator(); - p->add_item("Run Script",FILE_RUN_SCRIPT,KEY_MASK_CMD+KEY_R); + p->add_item("Run Script",FILE_RUN_SCRIPT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_R); p->add_separator(); p->add_item("Project Settings",RUN_SETTINGS); p->add_separator(); diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 4de68c7f4..4b3e05290 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -88,6 +88,7 @@ public: Color color; Color gradient_begin; Color gradient_end; + bool color_use_monochrome; String gradient_image; @@ -148,6 +149,8 @@ public: gradient_end=p_value; else if (n=="color/image") gradient_image=p_value; + else if (n=="color/monochrome") + color_use_monochrome=p_value; else if (n=="advanced/round_advance") round_advance=p_value; else @@ -210,6 +213,8 @@ public: r_ret=gradient_end; else if (n=="color/image") r_ret=gradient_image; + else if (n=="color/monochrome") + r_ret=color_use_monochrome; else if (n=="advanced/round_advance") r_ret=round_advance; else @@ -258,6 +263,7 @@ public: if (color_type==COLOR_GRADIENT_IMAGE) { p_list->push_back(PropertyInfo(Variant::STRING,"color/image",PROPERTY_HINT_FILE)); } + p_list->push_back(PropertyInfo(Variant::BOOL,"color/monochrome")); p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/round_advance")); } @@ -270,6 +276,35 @@ public: } + void reset() { + + char_extra_spacing=0; + top_extra_spacing=0; + bottom_extra_spacing=0; + space_extra_spacing=0; + + character_set=CHARSET_LATIN; + + shadow=false; + shadow_radius=2; + shadow_color=Color(0,0,0,0.3); + shadow_transition=1.0; + + shadow2=false; + shadow2_radius=2; + shadow2_color=Color(0,0,0,0.3); + shadow2_transition=1.0; + + color_type=COLOR_WHITE; + color=Color(1,1,1,1); + gradient_begin=Color(1,1,1,1); + gradient_end=Color(0.5,0.5,0.5,1); + color_use_monochrome=false; + + round_advance=true; + + } + _EditorFontImportOptions() { char_extra_spacing=0; @@ -293,6 +328,7 @@ public: color=Color(1,1,1,1); gradient_begin=Color(1,1,1,1); gradient_end=Color(0.5,0.5,0.5,1); + color_use_monochrome=false; round_advance=true; } @@ -503,6 +539,7 @@ public: dest->get_line_edit()->set_text(p_path); List opts; rimd->get_options(&opts); + options->reset(); for(List::Element *E=opts.front();E;E=E->next()) { options->_set(E->get(),rimd->get_option(E->get())); @@ -1200,6 +1237,12 @@ Ref EditorFontImportPlugin::generate_font(const Refhas_option("color/monochrome") && bool(from->get_option("color/monochrome"))) { + + atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA); + } + if (0) { //debug the texture Ref atlast = memnew( ImageTexture ); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 90dcbb97e..916bd5936 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -747,8 +747,10 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_source_count();i++) { String path = EditorImportPlugin::expand_source_path(from->get_source_path(i)); + String md5 = FileAccess::get_md5(path); + from->set_source_md5(i,FileAccess::get_md5(path)); ep.step("Loading Image: "+path,i); - print_line("source path: "+path); + print_line("source path: "+path+" md5 "+md5); Image src; Error err = ImageLoader::load_image(path,&src); if (err) { @@ -894,7 +896,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refset_source_md5(i,FileAccess::get_md5(apath)); + //from->set_source_md5(i,FileAccess::get_md5(apath)); } } } @@ -953,7 +955,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_data(); ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA); @@ -990,7 +992,6 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refcreate_from_image(image,tex_flags); @@ -1075,7 +1076,7 @@ Vector EditorTextureImportPlugin::custom_export(const String& p_path, c rimd->set_option("quality",group_lossy_quality); rimd->set_option("atlas",false); rimd->set_option("shrink",group_shrink); - rimd->add_source(EditorImportPlugin::validate_source_path(p_path)); + rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path)); } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { //handled by general image export settings @@ -1102,7 +1103,7 @@ Vector EditorTextureImportPlugin::custom_export(const String& p_path, c rimd->set_option("flags",flags); rimd->set_option("quality",EditorImportExport::get_singleton()->get_export_image_quality()); rimd->set_option("atlas",false); - rimd->add_source(EditorImportPlugin::validate_source_path(p_path)); + rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path)); } else { return Vector(); @@ -1117,7 +1118,7 @@ Vector EditorTextureImportPlugin::custom_export(const String& p_path, c } uint32_t flags = rimd->get_option("flags"); - uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1); + uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1); uint8_t format = rimd->get_option("format"); uint8_t comp = (format==EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM)?uint8_t(p_platform->get_image_compression()):uint8_t(255); @@ -1214,6 +1215,9 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor, Mode if (rimd.is_valid()) { if (rimd->get_editor()!="") { + int compression = rimd->get_option("format"); + if (compression!=EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM) + return Vector(); //only useful for RAM compression to reconvert Ref pl = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); if (pl.is_valid()) { Vector ce = pl->custom_export(p_path,p_platform); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index eae5dacb2..f571aba43 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -276,7 +276,7 @@ void ProjectExportDialog::_notification(int p_what) { image_action->select(EditorImportExport::get_singleton()->get_export_image_action()); image_quality->set_val(EditorImportExport::get_singleton()->get_export_image_quality()); - image_shrink->set_val(EditorImportExport::get_singleton()->get_export_image_quality()); + image_shrink->set_val(EditorImportExport::get_singleton()->get_export_image_shrink()); image_quality->connect("value_changed",this,"_quality_edited"); image_shrink->connect("value_changed",this,"_shrink_edited"); image_action->connect("item_selected",this,"_image_export_edited"); @@ -349,7 +349,7 @@ void ProjectExportDialog::_validate_platform() { List pl; EditorFileSystem::get_singleton()->get_changed_sources(&pl); - if (pl.size()) { + if (false && pl.size()) { if (pl.size()==1) platform_error_string->set_text(" -One Resource is pending re-import."); else diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index 37a346957..eb2e526d7 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -156,8 +156,6 @@ void ResourcesDock::save_resource(const String& p_path,const Ref& p_re flg|=ResourceSaver::FLAG_COMPRESS; if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) flg|=ResourceSaver::FLAG_RELATIVE_PATHS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_without_extension")) - flg|=ResourceSaver::FLAG_NO_EXTENSION; String path = Globals::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 89b7e5419..e2ae897fe 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -73,6 +73,12 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) undo_redo->commit_action(); } else if (n->is_type("CanvasItem")) { + CanvasItem *ci = n->cast_to(); + if (!ci->is_visible() && ci->get_parent_item() && !ci->get_parent_item()->is_visible()) { + error->set_text("This item cannot be made visible because the parent is hidden. Unhide the parent first."); + error->popup_centered_minsize(Size2(400,80)); + return; + } bool v = !bool(n->call("is_hidden")); undo_redo->create_action("Toggle CanvasItem Visible"); undo_redo->add_do_method(n,v?"hide":"show"); @@ -663,6 +669,9 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open tree->connect("button_pressed",this,"_cell_button_pressed"); // tree->connect("item_edited", this,"_renamed",Vector(),true); + error = memnew( AcceptDialog ); + add_child(error); + last_hash=0; pending_test_update=false; updating_tree=false; diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index 9a2bdb7ef..edd67a404 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -52,6 +52,8 @@ class SceneTreeEditor : public Control { Tree *tree; Node *selected; + AcceptDialog *error; + int blocked; void _compute_hash(Node *p_node,uint64_t &hash); -- cgit v1.2.3-70-g09d2