godotengine / godotengine/godot
Path2D editor can't split segment when a point creates a closed loop
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible in:
* v3.2.2.stable.mono.official
* v3.5.3.stable.official [6c814135b]
* v3.5.3.stable.mono.official [6c814135b]
NOT Reproducible in:
* v4.2.1
### System information
Linux
### Issue description
I have a path that is in the shape of an "R". Start is at the bottom left and follows the shape to end at the bottom right. Now when I use the "Select Points" tool which allows me to "Left Click: Split Segment (in curve)", any time I click on the top lines it will instead add the new point to the bottom lines instead. Adding a point (by splitting the segments) works fine at the bottom lines. And the issue appears to be point where the path touches the initial straight line again to close the upper loop. When I move that point to no longer exactly touch the line and close the loop, everything works as expected.
### Steps to reproduce
1. Save the following as a ".tres" file. (it's a Curve in the shape of an "R")
```
[gd_resource type="Curve2D" format=2]
[resource]
_data = {
"points": PoolVector2Array( 0, 0, 0, 0, -105, 218, 0, 0, 0, 0, -102, -206, 0, 0, 0, 0, 144, -67, 0, 0, 0, 0, -105, 6, 0, 0, 0, 0, 140, 220 )
}
```
2. Create a new 2D Scene
3. Create a new Path2D node
4. Load the curve from step 1 as the Path2D's Curve
5. Select the "Select Points" tool (it's the first one in the list) (should be pre-selected by default usually)
6. Try to split on of the upper segments by clicking on them
7. See that it is impossible to split one of the upper segments until you move the point that closes the loop
### Minimal reproduction project (MRP)
MRP following the reproduction steps
[MRP_Path2DLoop.zip](https://github.com/godotengine/godot/files/14932947/MRP_Path2DLoop.zip)
Contributor guide
Research direction
Start by opening the MRP_Path2DLoop.zip reproduction project and following the listed Path2D and Curve2D steps in the editor. Confirm that splitting an upper segment works when the curve closes its loop, while preserving the existing successful behavior on the lower segments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100