Commit graph

4056 commits

Author SHA1 Message Date
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
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
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
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
Gilles Roudière
30a615dd94 Implement painting properties over TileSets 2021-06-29 11:07:46 +02:00
Paweł Fertyk
3dae9993ac Validate image formats, check if resize_to_po2 failed 2021-06-28 21:17:06 +02:00
Haoyu Qiu
0b7ffd4f68 Fix Image.adjust_bcs crash when image format is invalid 2021-06-27 20:52:42 +08:00
reduz
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
Rémi Verschelde
f1bcc641dd
Merge pull request #49583 from timothyqiu/texture-crash
Fix crash when freeing GradientTexture and NoiseTexture
2021-06-24 09:40:42 +02:00
Fabio Alessandrelli
b00c4a4360 [Net] Makes HTTPClient a custom instance class. 2021-06-23 14:10:45 +02:00
Fabio Alessandrelli
421e771012 [Net] Unify HTTPClient request and request_raw. 2021-06-23 13:53:43 +02:00
Eric M
f96d9f5ae1 Improved some error messages (from ERR_FAIL_*) in Object. 2021-06-21 20:20:59 +10:00
Aaron Franke
0ce49800ac
Use mouse and joypad enums instead of plain integers
Also MIDIMessage
2021-06-20 11:54:24 -04:00
Aaron Franke
e919d894f8
Move many input enums to their own file 2021-06-20 11:53:01 -04:00
Rémi Verschelde
cca29b78b9
Merge pull request #48359 from Calinou/add-engine-print-error-property 2021-06-20 13:22:08 +02:00
Lightning_A
e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde
9b7c963d19
Merge pull request #48804 from EricEzaM/scripting-multi-error-support
Added support for scripts reporting multiple errors to ScriptTextEditor
2021-06-20 00:38:49 +02:00
Rémi Verschelde
bbf6d645fb
Merge pull request #48080 from aaronfranke/real-serialization
Binary serialization for reals
2021-06-20 00:33:30 +02:00
Rémi Verschelde
4effadc0ba
Merge pull request #48696 from madmiraal/fix-48692
Fix `InputMap.action_erase_event()` failing to erase events correctly.
2021-06-20 00:29:42 +02:00
Rémi Verschelde
d88be9b70c
Merge pull request #44806 from madmiraal/consolidate_json
Consolidate JSON, JSONParseResults and JSONParser into JSON
2021-06-19 21:45:34 +02:00
Eric M
d0e78c86d7 Added support for scripts reporting multiple errors to ScriptTextEditor
Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
2021-06-19 22:20:30 +10:00
Marcel Admiraal
2bafcd3422 Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse()
Renames JSON.decode_data() to stringify()
2021-06-19 08:01:40 +01:00
Hugo Locurcio
aa0976f47c
Expose OS data directory getter methods
This can be used by editor plugins and non-game applications to
store data in the correct directories according to the
XDG Base Directory specification.
2021-06-19 08:56:20 +02:00
Rémi Verschelde
a9c53fa599
Merge pull request #49287 from reduz/expose-variant-internal-binders
Make some Variant internal functions public.
2021-06-19 01:11:03 +02:00
Rémi Verschelde
92f20fd70e
Merge pull request #49659 from LightningAA/string-valid-integer-to-int 2021-06-18 16:14:14 +02:00
Rémi Verschelde
7aebb8f81c
Merge pull request #44156 from aaronfranke/quat-angle-to
Add Quaternion angle_to method
2021-06-18 12:35:58 +02:00
Rémi Verschelde
3fc39954ec
Merge pull request #49638 from aaronfranke/multiply-transforms
Allow multiplying Transforms and Basis by numbers
2021-06-18 12:35:14 +02:00
Rémi Verschelde
f6756e2bf5
Merge pull request #49698 from aaronfranke/prop-no-usage
Add PROPERTY_USAGE_NONE and use it
2021-06-18 12:28:05 +02:00
Aaron Franke
93b494d4ae
Add Quaternion angle_to method 2021-06-17 23:57:00 -04:00
Aaron Franke
29706651fe
Binary serialization for reals
Added new "encode_real" methods for handling real_t, and used them for vector types. Types are encoded based on compilation setting.

But for decoding, always check how it was encoded. This way, serialized data is cross-compatible with Godot compiled with singles and Godot compiled with doubles. At least, in theory.
2021-06-17 23:15:34 -04:00