Commit graph

164 commits

Author SHA1 Message Date
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
94721f5ab8 Revert "Renamed plane's d to distance"
This reverts commit ec7b481170.

This was wrong, `d` is not a distance but the `d` constant in the
parametric equation `ax + by + cz = d` describing the plane.
2020-05-10 16:47:11 +02:00
Rémi Verschelde
69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Marcus Elg
ec7b481170 Renamed plane's d to distance 2020-05-10 12:12:51 +02:00
Juan Linietsky
0e1c66d9fc Implement global and per instance shader uniforms.
Adds two keywords to shader language for uniforms:
-'global'
-'instance'

This allows them to reference values outside the material.
2020-04-17 12:35:41 -03:00
Tomasz Chabora
c1023157eb Remove Node.get_position_in_parent() 2020-04-06 01:19:20 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky
441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky
4758057f20 Working multiple window support, including editor 2020-03-26 15:49:40 +01:00
Juan Linietsky
9e08742de8 Added a Window node, and made it the scene root.
Still a lot of work to do.
2020-03-26 15:49:38 +01:00
Rémi Verschelde
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Rémi Verschelde
f742dabafe Signals: Manually port most of remaining connect_compat uses
It's tedious work...

Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
2020-02-28 14:24:09 +01:00
Rémi Verschelde
01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
Rémi Verschelde
6c8f2ae53a Update docs and bindings for new integer vector types 2020-02-25 15:27:29 +01:00
Juan Linietsky
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Juan Linietsky
3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Juan Linietsky
cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03:00
Juan Linietsky
e1b3444415 Bugfixes and ability to better specify filter and repeat modes everywhere.
Removes antialiased flag for draw_* methods.
2020-02-11 11:53:28 +01:00
Juan Linietsky
3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Aaron Franke
5e1dad3b28
Use int64_t for EditorPropertyInteger and warn when out of double range 2020-01-15 23:39:49 -05:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Haoyu Qiu
078c0d75f2 Cleans up headers included in editor_node.h 2019-12-24 21:46:05 +08:00
Rafał Mikrut
ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
Rémi Verschelde
8e76c5701b
Merge pull request #32997 from Calinou/editor-color-picker-add-tooltip
Add a tooltip to Color properties in the editor inspector
2019-11-07 13:18:27 +01:00
Hugo Locurcio
66bfa92e84
Add a tooltip to Color properties in the editor inspector
This makes it possible to view a color's raw R/G/B/A values
without clicking the ColorPickerButton.
2019-10-22 23:22:20 +02:00
Anubhab Ghosh
4972ef801a Add clear menu entries for extending and replacing scripts 2019-10-23 01:57:17 +05:30
Michael Alexsander
a0866716ed Make the the resource menu button fallback to the Object icon instead of Node 2019-10-21 11:26:58 -03:00
Michael Alexsander
22b9510558 Make resource editor fallback to Object icon if none is found 2019-10-14 16:36:00 -03:00
David Sichma
f7d9f070e1 Increased step precision
Results in nicer numbers for float properties like 20.0 instead of
20.000001
2019-10-13 00:29:53 +02:00
Joe Morton
c017f3405e Set tooltip to an empty string when clearing
Format


Remove string conversion
2019-10-06 17:29:11 +01:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Hugo Locurcio
21222fb478
Make editor inspector easing lines use the accent color when dragged
This makes their visual feedback more consistent with other controls.

This also makes easing lines slightly more subtle by decreasing
their opacity by 10%.
2019-09-06 16:11:26 +02:00
Bhupendra Aole
1de3ec911f Default ColorPicker color mode setting
There is a new setting for Default ColorPicker color mode in Editor Settings->Interface->Inspector. Initially this setting will be RGB. Editor ColorPicker will always start with mode defined in this settiing.
Fixes #30755 and #30754
2019-08-31 00:34:33 -04:00
merumelu
e2459479de Editor: remove TOOLS_ENABLED guards
For code  inside editor/ `#ifdef TOOLS_ENABLED`
is always true so those checks are redundant.
2019-08-30 19:02:46 +02:00
Rémi Verschelde
73f1f9b44f
Merge pull request #31586 from SonerSound/issue_31533
Export path is the only path to be saved as a relative path
2019-08-23 08:34:03 +02:00
SonerSound
326f856006 Export path is the only path to be saved as a relative path
Also reverts 90b2415343
2019-08-22 22:20:15 +01:00
Hugo Locurcio
ca42541020
Tweak the size of the multiline text edit popup dialog
This caps its size on large displays. This in turn prevents lines from
becoming very long, which could hamper text readability.
2019-08-09 22:03:25 +02:00
Rémi Verschelde
d844e30614 Inspector: Make default float step configurable
Also allow lifting the decimal step formatting with a hint range step
of 0. A new `range_step_decimals()` is added for this to avoid breaking
compatibility on the general purpose `step_decimals()` (which still
returns 0 for an input step of 0).

Supersedes #25470.
Partial fix for #18251.
2019-07-23 17:31:38 +02:00
Rémi Verschelde
d15cf7b672
Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
2019-07-20 12:00:13 +02:00
qarmin
6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Michael Alexsander Silva Dias
df9c890022 Make multiline text edit grab focus when popping up 2019-07-19 14:32:23 -03:00
SonerSound
90b2415343 Export path may now be written as a relative path
If the target directory does not exist, it will be recursively created.

Export paths are now saved as a relative to the projects base directory

Renamed relative_to function to final_path_from_relative which takes a relative path and outputs the final path from a string that represents a directory.
Added relative_path_from_final which takes in a final path and outputs a relative path if possible. If not possible it outputs the relative path that represents the current directory.
If the target directory does not exist when exporting the project, then it is recursively created.

Removed final_path_from_relative function

Changed DirAccess into DirAccessRef for automatic object destruction
2019-06-30 19:13:49 +01:00
Rémi Verschelde
f8df412512
Merge pull request #24156 from AnaDenisa/master
Add option to input value in EditorPropertyEasing. Fixes #8449
2019-06-29 15:34:24 +02:00
LikeLakers2
facafeb19a Fix an EditorPropertyResource bug where clicking on the flat buttons would not select the property in the inspector 2019-06-28 19:23:57 -04:00
AnaDenisa
13279a7da7 Add option to input value manually in EditorPropertyEasing
Double-clicking on the EditorPropertyEasing widget (e.g. for the Light
Attenuation parameter) shows an EditorSpinSlider to set the value manually.

Fixes #8449.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2019-06-28 12:25:19 +02:00