Commit Graph

5852 Commits

Author SHA1 Message Date
Rémi Verschelde 4ca6a9809d
Merge pull request #44596 from KoBeWi/🧹🧹🧹
Cleanup unused engine code v2
2023-01-19 19:32:51 +01:00
Juan Linietsky 3dcf380161 Implement a quick script inheritance check
Optimizes, simplifies and fixes EditorResourcePicker (was not refreshing custom clases).
2023-01-19 16:47:01 +01:00
Raul Santos 97610c8bfc
Add property usage to array indexer
This makes the `Array` indexer show as returning `Variant` instead of `void` in the documentation.
2023-01-19 14:22:11 +01:00
kobewi c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +01:00
bruvzg aade5abd4f
Reorganize main and sub-window initial position properties. 2023-01-19 13:44:06 +02:00
bruvzg db7d8c2d87
[GDExtension] Expose some low level functions and String operators. 2023-01-19 12:50:49 +02:00
Rémi Verschelde 4679f8724a
Merge pull request #71628 from reduz/fixup-editor-file-system-script-parsing
Clean up EditorFileSystem script parsing
2023-01-19 10:09:55 +01:00
Juan Linietsky 5bdc0d97d3 Clean up EditorFileSystem script parsing
* Optimize only update modified/added/removed files.
* Clean up documentation parsing.
2023-01-18 20:56:45 +01:00
Pedro J. Estébanez 6616b0619d Revert "Make MessageQueue::push_callable(p) work with bound arguments"
This reverts commit 81b1ebddef.
2023-01-18 19:20:40 +01:00
Rémi Verschelde b5f3ac522e
Merge pull request #71400 from touilleMan/gdextension-dump-global_enum-is_bitfield-field
Add missing is_bitfield field for global enum in extension_api_dump
2023-01-18 17:47:58 +01:00
Rémi Verschelde b516d05245
Merge pull request #71622 from RandomShaper/mq_bound
Make MessageQueue::push_callable(p) work with bound arguments
2023-01-18 17:33:34 +01:00
Pedro J. Estébanez 81b1ebddef Make MessageQueue::push_callable(p) work with bound arguments 2023-01-18 14:54:17 +01:00
Rémi Verschelde 6da836bbb4
Merge pull request #71514 from akien-mga/os-unset_environment
OS: Add `unset_environment`, better validate input
2023-01-18 08:35:43 +01:00
Rémi Verschelde 4005fc4b8d
Merge pull request #71279 from vonagam/fix-iterator-number-type
GDScript: Fix typing of iterator in for loop
2023-01-16 22:21:26 +01:00
Rémi Verschelde 91a54cdbc1
Linux/BSD: Add LINUXBSD_ENABLED define for non X11-related checks 2023-01-16 17:01:35 +01:00
Rémi Verschelde 818a9e99a4
OS: Add `unset_environment`, better validate input
Instead of returning an undocumented boolean error code, we do the
validation checks that should ensure a successful result.

Based on:
- https://linux.die.net/man/3/setenv
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable
2023-01-16 16:39:44 +01:00
Rémi Verschelde 5ca6c1f9db
Merge pull request #70557 from KoBeWi/class_yeet
Move global script class cache to separate file
2023-01-16 12:49:08 +01:00
Rémi Verschelde d94a46ab95
Merge pull request #64021 from ajreckof/change-shortcut-for-rect-tool-tilemap
Add `Key::CTRL_OR_CMD` and use it to fix shortcut for tilemap painting tools on macOS
2023-01-16 12:47:07 +01:00
kobewi 6444c7d127 Move global script class cache to separate file 2023-01-16 10:16:30 +01:00
Juan Linietsky 3a93efefee Fix cases of broken user:// paths.
* Properly validate paths when supplying the project name.
* Ensures that the user data dir will always be valid.

