Merge pull request #45956 from reduz/fix-editor-always-redrawing
Fix editor always redrawing
This commit is contained in:
commit
2b95372ad1
|
@ -430,45 +430,7 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorNode::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_PROCESS: {
|
||||
if (opening_prev && !confirmation->is_visible()) {
|
||||
opening_prev = false;
|
||||
}
|
||||
|
||||
if (unsaved_cache != (saved_version != editor_data.get_undo_redo().get_version())) {
|
||||
unsaved_cache = (saved_version != editor_data.get_undo_redo().get_version());
|
||||
_update_title();
|
||||
}
|
||||
|
||||
if (last_checked_version != editor_data.get_undo_redo().get_version()) {
|
||||
_update_scene_tabs();
|
||||
last_checked_version = editor_data.get_undo_redo().get_version();
|
||||
}
|
||||
|
||||
// update the animation frame of the update spinner
|
||||
uint64_t frame = Engine::get_singleton()->get_frames_drawn();
|
||||
uint32_t tick = OS::get_singleton()->get_ticks_msec();
|
||||
|
||||
if (frame != update_spinner_step_frame && (tick - update_spinner_step_msec) > (1000 / 8)) {
|
||||
update_spinner_step++;
|
||||
if (update_spinner_step >= 8) {
|
||||
update_spinner_step = 0;
|
||||
}
|
||||
|
||||
update_spinner_step_msec = tick;
|
||||
update_spinner_step_frame = frame + 1;
|
||||
|
||||
// update the icon itself only when the spinner is visible
|
||||
if (EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")) {
|
||||
update_spinner->set_icon(gui_base->get_theme_icon("Progress" + itos(update_spinner_step + 1), "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
editor_selection->update();
|
||||
|
||||
{ //TODO should only happen on settings changed
|
||||
void EditorNode::_update_from_settings() {
|
||||
int current_filter = GLOBAL_GET("rendering/canvas_textures/default_texture_filter");
|
||||
if (current_filter != scene_root->get_default_canvas_item_texture_filter()) {
|
||||
Viewport::DefaultCanvasItemTextureFilter tf = (Viewport::DefaultCanvasItemTextureFilter)current_filter;
|
||||
|
@ -534,9 +496,53 @@ void EditorNode::_notification(int p_what) {
|
|||
|
||||
float lod_threshold = GLOBAL_GET("rendering/quality/mesh_lod/threshold_pixels");
|
||||
scene_root->set_lod_threshold(lod_threshold);
|
||||
}
|
||||
|
||||
void EditorNode::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_PROCESS: {
|
||||
if (opening_prev && !confirmation->is_visible()) {
|
||||
opening_prev = false;
|
||||
}
|
||||
|
||||
if (unsaved_cache != (saved_version != editor_data.get_undo_redo().get_version())) {
|
||||
unsaved_cache = (saved_version != editor_data.get_undo_redo().get_version());
|
||||
_update_title();
|
||||
}
|
||||
|
||||
if (last_checked_version != editor_data.get_undo_redo().get_version()) {
|
||||
_update_scene_tabs();
|
||||
last_checked_version = editor_data.get_undo_redo().get_version();
|
||||
}
|
||||
|
||||
// update the animation frame of the update spinner
|
||||
uint64_t frame = Engine::get_singleton()->get_frames_drawn();
|
||||
uint32_t tick = OS::get_singleton()->get_ticks_msec();
|
||||
|
||||
if (frame != update_spinner_step_frame && (tick - update_spinner_step_msec) > (1000 / 8)) {
|
||||
update_spinner_step++;
|
||||
if (update_spinner_step >= 8) {
|
||||
update_spinner_step = 0;
|
||||
}
|
||||
|
||||
update_spinner_step_msec = tick;
|
||||
update_spinner_step_frame = frame + 1;
|
||||
|
||||
// update the icon itself only when the spinner is visible
|
||||
if (EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")) {
|
||||
update_spinner->set_icon(gui_base->get_theme_icon("Progress" + itos(update_spinner_step + 1), "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
editor_selection->update();
|
||||
|
||||
ResourceImporterTexture::get_singleton()->update_imports();
|
||||
|
||||
if (settings_changed) {
|
||||
_update_from_settings();
|
||||
settings_changed = false;
|
||||
emit_signal("project_settings_changed");
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
@ -960,6 +966,7 @@ void EditorNode::_reload_modified_scenes() {
|
|||
|
||||
void EditorNode::_reload_project_settings() {
|
||||
ProjectSettings::get_singleton()->setup(ProjectSettings::get_singleton()->get_resource_path(), String(), true);
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
void EditorNode::_vp_resized() {
|
||||
|
@ -5538,6 +5545,7 @@ void EditorNode::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("request_help_search"));
|
||||
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "args")));
|
||||
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj")));
|
||||
ADD_SIGNAL(MethodInfo("project_settings_changed"));
|
||||
}
|
||||
|
||||
static Node *_resource_get_edited_scene() {
|
||||
|
@ -5605,6 +5613,10 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
|
|||
return eta.exitcode;
|
||||
}
|
||||
|
||||
void EditorNode::notify_settings_changed() {
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
EditorNode::EditorNode() {
|
||||
Input::get_singleton()->set_use_accumulated_input(true);
|
||||
Resource::_get_local_scene_func = _resource_get_edited_scene;
|
||||
|
|
|
@ -312,6 +312,9 @@ private:
|
|||
|
||||
EditorSettingsDialog *settings_config_dialog;
|
||||
ProjectSettingsEditor *project_settings;
|
||||
bool settings_changed = true; //make it update settings on first frame
|
||||
void _update_from_settings();
|
||||
|
||||
PopupMenu *vcs_actions_menu;
|
||||
EditorFileDialog *file;
|
||||
ExportTemplateManager *export_template_manager;
|
||||
|
@ -847,6 +850,8 @@ public:
|
|||
void save_scene_list(Vector<String> p_scene_filenames);
|
||||
void restart_editor();
|
||||
|
||||
void notify_settings_changed();
|
||||
|
||||
void dim_editor(bool p_dimming, bool p_force_dim = false);
|
||||
bool is_editor_dimmed() const;
|
||||
|
||||
|
|
|
@ -756,7 +756,6 @@ int find(const PackedStringArray &a, const String &v) {
|
|||
void EditorPlugin::enable_plugin() {
|
||||
// Called when the plugin gets enabled in project settings, after it's added to the tree.
|
||||
// You can implement it to register autoloads.
|
||||
|
||||
if (get_script_instance() && get_script_instance()->has_method("enable_plugin")) {
|
||||
get_script_instance()->call("enable_plugin");
|
||||
}
|
||||
|
@ -819,6 +818,18 @@ void EditorPlugin::remove_debugger_plugin(const Ref<Script> &p_script) {
|
|||
EditorDebuggerNode::get_singleton()->remove_debugger_plugin(p_script);
|
||||
}
|
||||
|
||||
void EditorPlugin::_editor_project_settings_changed() {
|
||||
emit_signal("project_settings_changed");
|
||||
}
|
||||
void EditorPlugin::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
||||
}
|
||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||
EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPlugin::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control"), &EditorPlugin::add_control_to_container);
|
||||
ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::add_control_to_bottom_panel);
|
||||
|
@ -890,6 +901,7 @@ void EditorPlugin::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
|
||||
ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name")));
|
||||
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
||||
ADD_SIGNAL(MethodInfo("project_settings_changed"));
|
||||
|
||||
BIND_ENUM_CONSTANT(CONTAINER_TOOLBAR);
|
||||
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
|
||||
|
|
|
@ -130,7 +130,11 @@ class EditorPlugin : public Node {
|
|||
|
||||
String last_main_screen_name;
|
||||
|
||||
void _editor_project_settings_changed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
static void _bind_methods();
|
||||
UndoRedo &get_undo_redo() { return *undo_redo; }
|
||||
|
||||
|
|
|
@ -2335,7 +2335,43 @@ void Node3DEditorPlugin::edited_scene_changed() {
|
|||
}
|
||||
}
|
||||
|
||||
void Node3DEditorViewport::_project_settings_changed() {
|
||||
//update shadow atlas if changed
|
||||
int shadowmap_size = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/size");
|
||||
bool shadowmap_16_bits = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/16_bits");
|
||||
int atlas_q0 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv");
|
||||
int atlas_q1 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv");
|
||||
int atlas_q2 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv");
|
||||
int atlas_q3 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv");
|
||||
|
||||
viewport->set_shadow_atlas_size(shadowmap_size);
|
||||
viewport->set_shadow_atlas_16_bits(shadowmap_16_bits);
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3));
|
||||
|
||||
bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION));
|
||||
|
||||
if (shrink != (subviewport_container->get_stretch_shrink() > 1)) {
|
||||
subviewport_container->set_stretch_shrink(shrink ? 2 : 1);
|
||||
}
|
||||
|
||||
// Update MSAA, screen-space AA and debanding if changed
|
||||
|
||||
const int msaa_mode = ProjectSettings::get_singleton()->get("rendering/quality/screen_filters/msaa");
|
||||
viewport->set_msaa(Viewport::MSAA(msaa_mode));
|
||||
const int ssaa_mode = GLOBAL_GET("rendering/quality/screen_filters/screen_space_aa");
|
||||
viewport->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode));
|
||||
const bool use_debanding = GLOBAL_GET("rendering/quality/screen_filters/use_debanding");
|
||||
viewport->set_use_debanding(use_debanding);
|
||||
}
|
||||
|
||||
void Node3DEditorViewport::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &Node3DEditorViewport::_project_settings_changed));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
bool visible = is_visible_in_tree();
|
||||
|
||||
|
@ -2442,37 +2478,6 @@ void Node3DEditorViewport::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
//update shadow atlas if changed
|
||||
|
||||
int shadowmap_size = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/size");
|
||||
bool shadowmap_16_bits = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/16_bits");
|
||||
int atlas_q0 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv");
|
||||
int atlas_q1 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv");
|
||||
int atlas_q2 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv");
|
||||
int atlas_q3 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv");
|
||||
|
||||
viewport->set_shadow_atlas_size(shadowmap_size);
|
||||
viewport->set_shadow_atlas_16_bits(shadowmap_16_bits);
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
|
||||
viewport->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3));
|
||||
|
||||
bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION));
|
||||
|
||||
if (shrink != (subviewport_container->get_stretch_shrink() > 1)) {
|
||||
subviewport_container->set_stretch_shrink(shrink ? 2 : 1);
|
||||
}
|
||||
|
||||
// Update MSAA, screen-space AA and debanding if changed
|
||||
|
||||
const int msaa_mode = ProjectSettings::get_singleton()->get("rendering/quality/screen_filters/msaa");
|
||||
viewport->set_msaa(Viewport::MSAA(msaa_mode));
|
||||
const int ssaa_mode = GLOBAL_GET("rendering/quality/screen_filters/screen_space_aa");
|
||||
viewport->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode));
|
||||
const bool use_debanding = GLOBAL_GET("rendering/quality/screen_filters/use_debanding");
|
||||
viewport->set_use_debanding(use_debanding);
|
||||
|
||||
bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION));
|
||||
if (show_info != info_label->is_visible()) {
|
||||
info_label->set_visible(show_info);
|
||||
|
|
|
@ -463,6 +463,8 @@ private:
|
|||
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
||||
|
||||
void _project_settings_changed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -55,6 +55,7 @@ void ProjectSettingsEditor::popup_project_settings() {
|
|||
}
|
||||
|
||||
void ProjectSettingsEditor::queue_save() {
|
||||
EditorNode::get_singleton()->notify_settings_changed();
|
||||
timer->start();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue