Commit graph

441 commits

Author SHA1 Message Date
Rémi Verschelde 0ae65472e7
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 15:57:41 +02:00
Rémi Verschelde 3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
ne0fhyk b5c750fa65 Restrict the project data directory configuration 2021-10-18 14:10:38 -07:00
Rémi Verschelde a7ba227631
Merge pull request #52711 from m4gr3d/provide_getter_for_project_data_dir_master 2021-10-05 21:02:27 +02:00
ne0fhyk 69f890ff11 Provide a getter for the project data directory. 2021-09-15 12:52:03 -07:00
Lewis James 913aa270c0 Add editor keyboard shortcut for Mono Build solution button
Apply suggestions from code review

Merging @akien-mga's suggestion with the matching change to the CS project

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-09-14 13:13:00 +01:00
Raul Santos 2962a440ea Fix autoloads iteration
Removes the range iterator usage in the autoloads map since `OrderedHashMap`
does not implement range iterators.
2021-09-12 13:22:18 +02:00
Raul Santos c6b1c8093f Fix properties arrays in C# bindings generator 2021-09-08 12:52:39 +02:00
Raul Santos 415529400b Fix constant tag documentation in C# bindings generator 2021-09-03 18:54:40 +02:00
Raul Santos 5508d4606b Fix PackedInt64Array typo in bindings_generator.h 2021-09-03 18:54:40 +02:00
Aaron Franke 1933df0013
Some more C# formatting 2021-09-02 15:12:15 -05:00
Lyuma 31f790299c Use OrderedHashMap for autoloads to preserve order 2021-08-26 21:55:26 -07:00
Ignacio Roldán Etcheverry d2c3a86844 C#: Fix bindings generator for Callable argument default value
Previously there weren't any Callable arguments with a default value,
but d4dd859991 introduced one.
2021-08-20 11:18:04 +02:00
Max Hilbrunner 81f7d1890b Namespaces instead of underscore prefix for binds
Thanks to neikeq for the initial work.

Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2021-08-17 16:10:09 +02:00
Aaron Franke 03e2544d50
Use real_t and double where appropriate in Particles 2021-08-12 11:35:31 -05:00
Raul Santos f20db58271 Ensure MSBuildPanel buttons are instantiated 2021-08-06 22:30:38 +02:00
Yuri Sizov d3e413c659 Fix the editor theme application for the Mono build log 2021-08-03 22:13:32 +03:00
Rémi Verschelde 7cbdb9b4c3
Merge pull request #50917 from raulsntos/more-iterators 2021-07-27 08:05:15 +02:00
Raul Santos d636ebbfe9 Ignore paths with invalid chars in PathWhich 2021-07-27 04:16:20 +02:00
Raul Santos 3fe67fb5ad Use C++ iterators in the Mono module 2021-07-27 02:48:28 +02:00
Raul Santos accd05f4ad Use Array.Empty instead of allocating a every time
Use `System.Array.Empty<T>` to get an empty array instead of allocating
a new one every time. Since arrays are immutable there is no need to
allocate them every time.
2021-07-26 03:52:31 +02:00
Raul Santos b3274a7064 Fix bindings generator range iterator errors 2021-07-25 21:32:54 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Ignacio Roldán Etcheverry 2ee395a277
Merge pull request #50757 from aaronfranke/simple-cs-editorconfig
Add a simple C# `.editorconfig`
2021-07-24 21:48:41 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Aaron Franke 5f8275d9ac
Add a simple C# .editorconfig 2021-07-23 17:04:53 -04:00
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
Rémi Verschelde 671467b888
Mono: Remove info dialog discouraging use in production
While there are still various bugs to solve and features to implement, the C#
support as of Godot 3.4 is fairly mature and already used by a number of users
in production. Now that we default to dotnet CLI as build tool, it also seems
to be more reliable than MSBuild.

