Commit graph

297 commits

Author SHA1 Message Date
Yaohua Xiong
91e9ad92f5 Refactor baking code for Curve2D
The main change is to caculate tangent directly from bezier curve, without going
through discretized polyline, avoiding pitfalls of discretization. A similar refacor
had been applied to Curve3D.

The test cases for Curve2D is updated, comparing floating point with is_equal_approxmiate()
instead of `==`, in order to avoid float precision problem.
2022-12-05 21:22:05 +08:00
Silc Renew
83135aa122 Remove UPDATE_TRIGGER & Match behaviors between AnimationTree/Player
#69357
2022-12-02 20:28:10 +09:00
Rémi Verschelde
4a8b725bc9
Merge pull request #68386 from MewPurPur/snappedi-snappedf
Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
2022-11-24 18:54:49 +01:00
Rémi Verschelde
5e2bb98eee
Merge pull request #68806 from MewPurPur/printraw-warn-better-in-docs
Make it clearer that printraw only prints to terminal
2022-11-24 18:54:42 +01:00
VolTer
a18afb9a56 Make it clearer that printraw only prints to terminal 2022-11-24 18:08:02 +01:00
Yaohua Xiong
f9fa182abc Refactor Curve3D::_bake() method
The main change is to caculate tangent directly from bezier curve, without going
through discretized polyline, avoiding pitfalls of discretization.

Other changes are:
1. Add an bezier_derivative() method for Vector3, Vector2, and Math;
2. Add an tesselate_even_length() method to Curve3D, which tesselate bezier curve to even length segments adaptively;
3. Cache the tangent vectors in baked_tangent_vector_cache;
2022-11-24 10:52:06 +08:00
Rémi Verschelde
3791872c65
Merge pull request #67726 from HenryClones/integer-lerping-errors
Add case for Variant::INT in lerp variant switch
2022-11-23 08:33:53 +01:00
Xpertice
3e36cc7c73 Add case for Variant::INT in lerp variant switch 2022-11-22 22:37:22 -05:00
VolTer
e26f0906f2 Implement snappedi, snappedf, and Vector[2/3/4]i.snapped 2022-11-19 06:18:55 +01:00
Micky
b4324e7a45 Remove PROPERTY_HINT_IMAGE_COMPRESS constants
These were used in 3.x but there's no reference of them in the codebase, at all.
2022-11-15 15:28:49 +01:00
Rémi Verschelde
08d56ac2f1
Merge pull request #66747 from aaronfranke/move-euler-order
Move EulerOrder enum to math_defs.h and global scope
2022-11-02 22:37:12 +01:00
Aaron Franke
8556fdd4bc
Move EulerOrder enum to math_defs.h and global scope 2022-11-02 13:44:13 -05:00
Rémi Verschelde
f7c611ab71
Style: Misc docs and comment style and language fixes
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02 19:01:18 +01:00
Rémi Verschelde
632b3e974c
Merge pull request #67693 from Mickeon/slight-hint-shuffling
Fix unordered values of PROPERTY_HINT_INT_IS_POINTER & ARRAY_TYPE
2022-11-02 14:16:53 +01:00
Micky
9de7b1afce Doc consistency: "inspector" to "Inspector"
Also fixes a slightly misleading comment in `Node.print_tree_pretty`.
2022-10-27 18:41:20 +02:00
Micky
965f6e40ef Tweak @GlobalScope constants documentation overall
General:
- Replace most type names with strong references (such as "integer" to "[int]");
- Made the writing style closer to how the rest of the documentation is formatted.
- Use uppercase Inspector when referring to the Inspector dock.
- Describe missing MethodFlags, Variant.Type constants.

Key:
- Add " key." to the `KEY_0` to `KEY_9` constants;
- Reword some MouseButton constants;
	- In a programming context, it's kind of odd hearing about the plural of "mouse".

Error:
- Reword OK constant to flow better, use `printerr()` over `print()`;
- Describe where `ERR_HELP` is used by the engine;
- Point to the Github Issues Page in ERR_BUG.

