Commit graph

584 commits

Author SHA1 Message Date
Bastiaan Olij ae7675065a Only unload the library when no NativeScript objects exist if the reloadable flag is true. If it is false it is likely the library does other things and can't be unloaded 2021-02-14 15:47:49 +11:00
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
Henry Conklin 6575e4c1ba Fix broken gdnative variant test 2021-02-11 07:14:28 -06:00
Rémi Verschelde 94cba993bf
Merge pull request #45847 from vnen/gdnative-bindings
Improve GDNative API and JSON generation further
2021-02-11 11:11:29 +01: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
George Marques 0b3819d213
Improve GDNative api.json generator
- Add indexed type to the builtin types output, which is useful for
  bindings implementing array-like access.
- Use getter type instead of hint for property types, as the hint can be
  unreliable and include multiple comma-separated possible types.
2021-02-09 11:37:15 -03:00
George Marques 66ed69edb3
Further changes to GDNative API
- Moved Variant struct definition to its own file so it can be used
  without include cycles (like on Dictionary).
- Add `index` operator function so bindings like C++ can implement the
  operator[] overload (which needs a reference to the actual value).
- Added missing new/destroy functions to Vector3i array.
- Added print error/warning functions as helpers so bindings can print
  messages in the same manner as Godot itself does.
2021-02-09 11:33:35 -03:00
Rafał Mikrut f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Miguel de Icaza f02252e37d C conformance: Include stdbool.h to define bool
`bool` is otherwise not defined in C.
2021-02-02 18:11:00 +01:00
Rémi Verschelde 5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
George Marques 8a8dbd76b1
Add GDNative JSON generator for the builtin API
Which can be used by language bindings to generate code statically. This
is generated as a different file from the class API because it has
different requirements (the builtin types have constructors and don't
have signals), so bindings can better make use of each JSON file without
extra parsing.

This also cleans up a bit the old API generator, mainly initializing
structs and renaming "instanciable" to the more correct "instantiable".

