Commit graph

6460 commits

Author SHA1 Message Date
lawnjelly bf1de6bbfa Revert backport of 2D transform and camera snapping options
More work is needed to make sure that those options actually solve users' issues, so we prefer to remove the options for 3.2.4 and revisit for a future release.
2021-03-05 14:20:31 +00:00
Rémi Verschelde cad3771ce7
Merge pull request #46623 from Janglee123/tilemap-collision-show
Added `show_collision` property for tilemap node.
2021-03-04 23:40:17 +01:00
janglee 7b6cc3e687 Added show_collision property.
If true, collision shapes are shown in the editor and at run-time.
Requires Visible Collision Shapes to be enabled in the Debug menu,
for collision shapes to be visible at run-time.
2021-03-05 01:21:40 +05:30
Pedro Rodrigues 138d5121eb Fix crash trying to destroy an ImageTexture object containing a null texture
The problem happened when `ImageTexture::create_from_image` was called
with an empty image. In this situation an RID was allocated despite the
texture being null. The destructor would then crash trying to acess this
null texture.

Fixes #46274

(cherry picked from commit 46218d8c37)
2021-03-04 12:21:17 +01:00
kobewi b82d5688b9 Deselect column only if belongs to deselected item
(cherry picked from commit 5cd5722f6a)
2021-03-04 12:20:35 +01:00
sps1112 6ea1e97e06 Add null check for NavigationMesh.create_from_mesh()
(cherry picked from commit cf6bfea93f)
2021-03-04 11:41:46 +01:00
sps1112 216aba8228 Add size<=0 check in BakedLighmapData._get_user_data()
(cherry picked from commit 18bb6e74be)
2021-03-04 11:41:10 +01:00
Michael Alexsander 292c9e380a Make Camera2D's editor helper code only be compiled on editor builds
(cherry picked from commit f70ccbca52)
2021-03-04 11:35:39 +01:00
Zak 3f36ca7323 HTTPRequest: Improve response when disconnecting while downloading
Previously if a disconnect occured while downloading a non recoverable error was displayed. This PR attempts to fix this by making sure `request_completed` signal is emitted with an `STATUS_CONNECTION_ERROR` response code.

(cherry picked from commit 70c39737db)
2021-03-04 11:31:57 +01:00
Rémi Verschelde c003423674
Merge pull request #46579 from nekomatata/fix-joint-remove-body-regression-3.2
[3.2] Fix Joint2D/Joint node path reset on scene switch
2021-03-03 16:41:59 +01:00
PouleyKetchoupp cdf0ebfac7 Fix Joint2D/Joint node path reset on scene switch
When one of the bodies exited the tree, the corresponding node path was
reset instead of just resetting the joint from the physics server. That
was causing the node path to be reset on scene switch when one of the
bodies is under the joint in the scene tree.
2021-03-02 08:32:00 -07:00
Rémi Verschelde 9ee835ac93
Merge pull request #46409 from asheraryam/fix-scale-pivot-jitter
Fix flicker in control nodes due to pivot offset
2021-03-02 16:15:21 +01:00
Pedro Rodrigues 279b9f43f3 Fix crash in GIProbe::bake
The problem happened when the passed from_node was null and the GIProbe
node had no parent node.

Fixes #45978

(cherry picked from commit 82fed7b6da)
2021-03-02 10:26:14 +01:00
Fabio Alessandrelli 05367c755c [Net] Better EOF handling in HTTPRequest.
This fix request_completed being emitted two times, the first with the
result, the second as a failure when retrieving responses served with
read-until-EOF.

(cherry picked from commit d61cd469f1)
2021-03-02 10:26:14 +01:00
Eryk Dwornicki 127f3c0566 Fixed bug that caused collision not to be properly reenabled when joint between two bodies is destroyed
(cherry picked from commit 519e314bea)
2021-03-02 10:26:14 +01:00
Yuri Sizov 59dfd084ab Properly hide GraphEdit's minimap 2021-03-01 18:18:05 +03:00
lawnjelly b1e24597e7 Renaming rendering/2d project settings.
The rendering/quality/2d section of project settings is becoming considerably expanded in 3.2.4, and arguably was not the correct place for settings that were not really to do with quality.

3.2.4 is the last sensible opportunity we will have to move these settings, as the only existing one likely to break compatibility in a small way is `pixel_snap`, and given that the whole snapping area is being overhauled we can draw attention to the fact it has changed in the release notes.

Class reference is also updated and slightly improved.

