Repository: godotengine/godot
File: scene/2d/camera_2d.cpp (C++)

Code before:
	ERR_FAIL_INDEX((int)p_side, 4);
	limit[p_side] = p_limit;
	Point2 old_smoothed_camera_pos = smoothed_camera_pos;
	_update_scroll();
	smoothed_camera_pos = old_smoothed_camera_pos;
}

int Camera2D::get_limit(Side p_side) const {
	ERR_FAIL_INDEX_V((int)p_side, 4, 0);
	return limit[p_side];
}

void Camera2D::set_limit_smoothing_enabled(bool enable) {
	limit_smoothing_enabled = enable;
	_update_scroll();
}

bool Camera2D::is_limit_smoothing_enabled() const {
	return limit_smoothing_enabled;
}

void Camera2D::set_drag_margin(Side p_side, real_t p_drag_margin) {
	ERR_FAIL_INDEX((int)p_side, 4);
	drag_margin[p_side] = p_drag_margin;
	queue_redraw();
}

real_t Camera2D::get_drag_margin(Side p_side) const {
	ERR_FAIL_INDEX_V((int)p_side, 4, 0);
	return drag_margin[p_side];
}

Vector2 Camera2D::get_camera_position() const {
	return camera_pos;
}

void Camera2D::force_update_scroll() {
	_update_scroll();
}

void Camera2D::reset_smoothing() {
	_update_scroll();
	smoothed_camera_pos = camera_pos;
}

void Camera2D::align() {
	ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));

	Size2 screen_size = _get_camera_screen_size();

	Point2 current_camera_pos = get_global_position();

Review comment (suggestion):
I see you've removed the tool button from the code, but there's still this method left, now unused. So things are a little messed up now, I suspect you either forgot to remove everything button-related (including this method), or maybe you forgot to commit adding an EditorInspectorPlugin handling such button (suggested as an alternative in https://github.com/godotengine/godot/pull/101427#discussion_r1913834000)? :thinking:

Also PR description is not updated so it's hard to tell what's the intention now. Thus I've only skimmed through the code, haven't reviewed in detail.

Code after:
}

void Camera2D::_make_current(Object *p_which) {
	if (!is_inside_tree() || !viewport) {
		return;
	}

	if (custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) {
		return;
	}

	queue_redraw();

	bool was_current = viewport->get_camera_2d() == this;
	bool is_current = p_which == this;

	if (is_current) {
		viewport->_camera_2d_set(this);
	} else if (was_current) {
		viewport->_camera_2d_set(nullptr);
	}

	if (is_current != was_current) {
		_update_process_callback();
	}
}

void Camera2D::_update_process_internal_for_smoothing() {
	bool is_not_in_scene_or_editor = !(is_inside_tree() && _is_editing_in_editor());
	bool is_any_smoothing_valid = position_smoothing_speed > 0 || rotation_smoothing_speed > 0;

	bool enable = is_any_smoothing_valid && is_not_in_scene_or_editor;
	set_process_internal(enable);
}

void Camera2D::_set_limit_rect(const Rect2 &p_limit_rect) {
	Point2 limit_rect_end = p_limit_rect.get_end();
	set_limit(SIDE_LEFT, p_limit_rect.position.x);
	set_limit(SIDE_TOP, p_limit_rect.position.y);
	set_limit(SIDE_RIGHT, limit_rect_end.x);
	set_limit(SIDE_BOTTOM, limit_rect_end.y);
}

Rect2 Camera2D::get_limit_rect() const {
	return Rect2(limit[SIDE_LEFT], limit[SIDE_TOP], limit[SIDE_RIGHT] - limit[SIDE_LEFT], limit[SIDE_BOTTOM] - limit[SIDE_TOP]);
}

void Camera2D::make_current() {
	ERR_FAIL_COND(!enabled || !is_inside_tree());
	get_tree()->call_group(group_name, "_make_current", this);
	if (just_exited_tree) {