Fixes 69366.
2023-01-15 19:05:00 +01:00
ajreckof 4309dffc6a add CMD_OR_CTRL as a Key and not just a key modifier 2023-01-15 18:49:20 +01:00
Raul Santos 7560340ef6
Rename `center` method to `get_center` in Plane. 2023-01-15 17:18:50 +01:00
Emmanuel Leblond 38d9e8b366
Add missing is_bitfield field for global enum in extension_api_dump 2023-01-14 16:08:41 +01:00
Juan Linietsky 1aaff63b8f Fixes to JSON as resource
* It was not a resource, hence it was not working to load it as such.
* Changed so, when opened in editor, a parse error will not fail load and the text will be kept.
* This should allow proper editing from within the code editor, including syntax checking and saving files as-is in text.

Partially addresses #66820.

The code editor still needs to be changed for this to work.
2023-01-14 14:41:51 +01:00
Juan Linietsky 6f0e210093 Refactor ProjectSetting overrides
* Overrides no longer happen for set/get.
* They must be checked with a new function: `ProjectSettings::get_setting_with_override()`.
* GLOBAL_DEF/GLOBAL_GET updated to use this

This change solves many problems:
* General confusion about getting the actual or overriden setting.
* Feature tags available after settings are loaded were being ignored, they are now considered.
* Hacks required for the Project Settings editor to work.

Fixes #64100. Fixes #64014. Fixes #61908.
2023-01-13 15:13:56 +01:00
Dmitrii Maganov 40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
Rémi Verschelde c2790ec2b9
Merge pull request #68450 from KoBeWi/bracket_escapist
Allow to escape closing brackets in CFG tags
2023-01-12 21:53:15 +01:00
Danil Alexeev 8f706be6fa
Rearrange `editor/naming/*` project settings 2023-01-12 11:41:13 +03:00
Rémi Verschelde 0e4e782ada
Merge pull request #70714 from Calinou/doc-os-stdin
Improve documentation for `OS.read_string_from_stdin()`
2023-01-12 09:24:47 +01:00
Hugo Locurcio 86b8176864
Improve documentation for `OS.read_string_from_stdin()`
This makes it clearer that calls to this method are blocking.

The unused method parameter was also removed.
2023-01-11 19:57:25 +01:00
Eric M 7b66806dd3 Make InputEventAction as_text() return the text of the first valid event for the action. 2023-01-12 00:10:44 +10:00
Juan Linietsky 33d3b7eea7 Fix Callable call error reporting.
* Fix potential crash when using bind in `Variant::get_callable_error_text()`
* Properly compute bound arguments so they can be properly shown.
* Add a function to obtain the actual bound arguments.
2023-01-10 13:56:27 +01:00
Rémi Verschelde 0231b4a0e8
Merge pull request #70726 from heppocogne/Fix-open_compressed-get_path
Fix `get_path()` is not working when files are opend with `open_compressed`
2023-01-10 10:48:15 +01:00
Rémi Verschelde d3fc9d9e41
Merge pull request #71051 from vonagam/consts-are-deep-start
GDScript: Begin making constants deep, not shallow or flat
2023-01-09 23:22:59 +01:00
Rémi Verschelde be4e9dfeab
Merge pull request #69616 from reduz/change-uuid
Ability to change a resource UID from API
2023-01-09 23:08:18 +01:00
Juan Linietsky 07a964fce3 Ability to change a resource UID from API
* Works for text, binary and imported resources
* Allows better clean up of duplicate files.

TODO (future PRs):

