Commit graph

4084 commits

Author SHA1 Message Date
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Fabio Alessandrelli 5717118bcc [HTML5] Add 2 controllers to the godot database.
Sony PlayStation DualShock 4 (054c:05c4 first gen).
Unofficial Switch controller.
2021-07-17 23:51:48 +02:00
Fabio Alessandrelli 0e265b047e
Merge pull request #46554 from likeich/is_server_quiet_failure
MultiplayerAPI is_network_server Fails Silently
2021-07-16 20:04:41 +02:00
Hugo Locurcio 523d6b2ae8
Merge pull request #47395 from sygi/shape_idx_collision
Add shape_idx to CollisionObject2D mouse_entered signal
2021-07-16 19:05:08 +02:00
reduz b5d5d13f56 Add ability to set object instance binding on creation
* Required by binding generators
* Makes it easier to create the bindings on construction.
2021-07-15 11:41:57 -03:00
Joan Fons cfec291978 Fix equality operators in List's ConstIterator 2021-07-15 10:47:20 +02:00
Rémi Verschelde 06568bbfdf
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
2021-07-15 00:46:43 +02:00
George Marques 7bc52e56c0
Merge pull request #50056 from Blackiris/fix-in-operator
Fix 'in' operator to check if an object member exists
2021-07-13 14:25:42 -03:00
Rémi Verschelde 8747f25653
Merge pull request #50381 from reduz/implement-disable-classes
Implement the ability to disable classes
2021-07-13 15:31:38 +02:00
Rémi Verschelde b44b277f6f
Merge pull request #50169 from pycbouh/theme-type-variations 2021-07-13 15:13:00 +02:00
reduz 5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Rémi Verschelde dd27413907
Merge pull request #50412 from timothyqiu/fastlz-decompress 2021-07-13 12:12:46 +02:00
Faymoon 78ead60372
Let thread func have optional parameter
Fixes #38042.
2021-07-13 10:44:53 +02:00
Haoyu Qiu ccf292df38 Fix decompression with FastLZ when buffer size is less than 16 bytes 2021-07-13 16:34:45 +08:00
Rémi Verschelde e2b79e9591
Merge pull request #49291 from NoFr1ends/fix-49262
String::format leave passed values untouched
2021-07-13 09:33:46 +02:00
Rémi Verschelde a766661f6a
Merge pull request #50304 from timothyqiu/memfree-param
Fix memfree parameter name
2021-07-13 08:29:47 +02:00
Yuri Sizov 4ee0e6ddf5 Add type variations to Theme 2021-07-13 02:26:28 +03:00
Fabio Alessandrelli 88d68346ee [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer. 2021-07-12 16:36:34 +02:00
Hendrik Brucker 74ab336fe3 Change VSync mode project setting enum type from string to integer 2021-07-12 03:35:51 +02:00
Fabio Alessandrelli d3ba0aa3e0 [Net] Fix crash when receiving RPC on node without a script. 2021-07-11 10:18:32 +02:00
Rémi Verschelde a0d800e967
Merge pull request #50362 from timothyqiu/http-eof
Fix unicode invalid skip error in AssetLib
2021-07-11 09:33:51 +02:00
Haoyu Qiu 0caaaf4018 Fix unicode invalid skip error in AssetLib 2021-07-11 12:14:08 +08:00
Haoyu Qiu 293050a919 Handle Z_BUF_ERROR in decompress_dynamic 2021-07-11 11:05:12 +08:00
Hugo Locurcio a2d5f191d8
Merge pull request #48622 from Geometror/reimplement-disableable-vsync 2021-07-10 01:02:23 +02:00
Rémi Verschelde ca2fda629f
Merge pull request #50290 from reduz/redo-instance-bindings
Redo how instance bindings work
2021-07-09 23:25:33 +02:00
Haoyu Qiu 542d7d6460 Fix memfree parameter name 2021-07-09 14:41:00 +08:00
reduz a9c943bef9 Implement Range Iterators
This PR implements range iterators in the base containers (Vector, Map, List, Pair Set).
Given several of these data structures will be replaced by more efficient versions, having a common iterator API will make this simpler.
Iterating can be done as follows (examples):

```C++
//Vector<String>
for(const String& I: vector) {

}
//List<String>
for(const String& I: list) {

}
//Map<String,int>
for(const KeyValue<String,int>&I : map) {
	print_line("key: "+I.key+" value: "+itos(I.value));

}

//if intending to write the elements, reference can be used

//Map<String,int>
for(KeyValue<String,int>& I: map) {
	I.value = 25;
	//this will fail because key is always const
	//I.key = "hello"
}

```

The containers are (for now) not STL compatible, since this would mean changing how they work internally (STL uses a special head/tail allocation for end(), while Godot Map/Set/List do not).
The idea is to change the Godot versions to be more compatible with STL, but this will happen after conversion to new iterators have taken place.
2021-07-08 23:27:27 -03:00
reduz 4469144891 Redo how instance bindings work
* The harcoded 8 slots are no more and impose limits in the new extension system.
* New system is limitless, although it will impose small performance hit with a mutex.
* Use a token to request the instance binding.

**Warning**: Mono will most likely break as a result of this, will need to be modified to use the new system.
2021-07-08 17:08:12 -03:00
reduz c43f624d44 Unify material parameter update
* Unifies how material parameters are updated.
* Single function, easier to maintain.
* Updates materials properly when textures change.
2021-07-06 18:57:38 -03:00
Hendrik Brucker 043ae91560 Restructure and reimplement vsync options
-Add a v-sync mode setting which allows to choose between DISABLED, ON, ADAPTIVE and MAILBOX
-Removed the V-Sync via Compositor option
2021-07-06 16:34:26 +02:00
Eric M c2ba7464b6 Added EditorInspectorPlugin to aid in editing InputEvents in resources and shortcuts 2021-07-06 23:50:33 +10:00
bruvzg eca4d2fccc Fix Variant tags parsing. 2021-07-05 15:46:41 +03:00
Fabio Alessandrelli a28d25c441 [Crypto] Delete mbedtls ctx in deconstructor.
Would cause memory leak when the context was `start`ed but not
`finish`ed.
2021-07-03 16:12:55 +02:00
sygi 6f3e7f7cb0 Add mouse_shape_entered and mouse_shape_exited signals to CollisionObject2D.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-02 20:50:27 +01:00
Nick H c6f28ed62b Add get_dead_zone() method to InputMap
This commit adds a new method to the `InputMap`, allowing the user to get the value of an action's dead zone as a float.
2021-07-02 03:07:37 -04:00
Rémi Verschelde 97e041e285
Merge pull request #50057 from reduz/force-string-in-dictionary
Force String as Dictionary key instead of StringName
2021-07-01 22:22:47 +02:00
reduz 379b90fd33 Force String as Dictionary key instead of StringName
* Lua table syntax uses named indexing: `{ mykey = myvalue }`
* Python style syntax uses string indexing: `{ "mykey" : myvalue }`
* Both are incompatible since a StringName key wont fetch a String key, hence confusing.
* This PR proposes always using String for indexing at a very minimal performance cost. Always indexing with StringNames will be faster, but they are considerably more expensive to create.
2021-07-01 16:03:37 -03:00
Julien Nguyen 0a823e85d2 Fix 'in' operator to check if an object member exists 2021-07-01 20:59:26 +02:00
Aaron Franke 2508fd0533
Use PROPERTY_USAGE_NONE instead of 0 for no property usage
Also use const more often.
2021-07-01 14:13:27 -04:00
Rémi Verschelde 9f30638d4b
Merge pull request #50044 from akien-mga/localvector-find-noerror
LocalVector: Don't error if `from` >= `count`
2021-07-01 13:13:27 +02:00
Rémi Verschelde 230a24a49d
Merge pull request #50026 from lyuma/callable_is_valid
Add Callable.is_valid() analogous to FuncRef.is_valid() from 3.x
2021-07-01 12:57:14 +02:00
Rémi Verschelde 7b7ccf25b6
LocalVector: Don't error if from >= count
Vector handles this silently by returning -1, and we should do the same here.
Otherwise we get errors when calling `find()` on e.g. a LocalVector of size 0,
while `find()` is expected to always work (if the parameters are invalid then
it doesn't find anything, so -1).

Fixup to #49925.
2021-07-01 12:16:33 +02:00
Lyuma 8f1efa656b Add Callable.is_valid() analogous to FuncRef.is_valid() from 3.x 2021-07-01 02:54:01 -07:00
Rémi Verschelde 3f12d0a883
Merge pull request #50018 from fire/port-false
Network port comparison is always false
2021-07-01 09:42:34 +02:00
reduz 75688772b3 Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:

* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 12:38:25 -03:00
K. S. Ernest (iFire) Lee c1d9170194 Network port comparison is always false
error: comparison is always false due to limited range of data type [-Werror=type-limits]
  ERR_FAIL_COND_V_MSG(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER, "The local port number must be between 0 and 65535 (inclusive).");
2021-06-30 02:39:17 -07:00
reduz 64c925cca6 Improve RID_Owner memory usage
* Ability to allocate empty objects in RID_Owner, so RID_PtrOwner is not needed in most cases.
* Improves cache usage, as objects are now allocated together
* Should improve performance in 2D rendering
2021-06-29 12:28:08 -03:00
Rémi Verschelde 7f9346b81b
Merge pull request #49925 from RicardRC/FindFromNop
Make use of variable "from" in local_vector find() function.
2021-06-29 14:36:19 +02:00
Ricard Rovira 14d5908057 Use unused from in local vector find function. 2021-06-29 13:37:02 +02:00
Rémi Verschelde 05336adb86
Merge pull request #49905 from pfertyk/issue-46480-image-compress-crashes-godot
Validate image formats, check if resize_to_po2 failed
2021-06-29 12:44:20 +02:00