Commit Graph

305 Commits

Author SHA1 Message Date
kobewi b58111588a Add EditorUndoRedoManager singleton 2023-01-16 01:11:52 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Hugo Locurcio df636ac881
Document `collision_priority` in the CSGShape3D class 2022-10-24 18:44:30 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Micky ae5771e1b1 Rename remaining "Spatial" in Plugins to "Node3D"
For EditorNode3DGizmo:
- `get_spatial_node` -> `get_node_3d`
- `set_spatial_node` -> `set_node_3d`

For EditorPlugin:
- `add_spatial_gizmo_plugin` -> `add_node_3d_gizmo_plugin`
- `remove_spatial_gizmo_plugin` -> `remove_node_3d_gizmo_plugin`

Also renames some internal methods for consistency (`forward_3d_draw_over_viewport` & `forward_3d_force_draw_over_viewport` ...). Basically, Spatial has been completely eradicated.
2022-10-04 16:27:29 +02:00
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Andy Maloney 49ff3d5489 Remove unused includes & move some includes to top of file 2022-09-23 19:06:31 -04:00
Hugo Locurcio ae18928748
Rename Curve/Curve2D/Curve3D/Gradient `interpolate()` to `sample()`
"sampling" is a more accurate term than "interpolating" for what's
happening when using that function.
2022-08-30 22:08:38 +02:00
Micky 59e11934d8 Rename `str2var` to `str_to_var` and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde b8a64313f0
Merge pull request #59564 from KoBeWi/FINALLY,_ULTIMATE_UNDO_REDO 2022-08-22 22:37:33 +02:00
Rémi Verschelde 1f61d47766
Merge pull request #64339 from YuriSizov/core-multilevel-validate-property 2022-08-22 21:39:48 +02:00
kobewi ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
Yuri Sizov 1a24c9e14b Make `_validate_property` a multilevel method 2022-08-22 18:35:11 +03:00
Rémi Verschelde 5193332d10
Merge pull request #64343 from TokageItLab/priority-ph 2022-08-22 17:31:23 +02:00
RedMser c25b8f2876 Remove unintentional PROPERTY_USAGE_INTERNAL
The flag only matters for property definition,
but was also used in _validate_property a lot.
2022-08-18 16:25:00 +02:00
Silc Renew b31115cdc1 Add collision weight to PhysicsBody for penetrations must be avoided
Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2022-08-18 08:10:31 +09:00
Yuri Sizov c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Aaron Franke ce0080768c
Make "Godot source files" comment consistent in modules 2022-08-05 17:09:11 -05:00
Fabio Alessandrelli 55845bac26 Fix some array size function definition mismatch. 2022-08-04 13:06:17 +02:00
Fabian Keller 2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00
reduz 141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
FireForge 4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
Rémi Verschelde 03218889d0
Merge pull request #61213 from timothyqiu/csg-crash
Fix editor crash when opening scene with CSGMesh
2022-05-20 07:57:10 +02:00
Haoyu Qiu de93286b1d Fix editor crash when opening scene with CSGMesh 2022-05-20 10:47:29 +08:00
Aaron Franke 5dc3bfb80e
Use suffixes for units in nodes and resources 2022-05-19 14:34:27 -05:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Rémi Verschelde d8935b27a9 Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.
2022-05-10 13:03:13 +02:00
hoontee b869ec7262
Rename `CSGPrimitive3D.invert_faces` to `flip_faces` 2022-05-06 20:51:46 -05:00
Rémi Verschelde 84f64ddde9
Merge pull request #60723 from reduz/refactor-module-initialization 2022-05-04 19:08:43 +02:00
reduz de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
Aaron Franke fa7a7795f0
Rename Basis get_axis to get_column, remove redundant methods 2022-05-03 09:37:47 -05:00
Hugo Locurcio 53b8899be9
Decrease default sizes of some primitive and CSG meshes for consistency 2022-04-27 22:45:38 +02:00
Eeli Reilin 60f3d1d36f Fix CSG gizmos only working on root shapes 2022-04-06 13:36:34 +03:00
Rémi Verschelde f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Rémi Verschelde 5fe6984639 Modules: Don't build editor-specific classes in templates
They're moved to an `editor` subfolder so that we can easily handle them
separately.
2022-03-28 16:48:15 +02:00
MythTitans ec2984f7c7 Prevent non-smoothed face normals to participate to smoothed face normals 2022-03-11 20:23:13 +01:00
MythTitans 8bcbaff411 Fix normals computation at the 'seam' of smoothed torus shape 2022-03-11 00:16:30 +01:00
reduz 6f51eca1e3 Discern between virtual and abstract class bindings
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract".
* Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions.
* Converted a large amount of classes from "abstract" to "virtual" where it makes sense.