* Use this API for assigning new UIDs to copied files.
* Use this API for UID conflict on FS scanning (if more than one file has the same UID, the newer one(s) should get assigned a different UID).
2023-01-09 18:52:00 +01:00
Juan Linietsky 0e0a6bb39b
Removed unused property hints and `Object::get_translatable_strings()`
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Rémi Verschelde 88940571f2
Merge pull request #71082 from AThousandShips/array_find_fix
Fix for comparisons with PackedArrays
2023-01-09 14:19:09 +01:00
Rémi Verschelde d46568205d
Merge pull request #64795 from RandomShaper/fix_saferefcount
Prevent misuse of SafeRefCount
2023-01-09 14:18:53 +01:00
Pedro J. Estébanez b1c7665866 Prevent misuse of SafeRefCount 2023-01-09 10:17:55 +01:00
Rémi Verschelde 31f94574d4
Merge pull request #70996 from reduz/properly-report-callable-bound-arguments
Properly report Callable bound arguments
2023-01-09 08:34:28 +01:00
Rémi Verschelde e7905f4f48
Merge pull request #71045 from reduz/use-bitfield-in-core-types
Use BitField<> in core type masks
2023-01-09 08:33:26 +01:00
Juan Linietsky 0e0ca01bce Properly report Callable bound arguments
Fixes #63213
Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
2023-01-08 23:35:11 +01:00
Rémi Verschelde eff2739cf7
Merge pull request #71052 from Chaosus/fix_astargrid2d
Fix error in `AstarGrid2D::get_id_path`
2023-01-08 22:40:41 +01:00
Rémi Verschelde 0081c59198
Merge pull request #71013 from voidedWarranties/fix_ext_property_default_value
Fix `ScriptInstanceExtension::get_property_default_value` return value
2023-01-08 22:36:10 +01:00
Juan Linietsky 2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
Ninni Pipping 86240d97e1 Fix for PackedArray comparison 2023-01-08 21:22:28 +01:00
Yuri Rubinsky 6640eb8065 Fix error in `AstarGrid2D::get_id_path` 2023-01-08 10:34:33 +03:00
Dmitrii Maganov 5e2ac1a31e GDScript: Begin making constants deep, not shallow or flat 2023-01-08 07:29:10 +02:00
Rémi Verschelde d642274f75
Merge pull request #70939 from bruvzg/win_screen_2
Add support for the custom initial screen for the main window, fix primary screen detection.
2023-01-07 13:21:36 +01:00
Rémi Verschelde 41b74c675f
Merge pull request #71000 from reduz/callable-bind-from-array
Allow binding Callable arguments from an array
2023-01-07 13:18:53 +01:00
bruvzg 2718a7b7d3
Add support for the custom initial screen for the main window, fix primary screen detection. 2023-01-07 11:14:35 +02:00
voidedWarranties 411719a399 Fix `ScriptInstanceExtension::get_property_default_value` return value 2023-01-06 19:55:02 -08:00
Rémi Verschelde 163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde a12b326fab
Merge pull request #70995 from reduz/do-not-bind-variant-immutable
Unbind Variant methods that change immutable types.
2023-01-06 22:56:20 +01:00
Juan Linietsky d762a0395a Allow binding Callable arguments from an array
Restores 3.x functionality that was removed in the Signal/Callable refactor of 4.0.

Fixes #64668.
Implements https://github.com/godotengine/godot-proposals/issues/6034

Usage:

