Commit Graph

87 Commits

Author SHA1 Message Date
Hugo Locurcio
fb199547ff Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Rémi Verschelde
26d51fa0c3 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
bruvzg
4a042e3d08 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Silc 'Tokage' Renew
1cc952bc43 Implement cubic_interpolate() as MathFunc for refactoring 2022-02-12 18:11:17 +09:00
Pedro J. Estébanez
f1481707df Rename Variant::is_ref() to is_ref_counted() 2022-01-20 18:46:25 +01:00
Rémi Verschelde
7a2dfcf238 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Yuri Roubinsky
e56b37a0a8 Fix randfn in visual scripts 2021-11-17 18:52:44 +03:00
Yuri Roubinsky
1dca7ea720 Expose randfn to global scope 2021-11-17 14:29:19 +03:00
Silc 'Tokage' Renew
1da316233b reimplement ping-pong 2021-11-03 13:39:33 +09:00
Juan Linietsky
0837a9115d Revert "Implement reverse playback and ping-pong loop in AnimationPlayer and NodeAnimation" 2021-10-11 19:27:50 -03:00
Tokage
b19f39d0a2 implement ping-pong loop in animation
Co-authored-by: Chaosus <chaosus89@gmail.com>
2021-10-09 18:08:43 +09:00
Hugo Locurcio
e126128b49 Add print_verbose() built-in function to print in verbose mode only
This can be used as a shorthand for:

    if OS.is_stdout_verbose():
        print("...")

Unlike `print_debug()`, this works in release builds too and can
be toggled off in debug builds.
2021-09-21 15:59:49 +02:00
kobewi
faa6be529c Remove cartesian2polar and polar2cartesian 2021-08-31 01:41:41 +02:00
Aaron Franke
b7131d531e Remove obsolete "dectime" method
Replaced by "move_toward"
2021-07-30 16:41:28 -05:00
Lightning_A
6db897c183 Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Pedro J. Estébanez
6c237004df Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
David Cambré
fe3c1bffbf The built in function math/seed was missing the sequenceport. 2021-05-22 14:01:35 +02:00
Rémi Verschelde
395de681a8 Re-bind posmod, use int64_t instead of int
Fixes #48420, fixes #48421.
The binding was missed when moving GDScript built-in to Global Scope it seems.

Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2021-05-04 13:25:08 +02:00
reduz
8de8017dac 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
Aaron Franke
f593488534 Replace ColorN and from HTML with a string constructor 2021-02-01 17:27:19 -05:00
Rémi Verschelde
3debf92210 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
Marcel Admiraal
246c54b09b Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Aaron Franke
776b0c9f1d Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
reduz
67097782d5 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
reduz
4f7590cecf 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
Yuri Roubinsky
daa8361a91 Exposed randi_range to global funcs + renamed rand_range to randf_range 2020-11-06 17:06:26 +03:00
bruvzg
87f5ff9391 [Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Rémi Verschelde
61c72a6a78 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
05754f241e 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
7916419087 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
Nico Mitchell
9ea27c8c0c Change MATH_POSMOD return type back to INT 2020-04-14 17:23:35 -04:00
Nico Mitchell
e1b48823b0 Change round return type to float 2020-04-13 13:02:40 -04:00
lupoDharkael
93b9053b54 Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky
73ec47dbd7 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Juan Linietsky
6070e25d17 Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky
88818b6a37 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde
25cdea3653 Remove deprecated decimals builtin
Replaced by 'step_decimals' in 3.2 via #21425.
2020-02-12 13:39:39 +01:00
Rémi Verschelde
be5dd6ce1f Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
64epicks
184d3b19f2 Implemented ord function in VisualScript 2019-09-03 17:06:11 +02:00
Rémi Verschelde
e4f1b32c85 doc: Sync classref with current source 2019-07-22 12:27:52 +02:00
Chaosus
add37970b3 Added lerp_angles built-in function
Co-authored-by: Xrayez <https://github.com/Xrayez>
Co-authored-by: DleanJeans <https://github.com/DleanJeans>
2019-07-20 12:59:41 +03:00
Aaron Franke
8703a8dec8 Add integer posmod and rename default arg names
"posmod" is the integer version of "fposmod". We do not need a "mod" because of the % operator.

I changed the default arg names from "x" and "y" to "a" and "b" because they are not coordinates. I also changed pow's arg names to "base" and "exp". Also, I reorganized the code in the VS built-in funcs switch statement.
2019-07-18 16:33:43 -04:00
Giacom
959a4f59e6 Added move_toward functions for float, Vector2 and Vector3 2019-05-28 11:39:35 +01:00
Rémi Verschelde
63e671ffc0 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Rémi Verschelde
e2e90aa566 Merge pull request #27231 from Chaosus/smoothstep
Added smoothstep built-in function
2019-04-08 10:03:42 +02:00
Chaosus
dd9357d41c Added smoothstep built-in function 2019-04-07 14:11:26 +03:00
Fabio Alessandrelli
fc2d61df47 Add object encoding param to serialization methods
Network peers get_var/put_var
File get_var/store_var
GDScript/Mono/VisualScript bytes2var/var2bytes
Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding.

Break ABI compatibaility (API compatibility for GDNative).
2019-04-01 15:53:19 +02:00
Rémi Verschelde
c3208308e0 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
DualMatrix
d3d8d8929f Fixed argument names being swapped for atan2
The arguments of atan2() should be y,x instead of x,y This was just wrong since the internal atan2 already had y,x as parameters, so if you followed the autocomplete the result would just be wrong.
2018-09-16 21:27:54 +02:00
Rémi Verschelde
d69f42bdca Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00