PropertyHint:
- Mention that PROPERTY_HINT_IMAGE_COMPRESS_LOSSY and PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS are unused;
- Mention that PROPERTY_HINT_PASSWORD allows a placeholder string.
- Describe PROPERTY_HINT_OBJECT_TOO_BIG, PROPERTY_HINT_MAX.

PropertyUsageFlags:
- Describe PROPERTY_USAGE_HIGH_END_GFX, PROPERTY_USAGE_ARRAY.
2022-10-21 19:52:09 +02:00
Max Hilbrunner
f77f7d4ba9
Merge pull request #67072 from Mickeon/uh-oh-stinky
Rewrite most of Resource's documentation
2022-10-21 18:42:44 +02:00
Max Hilbrunner
13138b307b
Merge pull request #67656 from MewPurPur/instance🧹
Fix minor mistakes throughout the documentation
2022-10-21 18:19:32 +02:00
Micky
9a1d87f66f Fix unordered values of PROPERTY_HINT_INT_IS_POINTER & ARRAY_TYPE 2022-10-21 01:10:38 +02:00
VolTer
05a9637d5d Fix small mistakes throughout much of the documentation 2022-10-21 00:20:59 +02:00
Max Hilbrunner
e6311c8e5e
Merge pull request #67001 from KoBeWi/🎲
Fill random docs
2022-10-19 21:58:03 +02:00
Max Hilbrunner
431012e148
Merge pull request #67208 from Mickeon/doc-peeves-the-peevening
Tweak `@GlobalScope` functions documentation overall
2022-10-19 21:12:38 +02:00
Micky
34804a68e8 Rewrite most of Resource's documentation 2022-10-18 21:03:29 +02:00
Micky
474edca100 Tweak @GlobalScope functions documentation overall
Generally:
- Made use of [param] more frequently;
- Link to other classes' documentation more often;
- Improve and add more examples;
- Ensure that multiple comments of an codeblock example are spaced out equally for better readability;
- Made the writing style closer to how the rest of the documentation is formatted;
- Ensure these are called "functions", not "methods".
- Fixed a few typos.
- Touched up a few cases of zero being written as "zero" or "0" where "0" or "0.0" would be more appropriate.
- Removed mentions of "(real)". In 3.x, this was associated with floats, because TYPE_FLOAT was called TYPE_REAL.

