summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp88
1 files changed, 56 insertions, 32 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b2e21fa168..242648d4a9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -364,10 +364,28 @@ void EditorNode::_fs_changed() {
E->get()->invalidate();
}
- if (export_defer.platform != "") {
+ if (export_defer.preset != "") {
+ Ref<EditorExportPreset> preset;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ preset = EditorExport::get_singleton()->get_export_preset(i);
+ if (preset->get_name() == export_defer.preset) {
+ break;
+ }
+ }
+ if (preset.is_null()) {
+ String err = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ Ref<EditorExportPlatform> platform = preset->get_platform();
+ if (platform.is_null()) {
+ String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ }
+ }
- //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
- export_defer.platform = "";
+ export_defer.preset = "";
}
{
@@ -701,34 +719,34 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
ERR_FAIL_COND(err != OK);
}
-bool EditorNode::_find_and_save_resource(RES res, Map<RES, bool> &processed, int32_t flags) {
+bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
- if (res.is_null())
+ if (p_res.is_null())
return false;
- if (processed.has(res)) {
+ if (processed.has(p_res)) {
- return processed[res];
+ return processed[p_res];
}
- bool changed = res->is_edited();
- res->set_edited(false);
+ bool changed = p_res->is_edited();
+ p_res->set_edited(false);
- bool subchanged = _find_and_save_edited_subresources(res.ptr(), processed, flags);
+ bool subchanged = _find_and_save_edited_subresources(p_res.ptr(), processed, flags);
- //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
+ //print_line("checking if edited: "+p_res->get_type()+" :: "+p_res->get_name()+" :: "+p_res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
- if (res->get_path().is_resource_file()) {
+ if (p_res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
- print_line("Also saving modified external resource: " + res->get_path());
- ResourceSaver::save(res->get_path(), res, flags);
+ print_line("Also saving modified external resource: " + p_res->get_path());
+ ResourceSaver::save(p_res->get_path(), p_res, flags);
}
- processed[res] = false; //because it's a file
+ processed[p_res] = false; //because it's a file
return false;
} else {
- processed[res] = changed;
+ processed[p_res] = changed;
return changed;
}
}
@@ -1246,7 +1264,7 @@ void EditorNode::_dialog_action(String p_file) {
}
} else {
- ml.instance();
+ ml = Ref<TileSet>(memnew(TileSet));
}
TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
@@ -1285,7 +1303,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err == ERR_CANT_OPEN) {
config.instance(); // new config
@@ -1296,7 +1314,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_docks_to_config(config, p_file);
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -1313,7 +1331,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK || !config->has_section(p_file)) {
show_warning(TTR("Layout name not found!"));
@@ -1327,7 +1345,7 @@ void EditorNode::_dialog_action(String p_file) {
config->set_value(p_file, E->get(), Variant());
}
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -3774,9 +3792,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
singleton->progress_dialog->add_task(p_task, p_label, p_steps);
}
-void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {
+void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_redraw);
+ singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
}
void EditorNode::progress_end_task(const String &p_task) {
@@ -3844,9 +3862,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
-Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
+Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
- export_defer.platform = p_platform;
+ export_defer.preset = preset;
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
@@ -4313,7 +4331,7 @@ void EditorNode::_update_layouts_menu() {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4361,7 +4379,7 @@ void EditorNode::_layout_menu_option(int p_id) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4907,13 +4925,19 @@ void EditorNode::dim_editor(bool p_dimming) {
static int dim_count = 0;
bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup");
if (p_dimming) {
- if (dim_ui && dim_count == 0)
- _start_dimming(true);
- dim_count++;
+ if (dim_ui) {
+ if (dim_count == 0) {
+ _start_dimming(true);
+ }
+ dim_count++;
+ }
} else {
- dim_count--;
- if (dim_count < 1)
+ if (dim_count == 1) {
_start_dimming(false);
+ dim_count = 0;
+ } else if (dim_ui && dim_count > 0) {
+ dim_count--;
+ }
}
}