Commit graph

2125 commits

Author SHA1 Message Date
Rémi Verschelde a2acbb0bfb
Merge pull request #21167 from elasota/squish-quality-config
Support higher-quality S3TC compression modes
2018-08-23 08:58:44 +02:00
Daniel Eliasinski fb3506d796 Fixed bugs in expression class 2018-08-23 01:29:24 -04:00
Ignacio Etcheverry 908a30964a Notify instance binding data api of refcount increment/decrement 2018-08-23 01:38:48 +02:00
Juan Linietsky 9c69671611 get rid of default template function arguments, works on cxx03 2018-08-22 17:57:09 -03:00
Juan Linietsky 3fd2fc1e01 Make sure resizing of float and half float images works, fixes #21157 2018-08-22 16:40:43 -03:00
Aaron Franke 434973fb83 [Mono] Vector2/3 Project methods 2018-08-22 13:27:35 -04:00
elasota 4cd866685e Use cluster fit at higher quality levels 2018-08-22 12:05:25 -04:00
elasota 35f6ba5c5d BPTC support 2018-08-21 22:56:04 -04:00
Rémi Verschelde 4bf15d8090
Merge pull request #21236 from dragmz/windows-graceful-close
Try closing gracefully before terminating process
2018-08-21 22:47:21 +02:00
Rémi Verschelde 65c8a49122
Merge pull request #21250 from dragmz/ref-ptr-n(eq)-op
== and != operators for Ref<T> / T*
2018-08-21 21:28:29 +02:00
Rémi Verschelde a319d72071
Merge pull request #21253 from aaronfranke/plane-constants
Rename Plane constants, add to Mono
2018-08-21 21:16:41 +02:00
Rémi Verschelde 28e9aedbdd
Merge pull request #21267 from akien-mga/color-grayscale
Deprecate incorrect Color::gray()
2018-08-21 20:29:56 +02:00
Andrea Catania c153489e25 Added comment to class_db to know how to bind more then 6 params 2018-08-21 18:51:08 +02:00
Rémi Verschelde 2969dffbe3 Deprecate incorrect Color::gray()
This average is not a proper approximation of a grayscale value,
get_v() is better suited for that.

If we want a real to_grayscale() conversion, it's somewhat more
involved: https://en.wikipedia.org/wiki/Grayscale

Remove the deprecated Gray() from C# bindings as it conflicts
with new named color constants.
2018-08-21 17:48:31 +02:00
Marcin Zawiejski a1d2fbdeb2 == and != operators for Ref<T> / T*
This is to prevent crashes for code like:

