diff options
Diffstat (limited to 'tools/editor')
| -rw-r--r-- | tools/editor/animation_editor.cpp | 20 | ||||
| -rw-r--r-- | tools/editor/editor_file_dialog.cpp | 18 | ||||
| -rw-r--r-- | tools/editor/editor_import_export.cpp | 75 | ||||
| -rw-r--r-- | tools/editor/editor_import_export.h | 2 | ||||
| -rw-r--r-- | tools/editor/editor_node.cpp | 1 | ||||
| -rw-r--r-- | tools/editor/editor_settings.h | 1 | ||||
| -rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 |
7 files changed, 88 insertions, 33 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 4ccb612a39..b8aa5874d1 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -961,7 +961,7 @@ void AnimationKeyEditor::_cleanup_animation(Ref<Animation> p_animation) { Object *obj=NULL; RES res; - Node *node = root->get_node_and_resource(animation->track_get_path(i),res); + Node *node = root->get_node_and_resource(p_animation->track_get_path(i),res); if (res.is_valid()) { obj=res.ptr(); @@ -969,32 +969,32 @@ void AnimationKeyEditor::_cleanup_animation(Ref<Animation> p_animation) { obj=node; } - if (obj && animation->track_get_type(i)==Animation::TYPE_VALUE) { - valid_type=obj->get_static_property_type(animation->track_get_path(i).get_property(),&prop_exists); + if (obj && p_animation->track_get_type(i)==Animation::TYPE_VALUE) { + valid_type=obj->get_static_property_type(p_animation->track_get_path(i).get_property(),&prop_exists); } if (!obj && cleanup_tracks->is_pressed()) { - animation->remove_track(i); + p_animation->remove_track(i); i--; continue; } - if (!prop_exists || animation->track_get_type(i)!=Animation::TYPE_VALUE || cleanup_keys->is_pressed()==false) + if (!prop_exists || p_animation->track_get_type(i)!=Animation::TYPE_VALUE || cleanup_keys->is_pressed()==false) continue; - for(int j=0;j<animation->track_get_key_count(i);j++) { + for(int j=0;j<p_animation->track_get_key_count(i);j++) { - Variant v = animation->track_get_key_value(i,j); + Variant v = p_animation->track_get_key_value(i,j); if (!Variant::can_convert(v.get_type(),valid_type)) { - animation->track_remove_key(i,j); + p_animation->track_remove_key(i,j); j--; } } - if (animation->track_get_key_count(i)==0 && cleanup_tracks->is_pressed()) { - animation->remove_track(i); + if (p_animation->track_get_key_count(i)==0 && cleanup_tracks->is_pressed()) { + p_animation->remove_track(i); i--; } } diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 66b38e2f0c..104539c308 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -34,8 +34,7 @@ void EditorFileDialog::_notification(int p_what) { fav_down->set_icon(get_icon("MoveDown","EditorIcons")); fav_rm->set_icon(get_icon("RemoveSmall","EditorIcons")); - } - if (p_what==NOTIFICATION_PROCESS) { + } else if (p_what==NOTIFICATION_PROCESS) { if (preview_waiting) { preview_wheel_timeout-=get_process_delta_time(); @@ -48,12 +47,17 @@ void EditorFileDialog::_notification(int p_what) { preview_wheel_timeout=0.1; } } - } - - if (p_what==NOTIFICATION_DRAW) { + } else if (p_what==NOTIFICATION_DRAW) { //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); + } else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { + + bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); + + if (show_hidden != show_hidden_files) { + set_show_hidden_files(show_hidden); + } } } @@ -1013,7 +1017,7 @@ void EditorFileDialog::_go_forward(){ } -bool EditorFileDialog::default_show_hidden_files=true; +bool EditorFileDialog::default_show_hidden_files=false; void EditorFileDialog::set_display_mode(DisplayMode p_mode) { @@ -1142,7 +1146,7 @@ void EditorFileDialog::_save_to_recent() { EditorFileDialog::EditorFileDialog() { - show_hidden_files=true; + show_hidden_files=default_show_hidden_files; display_mode=DISPLAY_THUMBNAILS; local_history_pos=0; diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index a4906c1b3a..cd455406b7 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -399,6 +399,40 @@ Vector<StringName> EditorExportPlatform::get_dependencies(bool p_bundles) const } +String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { + String user_file = EditorSettings::get_singleton()->get_settings_path() + +"/templates/"+template_file_name; + String system_file=OS::get_singleton()->get_installed_templates_path(); + bool has_system_path=(system_file!=""); + system_file+=template_file_name; + + // Prefer user file + if (FileAccess::exists(user_file)) { + return user_file; + } + + // Now check system file + if (has_system_path) { + if (FileAccess::exists(system_file)) { + return system_file; + } + } + + // Not found + if (err) { + *err+="No export template found at \""+user_file+"\""; + if (has_system_path) + *err+="\n or \""+system_file+"\"."; + else + *err+="."; + } + return ""; +} + +bool EditorExportPlatform::exists_export_template(String template_file_name, String *err) const { + return find_export_template(template_file_name,err)!=""; +} + /////////////////////////////////////// @@ -1131,19 +1165,32 @@ Error EditorExportPlatformPC::export_project(const String& p_path, bool p_debug, ep.step("Setting Up..",0); - String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/"; - if (use64) { - if (p_debug) - exe_path=custom_debug_binary!=""?custom_debug_binary:exe_path+debug_binary64; - else - exe_path=custom_release_binary!=""?custom_release_binary:exe_path+release_binary64; - } else { + String exe_path=""; - if (p_debug) - exe_path=custom_debug_binary!=""?custom_debug_binary:exe_path+debug_binary32; - else - exe_path=custom_release_binary!=""?custom_release_binary:exe_path+release_binary32; + if (p_debug) + exe_path=custom_debug_binary; + else + exe_path=custom_release_binary; + if (exe_path=="") { + String fname; + if (use64) { + if (p_debug) + fname=debug_binary64; + else + fname=release_binary64; + } else { + if (p_debug) + fname=debug_binary32; + else + fname=release_binary32; + } + String err=""; + exe_path=find_export_template(fname,&err); + if (exe_path=="") { + EditorNode::add_io_error(err); + return ERR_FILE_CANT_READ; + } } FileAccess *src_exe=FileAccess::open(exe_path,FileAccess::READ); @@ -1207,14 +1254,12 @@ bool EditorExportPlatformPC::can_export(String *r_error) const { String err; bool valid=true; - String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/"; - - if (use64 && (!FileAccess::exists(exe_path+debug_binary64) || !FileAccess::exists(exe_path+release_binary64))) { + if (use64 && (!exists_export_template(debug_binary64)) || !exists_export_template(release_binary64)) { valid=false; err="No 64 bits export templates found.\nDownload and install export templates.\n"; } - if (!use64 && (!FileAccess::exists(exe_path+debug_binary32) || !FileAccess::exists(exe_path+release_binary32))) { + if (!use64 && (!exists_export_template(debug_binary32) || !exists_export_template(release_binary32))) { valid=false; err="No 32 bits export templates found.\nDownload and install export templates.\n"; } diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index e3ef3a592c..93086f7ad4 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -86,6 +86,8 @@ protected: Vector<uint8_t> get_exported_file_default(String& p_fname) const; virtual Vector<uint8_t> get_exported_file(String& p_fname) const; virtual Vector<StringName> get_dependencies(bool p_bundles) const; + virtual String find_export_template(String template_file_name, String *err=NULL) const; + virtual bool exists_export_template(String template_file_name, String *err=NULL) const; struct TempData { diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 8b04e4f77e..8e39ce36f8 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -4594,6 +4594,7 @@ EditorNode::EditorNode() { ResourceLoader::set_abort_on_missing_resources(false); FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); ResourceLoader::set_error_notify_func(this,_load_error_notify); ResourceLoader::set_dependency_error_notify_func(this,_dependency_error_report); diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 4ba940cd1c..bdfa5160d6 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -107,6 +107,7 @@ public: static EditorSettings *get_singleton(); void erase(String p_var); String get_settings_path() const; + String get_global_settings_path() const; String get_project_settings_path() const; const Map<String,Plugin>& get_plugins() const { return plugins; } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 956e7a98a2..4e394f9e3f 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1137,12 +1137,14 @@ void ScriptEditor::_menu_option(int p_option) { return; int line = tx->cursor_get_line(); int next_line = line + 1; + int column = tx->cursor_get_column(); - if (line == tx->get_line_count() - 1 || next_line >= tx->get_line_count()) + if (line >= tx->get_line_count() - 1) tx->set_line(line, tx->get_line(line) + "\n"); String line_clone = tx->get_line(line); tx->insert_at(line_clone, next_line); + tx->cursor_set_column(column); tx->update(); } break; |