The argument description in help text was updated to better reflect how
it should be used. The <path> argument is mandatory.
2021-01-29 11:40:37 -03:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
George Marques fa498f6105
Merge pull request #45373 from aaronfranke/gdnative-sizeof
Define GDNative sizes using sizeof(godot_real) and sizeof(int32_t)
2021-01-26 14:00:32 -03:00
Rémi Verschelde f7dd6975fb
Merge pull request #44617 from geekrelief/gdnative_unload
free library when no nativescripts reference it
2021-01-26 15:52:33 +01:00
Aaron Franke 6c197cf259
Define GDNative sizes using sizeof(godot_real_t) and sizeof(int32_t) 2021-01-25 16:42:14 -05:00
George Marques 29e5dd06c7
GDNative: Remove print functions
Those are now utilities so the function pointer can be fetched when
needed.
2021-01-25 09:28:32 -03:00
George Marques 030d1d6a17
GDNative: New core API
This API now uses the discovery functions present in Variant instead of
wrapping every built-in function. Users now need to query for function
pointers and use those.
2021-01-25 09:28:02 -03:00
zero13cool 9f3d7d9709 Changed type to make it work on x32 architecture. 2021-01-05 01:44:52 +00: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
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
Marcel Admiraal b628912af0 Rename Rect2 and Rect2i grow_margin() to grow_side() 2020-12-28 12:47:33 +00:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
geekrelief cc5d8bb5ad Removes the gdnative library when no script (gdns) references it any longer. This enables hot reload for gdnative. 2020-12-23 06:36:01 -08:00
Marcel Admiraal 4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Marcel Admiraal fdf92ca298 Rename XRPositionalTracker methods
Renames:
- set_type() -> set_tracker_type()
- set_name() -> set_tracker_name()
- get_tracks_orientation() - `is_tracking_orientation()
- get_tracks_position() -> `is_tracking_position()
- get_hand() -> get_tracker_hand()
- set_hand() -> set_tracker_hand()
2020-12-21 06:32:53 +00:00
Rémi Verschelde bccbd4be90
Merge pull request #44261 from madmiraal/rename-trackerhand-enums
Rename TrackerHand enums
2020-12-21 00:26:44 +01:00
Marcel Admiraal 2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00
Marcel Admiraal 8509c8c8fc Rename AcceptDialog get_ok() to get_ok_button()
Also renames:
- AcceptDialog add_cancel() to add_cancel_button()
- ConfirmationDiaglog get_cancel() to get_cancel_button()
2020-12-14 18:43:52 +00:00
bruvzg c1d261fdb0
[Complex Text Layouts] Add variable fonts support. 2020-12-13 18:43:39 +02:00
Marcel Admiraal e40ab06599 Rename TrackerHand enums
Renames:
TRACKER_LEFT_HAND -> TRACKER_HAND_LEFT
TRACKER_RIGHT_HAND -> TRACKER_HAND_RIGHT
2020-12-10 10:30:45 +00:00
Rémi Verschelde edb3686ee2
Merge pull request #44190 from touilleMan/constify-ScriptLanguage.can_inherit_from_file
Constify ScriptLanguage.can_inherit_from_file
2020-12-08 13:59:46 +01:00
Rémi Verschelde 360cfeedac
Merge pull request #44176 from touilleMan/global_class_naming-for-pluginscript
Add PluginScript support for global class naming/icon path
2020-12-08 13:51:06 +01:00
Emmanuel Leblond c4c18a2c58
Add PluginScript support for global class naming/icon path 2020-12-08 13:17:22 +01:00
Emmanuel Leblond a211812932
Constify ScriptLanguage.can_inherit_from_file 2020-12-08 13:06:15 +01:00
Emmanuel Leblond 014efeb272
Allow PluginScript to customize language's can_inherit_from_file attribute 2020-12-08 00:56:01 +01:00
Rémi Verschelde e20011b0da
Merge pull request #44076 from Faless/js/4.x_gdnative
[HTML5] Optional GDNative Support
2020-12-07 15:34:33 +01:00
Marcel Admiraal a24c38d1a8 Rename Vector2.tangent() to Vector2.orthogonal() 2020-12-06 18:16:06 +00:00
Fabio Alessandrelli dd9503dc19 [HTML5] Make GDNative support feature-based.
This is suboptimal as it requires adding an extra compile flag, but
rewriting how feature tags work is beyond the scope of this work.
2020-12-05 01:12:52 +01:00
Fabio Alessandrelli ca34b5e57a [HTML5] GDNative support via SIDE_MODULE.
Working with emscripten >= 2.0.10
2020-12-05 00:52:43 +01:00
George Marques 02f60812ed
Rename TYPE_REAL to TYPE_FLOAT
To be consistent with the naming everywhere else.
2020-12-04 09:47:26 -03:00
Thakee Nathees 42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
Thakee Nathees d0e7d9b62f Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
2020-11-29 19:45:36 +05:30
bruvzg 07d14f5bb8
[Complex Text Layouts] Implement GDNative interface for TextServer. 2020-11-26 13:55:29 +02:00
Rémi Verschelde d76806d322
Core: Always enable ptrcall, remove PTRCALL_ENABLED define
ptrcall is now also used to optimize calls in GDScript, on top of the existing
use by the GDNative and Mono modules.

It no longer makes sense to make it optional.
2020-11-25 14:08:17 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
reduz 635d33dc6c Refactor variant built-in methods yet again.
* Using C-style function pointers now, InternalMethod is gone.
* This ensures much better performance in typed code.
* Renamed builtin_funcs to utility_funcs, to avoid naming confusion
2020-11-11 16:36:36 -03:00
Fabio Alessandrelli 05261cceaf Fix gdnative build when WebRTC module is disabled. 2020-11-10 11:42:51 +01:00
Rémi Verschelde b51dca64a6
Merge pull request #43383 from vnen/gdnative-string-header
GDNative: Define special char types in string.h
2020-11-10 09:40:26 +01: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
George Marques 82576371ef
GDNative: Define special char types in string.h
Those are standard types in C++ but not in C.

This also removes the wchar header which is not needed anymore and use
stddef.h instead (which is needed for size_t).
2020-11-07 16:09:14 -03:00