The documentation can (and does for the most part) point out some caveats that
users should be aware of, but this info dialog has outlived its intended
purpose.
2021-07-15 11:48:19 +02:00
Grzegorz Puławski fa82727f5b Fixing mono build after instance() -> instanciate() name change 2021-06-23 16:07:23 +02:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Aaron Franke e6c7567da7
Fix a typo in C# bindings generator for default value types 2021-06-18 01:13:00 -04:00
Rémi Verschelde 600b4c9c7b
Merge pull request #34668 from aaronfranke/to-string
[Core] Reformat structure string operators
2021-06-13 11:58:24 +02:00
Pedro J. Estébanez f59488e94e Improve & fix Mono build
- Fix C++ compile errors about pending variable renames after the `Reference` to `RefCount` change.
- Fix C# compile errors due to the recent rename of `EnablePlugin()` and `Build()`, which are now underscore-prefixed in bindings.
- Additional rename: `godot_icall_Reference_Dtor` to  `godot_icall_RefCounted_Dtor`.
2021-06-13 11:21:14 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Aaron Franke 554c776e08
Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant).

For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
2021-06-11 10:53:20 -04:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Aaron Franke a3c29ed899
Rename files and the exposed name for Transform3D 2021-06-03 07:30:01 -04:00
Aaron Franke 08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Rémi Verschelde 5b16020846
Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
Rémi Verschelde 8368f53941
Merge pull request #46954 from neikeq/reggr-46307
C#: Fix StringName leak warnings after generating bindings
2021-03-13 09:13:34 +01:00
Ignacio Etcheverry d9603b2d73 C#: Fix StringName leak warnings after generating bindings
`Main::cleanup()` prints warnings if it finds `StringName`s still alive.
We need the `BindingsGenerator` to be destructed before calling cleanup.
2021-03-13 01:16:31 +01:00
Ignacio Etcheverry ee8e5146a4 C#: Fix ScriptPathAttribute generator with none or nested namespaces
The following two bugs were fixed:
- For classes without namespace we were still generating `namespace {`
without a namespace identifier, causing a syntax error.
- For classes with nested namespaces we were generating only the innermost
part of the namespace was being generated, e.g.: for `Foo.Bar` we were
generating `namespace Bar {` instead of `namespace Foo.Bar {`.
This wasn't causing any build error, but because of the wrong namespace
Godot wasn't able to find the class associated with the script.
2021-03-13 01:04:59 +01:00
Rémi Verschelde 15bd2bf03f
Merge pull request #46713 from neikeq/csharp-source-generators-init
Add C# source generator for ScriptPathAttribute
2021-03-07 01:04:47 +01:00
Ignacio Etcheverry e2afe700f6 Add C# source generator for a new ScriptPath attribute
This source generator adds a newly introduced attribute,
`ScriptPath` to all classes that:

- Are top-level classes (not inner/nested).
- Have the `partial` modifier.
- Inherit `Godot.Object`.
- The class name matches the file name.

A build error is thrown if the generator finds a class that meets these
conditions but is not declared `partial`, unless the class is annotated
with the `DisableGodotGenerators` attribute.

We also generate an `AssemblyHasScripts` assembly attribute which Godot
uses to get all the script classes in the assembly, eliminating the need
for Godot to search them. We can also avoid searching in assemblies that
don't have this attribute. This will be good for performance in the
future once we support multiple assemblies with Godot script classes.

This is an example of what the generated code looks like:

```
using Godot;
namespace Foo {
	[ScriptPathAttribute("res://Player.cs")]
	// Multiple partial declarations are allowed
	[ScriptPathAttribute("res://Foo/Player.cs")]
	partial class Player {}
}

[assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })]
```

The new attributes replace script metadata which we were generating by
determining the namespace of script classes with a very simple parser.
This fixes several issues with the old approach related to parser
errors and conditional compilation.
It also makes the task part of the MSBuild project build, rather than
a separate step executed by the Godot editor.
2021-03-06 21:50:32 +01:00
Aaron Franke 4b4721f5bd
Fix C# bindings generator for default value types 2021-02-25 08:30:48 -05:00
Pedro J. Estébanez 23907e6f19 Make glue generation shutdown more graceful 2021-02-22 11:06:33 +01:00
Rémi Verschelde ed8333f6bc
Merge pull request #45158 from aaronfranke/cs-packedarray
Add C# array features from core PackedArrays
2021-02-20 09:42:30 +01:00
Rémi Verschelde 8eaea1db53
Merge pull request #45032 from neikeq/classdb-tests-for-44856
Add ClassDB tests to look for core API deps on editor API
2021-02-18 15:16:52 +01:00