...
void Material::set_next_pass(const Ref<Material> &p_pass) {

	ERR_FAIL_COND(p_pass == this);
...

that's been fixed in 031f763d4f
2018-08-21 13:25:50 +02:00
Aaron Franke a986686ac4 Rename Plane constants, add to Mono
But I'm not tagging PR as [Core] or [Mono] due to it being a minor change anyway.
2018-08-21 01:35:07 -04:00
Rémi Verschelde f0b914fa68 Remove circle/diamond and NodePath String constants
They were introduced in #14704 but need more discussion IMO,
they don't strike me as core features that would have to be
registered in Variant directly.

Moreover, they currently break the documentation XML as string
constants end up encoded as e.g. `value=""..""`.
2018-08-21 00:23:35 +02:00
Rémi Verschelde 35d232b100
Merge pull request #21228 from Noshyaar/docs-bind
Fix arg name in docs, some copy-paste errors
2018-08-21 00:08:05 +02:00
Marcin Zawiejski ca1c851dbd Try closing gracefully before terminating process
Use a Microsoft recommended way of process termination for the project
process run from the editor. This allows loaded DLLs to receive and handle
DLL_PROCESS_DETACH notification and cleanup any global state before the
process actually exits.
2018-08-20 22:41:06 +02:00
Juan Linietsky 031f763d4f Crash fixes for material and animtree 2018-08-20 16:35:36 -03:00
Poommetee Ketson 76adef2704 Fix arg name in docs, some copy-paste errors 2018-08-21 01:51:19 +07:00
Juan Linietsky c7e4527a88 Massive rewrite to AnimationTree. Many APIs changed in order to:
-Reuse resources
-Expose properties in AnimationTree
2018-08-20 13:39:16 -03:00
Rémi Verschelde 661c9ece7c Add PROPERTY_HINT_PLACEHOLDER_TEXT for String properties
Use it to provide a better example for application identifiers
on Android, iOS and macOS, where users thought they *had* to use
this as a magic token.
2018-08-20 13:48:05 +02:00
Hein-Pieter van Braam 33669a8bca Remove faces in in QuickHull::build() that we don't need anymore
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes #16560 and fixes #17569
2018-08-20 00:22:47 +02:00
Thomas Herzog 037f4638ab add project method to Vector2/3 2018-08-16 12:52:38 +02:00
Rémi Verschelde 040c6be426
Merge pull request #20560 from willnationsdev/class_icons
Add custom icons to script classes.
2018-08-15 15:16:29 +02:00
Rémi Verschelde 4548ec4a49
Merge pull request #20945 from neikeq/dict-erase-retbool
Dictionary: remove erase_checked(key), make erase(key) return bool
2018-08-15 01:08:23 +02:00
Rémi Verschelde 5d86b1e155
Merge pull request #21008 from groud/fix_action_init
Fixes initialization of action list
2018-08-15 01:06:58 +02:00
Juan Linietsky 4e55835e48
Merge pull request #18096 from aaronfranke/master
[Core] Split up math_2d.h
2018-08-14 18:58:32 -03:00
Juan Linietsky ef5095720b -Deprecate ImageTexture::load
-Add warning to Image::load when loading resources
-Add script binding for get_configuration_warning
2018-08-14 16:53:20 -03:00
Will Nations 6d9cc032e7 Add custom icons to script classes. 2018-08-14 14:18:05 -05:00
Rémi Verschelde b4f579b5ba
Merge pull request #20583 from neikeq/issue-15371
Fix case where exported properties value is lost
2018-08-14 21:08:56 +02:00
Rémi Verschelde 66da2ca320
Merge pull request #20856 from KoBeWi/pretty-dictionary-print
Add some curly braces to make dictionary printing less ambiguous
2018-08-14 20:51:42 +02:00
Ignacio Etcheverry 21d285e30f Dictionary: remove erase_checked(key), make erase(key) return bool 2018-08-14 19:19:05 +02:00
groud 6ccf3d887c Fixes initialization of action list 2018-08-14 18:44:22 +02:00
Rémi Verschelde 7718b90d92
Merge pull request #20443 from AlexHolly/add-string-format-no-index
Added String.format "no index" support
2018-08-14 16:13:34 +02:00
Rémi Verschelde 9a6e4d10b4
Merge pull request #20772 from dragmz/string_copy_oob_read_fix
Fix out of buffer read when copying from a non-null-terminated string
2018-08-14 15:47:34 +02:00
Rémi Verschelde 240462e998
Merge pull request #20992 from Chaosus/conversion_fix
Fix int(String) != int(int) conversion
2018-08-14 15:31:10 +02:00
Rémi Verschelde f33a9db279
Merge pull request #20826 from raphael10241024/mybranch
fix #20390: handle time before year 1970
2018-08-14 09:59:05 +02:00
Chaosus 3b10bd1fa2 Fix int(String) != int(int) conversion 2018-08-14 10:56:10 +03:00
Rémi Verschelde 623529ce2f
Merge pull request #20778 from ibrahn/remove-zero-append-typos
removed some surplus null appends that got typoed in 0e29f7974b59e444…
2018-08-13 12:31:46 +02:00
RaphaelHunter 43825dce47 fix #20390 :get_unix_time_from_datetime and get_date_time_from_unix_time can handle time before year 1970 now 2018-08-13 15:37:27 +08:00
Rémi Verschelde d29ea4337f Fix ResourceLoader::exists() false negative and readd deprecated has() 2018-08-12 12:44:38 +02:00
Aaron Franke cf136a91d6 [Core] Completely kill math_2d.h, change includes 2018-08-11 03:08:34 -05:00
Aaron Franke 14fe7230f4 [Core] Move Vector2i and Rect2i out of math_2d.h 2018-08-11 00:33:01 -05:00
Aaron Franke 2eb8a9749e [Core] Move Rect2 and Transform2D to their own files
Math2D includes Transform2D, which includes Rect2, which includes Vector2.
2018-08-10 23:40:50 -05:00
Aaron Franke 9170d932e3 [Core] Grammar, move defs to defs
Math constant definitions belong in `math_defs.h`. Also, the grammer in these files really needed some updating.
2018-08-10 22:42:02 -05:00
Aaron Franke 28fc195339 [Core] Change math_2d includes to vector2 includes where relevant 2018-08-10 14:59:29 -05:00
Aaron Franke 9d1b5f4e3b [Core] Move Vector2 to its own file
Makes 2D math code easier to read and makes Vector2 consistent with Vector3. In the future, we may move other things out of math_2d as well.
2018-08-10 14:59:29 -05:00
Juan Linietsky 783fd23dea
Merge pull request #19993 from vnen/gdscript-warnings
System for GDScript warnings
2018-08-10 16:22:41 -03:00
George Marques eb48119821
Added system for GDScript warnings
- Count and panel per script.
- Ability to disable warnings per script using special comments.
- Ability to disable warnings globally using Project Settings.
- Option to treat enabled warnings as errors.
2018-08-10 16:00:47 -03:00
Juan Linietsky 852378109f Added function ResourceLoader.exists(), to check if a resource exists. Closes #19140 2018-08-10 15:57:43 -03:00
Juan Linietsky ea3d997f9d
Revert "added get_creation_time function for gdscript" 2018-08-10 13:29:49 -03:00
Juan Linietsky 275e0d5ee4
Merge pull request #18914 from notwarp/master
added get_creation_time function for gdscript
2018-08-10 13:28:47 -03:00
Juan Linietsky c76f444c4e
Merge pull request #14704 from poke1024/colorconstants
Allow some non-integer built-in constants in gdscript
2018-08-10 12:57:20 -03:00
Juan Linietsky b4006f68b3
Merge pull request #15536 from poke1024/fix3327
Fix SortArray crashing with bad comparison functions
2018-08-10 12:51:11 -03:00
Tomasz Chabora 929b416fdb Add some curly braces to make dictionary printing less ambiguous 2018-08-09 21:44:41 +02:00
Marcelo Fernandez da1f1619fe Fix clang compile error 2018-08-09 08:50:06 -03:00
Juan Linietsky a71a5fc0c3 Ability to pass custom variables to expression. 2018-08-08 17:47:51 -03:00
Juan Linietsky 934c641a15 -Add Expression class, used to evaluate expressions
-Added expression evaluation to EditorSpinSlider, fixes #20813, fixes #18932
2018-08-08 17:35:23 -03:00
Juan Linietsky e0456f7976 Make sure warn deprecated uses a volatile bool (for multithreading) 2018-08-07 12:25:48 -03:00
Thomas Herzog 6ffd2d3529
Merge pull request #20636 from goodyttoor/hdr_import
Fix #20564 HDR import fail
2018-08-07 16:37:38 +02:00
Ibrahn Sahir 62f0dd9d57 removed some surplus null appends that got typoed in 0e29f7974b
A couple of null appends got typoed to append a '0' character instead.
Removed them here since String already takes care of the null terminator for us.
2018-08-07 03:30:14 +01:00
Marcin Zawiejski f3b2689aa6 fix out of buffer read when copying non-null terminated strings 2018-08-06 23:51:07 +02:00
Juan Linietsky edde52c8de Added proper import support for 3D and Array textures 2018-08-06 14:56:06 -03:00
Hein-Pieter van Braam b5a20d21f2
Merge pull request #20573 from hpvb/fix-nested-vector-cow
Fix nested Vectors
2018-08-05 22:31:51 +02:00
willnationsdev 417e5457b8 ResourceFormatLoaderImage::get_resource_type now uses file path 2018-08-04 15:14:28 -05:00
Marcelo Fernandez 05fc12ddb6 Add OS::open_midi_inputs and OS::close_midi_inputs 2018-08-04 10:07:46 -03:00
poke1024 9d27bd3c3b Fix SortArray crashing with bad comparison functions 2018-08-04 14:08:34 +02:00
Bernhard Liebl ba974b8d1e Allow some non-integer built-in constants in gdscript 2018-07-31 17:56:48 +02:00
Unknown 7fbb826422 Fix #20564 HDR import fail
Token has extra "0" at the end so it fail condition checking.
2018-07-31 21:34:44 +07:00
Juan Linietsky ac52eb444f Ensure one shot signals are not disconnected while edited, closes #7776 2018-07-29 21:05:31 -03:00
Ignacio Etcheverry f3c7527225 Fix case where exported properties value is lost
Fixes exported property modified values lost when creating a placeholder script instance with a failed script compilation

- Object set/get will call PlaceHolderScriptInstance's new fallback set/get methods as a last resort. This way, placeholder script instances can keep the values for storage or until the script is compiled successfuly.
- Script::can_instance() will only return true if a real script instance can be created. Otherwise, in the case of placeholder script instances, it will return false.
- Object::set_script(script) is now in charge of requesting the creation of placeholder script instances. It's no longer Script::instance_create(owner)'s duty.
- PlaceHolderScriptInstance has a new method set_build_failed(bool) to determine whether it should call into its script methods or not.
- Fixed a few problems during reloading of C# scripts.
2018-07-29 22:40:12 +02:00
Juan Linietsky 317dee95de It is now possible to import images as a separate resource, closes #5738 and likely many others 2018-07-29 16:45:23 -03:00
Hein-Pieter van Braam 2d98b40d47 Fix nested Vectors
When a Vector of Vectors gets resized the 'this' pointer of the Vectors
change. This means that the VectorWriteProxy _parent references get
invalidated. Thanks a lot to @ibrahn for finding the root cause of this.

To fix this we now create a pointer to CowData in Vector (which won't
change when the vectors move) and pass that to the write proxy also.

This fixes #20475
2018-07-29 17:03:35 +02:00
Fabio Alessandrelli feaf03421d Fix marshalls size checks.
Yesterday, when playing around with my network code, I realized there is
a security issue in decode_variant, at least when decoding PoolArrays.
Basically, the size of the PoolArray is encoded in a uint32_t, when
decoding it, that value is cast to int when comparing if the packet is
actually that size causing numbers with MSB=1 to be interpreted as
negative thus always passing the check. That same value though, is used
as uint32_t again to resize the output vector.  For this reason, sending
a malformed packet with declared type PoolByteArray and size of 2^31(+x)
causes the engine to try to allocate 2+GB of pool memory, causing the
engine to crash.

(cherry picked from commit 5262d1bbcc)
2018-07-29 03:00:34 +02:00
dragmz 8fd337e2df fix windows build using python 3.7
fixes NameError (missing "subprocess_main" and "basestring")
2018-07-28 18:13:48 +02:00
Rémi Verschelde 4e4702e386
Merge pull request #20464 from Calinou/add-editor-standalone-feature-tags
Add "editor" and "standalone" feature tags
2018-07-28 10:49:27 +02:00
Rémi Verschelde e6aec27428
Merge pull request #20511 from maksloboda/InputEventActionFix
Fixed shortcuts not working with InputEventActions
2018-07-28 09:48:44 +02:00
Viktor Ferenczi c5bd0c37ce Running builder (content generator) functions in subprocesses on Windows
- Refactored all builder (make_*) functions into separate Python modules along to the build tree
- Introduced utility function to wrap all invocations on Windows, but does not change it elsewhere
- Introduced stub to use the builders module as a stand alone script and invoke a selected function

There is a problem with file handles related to writing generated content (*.gen.h and *.gen.cpp)
on Windows, which randomly causes a SHARING VIOLATION error to the compiler resulting in flaky
builds. Running all such content generators in a new subprocess instead of directly inside the
build script works around the issue.

Yes, I tried the multiprocessing module. It did not work due to conflict with SCons on cPickle.
Suggested workaround did not fully work either.

Using the run_in_subprocess wrapper on osx and x11 platforms as well for consistency. In case of
running a cross-compilation on Windows they would still be used, but likely it will not happen
in practice. What counts is that the build itself is running on which platform, not the target
platform.

Some generated files are written directly in an SConstruct or SCsub file, before the parallel build starts. They don't need to be written in a subprocess, apparently, so I left them as is.
2018-07-27 21:37:55 +02:00
Max c2be1a75a0 Fixed shortcuts not working with InputEventActions 2018-07-27 15:09:41 +03:00
Rémi Verschelde 0494bbc5ca
Merge pull request #20478 from mattiascibien/main_Scene_filter
Fix main scene file filter
2018-07-26 13:45:18 +02:00
Rémi Verschelde 391e46830f doc: Sync classref with current source
Fix various missing arguments in bindings.
2018-07-26 11:56:21 +02:00
Mattias Cibien 4462819e63 Fix main scene file filter 2018-07-26 11:48:12 +02:00
Rémi Verschelde 47a7dc7b3c
Merge pull request #18282 from aaronfranke/better-mathf
[Core] [Mono] Fix Color missing int export methods, added 64-bit
2018-07-26 10:48:47 +02:00
Rémi Verschelde 5c8919aac6
Merge pull request #18955 from tagcup/fix_set_scale
Removed incorrect Basis::set_scale().
2018-07-26 10:37:03 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Hugo Locurcio 0254a40817
Add "editor" and "standalone" feature tags
These feature tags can be used to check whether the project was
started from an editor binary or from an export template binary.
2018-07-25 23:27:50 +02:00
Aaron Franke 55d976467d Expose 64-bit Color methods to GDScript and fix/update Color XML doc 2018-07-25 15:35:29 -05:00
Aaron Franke de4b096898 [Core] 64-bit int Color methods 2018-07-25 15:34:24 -05:00
Alexander Holland 2290cc6227 Added String.format "no index" support 2018-07-25 13:23:44 +02:00
Alexander Holland 84db7056b7 Fix format ignores case in placeholder 2018-07-25 12:14:48 +02:00
Rémi Verschelde a501678ba1
Merge pull request #20154 from marcelofg55/midi_driver
Added a new MIDIDriver class
2018-07-25 01:17:57 +02:00
Rémi Verschelde 540da3683f
Merge pull request #20411 from ibrahn/remove-substr-strlen
removed redundant strlen calculation from String::substr
2018-07-24 23:53:37 +02:00
Max Hilbrunner 9377f8db55
Merge pull request #20407 from akien-mga/po-newline-eof
Fix loading PO files with missing newline after last msgstr
2018-07-24 18:12:51 +02:00
Ibrahn Sahir e0df1221bf removed redundant strlen calculation from String::substr 2018-07-24 16:08:45 +01:00
Rémi Verschelde 12d69ef53e Fix loading PO files with missing newline after last msgstr
Fixes #20375.
2018-07-24 13:32:37 +02:00
karroffel 7211fd604c reduce clang warning spam 2018-07-24 12:13:05 +02:00
Wilson E. Alvarez a22e746bc3 Removed unnecessary assignments 2018-07-24 09:51:03 +02:00
Ignacio Etcheverry 779c9d638e
Merge pull request #15880 from neikeq/better-collections
Mono: Add Dictionary and Array classes
2018-07-23 23:59:04 +02:00