Most classes that make sense have been converted. Missing:

* Physics servers
* VideoStream
* Script* classes.

which will go in a separate PR due to the complexity involved.
2022-03-10 12:28:11 +01:00
hoontee 9c312c486c
Revert #52647 2022-03-09 17:25:45 -06:00
hoontee f1cc99c6e8
Add SNAME macro optimization missed during rebase 2022-03-09 11:23:46 -06:00
hoontee ce2b367afb
Properly handle CSGShape parent and visibility updates, plus some refactoring 2022-03-08 18:58:47 -06:00
MythTitans 509e03c821 Fix normals computation at the 'seam' of smoothed sphere and cylinder shapes 2022-02-16 22:23:28 +01:00
Jakob Bouchard 6553f5c242
Convert _notification methods to switch - Chunk C 2022-02-16 13:03:05 -05:00
Rémi Verschelde 78a767edb3
Merge pull request #35679 from Calinou/doc-add-xml-schema 2022-02-15 13:14:58 +01:00
Hugo Locurcio b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
trollodel cd1d7294d8 Remove the EditorNode parameter from EditorPlugins create methods
Remove EditorNode usage from the Navigation editor plugin.
2022-02-14 18:21:42 +01:00
trollodel 05b56f316d Remove most EditorNode constructor parameters and fields 2022-02-14 14:16:24 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Hugo Locurcio 5268786ac0
Document performance limitations with CSG nodes, link to tutorial 2022-02-07 15:55:02 +01:00
Aaron Franke 8cfd264148
Improve the default size for 3D shapes (Box, Capsule, and Cylinder) 2022-02-01 06:43:16 -06:00
Hugo Locurcio 69617a893e
Improve CSGPolygon3D documentation
- Describe why polygon triangulation usually fails in the error message.
2022-01-21 20:00:34 +01:00
jfons 5ebea2d120 Fix secondary handles in editor gizmos
Primary and secondary handles are no longer differentiated by their ids, so a bool was added to tell them apart in all the handle-related methods.

