Commit graph

1369 commits

Author SHA1 Message Date
Aaron Franke ab674a41aa
Area: Uncap the range for gravity and change the slider hints 2021-05-18 07:17:11 -04:00
Rémi Verschelde b2fb119c53
Merge pull request #36263 from Calinou/increase-default-2d-gravity 2021-05-18 10:54:47 +02:00
Rémi Verschelde a3dd18b12e
Merge pull request #39976 from aaronfranke/tilemap-vec2i
Update TileMap to use Vector2i
2021-05-13 14:48:16 +02:00
reduz 479391ef54 Fixes missng 2D engine bits
-Mesh2D now works
-MultiMesh2D now works
-Polygon2D now works
-Added hooks for processing 2D particles
-Skeleton2D now works

2D particles still not working, but stuff needed for it is now implemented.
2021-05-11 11:21:36 -03:00
Aaron Franke 75e3f6b732
Update TileMap to use Vector2i instead of two ints 2021-05-07 16:20:02 -04:00
Gilles Roudière a3dda2df85 Rework the TileSet resource and TileMap nodes:
- Move most properties from TileMap to TileSet,
- Make TileSet more flexible, supporting more feature (several
  collision layers, etc...),
- Fusion both the TileMap and TileSet editor,
- Implement TileSetSources, and thus a new way to index tiles in the TileSet,
- Rework the TileSet and TileMap editors completely,
- Implement an editor zoom widget (and use it in several places)
2021-05-07 18:06:17 +02:00
Hugo Locurcio 4a28f7e44f
Increase the default 2D gravity to 980.0
This makes 2D RigidBody physics feel less floaty out of the box.