`pixel_snap` is renamed to `gpu_pixel_snap` in the project settings and code to help differentiate from CPU side transform snapping.
2021-03-01 11:38:46 +00:00
lawnjelly 847a37b196 Change 2d transform snapping from floor to round
Two common problems have emerged as a result of transform snapping:
1) Camera jitter with a camera following a snapped object
2) Pixel gaps between e.g. a platform and a player, where a platform rounds down and a player rounds up

Using round seems to greatly reduce problems due to camera jitter. It also may prove better for  pixel gaps because pixel art is often designed on a grid, so whole numbers are too expected, which are unstable with floor().
2021-02-28 14:34:39 +00:00
asheraryam 25f35b2c9f Fix jitter in control nodes when using pivot-offset and animating scale
This is based on suggested fix from this comment
https://github.com/godotengine/godot/issues/36087#issuecomment-771593146 -- basically the old rounding workaround is removed, and rounding is now done locally in the scroll_container instead.

Fixes #28804

Co-authored-by: Georg Wacker <contact@georgwacker.com>
2021-02-28 15:30:48 +03:00
Delf Neumärker 7df977c3ed
Fix crash during drag if user freed the drag preview 2021-02-27 15:16:06 +01:00
Rémi Verschelde 9047e760d1
Merge pull request #46451 from hilfazer/click_mesh_instance_crash
Prevent crash when clicking Mesh in MeshInstance when is scene root
2021-02-26 20:59:19 +01:00
hilfazer 84a9efcebc Prevent crash when clicking Mesh in MeshInstance when is scene root 2021-02-26 18:58:05 +01:00
Eric M 3b2c43312c Fixed issues with slider focus and scroll input
(cherry picked from commit 707cf278a5)
2021-02-26 15:27:42 +01:00
Meriipu 6f77f1bb3e If the mouse is held on notification_wm_mouse_exit, do not drop focus
This fixes a bug where users of the scrollbar had to be very careful
not to move the mouse outside the viewport, otherwise the scrollbar
would drop its drag-action and stop scrolling until clicked again.

The existing behaviour had the side-effect of also dropping the
cosmetic highlighting of the scrollbar (in addition to the dragging),
for the specific case where the mouse was move outside the window.
The previous behaviour did nothing to remove the highlight if the
mouse was released (but not moved) inside the viewport.

This separate issue with the lingering highlight of the scrollbar
(until a mouse-movement action is performed inside the viewport) is
fixed in an immediate followup to this commit.

Closes bug #39634

(cherry picked from commit 44657db3e2)
2021-02-26 15:22:08 +01:00
Delf Neumärker 28e36dc7b9 Fix crash when loading a scene containing an uncreatable type
(cherry picked from commit 04a4828c5e)
2021-02-26 11:30:38 +01:00
Emmanuel Leblond 94fe2dd31e
Fix Godot returned status code on unexpected error 2021-02-25 18:39:29 +01:00
Rémi Verschelde 6fc9c409dd
Merge pull request #46420 from nekomatata/draw-collision-outline-option-3.2
[3.2] Added option in project settings to draw Shape2D outlines
2021-02-25 17:15:52 +01:00
Rémi Verschelde e919a413fb
Merge pull request #46397 from trollodel/collisionobject3d-debug-shapes-3.2
Allow CollisionObject to show collision shape meshes
2021-02-25 16:54:47 +01:00
PouleyKetchoupp d94cd42ccd Added option in project settings to draw Shape2D outlines
Disabling collision outlines can be useful for performance when the game
is running and many collision shapes are displayed.
2021-02-25 07:48:33 -07:00
Rémi Verschelde 96d38d9751 Revert "Warn when setting Control size inside ready()"
This reverts commit a8105d73c7.

We need to improve the logic somewhat to make the warning more specific to
actual problematic scenarios. Will likely be cherry-picked again + fixes
for the next release.

Fixes #46376.
2021-02-25 15:14:32 +01:00
kleonc 80e4b2d02e MeshDataTool::create_from_surface Fail on invalid index data
(cherry picked from commit 8e82cf8174)
2021-02-25 15:14:32 +01:00
Jummit 0a9190134d expose edit_selected in Tree
(cherry picked from commit 13fb24cb6f)
2021-02-25 15:14:32 +01:00
Christoffer Sundbom 3b63467783 Tween: Add null check for target object
Fixes #45399.

(cherry picked from commit 5b2100d85c)
2021-02-25 15:14:31 +01:00
trollodel 2da6d82f3b Allow CollisionObject to show collision shape meshes
Add an editor gizmo to CollisionObject.
CollisionShape no longer shows collision shapes directly.
2021-02-24 21:33:40 +01:00
Hugo Locurcio 2735a5498e Improve the get_node() error message to be more descriptive
- Mention the origin of the `get_node()` call.
- Mention whether the attempted path is absolute or relative.

See #46214.

(cherry picked from commit e6abdc943d)
2021-02-22 14:16:42 +01:00
kleonc 566ad4fd22 Label::set_lines_skipped Fail if passed a negative value
(cherry picked from commit d7bb7cad47)
2021-02-22 10:16:54 +01:00
kleonc bd7c24371d Line2D::set_point_position Fail if passed index is out of bounds
(cherry picked from commit df49fdd189)
2021-02-22 10:16:22 +01:00
Kongfa Waroros af5fe70623 Keep Hue value when Saturation or Value is zero
(cherry picked from commit 27749711b2)
2021-02-22 10:15:29 +01:00
nc bc86f3e27e improve error message when travel() is called on an AnimationNodeStateMachine when the state machine is not playing
(cherry picked from commit 0c968d603a)
2021-02-22 10:15:00 +01:00
Tomasz Chabora a8105d73c7 Warn when setting Control size inside ready()
(cherry picked from commit 84da090a69)
2021-02-22 10:15:00 +01:00
PouleyKetchoupp cefaa6fb06 Fixed export var default value in PackedScene when script is not loaded in editor
(cherry picked from commit 4e14eefd94)
2021-02-22 10:15:00 +01:00
Hugo Locurcio aacaad5066
Draw an outline for 2D debug collision shapes
This makes them easier to distinguish, especially when used
in a TileMap.

The default color's opacity has been slightly decreased to account
for the new outline.
2021-02-21 17:55:54 +01:00
hilfazer 28fa0f5d13 Prevent selecting hidden nodes in Canvas Item Editor 2021-02-20 20:30:16 +01:00
Ellen Poe 8ac22bdae4 Don't fade out after pausing unless stream is running
(cherry picked from commit eb5566f5c5)
2021-02-19 15:55:41 +01:00
Ellen Poe d55501505c Initialize fadeout to false in AudioStreamPlayer
(cherry picked from commit b8a13a4968)
2021-02-19 15:55:34 +01:00
Delf Neumärker 4065fa0bcf Fix crash when calling connect_nodes_forced with invalid params
(cherry picked from commit 4a468171e5)
2021-02-19 15:54:00 +01:00
Eoin O'Neill 2fb221e79a Collision Shape 2D 'Disabled' Visualization Correction
Having white or strongly desaturated debug collision shape color
setting would make it harder to visualize enabled / disabled state.
This change makes it easier to visualize enabled / disabled state
by reducing the alpha color by half when disabled.

(cherry picked from commit 0c4594f6c9)
2021-02-19 15:51:43 +01:00
Delf Neumärker fd90fc2c9b Fix handling of negative indices in SurfaceTool
(cherry picked from commit 735f75a16b)
2021-02-18 23:47:35 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Rémi Verschelde 7af8da32b1
Merge pull request #45933 from nekomatata/cylinder-support-3.2
[3.2] Cylinder support in Godot Physics 3D
2021-02-18 19:36:42 +01:00
PouleyKetchoupp c6fbd55ca9 Cylinder support in Godot Physics 3D
Backport of cylinder support from Master.
2021-02-18 08:44:23 -07:00
Rémi Verschelde 0176cc4fca
Merge pull request #46162 from gongpha/jr-_-avoid-get_tree-when-flying-colorpicker
[3.2] Avoid signal methods in ColorPicker to access the tree when it isn't in the tree
2021-02-18 13:15:12 +01:00
Rémi Verschelde 3374f84a2f
Merge pull request #46165 from angad-k/fix-mesh-instance-crash
add null check in MeshInstance::_mesh_changed()
2021-02-18 13:00:17 +01:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Angad Kambli 013fc360d7 add null check in MeshInstance::_mesh_changed() 2021-02-18 16:36:27 +05:30
Rémi Verschelde f30d827448
Merge pull request #45951 from KoBeWi/copy_of_3.2
[3.2] Add node copy-paste
2021-02-18 12:06:17 +01:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez b450036120 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:41:07 +01:00
Kongfa Waroros 5ec1eee6b1 Avoid function signals in ColorPicker to access the tree when it isn't in the tree 2021-02-18 16:57:47 +07:00
Ellen Poe 8a426923c2
Fix pops in play() of both spatial audio players
(cherry picked from commit 5e1442ad55)
2021-02-18 10:33:46 +01:00
Angad Kambli bba67729ca
add null check in _update_particle_data_buffer()
add check to see if p_order is in range for CPUParticles3D::set_draw_order'