Includes a minor fix in CollisionPolygon3DEditor, unrelated to editor gizmos.
2022-01-12 14:21:20 +01:00
SaracenOne 7f16bed947 Fix selection of CSG objects 2022-01-07 19:57:02 +00:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
luz paz a124f1effe Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05:00
Lightning_A e078f970db Rename `remove()` to `remove_at()` when removing by index 2021-11-23 18:58:57 -07:00
Rémi Verschelde 6c1bd4d227
Replace Godot docs URL with `$DOCS_URL` in XML class reference 2021-11-15 13:02:21 +01:00
Hugo Locurcio c012fbc8b2
Rename `PROPERTY_USAGE_NOEDITOR` to `PROPERTY_USAGE_NO_EDITOR`
This is consistent with other constants that include `NO`,
such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-11-03 23:06:17 +01: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
reduz d03b7fbe09 Refactored Node3D rotation modes
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis

Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25 14:34:00 -03:00
M. Huri b981c111c9 Fixed a typo in csg module 2021-10-12 11:12:19 +07:00
Lightning_A c63b18507d Use range iterators for `Map` 2021-09-30 15:09:12 -06:00
Anilforextra fc9767abb1 Use functions defined in the their classes. 2021-09-29 09:36:34 +05:45
jitspoe 1da948a688 CSGPolygon fixes and features: Angle simplification, UV tiling distance, interval type. 2021-09-27 21:24:19 -04:00
Anilforextra d090925d98 Fix Typo: Segement. 2021-09-27 17:05:23 +05:45
Rémi Verschelde ba57252bd8
Merge pull request #52878 from AnilBK/add-get-center 2021-09-21 21:30:30 +02:00
Anilforextra 90908cd67d Add Get Center Method for Rect2/Rect2i and AABB. 2021-09-21 21:14:17 +05:45
Aaron Franke d54f2ad7ca
Don't generate empty doc sections and reduce code duplication 2021-09-20 20:59:33 -05:00
Haoyu Qiu 07042b4044 Don't update CSG Shape when not inside tree 2021-09-14 08:38:30 +08:00
Rémi Verschelde c89ad92c96
Merge pull request #51532 from nekomatata/layer-mask-accessors
Uniformize layer names, script methods and documentation
2021-08-12 17:55:11 +02:00
PouleyKetchoupp 989acbbe81 Uniformize layer names, script methods and documentation
- Back to 1-based layer names to make it clearer in editor UI
- Layer bit accessors are renamed to layer value and 1-based too
- Uniform errors and documentation in render and physics
- Fix a few remaining collision_layer used in place of collision_mask
2021-08-12 08:06:42 -07:00
Marcel Admiraal cf771342cb Fix multiple issues with CSGPolygon 2021-08-12 09:52:38 +01:00
Aaron Franke 430ad75963
Some work on double support 2021-08-09 17:43:48 -05:00
AndreaCatania e4e4a02d3d Removes const from set functions on the Gizmos 2021-08-07 09:15:57 +02:00
Haoyu Qiu 0f1e107ede Do nothing when dragging CSGBox handle perpendicular to the camera 2021-07-31 02:25:05 +08:00
Rémi Verschelde 7adf4cc9b5
doc: Use self-closing tags for `return` and `argument`
For the time being we don't support writing a description for those, preferring
having all details in the method's description.

Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.
2021-07-30 15:29:52 +02:00
Aaron Franke b2156b22ea
Fix CSGSphere3D mesh creation 2021-07-26 00:09:52 -04:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
jfons cfb555a081 Node3D gizmo improvements
* Clean-up of node_3d_editor_plugin.{h,cpp}: removed unused code, fixed some bugs.
* Moved node_3d_editor_gizmos.{h,cpp} to editor/plugins.
* Added support for multiple gizmos per node. This means custom gizmos will no longer override the built-in ones and that multiple gizmos can be used in more complex nodes.
* Added support for handle IDs. When adding handles to a gizmo, an ID can be specified for each one, making it easier to work with gizmos that have a variable number of handles.
* Added support for subgizmos, selectable elements that can be transformed without needing a node of their own. By overriding _subgizmo_intersect_frustum() and/or _subgizmo_intersect_ray() gizmos can define which subgizmos should be selected on a region or click selection. Subgizmo transformations are applied using get/set/commit virtual methods, similar to how handles work.
2021-07-23 21:01:10 +02:00
Aaron Franke 78b0a7da03
Use is_equal_approx in more places 2021-07-21 00:32:37 -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
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
Hugo Locurcio 8f7e1b53ff
Allow using ORMMaterial3D by using BaseMaterial3D as a resource hint
Previously, only StandardMaterial3D could be defined as an alternative
to ShaderMaterial.

This also reorders the CanvasItemMaterial property hints to follow
alphabetical order (which is enforced by the inspector).
2021-07-04 17:49:36 +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
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
Lightning_A e28fd07b2b Rename `instance()`->`instantiate()` when it's a verb 2021-06-19 20:49:18 -06:00
Michael Alexsander Silva Dias 0ff4095b36 Better format arguments in variant parser 2021-06-18 00:06:40 -03:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Aaron Franke acd695060b
Disable 3D-only modules when 3D is disabled 2021-06-03 17:45:28 -04:00
Aaron Franke 0ac4051c00
Update documentation for Transform3D 2021-06-03 07:30:01 -04:00
Aaron Franke a3c29ed899
Rename files and the exposed name for 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
Marcel Admiraal 3dc1a2951b Fix UV mapping on CSGSphere 2021-05-29 19:14:52 +01:00
Hugo Locurcio 7375a02015
Increase icon saturation by 30% for all editor icons
More saturated icons go better with the new editor theme.

These color changes only apply when using a dark theme.

The editor icon saturation can still be adjusted in the Editor Settings.
Setting the editor icon saturation setting to 0.77 should roughly match
the old icon saturation.
2021-05-11 18:15:31 +02:00
rafallus abf6872c38 Change Path to Path3D in CSGPolygon3D 2021-05-01 22:43:36 -05:00
Rafał Mikrut efcb097674 Prevent setting too big or too small Collision Mask and Layer 2021-04-30 17:19:04 +02:00
Rémi Verschelde cab5064f20
doc: Sync classref with current source
And typo fix from https://github.com/godotengine/godot-docs/pull/4882.
2021-04-29 12:11:40 +02:00
Marcel Admiraal c2f6a73e4e Update CSGMesh3D's documentation to explain how vertex normals are used 2021-04-27 18:32:25 +01:00
Johannes Witt bab36f1273
Fix CSG Path Polygon cache being removed after connect
fixes #30229
2021-04-27 13:58:01 +02:00
Rémi Verschelde f6e5ea774b
Merge pull request #48172 from madmiraal/fix-empty-csgshape-error
Fix new `CSGMesh` errors
2021-04-26 12:19:48 +02:00