More specifically:
- Every type-safe version of a function (such as `ceili` has a consistent final note ("A type-safe version of [method ceil], returning a [int]").
- Added more details to `randomize`, `seed`.
- Corrected `floori()`'s description. It's not the same as `int()`. This was not correct behavior and has been fixed.
2022-10-18 15:36:18 +02:00
Rémi Verschelde
58eff50bf1 Merge pull request #64268 from timothyqiu/is-finite
Add `is_finite` method for checking built-in types
2022-10-11 09:25:46 +02:00
Haoyu Qiu
5da515773d Add is_finite method for checking built-in types 2022-10-08 13:25:08 +08:00
Haoyu Qiu
344ed9ec6c Remove leading spaces from enumerator name hints
For `PROPERTY_HINT_ENUM` properties, enumerator names can be provided as
a comma separated list. There're a few properties that add leading
spaces to the names (e.g. `First, Second, Third`).

These spaces are included in the Inspector dropdown, which is
unexpected.

It's better to leave the surrounding spaces untouched because it could
be part of the resulting string value (the variable is a string enum).
And most other enum hints don't contain surrounding whitespaces.

This PR removes the spaces and documents this `PROPERTY_HINT_ENUM`
behavior.
2022-10-08 11:33:50 +08:00
kobewi
1b7aee3c8d Fill random docs 2022-10-07 20:10:18 +02:00
Rémi Verschelde
9cd62741bb Merge pull request #66839 from aaronfranke/editor-prop-hide-slider
Fix `hide_slider` vs `no_slider` inconsistency in editor property code
2022-10-05 08:47:06 +02:00
Haoyu Qiu
f6e9565bdc Describe the left mouse button constant as the primary button 2022-10-05 10:32:04 +08:00
Aaron Franke
094e8db97c
Fix hide_slider vs no_slider inconsistency in editor property code 2022-10-03 13:40:31 -05:00
Marc Gilleron
856466ed02 Expose PROPERTY_USAGE_READ_ONLY 2022-09-28 22:50:55 +01:00
bruvzg
6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Ricardo Buring
532e378cd9 Expose registration of physics servers to GDExtension
This exposes PhysicsServer2DManager and PhysicsServer3DManager.
2022-09-07 15:05:46 +02:00
Fabio Alessandrelli
fffdbb38e3
Merge pull request #65239 from Geequlim/js2web
Rename JavaScript singleton to JavaScriptBridge
2022-09-07 09:29:42 +02:00
Micky
b6daad8d4b Rename range_lerp to remap 2022-09-06 07:19:20 +02:00
Hugo Locurcio
f7292dbeb3
Rename or_lesser range property hint to or_less
"less" should be used for quantity, rather than "lesser".

Existing scripts that use `or_lesser` in `_get_property_list()`
will need to be updated to account for this change.
2022-09-02 19:08:20 +02:00
Geequlim
48f9069f3a Rename JavaScript singleton to JavaScriptBridge 2022-09-02 21:11:15 +08:00
Rémi Verschelde
e60086f98b
Merge pull request #64119 from YuriSizov/theme-init-database 2022-08-29 14:02:21 +02:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Silc Renew
931fb4dc11 Add linear/cubic angle interpolation to Animation interpolation type 2022-08-27 07:58:22 +09:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Yuri Sizov
6320a0fc18 Add ThemeDB, expose previously static Theme methods 2022-08-26 19:23:05 +03:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
bruvzg
d91cb1d5d5
[macOS export] Simplify code signing options, add support for rcodesign tool for signing and notarization. 2022-08-26 14:23:31 +03:00
Rémi Verschelde
2961651444
Merge pull request #64691 from TokageItLab/Quaternion-editor 2022-08-24 18:36:54 +02:00
Silc Renew
673c649adb Implement Quaternion Editor 2022-08-24 22:04:49 +09:00
Rémi Verschelde
b1f392c25e Remove VisualScript module for 4.0
As announced in https://godotengine.org/article/godot-4-will-discontinue-visual-scripting,
Godot maintainers have agreed to discontinue the current implementation of
our VisualScript language.

The way it had been designed was not user-friendly enough and we did not
succeed in improving its usability to actually make it a good low-code
solution for users who need one.

So we prefer to remove it for Godot 4.0 and leave the door open for new,
innovative ideas around visual scripting, to be developed as plugins or
extensions now that Godot provides sufficient functionality for this
(notably via GDExtension and the godot-cpp C++ bindings).

The current module has been moved to a dedicated repository (with full Git
history extracted with `git filter-branch`):

https://github.com/godotengine/godot-visual-script

It can still be compiled as a C++ module (for now, but will likely require
work to be kept in sync with the engine repository), but our hope is that
contributors will port it to GDExtension (which is quite compatibile with
the existing C++ module code when using the godot-cpp C++ bindings).
2022-08-24 12:08:17 +02:00
Rémi Verschelde
944bfc6d00
Merge pull request #63602 from TokageItLab/cubic-interp-time 2022-08-22 17:32:47 +02:00
Yuri Sizov
a0995182fe Add documentation for all annotations 2022-08-19 15:06:39 +03:00
Silc Renew
dded7c72c1 Make cubic_interpolate() consider key time in animation 2022-08-19 14:48:37 +09:00
Andy Maloney
9b345e793a [doc] Use "param" instead of "code" to refer to parameters (8) 2022-08-12 14:00:25 -04:00
Yuri Sizov
c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Raul Santos
87a1bca37b
Fix typo in weakref documentation 2022-08-07 20:35:56 +02:00
Rémi Verschelde
e6e13c8251
Merge pull request #63361 from KoBeWi/floorf_lol 2022-08-06 22:25:27 +02:00
kobewi
ae3d83b17b Restore old lerp() behavior and add lerpf() 2022-08-06 21:15:37 +02:00
Hugo Locurcio
bd19c9a95c
Improve range_lerp() and related methods documentation 2022-08-05 12:23:23 +02:00
RedMser
ae2ebfbc49 Add ResourceUID documentation 2022-08-03 19:59:11 +02:00
kobewi
fdf7441015 Split ceil(), floor() and round() method 2022-07-27 16:58:56 +02:00
Fabio Alessandrelli
ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
reduz
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
reduz
67a260d63f Implement a Worker ThreadPool
This PR implements a worked thread pool. It uses a fixed amount of threads in a pool and allows scheduling tasks
that can be run on threads (and then waited for). It satisfies the following use cases:

* HTML5 thread count is fixed (and similar restrictions are known in consoles) so we need to reuse threads.
* Thread spawning is slow in general, so reusing threads is faster anyway.
* This implementation supports recursive waiting for tasks, making it less prone to deadlocks if threads from the pool also run tasks.

After this is approved and merged, subsequent PRs will be needed to replace the ThreadWorkPool usage by this class.
2022-07-22 11:46:48 +02:00
bruvzg
cbe3a2dcb7
Use BitField hint for the TextServer enums. Add missing parts for BitField support to the GDextension API. 2022-07-15 08:49:50 +03:00
kobewi
2f777b9a1e Remove unused hints 2022-07-12 00:44:13 +02:00
Voylin
c6291bcd8a Adding print_rich for printing with BBCode 2022-06-29 00:41:29 +09:00
Rémi Verschelde
b863c40356
Merge pull request #62468 from V-Sekai/core-const-expressions
Add a const call mode to Object, Variant and Script.
2022-06-28 01:08:24 +02:00
Rémi Verschelde
8fd0b4d1f8
Merge pull request #62449 from Chaosus/wrap_func
Add generalized version of `wrap` function
2022-06-27 23:28:37 +02:00
K. S. Ernest (iFire) Lee
9ddebc0c22 Add a const call mode to Object, Variant and Script.
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script).

This mode ensures only const functions can be called, making it safe to use from the editor.

Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-27 13:33:06 -07:00
Hendrik Brucker
99ce0df3b1 Refactor bezier interpolation functions 2022-06-27 19:42:43 +02:00
Yuri Rubinsky
2476c50a66 Add generalized version of wrap function 2022-06-27 16:11:21 +03:00
Rémi Verschelde
fbc3777467
Merge pull request #62185 from reduz/export-node-pointer-path
Add ability to export Node pointers as NodePaths
2022-06-27 11:14:36 +02:00
reduz
b7c41f9ba1 Add ability to export Node pointers as NodePaths
This PR implements:
* A new hint: PROPERTY_HINT_NODE_TYPE for variant type OBJECT, which can take specific node types as hint string.
* The editor will show it as a node path, but will set it as a pointer to a node from the current scene if you select a path.
* When scene is saved, the node path is saved, then restored as a pointer.

NOTE: This is a proof of concept and this approach will most likely not work. The reason if that, if the node referenced is deleted, then when trying to edit this the node will become invalid.

Potential workarounds: Since this uses the Variant API, it should obtain the pointer from the Variant object ID. Yet, this would either only really work in GDScript or it would need to be implemented with workarounds in every language.
Alternative ways to make this work: Nodes could export an additional property with a node path (like for which_node, it could be which_node_path).
Another alternative: Path editing could happen as a hidden metadata (ignoring the pointer).
2022-06-25 15:50:15 +02:00
Marcus Elg
6c1ac9f3be Rename export_range's noslider option to no_slider 2022-06-24 10:45:34 +02:00
Rémi Verschelde
40c360b870
Merge pull request #62122 from reduz/implement-movie-writer
Implement a Movie Maker mode
2022-06-21 14:24:14 +02:00
reduz
5786516d4d Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.

This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).

**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).

Usage:

$ godot --write-movie movie.avi [scene_file.tscn]

Missing:

* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
2022-06-21 11:28:47 +02:00
Rémi Verschelde
4463dd9d89
Merge pull request #62132 from timothyqiu/doc-fixes 2022-06-17 15:51:25 +02:00
Haoyu Qiu
27dabe1a6d Classref typo fixes and improvements 2022-06-17 15:15:30 +08:00
gregcsokas
42e619c01e Adding function key support from F17 to F35
OSX supports everything by default,
Linux is also capable of supporting every function key,
Windows as I know support only up to F24
2022-06-16 19:38:21 +02:00
kobewi
5553e27fe8 Add vector value linking
Co-authored-by: redlamp <244062+redlamp@users.noreply.github.com>
2022-06-14 14:58:44 +02:00
sps1112
1f361b0367 Bind vararg method flag in core constants 2022-06-07 17:06:34 +02:00
Nathan Franke
f464caf214
finish renaming AUTH to AUTHORITY 2022-05-25 14:31:46 -05:00
Yuri Roubinsky
dbd7a31507 Implement exponential operator (**) to GDScript/Expressions 2022-05-11 16:30:37 +03:00
Haoyu Qiu
492903a0b2 Document lerp_angle behavior when angles are approximately PI apart 2022-04-30 19:02:21 +08:00
Rémi Verschelde
1de51133c9
Merge pull request #60331 from KoBeWi/tween_static() 2022-04-27 13:20:11 +02:00
bruvzg
de4c97758a
Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
kobewi
3017530e26 Make Tween.interpolate_value() static 2022-04-17 23:13:39 +02:00
Haoyu Qiu
2fa3c65d30 Improves EditorInspector documentation 2022-04-12 12:08:24 +08:00
Haoyu Qiu
405bc96a1e Document how to specify explicit value for PROPERTY_HINT_ENUM names 2022-03-23 17:05:49 +08:00
Rémi Verschelde
952b71a425
Merge pull request #58751 from bruvzg/loc_str_props 2022-03-11 10:45:02 +01:00
Rémi Verschelde
4e3d5a9a2c VariantUtility: Unexpose Math::range_step_decimals
This method was meant only as a convenience for editor code
to allow using a step of 0 to disable snapping.

It was exposed by mistake when refactoring GlobalScope.
2022-03-07 22:13:49 +01:00
Rémi Verschelde
a51f724b8b
Merge pull request #57812 from piiertho/bugfix/add-none-enum-global-constants 2022-03-07 10:23:25 +01:00
Pierre-Thomas Meisels
a41fb2fa3c bugfix: bind core enums' none values 2022-03-07 09:16:25 +01:00
bruvzg
12cb6386f6
Improve app name and system permission message localization.
Add localizable string (Dictionary<Lang Code, String>) property editor and property hint.
Add localized "app name" property to the project settings.
Add localized permission and copyright properties to the macOS and iOS export settings.
Remove some duplicated ("app name") and deprecated ("info") macOS and iOS export properties.
2022-03-04 18:11:31 +02:00
Yuri Sizov
3ac4b42059 Fix a typo in PROPERTY_HINT_ENUM_SUGGESTION description 2022-02-17 15:31:16 +03:00
Hugo Locurcio
b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
Silc 'Tokage' Renew
865da09871 Implement cubic_interpolate() as MathFunc for refactoring 2022-02-12 18:11:17 +09:00
bruvzg
b801742b77
[GDExtension] Add binds for missing methods, operators, and constants required for GDExtension TextServer implementation. 2022-02-08 09:49:14 +02:00
bruvzg
40c56ed410
Improve locale detection.
Use separate language, script and country lists.
Add locale selection dialog and property hint.
2022-01-18 14:30:00 +02:00
bruvzg
61ea8f8337
Add joystick button index boundary check. Increase max. button number to 128 (max. buttons supported by DirectInput). 2022-01-10 14:39:05 +02:00
Rémi Verschelde
8d83da5bf9
Merge pull request #56224 from Calinou/variant-rename-packed-array-constants 2022-01-06 17:08:36 +01:00