(cherry picked from commit c97fffdc59)
2021-02-18 00:36:20 +01:00
Jitesh d968a03cbc
Add animation_finished signal and fix frame_changed signal for AnimatedSprite3D
Fixes #40301.
Fixes #45947.

(cherry picked from commit c3be0c2c04)
2021-02-18 00:36:20 +01:00
andybarcia 61c00938a2
Fixes crash when calling VisualShader::set_mode
(cherry picked from commit f455f873c7)
2021-02-18 00:35:57 +01:00
Angad Kambli 1ca1b78a09 add checks for node type range in add_node function 2021-02-17 14:22:50 +05:30
Michael Alexsander c67c3e0a46
Fix StyleBoxLine's incorrect style margin values
(cherry picked from commit ddf05a7c3c)
2021-02-16 14:27:40 +01:00
kobewi 6440b7fcae
Select TreeItem if none is selected
(cherry picked from commit 282639d653)
2021-02-16 14:27:40 +01:00
Ellen Poe 3d34803edc
Return setseek position if one exists in get_playback_position.
(cherry picked from commit 15b8480b2c)
2021-02-16 14:27:40 +01:00
kleonc e40682c32d
RichTextLabel::add_image Fail if passed image has no area
(cherry picked from commit a4afdd4a77)
2021-02-16 14:27:39 +01:00
kleonc 31744577b3
VisualShader::_input_type_changed Fix index out of bounds crash.
(cherry picked from commit 7d451c0040)
2021-02-16 14:27:39 +01:00
hoontee d91a5e7883
Implement CollisionPolygon3D margin
(cherry picked from commit fbb1ef759c)
2021-02-16 14:27:39 +01:00
PouleyKetchoupp ac9e5d9c60
Fix TextEdit autoscroll with wrapped lines
Index to find the last line wrap index was off by one, which prevented the first wrapped line to trigger autoscroll.

(cherry picked from commit 121030940c)
2021-02-16 14:27:38 +01:00
Rémi Verschelde 77438f7a45
Merge pull request #46054 from JFonS/cpu_lightmapper_disk
[3.2] Reduce lightmaps file size.
2021-02-16 13:37:09 +01:00
JFonS 56bf256d76 Add options to reduce lightmaps disk usage.
Added BakedLightmap.use_hdr and BakedLightmap.use_color properties
that can reduce the flie size of lightmap texture at the expense of quality.

Changed the denoiser to work in a single buffer, reducing RAM
usage. Also added the `-mstackrealign` flag in the denoiser compilation
for MinGW builds. This flag helped fix a bug in Embree, so I want to see
if it will help fix GH #45296.
2021-02-16 13:20:27 +01:00
Rémi Verschelde 1611d3dc17
Merge pull request #46008 from akien-mga/3.2-fix-camera-align-crash-45976
Camera2D: Fix crash calling align when not in tree
2021-02-16 12:18:38 +01:00
PouleyKetchoupp 018008ce81 TextEdit respects content margin from StyleBox
Backport from PR #45858 on master.
2021-02-15 10:47:38 -07:00
bruvzg 56fccb1ec1
[3.2] Fix SPACING_SPACE not used for drawing characters. 2021-02-15 18:03:26 +02:00
Rémi Verschelde 5a22bd2b3e
Camera2D: Fix crash calling align when not in tree
Fixes #45976.
2021-02-15 10:54:16 +01:00
kobewi 637117c8d1 [3.2] Add node copy-paste 2021-02-13 14:27:36 +01:00
Rémi Verschelde e71510097d
Merge pull request #45837 from Kayomn/3.2
Accomodate blend shape ranges of -1 to +1 for GLES
2021-02-12 09:28:19 +01:00
Kongfa Waroros adb93d7120
Update GraphEdit when GraphNode's slot is updated
(cherry picked from commit fe6c8d48e6)
2021-02-11 13:14:33 +01:00
PouleyKetchoupp 5e978d1df5
Fix contact points debug for 3D Physics
Setting each point's position was missing for 3D. Now enabling collision
render debug will display contact points for 3D physics, the same way it
does for 2D physics.