```GDScript

callable.bindv([arg1,arg2,arg3])

```
2023-01-06 22:37:25 +01:00
Juan Linietsky 576ae694e0 Unbind Variant methods that change immutable types.
Fixes #62706.
Code is commented instead of removed to clarify why they should not be re-added.
2023-01-06 17:17:43 +01:00
Yuri Rubinsky 4a45c76737 Fix jumping in `AStarGrid2D` when `DIAGONAL_MODE_NEVER` is enabled 2023-01-06 13:40:24 +03:00
Rémi Verschelde 1816f49886
Merge pull request #64253 from heppocogne/Fix-native-enum-release-1
Register enum type names in release build
2023-01-06 00:10:31 +01:00
Rémi Verschelde e5f6e03490
Merge pull request #70547 from TokageItLab/pingpong-wrap
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-06 00:10:18 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde 565ae3b767
Merge pull request #67694 from aaronfranke/its-time
Remove duplicate Month and Weekday enums
2023-01-03 23:21:19 +01:00
Rémi Verschelde f0893890e1
Merge pull request #70482 from bruvzg/ios_pencil
[iOS] Add Apple Pencil pressure and tilt support.
2023-01-03 15:51:39 +01:00
Rémi Verschelde 4e360ac612
Merge pull request #70702 from vnen/gdscript-error-on-assign-void
GDScript: Error when assigning return value of void function
2023-01-03 12:23:00 +01:00
Clay John 61c7b7fb13
Merge pull request #67853 from Zylann/fix_lods_with_doubles
Fix usages of mesh simplification functions in float=64 builds
2023-01-02 12:33:44 -07:00
Yuri Rubinsky b28571ca3e Optimize `wrapf` function a bit 2023-01-01 23:17:29 +03:00
George Marques 0c15844551
GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
heppocogne ea11ffc88c Fix `get_path()` is not working when files are opend with `open_compressed`
And also fixed `get_absolute_path()` in the same way
2022-12-30 10:31:12 +09:00
heppocogne 6f31f7b0bc Register native base class name of enum types when release build 2022-12-30 00:30:18 +09:00
Aaron Franke 8d7d1b0bb2
Remove duplicate Month and Weekday enums
Well, they were duplicately-exposed, but triplicately-defined.
2022-12-26 15:16:25 -06:00
Silc Renew 8745c206c4 Fix pingpong with loop wrap is not working 2022-12-25 18:16:38 +09:00
Yuri Rubinsky 16efd0b0fc Divide `AStarGrid2D::default_heuristic` into two different heuristics 2022-12-24 09:31:02 +03:00
bruvzg 223a612c0c
[iOS] Add Apple Pencil pressure and tilt support. 2022-12-23 23:44:10 +02:00
Rémi Verschelde f5a6c9cf50
Merge pull request #62029 from Maran23/optional-default-value-project-settings
Allow to specify a default value in `ProjectSettings.get_setting()`
2022-12-21 22:23:43 +01:00
Marius Hanl 5aa243f9da Added the possibility to define a default value in ProjectSettings.get_setting(), which is used when no setting is set.
Also added tests for the project settings.

Co-authored-by: Yuri Sizov <11782833+YuriSizov@users.noreply.github.com>
2022-12-21 19:49:57 +01:00
Rémi Verschelde 186f6f0d87
Merge pull request #70403 from rburing/fix_edge_map_capacity
Fix edge map capacity in convex hull computer
2022-12-21 18:29:38 +01:00
Rémi Verschelde 1df71f89a8
Merge pull request #70355 from Chaosus/gds_fix_loops
Fix empty zero assigners for the variant types
2022-12-21 18:25:28 +01:00
Ricardo Buring e0e45e013e Fix edge map capacity in convex hull computer
The desired capacity could be less than the default, so reserve would
error.
2022-12-21 17:12:36 +01:00
stmSi 96b0fbb756 Fix crashed when compressing empty image data. 2022-12-21 16:39:35 +06:30
Rémi Verschelde 4f3ec4121a
Merge pull request #70350 from Chaosus/stringname_operator
Add missing != operator to `StringName`
2022-12-21 09:21:32 +01:00
Yuri Rubinsky 0bcbf8e00d Add `get_point_position` method to `AStarGrid2D` 2022-12-20 23:21:38 +03:00
Yuri Rubinsky fff3d812a5 Fix empty zero assigners for the variant types 2022-12-20 19:02:44 +03:00
Yuri Rubinsky 522d4243bf Add missing != operator to `StringName` 2022-12-20 17:25:54 +03:00
Rémi Verschelde 2a04b18d37
Merge pull request #70339 from Chaosus/astargrid2d_weight_scale
Restore weight scale for `AStarGrid2D` (partially)
2022-12-20 13:30:37 +01:00
Rémi Verschelde f318d60e06
Merge pull request #65376 from reduz/astc-support
Implement basic ASTC support
2022-12-20 12:44:30 +01:00
Juan Linietsky 71d21c7ccb Implement basic ASTC support
Implements basic ASTC support:
* Only 4x4 and 8x8 block sizes.
* Other block sizes are too complex to handle for Godot image compression handling. May be implemented sometime in the future.

