Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error spam when measuring the size of control nodes while holding the Shift button #93738

Closed
JekSun97 opened this issue Jun 29, 2024 · 1 comment · Fixed by #93764
Closed
Milestone

Comments

@JekSun97
Copy link
Contributor

JekSun97 commented Jun 29, 2024

Tested versions

Godot 4.2.2, Godot 4.3 beta2

System information

Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Mobile) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)

Issue description

When we resize nodes of type Control, with size (0,0), while holding down the Shift button, error spam occurs:
scene/gui/control.cpp:1456 - Condition "!isfinite(p_size.x) || !isfinite(p_size.y)" is true.

0629.mp4

Steps to reproduce

  1. Create a Panel node
  2. Center it so it becomes a point in the center
  3. Pull it by any side while holding Shift

Minimal reproduction project (MRP)

N/A

@patwork
Copy link
Contributor

patwork commented Jun 29, 2024

Yea, propably when control size is 0x0...

// Resize the node
if (m.is_valid()) {
CanvasItem *ci = drag_selection.front()->get();
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
//Reset state
ci->_edit_set_state(se->undo_state);
bool uniform = m->is_shift_pressed();
bool symmetric = m->is_alt_pressed();
Rect2 local_rect = ci->_edit_get_rect();
real_t aspect = local_rect.get_size().y / local_rect.get_size().x;
Point2 current_begin = local_rect.get_position();
Point2 current_end = local_rect.get_position() + local_rect.get_size();
Point2 max_begin = (symmetric) ? (current_begin + current_end - ci->_edit_get_minimum_size()) / 2.0 : current_end - ci->_edit_get_minimum_size();
Point2 min_end = (symmetric) ? (current_begin + current_end + ci->_edit_get_minimum_size()) / 2.0 : current_begin + ci->_edit_get_minimum_size();
Point2 center = (current_begin + current_end) / 2.0;
drag_to = transform.affine_inverse().xform(m->get_position());
Transform2D xform = ci->get_global_transform_with_canvas();

in line 1789 we have division by 0 and aspect = -nan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants