Explorar o código

Update half resolution immediately

kobewi %!s(int64=3) %!d(string=hai) anos
pai
achega
489ac77cbc

+ 8 - 7
editor/plugins/node_3d_editor_plugin.cpp

@@ -411,6 +411,11 @@ void Node3DEditorViewport::cancel_transform() {
 	set_message(TTR("Transform Aborted."), 3);
 	set_message(TTR("Transform Aborted."), 3);
 }
 }
 
 
+void Node3DEditorViewport::_update_shrink() {
+	bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION));
+	subviewport_container->set_stretch_shrink(shrink ? 2 : 1);
+}
+
 float Node3DEditorViewport::get_znear() const {
 float Node3DEditorViewport::get_znear() const {
 	return CLAMP(spatial_editor->get_znear(), MIN_Z, MAX_Z);
 	return CLAMP(spatial_editor->get_znear(), MIN_Z, MAX_Z);
 }
 }
@@ -2387,11 +2392,7 @@ void Node3DEditorViewport::_project_settings_changed() {
 	viewport->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
 	viewport->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
 	viewport->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3));
 	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_shrink();
 
 
 	// Update MSAA, screen-space AA and debanding if changed
 	// Update MSAA, screen-space AA and debanding if changed
 
 
@@ -3085,8 +3086,8 @@ void Node3DEditorViewport::_menu_option(int p_option) {
 		case VIEW_HALF_RESOLUTION: {
 		case VIEW_HALF_RESOLUTION: {
 			int idx = view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION);
 			int idx = view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION);
 			bool current = view_menu->get_popup()->is_item_checked(idx);
 			bool current = view_menu->get_popup()->is_item_checked(idx);
-			current = !current;
-			view_menu->get_popup()->set_item_checked(idx, current);
+			view_menu->get_popup()->set_item_checked(idx, !current);
+			_update_shrink();
 		} break;
 		} break;
 		case VIEW_INFORMATION: {
 		case VIEW_INFORMATION: {
 			int idx = view_menu->get_popup()->get_item_index(VIEW_INFORMATION);
 			int idx = view_menu->get_popup()->get_item_index(VIEW_INFORMATION);

+ 1 - 0
editor/plugins/node_3d_editor_plugin.h

@@ -251,6 +251,7 @@ private:
 	Transform3D _get_camera_transform() const;
 	Transform3D _get_camera_transform() const;
 	int get_selected_count() const;
 	int get_selected_count() const;
 	void cancel_transform();
 	void cancel_transform();
+	void _update_shrink();
 
 
 	Vector3 _get_camera_position() const;
 	Vector3 _get_camera_position() const;
 	Vector3 _get_camera_normal() const;
 	Vector3 _get_camera_normal() const;