Merge pull request #89248 from KoBeWi/store_no_store

Don't store values when loading them
This commit is contained in:
Rémi Verschelde 2024-05-07 16:49:26 +02:00
commit ba6f840970
No known key found for this signature in database
GPG Key ID: C3336907360768E1
8 changed files with 52 additions and 14 deletions

View File

@ -324,6 +324,7 @@ void EditorDebuggerNode::_notification(int p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
_update_debug_options(); _update_debug_options();
initializing = false;
} break; } break;
case NOTIFICATION_PROCESS: { case NOTIFICATION_PROCESS: {
@ -535,7 +536,9 @@ void EditorDebuggerNode::_menu_option(int p_id) {
bool ischecked = script_menu->get_popup()->is_item_checked(script_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR)); bool ischecked = script_menu->get_popup()->is_item_checked(script_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR));
debug_with_external_editor = !ischecked; debug_with_external_editor = !ischecked;
script_menu->get_popup()->set_item_checked(script_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), !ischecked); script_menu->get_popup()->set_item_checked(script_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "debug_with_external_editor", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "debug_with_external_editor", !ischecked);
}
} break; } break;
} }
} }

View File

@ -102,6 +102,7 @@ private:
Ref<Script> stack_script; // Why?!? Ref<Script> stack_script; // Why?!?
bool initializing = true;
int last_error_count = 0; int last_error_count = 0;
int last_warning_count = 0; int last_warning_count = 0;

View File

@ -129,7 +129,8 @@ void EditorPropertyVectorN::_notification(int p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
if (linked->is_visible()) { if (linked->is_visible()) {
const String key = vformat("%s:%s", get_edited_object()->get_class(), get_edited_property()); const String key = vformat("%s:%s", get_edited_object()->get_class(), get_edited_property());
linked->set_pressed(EditorSettings::get_singleton()->get_project_metadata("linked_properties", key, true)); linked->set_pressed_no_signal(EditorSettings::get_singleton()->get_project_metadata("linked_properties", key, true));
_update_ratio();
} }
} break; } break;

View File

@ -124,7 +124,9 @@ void DebuggerEditorPlugin::_menu_option(int p_option) {
} }
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
}
} break; } break;
case RUN_LIVE_DEBUG: { case RUN_LIVE_DEBUG: {
@ -132,43 +134,57 @@ void DebuggerEditorPlugin::_menu_option(int p_option) {
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG), !ischecked);
EditorDebuggerNode::get_singleton()->set_live_debugging(!ischecked); EditorDebuggerNode::get_singleton()->set_live_debugging(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
}
} break; } break;
case RUN_DEPLOY_REMOTE_DEBUG: { case RUN_DEPLOY_REMOTE_DEBUG: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
}
} break; } break;
case RUN_DEBUG_COLLISIONS: { case RUN_DEBUG_COLLISIONS: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisions", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisions", !ischecked);
}
} break; } break;
case RUN_DEBUG_PATHS: { case RUN_DEBUG_PATHS: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_paths", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_paths", !ischecked);
}
} break; } break;
case RUN_DEBUG_NAVIGATION: { case RUN_DEBUG_NAVIGATION: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
}
} break; } break;
case RUN_DEBUG_AVOIDANCE: { case RUN_DEBUG_AVOIDANCE: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_avoidance", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_avoidance", !ischecked);
}
} break; } break;
case RUN_DEBUG_CANVAS_REDRAW: { case RUN_DEBUG_CANVAS_REDRAW: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW)); bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_canvas_redraw", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_canvas_redraw", !ischecked);
}
} break; } break;
case RUN_RELOAD_SCRIPTS: { case RUN_RELOAD_SCRIPTS: {
@ -176,7 +192,9 @@ void DebuggerEditorPlugin::_menu_option(int p_option) {
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked); ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
}
} break; } break;
case SERVER_KEEP_OPEN: { case SERVER_KEEP_OPEN: {
@ -184,7 +202,9 @@ void DebuggerEditorPlugin::_menu_option(int p_option) {
debug_menu->set_item_checked(debug_menu->get_item_index(SERVER_KEEP_OPEN), !ischecked); debug_menu->set_item_checked(debug_menu->get_item_index(SERVER_KEEP_OPEN), !ischecked);
EditorDebuggerNode::get_singleton()->set_keep_open(!ischecked); EditorDebuggerNode::get_singleton()->set_keep_open(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "server_keep_open", !ischecked); if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "server_keep_open", !ischecked);
}
} break; } break;
case RUN_MULTIPLE_INSTANCES: { case RUN_MULTIPLE_INSTANCES: {
@ -198,6 +218,7 @@ void DebuggerEditorPlugin::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
_update_debug_options(); _update_debug_options();
initializing = false;
} break; } break;
case NOTIFICATION_PROCESS: { case NOTIFICATION_PROCESS: {

View File

@ -60,6 +60,8 @@ private:
RUN_MULTIPLE_INSTANCES, RUN_MULTIPLE_INSTANCES,
}; };
bool initializing = true;
void _update_debug_options(); void _update_debug_options();
void _notification(int p_what); void _notification(int p_what);
void _menu_option(int p_option); void _menu_option(int p_option);

View File

@ -674,6 +674,11 @@ void GenericTilePolygonEditor::_set_snap_option(int p_index) {
current_snap_option = p_index; current_snap_option = p_index;
button_pixel_snap->set_icon(button_pixel_snap->get_popup()->get_item_icon(p_index)); button_pixel_snap->set_icon(button_pixel_snap->get_popup()->get_item_icon(p_index));
snap_subdivision->set_visible(p_index == SNAP_GRID); snap_subdivision->set_visible(p_index == SNAP_GRID);
if (initializing) {
return;
}
base_control->queue_redraw(); base_control->queue_redraw();
_store_snap_options(); _store_snap_options();
} }
@ -955,6 +960,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
snap_subdivision->set_value_no_signal(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_snap_subdiv", 4)); snap_subdivision->set_value_no_signal(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_snap_subdiv", 4));
_set_snap_option(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_snap_option", SNAP_NONE)); _set_snap_option(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_snap_option", SNAP_NONE));
initializing = false;
} }
void TileDataDefaultEditor::_property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field) { void TileDataDefaultEditor::_property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field) {

View File

@ -140,6 +140,7 @@ private:
EditorZoomWidget *editor_zoom_widget = nullptr; EditorZoomWidget *editor_zoom_widget = nullptr;
Button *button_center_view = nullptr; Button *button_center_view = nullptr;
Vector2 panning; Vector2 panning;
bool initializing = true;
Ref<Texture2D> background_texture; Ref<Texture2D> background_texture;
Rect2 background_region; Rect2 background_region;

View File

@ -357,7 +357,10 @@ void TileSetEditor::_set_source_sort(int p_sort) {
} }
} }
_update_sources_list(old_selected); _update_sources_list(old_selected);
EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "tile_source_sort", p_sort);
if (!first_edit) {
EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "tile_source_sort", p_sort);
}
} }
void TileSetEditor::_notification(int p_what) { void TileSetEditor::_notification(int p_what) {
@ -738,8 +741,8 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
tile_set->connect_changed(callable_mp(this, &TileSetEditor::_tile_set_changed)); tile_set->connect_changed(callable_mp(this, &TileSetEditor::_tile_set_changed));
if (first_edit) { if (first_edit) {
first_edit = false;
_set_source_sort(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_source_sort", 0)); _set_source_sort(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_source_sort", 0));
first_edit = false;
} else { } else {
_update_sources_list(); _update_sources_list();
} }