This closes https://github.com/godotengine/godot-proposals/issues/98.
2021-05-05 22:49:06 -04:00
kleonc f1420c7cbf TileMap::world_to_map Ensure half offset is added according to the returned value
Decide whether half offset should be added based on the value used for calculating the return value of this method.
2021-05-02 23:34:51 +02:00
Rafał Mikrut efcb097674 Prevent setting too big or too small Collision Mask and Layer 2021-04-30 17:19:04 +02:00
Rémi Verschelde 8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Rémi Verschelde 3a0cfd3d85
Merge pull request #47960 from smix8/issue_47334_navagent2d_target_reached 2021-04-27 13:34:48 +02:00
smix8 0b87cb5e3d put distance check to target into function
put distance check to target into function
2021-04-27 11:22:37 +02:00
Rémi Verschelde 1a3d60944f
Merge pull request #47485 from rafallus/fix/rigidbody-crash
Fix crash on RigidBody _direct_state_changed
2021-04-23 16:02:26 +02:00
Rémi Verschelde bd7a92ec23
Merge pull request #48030 from smix8/issue_47337_broken_navagent2d_callback 2021-04-23 10:13:44 +02:00
rafallus cfa06f0f76 Unexpose _direct_state_changed in PhysicsBody
Removed _direct_state_changed bindings
Affects 2D and 3D nodes
Callbacks now use Callable
Tests were changed accordingly
2021-04-22 23:20:58 -05:00
Marcel Admiraal 071871b787 Move collision layer and mask into CollisionObject. 2021-04-20 10:38:42 +01:00
Rémi Verschelde aa677865e3
Merge pull request #47991 from LightningAA/regroup-area-inspector-4.0
`Area[X]D`: Put physics override parameters in their own group and document that areas can be used to influence audio
2021-04-20 09:54:07 +02:00
smix8 a491071c24 Fix broken NavigationAgent2D collision avoidance callbacks
Fix broken NavigationAgent2D collision avoidance callbacks
2021-04-20 01:56:04 +02:00
Lightning_A 80b1a29c46 Put physics override parameters in their own group and document that areas can be used to influence audio 2021-04-18 21:27:06 -06:00
smix8 cd24a63da2 Fix NavigationAgent2D not emitting "target_reached" Signal reliably
Fix NavigationAgent2D not emitting "target_reached" Signal reliably
2021-04-16 22:04:02 +02:00
Nathan Franke 2a8c59c171
Use Array for node configuration warnings
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-04-11 23:25:38 -05:00
Rémi Verschelde 77264e346b
Re-allow playing AnimatedSprite2D without frames
Fixes #47578, partial revert of #47064.
2021-04-05 14:42:21 +02:00
Rafał Mikrut 504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Rémi Verschelde 6fa24729ae
Merge pull request #45571 from aaronfranke/node2d-real_t
Use real_t in 2D nodes
2021-03-23 00:10:53 +01:00
Rémi Verschelde 6608d99291
Merge pull request #47001 from madmiraal/rename-sprite_2d-region_enabled
Rename Sprite.region_enabled getter and setter methods to match properties
2021-03-20 18:36:17 +01:00
Aaron Franke 6811a45b59
Use real_t in non-physics 2D nodes 2021-03-19 13:04:45 -04:00
Rémi Verschelde 0615e55b27
Merge pull request #47064 from jmb462/fix-crash-in-uninitialized-AnimatedSprite2d-play
Fix crash on calling play() in a uninitialized AnimatedSprite2D (Fix #46013)
2021-03-17 15:21:34 +01:00
jmb462 324ab63844 Fix crash on calling play() in a uninitialized AnimatedSprite2D
When AnimatedSprite2D::play() was called before SpriteFrames has been initialized, a crach occurred (issue #46013).

Modification : An error message on null check test has been added to prevent crash.

Fix #46013.
2021-03-17 14:57:04 +01:00
Rémi Verschelde 08ca4184f4
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
2021-03-17 09:18:54 +01:00
Aaron Franke a94cef0ea0
Move SpriteFrames to its own file in the resources folder 2021-03-16 02:00:47 -04:00
Gilles Roudière ac7073f586 Allow Navigation to be more flexible 2021-03-15 15:58:59 +01:00
Marcel Admiraal 3dcdb84660 Rename Sprite.region_enabled getter and setter to match properties
Also renames Sprite2D.region_filter_clip property and its setter to
region_filter_clip_enabled and set_region_filter_clip_enabled.
2021-03-14 17:31:49 +00:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Gilles Roudière ba1344408f Implement Navigation layers 2021-03-10 11:23:06 +01:00
Gilles Roudière a9dc53d152 Remove Navigation2D/3D nodes, and move the navigation map to the world resource 2021-03-10 11:23:06 +01:00
Rémi Verschelde c487f1e854
Merge pull request #46643 from YeldhamDev/hide_all_the_things
Hide more options of disabled properties
2021-03-07 15:12:15 +01:00
Marcel Admiraal 38f2e32e32 Return RID instead of Object id in area-body_shape_entered-exited signals. 2021-03-06 10:48:17 +00:00
fabriceci af041adb06 add responsive arrows when the size is very small + fix a regression: missing a translation on the line 2021-03-05 22:14:06 +01:00
fabriceci 90ca587281 Highlight collision, correct the size and make the arrow a bit less thick for low-res game 2021-03-05 00:32:49 +01:00
Rémi Verschelde a3dece960f
Merge pull request #46668 from nekomatata/fix-errors-polygon-2d
Fix errors with invalid CollisionPolygon2D
2021-03-04 20:33:22 +01:00
PouleyKetchoupp 2217e477b9 Fix errors with invalid CollisionPolygon2D
Fixed internal errors when the shape is invalid and made warnings more
descriptive.
2021-03-04 10:44:37 -07:00
Michael Alexsander 4be282a269 Hide more options of disabled properties 2021-03-03 20:51:35 -03:00
Rémi Verschelde d0e62518a8
Merge pull request #46578 from nekomatata/fix-joint-remove-body-regression
Fix Joint2D/Joint3D node path reset on scene switch
2021-03-03 16:41:37 +01:00
PouleyKetchoupp 2dc5ff0caa Fix Joint2D/Joint3D 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:24:50 -07:00
Rémi Verschelde e871b07ed6
Merge pull request #36065 from YeldhamDev/camera2d_helper_editor_only
Make Camera2D's editor helper code only be compiled on editor builds
2021-03-02 15:06:54 +01:00
Michael Alexsander 70304f8633 Hide extra options from various nodes if they're not enabled 2021-03-02 09:25:09 -03:00
Michael Alexsander f70ccbca52 Make Camera2D's editor helper code only be compiled on editor builds 2021-03-01 14:05:45 -03:00
Kyle 821591a95b Refactored cpu_particles_2d.cpp _notification Method
Refactors the _notification method in cpu_particles_2d.cpp to use a switch statement for readability and to bring it inline with other classes like node.cpp and timer.cpp.
2021-02-28 21:59:01 -05:00
Aaron Franke 548de64742
Use a more specific type for Area2D/3D body signals 2021-02-24 00:05:54 -05:00
kleonc df49fdd189 Line2D::set_point_position Fail if passed index is out of bounds 2021-02-21 13:50:11 +01:00
Rémi Verschelde 04cb7e638c
Merge pull request #46191 from reduz/refactor-process-mode
Refactor Process Mode
2021-02-19 13:46:50 +01:00
Rémi Verschelde b84f65f13c
Merge pull request #44737 from KoBeWi/touch_shape_screen_centered_button
Fix shape_centered property in TouchScreenButton
2021-02-19 13:45:23 +01:00
reduz 083aa9b95e Refactor Process Mode
Implements https://github.com/godotengine/godot-proposals/issues/1835#issuecomment-727186192

* PauseMode is now ProcessMode, containing the following states:
	```
	PROCESS_MODE_INHERIT, // same as parent node
	PROCESS_MODE_NORMAL, // process only if not paused
	PROCESS_MODE_PAUSE_ONLY, // process only if paused
	PROCESS_MODE_ALWAYS, // process always
	PROCESS_MODE_DISABLED, // never process
	```
* NOTIFICATION_PAUSED and NOTIFICATION_UNPAUSED are received effectively when the node is paused and unpaused (not any longer when pause mode is set in SceneTree).
* Renamed some nodes that used ProcessMode/process_mode to specify a callback type to ProcessCallback to avoid clashes.
2021-02-18 20:39:55 -03:00
Rémi Verschelde a23d7480d2
Merge pull request #41644 from Eoin-ONeill-Yokai/collision_2d_shape_visualization_fix
CollisionShape2D 'Disabled' Visualization Correction
2021-02-18 23:42:02 +01:00
Pedro J. Estébanez 8e128726f0 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 bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
Rémi Verschelde 9d84e3b395
Merge pull request #46151 from ellenhp/fix_spatial_player_play
Fix a pop on play() in AudioStreamPlayer2D and 3D
2021-02-18 10:12:13 +01:00
Ellen Poe 5e1442ad55 Fix pops in play() of both spatial audio players 2021-02-17 19:09:42 -08:00
Ellen Poe 15b8480b2c Return setseek position if one exists in get_playback_position. 2021-02-14 20:41:59 -08:00
reduz 1aa2823fa3 Removed _change_notify
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap.
-For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed()
-Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-10 19:31:24 -03:00
reduz 8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
Rafał Mikrut 003bb8e1a8 Initialize class variables with default values in scene/ [1/2] 2021-02-07 22:29:31 +01:00
Rémi Verschelde 7185a7c3c2
Merge pull request #45496 from Chaosus/fix_particles
Fix particles not properly updated by their lifetime
2021-02-03 15:50:52 +01:00
Rémi Verschelde d2e1216504
Merge pull request #37547 from aaronfranke/tau
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-02-01 20:55:25 +01:00
Aaron Franke 9199a681de
Use real_t in physics nodes 2021-01-29 19:59:58 -05:00
Yuri Roubinsky aefce8000d Fix particles not properly modified by their lifetime 2021-01-27 16:28:15 +03:00
Rémi Verschelde fa5ead4db7
Merge pull request #42713 from madmiraal/fix-42614
Update area-body_shape_entered-exited signal documentation.
2021-01-15 13:00:23 +01:00
Rémi Verschelde 7f8ab378e9
Merge pull request #45102 from nekomatata/fix-update-shape-data
Fix collision shape update when changing shape properties
2021-01-13 09:18:15 +01:00
Aaron Franke ddd6fb37e8
Update PolyPartition / Triangulator library 2021-01-12 13:46:16 -05:00
PouleyKetchoupp 4b43cd17c5 Fix collision shape update when changing shape properties
This change does two things:

1. Properly update the internal shape data using _update_in_shape_owner
when updating a shape (in 2D it was resetting one way collision)

2. Avoid unnecessary updates when calling set_shape with the same shape,
which happens each time a shape property is modified
(e.g shape.extents.x = ...)

Fixes #45090
2021-01-12 10:28:20 -07:00
Marcel Admiraal 5fa12da6f9 Rename the final parameter of area_shape_entered-exited local_shape. 2021-01-09 13:34:59 +00:00
Aaron Franke 1d5042c9e2
Use Math_TAU and deg2rad/rad2deg in more places and optimize code 2021-01-09 03:47:14 -05:00
Rafał Mikrut b0f28d2259 Remove memory leak in Canvas Group 2021-01-03 21:29:18 +01:00
Rémi Verschelde 2900b40507
Merge pull request #44839 from qarmin/fix_crash_tile_map
Do not iterate over map when removing its values
2021-01-01 23:06:35 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Eoin O'Neill 0c4594f6c9 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.
2020-12-31 23:22:24 -08:00
Marcel Admiraal 026aa4381d Add signal to inform joint that body has exited tree 2020-12-31 16:19:57 +00:00
Rafał Mikrut 29b2882381 Do not iterate over map when removing its values 2020-12-31 15:47:37 +01:00
Rémi Verschelde 4ca98c7a35
Merge pull request #44183 from madmiraal/box_shape-size
Use a size Vector for adjusting the size of Rectangles and Boxes
2020-12-28 16:06:50 +01:00
Rémi Verschelde 058f3fe069
Merge pull request #44149 from madmiraal/rename-tangent-orthogonal
Rename Vector2.tangent() to Vector2.orthogonal()
2020-12-28 16:00:12 +01:00
Rémi Verschelde 18bbd6410f
Merge pull request #44232 from madmiraal/rename-camera2d-drag-offset
Rename Camera2D offset_h and offset_v properties
2020-12-28 15:56:56 +01:00
Marcel Admiraal 04ab6c39cf Rename Camera2D offset_h and offset_v properties 2020-12-28 11:01:20 +00:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
kobewi f814f58942 Fix shape_centered property in TouchScreenButton 2020-12-27 21:53:50 +01:00
Rémi Verschelde 7d972b8c67
Merge pull request #44640 from nekomatata/joint2d_update_body_transforms
Update body transforms on joint2D setup
2020-12-25 14:59:53 +01:00
PouleyKetchoupp 11bee25de4 Update body transforms on joint2D setup
Body transforms from physics are used to setup the joint and they are
only updated before the physics step by default.

Without forcing the transform update, joints could use a previous
position if the body's position was set after it was added to the scene.

3D physics is not affected by this issue.
2020-12-23 20:04:22 -07:00
Marcel Admiraal 4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Rémi Verschelde 153c132a7e
Merge pull request #44300 from KoBeWi/🧹🧹
Move initialization of some classes to headers
2020-12-21 00:24:36 +01:00
Dominik 'dreamsComeTrue' Jasiński aba477361d Fix camera2d zoom when set to zero (causing ERROR: affine_invert: Condition ' det == 0 ' is true.)
Fixes: #41873
2020-12-16 23:42:12 +01:00
Tomasz Chabora 31cb04fbdd Move initialization of some classes to headers 2020-12-11 18:20:03 +01:00
Tomasz Chabora 2c048ea164 Cleanup unused engine code 2020-12-09 12:12:36 +01:00
Marcel Admiraal d5d99aaed6 Use rectangle size instead of extents for Shape dimensions 2020-12-08 11:57:46 +00:00
Marcel Admiraal a24c38d1a8 Rename Vector2.tangent() to Vector2.orthogonal() 2020-12-06 18:16:06 +00:00
Aaron Franke 47f8ac7864
Rename Particles/ParticlesMaterial "Flags" enum to "ParticleFlags"
"Flags" was a bit too ambiguous, and in 3D it hid GeometryInstance.Flags
2020-12-04 19:34:29 -05:00
Aaron Franke 1b499d244a
Rename LightOccluder2D light_mask to occluder_light_mask 2020-12-04 19:34:29 -05:00
Aaron Franke ce9d87ddfd
Rename PathFollow2D rotate bool 2020-12-04 18:59:02 -05:00
Marcel Admiraal 981fbcd3e0 Remove RigidBody weight property 2020-11-27 17:39:20 +00:00
reduz 1bcf3c305b Implement signed distance fields for 2D shaders 2020-11-26 10:49:50 -03:00
Marcel Admiraal 002cc47fbd Check joint nodes and generate configuration warning messages. 2020-11-25 20:53:19 +00:00
greenfox b9c0897713 fixed Camera2D rotation with non-square zoom 2020-11-22 18:09:33 -06:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Rémi Verschelde 424cd00f8b
doc: Sync classref with current source + fixup some bindings
Includes various changes triggered by the refactoring of method bindings.
2020-11-04 15:38:26 +01:00
reduz f123981a96 Implement DirectionalLight2D
Also separated Light2D in PointLight2D and DirectionalLight2D.
Used PointLight2D because its more of a point, and it does not work
the same as OmniLight (as shape depends on texture).
Added a few utility methods to Rect2D I needed.
2020-11-04 10:03:01 -03:00
reduz 0e6664539d Refactor pixel snapping.
-Rename pixel_snap to snap_2d_to_vertices
-Added snap_2d_to_transforms which is more useful

Fixes #41814
Solves proposal https://github.com/godotengine/godot-proposals/issues/1666
Supersedes #35606, supersedes #41535, supersedes #41534
2020-10-30 08:57:32 -03:00
reduz 8ab9b39707 Implement CanvasGroup and CanvasItem clipping
-Allows merging several 2D objects into a single draw operation
-Use current node to clip children nodes
-Further fixes to Vulkan barriers
-Changed font texture generation to white, fixes dark eges when blurred
-Other small misc fixes to backbuffer code.
2020-10-28 18:53:32 -03:00
Eric Tuvesson e892a92ad6 fix(sprite2d): Rect is not handling pixel snap
related https://github.com/godotengine/godot/issues/42985
2020-10-27 23:34:19 +01:00
Rémi Verschelde 8ee44cc60c
Merge pull request #43075 from Xrayez/color-ramp-to-gradient
Fixup `ColorRamp` to `Gradient` renames
2020-10-26 08:44:27 +01:00
Andrii Doroshenko (Xrayez) 8ce2f401dd Fixup ColorRamp to Gradient renames 2020-10-25 18:32:44 +02:00
reduz 84d734da0e Refactored 2D shader and lighting system
-Removed normal/specular properties from nodes
-Create CanvasTexture, which can contain normal/specular channels
-Refactored, optimized and simplified 2D shaders
-Use atlas for light textures.
-Use a shadow atlas for shadow textures.
-Use both items aboves to make light rendering stateless (faster).
-Reorganized uniform sets for more efficiency.
2020-10-24 15:57:25 -03:00
reduz ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Marcel Admiraal a17fdaef09 Remove old RigidBody layers property and methods. 2020-10-13 16:59:49 +01:00
Marcel Admiraal 2bb0427662 Remove area or body from map before emitting signals. 2020-10-02 17:03:09 +01:00
Rémi Verschelde 7b18a7143b
Better validate CollisionShape3D config. warning after #38743
Relates to #42479, though I don't think it would crash in the master version.
2020-10-02 09:41:55 +02:00
Rémi Verschelde 12091b39d2
Merge pull request #38743 from arrowinaknee/node-config-warnings
Update all get_configuration_warning() to retrieve warnings from the parent
2020-10-01 14:03:29 +02:00
Rémi Verschelde f87c75f77b
Merge pull request #41934 from timothyqiu/parallax-ignore-zoom
Fixes ParallaxLayer offset when camera zoom is ignored
2020-09-24 15:23:24 +02:00
booer 113921b56c Fixes updating CPUParticles emmision shape values 2020-09-23 14:17:47 +07:00
Mateo Dev .59 bb7db2138b TileMap: Set texture_filter and texture_repeat to generated CanvasItems and update when it changes 2020-09-12 11:49:38 -03:00
Hugo Locurcio a706c22db7
Rename RayCast's cast_to property to target_position
`cast_to` is sometimes mistaken as a method rather than a property.
`target_position` makes it more obvious that it's a property.
2020-09-10 19:06:56 +02:00
Haoyu Qiu 5e2167631b Fixes ParallaxLayer offset when ignore camera zoom 2020-09-10 11:08:20 +08:00
Jonathan Vice 28326aec60 Reorder sprite h_frames & v_frames 2020-08-31 14:55:49 +02:00
Rémi Verschelde 6875c9d684
Merge pull request #40302 from verdog/camera-bounds-fix
Fix Camera2D Incorrect Preview Bounds
2020-08-27 09:58:24 +02:00
PouleyKetchoupp 1c231cacb3 Fix 2D Particle velocity with directed emission mask
Changed CPU velocity calculation for EMISSION_SHAPE_DIRECTED_POINTS
to follow the same logic as in the GPU version:
mat2 rotm;
rotm[0] = texelFetch(emission_texture_normal, emission_tex_ofs, 0).xy;
rotm[1] = rotm[0].yx * vec2(1.0, -1.0);
VELOCITY.xy = rotm * VELOCITY.xy;

Now both CPUParticles2D & CPUParticles3D (z disabled) show the same results
as their GPU counterparts and take the initial velocity settings into account.
2020-08-09 18:16:53 +02:00
Josh Chandler 79e44f4033 fixed camera2D showing incorrect bounds in editor 2020-07-18 18:01:37 -04:00
Rémi Verschelde c5d02fdffc Revert "Merge pull request #38341 from verdog/camera-bounds-fix"
This reverts commit 08bbb3f161.
2020-07-11 19:05:48 +01:00
Rémi Verschelde dcd11faad3
Merge pull request #40253 from madmiraal/add-override-keywords
Add override keywords.
2020-07-10 21:04:23 +02:00
Rémi Verschelde 08bbb3f161
Merge pull request #38341 from verdog/camera-bounds-fix
Fix Camera2D incorrect preview bounds
2020-07-10 19:35:26 +02:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
Andrii Doroshenko (Xrayez) dc446203be Provide warning when using polygon shapes in CollisionShape2D node
`ConvexPolygonShape2D` and `ConcavePolygonShape2D` are only meant to be
used directly in code and not in the editor for physics-based use cases
specifically.

Developers are advised to use `CollisionPolygon2D` instead, which does
generate those shapes under the hood, handling polygon convexivity,
proper orientation etc.
2020-07-03 15:46:09 +03:00
Rémi Verschelde 67e4082b1e
Merge pull request #37350 from aaronfranke/force-impulse
Refactor physics force and impulse code to use (force, position) order
2020-07-02 18:39:16 +02:00
Rémi Verschelde 34e011c8a5
Merge pull request #36307 from Xrayez/raycast-enabled-true
Enable raycast nodes by default
2020-07-01 16:06:16 +02:00
Marcel Admiraal c4650540d4 Normalise p_up_direction vector in move_and_slide() and
move_and_slide_with_snap() and fix tolerance in
move_and_slide_with_snap() max floor angle.
2020-06-16 09:56:08 +01:00
Ranoller bccc2cdb9c
Fix bad position in Camera2D offset and camera rotation if smothing enabled.
Fix https://github.com/godotengine/godot/issues/16323 in master. Apply same solution of https://github.com/godotengine/godot/issues/2074 in rotation and offset.
2020-06-15 16:27:59 +02:00
Rémi Verschelde b3bc5aafc5 Object: Add usage hint to instantiate Object properties in editor
Fixes #36372 as Path2D/Path3D's `curve` property no longer uses a Curve
instance as default value, but instead it gets a (unique) default Curve
instance when created through the editor (CreateDialog).

ClassDB gets a sanity check to ensure that we don't do the same mistake
for other properties in the future, but instead use the dedicated
property usage hint.

Fixes #36372.
Fixes #36650.

Supersedes #36644 and #36656.

Co-authored-by: Thakee Nathees <thakeenathees@gmail.com>
Co-authored-by: simpuid <utkarsh.email@yahoo.com>
2020-06-12 14:30:18 +02:00
Marcel Admiraal b5e31b70dc Correct misspellings of damped spring. 2020-06-04 18:07:24 +01:00
Aaron Franke ba27deef06
Refactor physics force and impulse code 2020-06-02 23:18:59 -04:00
Andrii Doroshenko (Xrayez) 11f367fe02 Enable raycast nodes by default 2020-05-27 15:10:53 +03:00
Andrii Doroshenko (Xrayez) 69d5de632e Split Geometry singleton into Geometry2D and Geometry3D
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
ArrowInAKnee 9fc2b0fddc Update all get_configuration_warning to retrieve warnings from the parent 2020-05-16 16:07:42 +03:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Rémi Verschelde 66b0b0c153
Merge pull request #38635 from Calinou/tilemap-rename-ysort-index
Rename various TileMap methods/properties for clarity and consistency
2020-05-11 23:05:15 +02:00
Rémi Verschelde 22db301009
Merge pull request #31938 from KoBeWi/a_welcome_lag
Fix VisibilityEnabler2D behavior on start
2020-05-11 10:27:42 +02:00
Hugo Locurcio c64c45ccaf
Rename various TileMap methods/properties for clarity and consistency
The YSort renames were tracked in https://github.com/godotengine/godot/issues/16863.

This closes https://github.com/godotengine/godot-proposals/issues/814.
2020-05-10 19:16:38 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Tomasz Chabora d0c5d91032 Fix VisibilityEnabler2D behavior on start 2020-05-08 11:19:52 +02:00
Mateo Kuruk Miccino e253451a5b GUI: Touch screen button click area now is synced with its draw
(cherry picked from commit 1cba7fb180)
2020-05-07 21:21:13 +02:00
Rémi Verschelde 560510b93b
Merge pull request #38446 from qarmin/navigation_polygon_type
Fixes type of array in _set_outlines function
2020-05-04 16:36:16 +02:00