The need for ASTC is mostly for the following use cases:
* Implement a high quality compression option for textures on mobile and M1 Apple hardware.
* For this, the 4x4 is sufficient, since it uses the same size as BPTC.

ASTC supports a lot of block sizes, but the benefit of supporting most of them is slim, while the implementation complexity in Godot is very high.
Supporting only 4x4 (and 8x8) solves the real problem, which is lack of a BPTC alternative on hardware where it's missing.

Note: This does not yet support encoding on import, an ASTC encoder will need to be added.
2022-12-20 11:26:30 +01:00
Yuri Rubinsky 8c478dcec9 Restore weight scale for `AStarGrid2D` (partially) 2022-12-20 12:22:32 +03:00
Rémi Verschelde 418ec03a40
Merge pull request #65990 from touilleMan/gdextension-expose-builtins-members-real-types
Expose in builtins' members internal type & size (on top of offset) in extension_api.json
2022-12-19 16:26:05 +01:00
Hugo Locurcio 70f6d42c92
Remove Disable Touch debug project setting
This project setting was only implemented and iOS and likely served
no purpose outside of debugging during development of engine features.

It was also located in a confusing location in the project settings
editor, as it was located below a root category (which appears in bold
and is normally not seen as clickable by users).
2022-12-17 18:47:29 +01:00
Rémi Verschelde ffed638cbc
Merge pull request #70116 from Calinou/vibrate-handheld-silence-warning
Silence `Input.vibrate_handheld()` warning as it's already documented
2022-12-16 13:47:11 +01:00
Haoyu Qiu 207e52c161 Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()`
  - Returns pairs of boundary start and end offsets
  - Accepts `chars_per_line` to return line breaks
- Removes `String::word_wrap()`

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-12-16 13:18:57 +08:00
Hugo Locurcio 4a991887bf
Silence `Input.vibrate_handheld()` warning as it's already documented
The warning causes messages to be spammed if you are calling this
method in a game that runs on both desktop and mobile platforms,
unless you guard all calls to `Input.vibrate_handheld()` with
`OS.has_feature("mobile") or OS.has_feature("web")`.

Since the limitation is already documented (and is obvious enough
given the method's name), the warning message is redundant.
2022-12-16 01:12:20 +01:00
bruvzg 53c76fa5d1
[RTL/TextServer] Add baseline inline alignment mode for objects and RTL tables. 2022-12-15 23:16:02 +02:00
Hei cc245ff8a6
Fix "p_zfar" to "p_znear" in Projection.create_orthogonal
Was confused why it always gave inf:s.
2022-12-15 19:03:33 +02:00
Emmanuel Leblond 2c2fd0820a
Expose in builtins' members internal type & size (on top of offset) in extension_api.json 2022-12-15 12:43:42 +01:00
Rémi Verschelde 762c6d4b36
Merge pull request #69709 from RandomShaper/refactor_spirv_reflection
Refactor SPIR-V reflection into a generic RenderingDevice feature
2022-12-15 09:21:35 +01:00
Jan Haller ebb3306da3 Extension header: amend const correctness of `p_args` parameters
A while ago, argument arrays were passed as const GDNativeTypePtr* (void* const*)
This was changed to GDNativeConstTypePtr* (void const**), adding const on the value but removing it on the pointer level.
This commit changes argument types to const GDExtensionConstTypePtr* (void const* const*).

Besides object pointers, the same change is applied to variant pointers.
2022-12-14 18:25:30 +01:00
Bastiaan Olij 7502e1dc0d Improve logic around using Ref<T> with GDExtension virtual functions 2022-12-13 10:54:29 +11:00
lawnjelly 491594ef0f VariantParser make readahead optional
It turns out some areas are independently moving / reading filepointers outside of the VariantParser, which can cause the readahead caching to get out of sync.

This PR makes the VariantParser readahead to be optional to allow for these use cases.
2022-12-12 15:14:39 +00:00
Rémi Verschelde 5f35b1d516
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@adf7ec1edf
2022-12-12 13:43:15 +01:00