Commit Graph

68 Commits

Author SHA1 Message Date
75881f8322 Use initializer list in Arrays 2025-03-26 18:38:15 +01:00
22a7079afd Merge pull request #104047 from YYF233333/dict_iter
Add const iteration support to `Dictionary`
2025-03-13 08:57:23 -05:00
bebe037abf Add ConstIterator to Dictionary. 2025-03-13 01:28:46 +08:00
2aeca3e885 Optimize String::chr to avoid calling strlen. Use String::chr instead of String(&chr, 1) where appropriate. 2025-01-10 18:06:46 +01:00
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
e06d83860d Style: Enforce AllowShortFunctionsOnASingleLine 2025-01-02 10:09:41 -06:00
30d87229ed Merge pull request #82845 from Hysterelius/master
Color: Expose OKHSL properties
2024-11-11 14:18:04 -06:00
2126df2dfd Color: Expose OKHSL properties 2024-11-11 20:41:57 +01:00
b3d7960df4 Core: Fix operator[] for typed dictionaries 2024-09-12 11:10:17 -05:00
9853a69144 Implement typed dictionaries 2024-09-04 10:27:26 -05:00
154049ce17 StringName Dictionary keys
also added 'is_string()' method to Variant
and refactored many String type comparisons to use it instead
2024-08-29 13:39:27 -07:00
a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
f9b488508c Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +02:00
ec29c3e784 [Core] Fix property access on read-only Dictionary 2024-04-22 13:57:34 +02:00
9903e6779b Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
3a08c646ee Pre-commit: Update to clang-format 17.0.6 and black 24.2.0 2024-02-28 14:25:35 +01:00
2bffa3cbc5 Merge pull request #82639 from golfinq/gdscript-improve-indexing-error
GDScript: Improve error messages for invalid indexing
2024-01-04 16:38:58 +01:00
b04263644c Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +03:00
5efbed51cc GDScript: Improve error messages for invalid indexing
These errors are very common when using an invalid property name
or calling on an object of the wrong type, and the previous message
was a bit cryptic for users.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: golfinq <golfinqz@gmail.com>
2023-10-02 14:23:11 -04:00
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
f83a90192f Revert "Add API for HSL conversion"
This reverts commit 0b7fd664c1.
2023-05-10 17:45:56 -03:00
0b7fd664c1 Add API for HSL conversion
Math ported pretty much 1:1 from https://en.wikipedia.org/wiki/HSL_and_HSV
Style doesn't match the existing HSV code exactly, but should be close enough.
2023-05-09 17:43:10 +02:00
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
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
40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
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
2cea42cc7f Rename Projection matrix to columns 2022-10-04 12:34:19 -05:00
9d47e079b7 Move some methods to Animation from Variant for refactoring 2022-09-15 04:52:43 +09:00
7006f7d693 Add some missing Vector4 methods 2022-07-26 02:35:42 +02:00
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
023b1d7f5a Implement read-only arrays
Arrays can be set as read-only and thus cannot be modified. Assigning
the array will create an editable copy.

Similar to is already done to read-only dictionaries.
2022-05-17 14:14:42 -03:00
e6c443a353 Implement read-only dictionaries.
* Add ability to set them read only.
* If read-only, it can't be modified.

This is added in order to optionally make const dictionaries (and eventually arrays) properly read-only in GDScript.
2022-05-16 23:31:46 +02:00
fa7a7795f0 Rename Basis get_axis to get_column, remove redundant methods 2022-05-03 09:37:47 -05:00
931838b330 Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
b831fb0a54 Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
860fac4e6f Make blend animation to use ResetTrack as default value 2022-04-10 13:00:00 +09:00
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
6af77c7b09 Merge pull request #53684 from TokageItLab/orthogonal-mode 2022-01-05 16:05:40 +01:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
61759da5b3 Fix some gizmo behavior to make more consistent 2021-12-25 03:24:04 +09:00
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
f9ba2efe1e Modify Dictionary::operator== to do real key/value comparison with recursive support (and add unittests) 2021-10-30 13:11:01 +02:00
9e5fdbc79d Fix LUA-style assignment in Dictionary 2021-10-05 12:17:13 +02:00
262d9397fb Allow indexing of String values in scripting languages 2021-09-17 16:24:56 -03:00
ac3322b0af Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
4e6efd1b07 Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
b1d15c51bc Implement native extension system
* Deprecates GDNative in favor of a simpler, lower level interface.
* New extension system allows registering core engine classes.
* Simple header interface in gdnative_interace.h
2021-06-25 17:32:45 -03:00
2c81e5fa0e Make some variant internal functions public.
-Make constructors, ops and setget inline functions public
-Should help optimizing the GDScript VM
2021-06-17 19:59:28 -03:00
04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00