summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/editor_file_system.cpp4
-rw-r--r--tools/editor/editor_import_export.cpp88
-rw-r--r--tools/editor/editor_node.cpp6
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp43
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp18
-rw-r--r--tools/editor/project_export.cpp4
-rw-r--r--tools/editor/resources_dock.cpp2
-rw-r--r--tools/editor/scene_tree_editor.cpp9
-rw-r--r--tools/editor/scene_tree_editor.h2
9 files changed, 156 insertions, 20 deletions
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index 52b195b232..861b6a9e3c 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<String>
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<String>::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_meta.sources.size();j++) {
+
String src = EditorImportPlugin::expand_source_path(p_meta.sources[j].path);
if (!FileAccess::exists(src)) {
@@ -556,6 +557,7 @@ bool EditorFileSystem::_check_meta_sources(EditorFileSystemDirectory::ImportMeta
if (mt!=p_meta.sources[j].modified_time) {
//scan
String md5 = FileAccess::get_md5(src);
+ print_line("checking: "+src);
print_line("md5: "+md5);
print_line("vs: "+p_meta.sources[j].md5);
if (md5!=p_meta.sources[j].md5) {
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 1a5dd73040..18c0010904 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -447,12 +447,64 @@ void EditorExportPlatformPC::_get_property_list( List<PropertyInfo> *p_list) con
+static void _exp_add_dep(Map<StringName,List<StringName> > &deps,const StringName& p_path) {
+
+
+ if (deps.has(p_path))
+ return; //already done
+
+ deps.insert(p_path,List<StringName>());
+
+ List<StringName> &deplist=deps[p_path];
+ Set<StringName> depset;
+
+ List<String> dl;
+ ResourceLoader::get_dependencies(p_path,&dl);
+
+ //added in order so child dependencies are always added bfore parent dependencies
+ for (List<String>::Element *E=dl.front();E;E=E->next()) {
+
+
+ if (!deps.has(E->get()))
+ _exp_add_dep(deps,E->get());
+
+ for(List<StringName>::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<StringName> files=get_dependencies(p_make_bundles);
+ Map<StringName,List<StringName> > deps;
+
+ if (false) {
+ for(int i=0;i<files.size();i++) {
+
+ _exp_add_dep(deps,files[i]);
+
+ }
+ }
+
+
+
/* GROUP ATLAS */
@@ -643,7 +695,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
for (List<StringName>::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<r_rects.size();i++) {
//get back region and margins
-
rects[i]=r_rects[i];
}
@@ -788,18 +839,49 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
{
//make binary engine.cfg config
-
Map<String,Variant> custom;
+
if (remap_files.size()) {
Vector<String> remapsprop;
for(Map<StringName,StringName>::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<StringName,List<StringName> >::Element *E=deps.front();E;E=E->next()) {
+
+ if (E->get().size()==0)
+ continue; //no deps
+ String key;
+ Vector<StringName> 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<StringName>::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 d8f9dcc947..af61022af2 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 4de68c7f4c..4b3e052907 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<String> opts;
rimd->get_options(&opts);
+ options->reset();
for(List<String>::Element *E=opts.front();E;E=E->next()) {
options->_set(E->get(),rimd->get_option(E->get()));
@@ -1200,6 +1237,12 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
}
+
+ if (from->has_option("color/monochrome") && bool(from->get_option("color/monochrome"))) {
+
+ atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA);
+ }
+
if (0) {
//debug the texture
Ref<ImageTexture> 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 90dcbb97e0..916bd59360 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 Ref<Resourc
for(int i=0;i<from->get_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 Ref<Resourc
EditorNode::add_io_error("Couldn't save atlas image: "+apath);
return err;
}
- from->set_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 Ref<Resourc
} else {
- print_line("compress...");
+
Image image=texture->get_data();
ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA);
@@ -990,7 +992,6 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
- print_line("COMPRESSED TO: "+itos(image.get_format()));
texture->create_from_image(image,tex_flags);
@@ -1075,7 +1076,7 @@ Vector<uint8_t> 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<uint8_t> 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<uint8_t>();
@@ -1117,7 +1118,7 @@ Vector<uint8_t> 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<uint8_t>(); //only useful for RAM compression to reconvert
Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
if (pl.is_valid()) {
Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index eae5dacb27..f571aba434 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<String> 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 37a3469578..eb2e526d71 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<Resource>& 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 1d2c864c99..162475cb9f 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<CanvasItem>();
+ 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<Variant>(),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 9a2bdb7ef9..edd67a4047 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);