Note: Multimesh rendering seems not to work in this scenario on master,
but it's working fine on 3.2.

(cherry picked from commit e5e9be8355)
2021-02-11 13:12:06 +01:00
Filip 9c4f16f4c1 Fixed completion box not showing properly [3.2] 2021-02-10 20:40:00 +01:00
Rémi Verschelde 398a625a9f
Merge pull request #39421 from RandomShaper/pause_aware_picking_3.2
Implement pause-aware picking (3.2)
2021-02-09 10:43:48 +01:00
Rémi Verschelde daa0fe101e
Merge pull request #45813 from RandomShaper/keep_selected_visible_3.2
Keep selected node visible after filter change (3.2)
2021-02-09 10:43:37 +01:00
kobewi 2863c6117e
Set selected Tree item to null when deselected
Co-authored-by: Brody Eller <wviper3@gmail.com>
(cherry picked from commit ef8ec59f2f)
2021-02-08 22:36:37 +01:00
Kanabenki dad0d4a8ee
Update ColorPicker controls when entering tree
(cherry picked from commit 03d4ebf129)
2021-02-08 22:36:37 +01:00
Rafał Mikrut 24d03afc9b
Fix nan errors when using VehicleBody
(cherry picked from commit 1b8cbcf946)
2021-02-08 22:36:36 +01:00
Oliver Dick db57f32194
TextEdit: When left mouse is pressed to place the cursor, do not immediately adjust the viewport when cursor_set_line is called, but afterwards on cursor_set_column (effectively when the cursor reached its final position)
Fixes #45770

(cherry picked from commit 8d598693fc)
2021-02-08 22:36:36 +01:00
Rémi Verschelde b060b2e68f
Merge pull request #45750 from revilo/3.2
[3.2] Bugfix: Update transform of collision shape on NOTIFICATION_PARENTED
2021-02-08 21:33:21 +01:00
Pedro J. Estébanez 745c711289 Implement pause-aware picking
This adds a new project setting (`physics/common/enable_pause_aware_picking`). It's disabled by default.

When enabled, it changes the way 2D & 3D physics picking behaves in relation to pause:
- When pause is set, every collision object that is hovered or captured (3D only) is released from that condition, getting the relevant mouse-exit callback., unless its pause mode makes it immune from pause.
- During the pause. picking only considers collision objects immune from pause, sending input events and enter/exit callbacks to them as expected.
- When pause is left, nothing happens. This is a big difference with the classic behavior, which at this point would process all the input events that have been queued against the current state of the 2D/3D world (in other words, checking them against the current position of the objects instead of those at the time of the events).
2021-02-08 20:48:13 +01:00
Yuri Roubinsky 34d3235c84 [3.2] Visual Shader Parenthesis fix 2021-02-08 19:37:50 +03:00
Pedro J. Estébanez e1054a17b5 Expose Tree::scroll_to_item() 2021-02-08 02:19:23 +01:00
Kayomn d923df52c5 Accomodate blend shape ranges of -1 to +1 2021-02-07 21:42:02 +00:00
Rémi Verschelde f05e068d6c
Merge pull request #45583 from lawnjelly/optimize_transform_propagate
Optimize transform propagation for hidden 3d objects
2021-02-06 12:23:52 +01:00
Rémi Verschelde f36c529ad0
Merge pull request #45752 from JFonS/cpu_lightmapper_fixes
Assorted CPU lightmapper fixes
2021-02-06 11:44:52 +01:00
Oliver Dick 09924d6d73 Bugfix: Update transform of collision shape on NOTIFICATION_PARENTED (fixes invalid transform of collision shape in cases where the node is not supposed to enter the scene tree) 2021-02-06 02:41:16 +01:00
JFonS 27c1e65969 Assorted CPU lightmapper fixes
- Fix crash when a ray hits a texel with a UV2 coordinate exactly
  equal to 1.0.
- Take BakedLightmap extents into account.
- Clear capture data between bakes.
- Fix minor issues with seam correction.
2021-02-05 19:18:19 +01:00
muiroc 11fc3b8758 Use the blend parameter passed to blend_animation during graph processing
(cherry picked from commit 01bd1b33c7)
2021-02-05 09:26:50 +01:00
lawnjelly cb8134f371 Optimize transform propagation for hidden objects
When visual instances are hidden, there is no need to update their global transforms and send these to the visual server. This only needs to be done when the objects are reshown.
2021-02-03 15:16:47 +00:00