Commit Graph

140 Commits

Author SHA1 Message Date
Gilles Roudière
a3b431b09d Add gesture to ViewPanner and simplify a bit its API 2023-01-23 16:43:53 +01:00
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
Silc Renew
060fb2d093 Add inspector plugin for key time edit & Change find key argument 2022-12-22 10:03:06 +09:00
Silc Renew
c87e9f0b7c Fix unmerged history in AnimationTrackEditor 2022-12-10 22:21:38 +09:00
trollodel
c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
kobewi
8a3d2f4e0c Cleanup remaining EditorUndoRedoManager usages 2022-11-24 18:56:22 +01:00
Markus Sauermann
28af870750 Code simplifications found by cppcheck
They are based on:
- Boolean arithmetic simplifications
- setting variables that are not accessed
- constant variables
2022-11-21 08:43:36 +01:00
Silc Renew
3818be64a4 Fix the behavior of focus selection in bezier editor 2022-11-19 16:46:10 +09:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +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
Tomasz Chabora
882a4f8906 Port remaining connections to callable_mp 2022-09-18 13:08:54 +02:00
bruvzg
6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Micky
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
Rémi Verschelde
fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
Aaron Record
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
Rémi Verschelde
6277448f42
Merge pull request #64647 from TokageItLab/auto-tangent 2022-08-23 18:17:15 +02:00
Silc Renew
9327296e73 Add bezier preset and refactor bezier editor
Co-authored-by: Razoric480 <razoric480@gmail.com>
2022-08-23 19:14:03 +09:00
kobewi
ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
Rémi Verschelde
cf95056c91
Merge pull request #63245 from V-Sekai/animation_editor_read_only 2022-08-10 15:26:21 +02:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
SaracenOne
7776b47489 Add read-only mode to AnimationEditor for foreign resources. 2022-07-21 14:46:58 +01:00
FireForge
97dfbea6ad Rename Control PRESET_WIDE to PRESET_FULL_RECT 2022-07-18 20:08:11 -05:00
Hendrik Brucker
99ce0df3b1 Refactor bezier interpolation functions 2022-06-27 19:42:43 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02: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
FireForge
3073b85de9 Rename theme properties to include underscores
- check_vadjust -> check_v_adjust
- close_h_ofs -> close_h_offset
- close_v_ofs -> close_v_offset
- commentfocus -> comment_focus
- hseparation -> h_separation
- ofs -> offset
- selectedframe -> selected_frame
- state_machine_selectedframe -> state_machine_selected_frame
- table_hseparation -> table_h_separation
- table_vseparation -> table_v_separation
- vseparation -> v_separation
2022-04-23 11:16:18 -05:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
kobewi
7d44bb8f06 Remove set_as_minsize() 2022-03-06 00:57:42 +01:00
Rémi Verschelde
51a00c2855
Merge pull request #58182 from akien-mga/style-cleanup-if-semicolons-deadcode 2022-02-16 16:55:07 +01:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
jmb462
dcd2a92af3 Port existing _notification code to use switch statements (part 1/3) 2022-02-16 11:38:24 +01:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Francois Belair
13a0d9177d Implement drawing and editing all anim beziers
* Move bezier edit from track to button in toolbar
* Draw, edit all bezier curves simultaneously
* Add click on curve to select tracks
* Tie track editor's filter view to bezier editor
* Implement visibility and locking
* Fix editor spacing issues
* Fix track buttons spacing
* Add keyframe focus and (de)select all key handling
2022-02-09 19:48:22 -05:00
kobewi
98692d68c3 Minor tweaks and fixes to panning 2022-01-23 13:49:53 +01:00
kobewi
74bfe88267 Add ViewPanner to 2D editor 2022-01-21 18:35:06 +01:00
kobewi
fbb5580b3d Add ViewPanner to more editors 2022-01-14 13:09:39 +01: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
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
jmb462
81efebb3a1
Fix bad popups offset in editor with single window off
Co-authored-by: Gil Arasa Verge <gilarasaverge@gmail.com>
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
2021-12-06 14:29:48 +01:00
Nathan Lovato
a5d0a74b65 Make bezier handle type a property of keyframes, update interface
- Replaced unused code related to old close icon with a button
- Add bezier handle options to right-click menu
- Remove mirror handle mode, only keep balanced
- Update animation reference
2021-11-16 09:26:35 -05:00
Aaron Franke
3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Lightning_A
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Rémi Verschelde
88b347dc27
Merge pull request #51920 from jmb462/missing-sname-macro-optimization-in-some-functions 2021-09-23 13:14:20 +02:00
Nathan Lovato
4e7ac43cfe Replace close icon with button in the Bezier editor 2021-08-26 19:21:49 -06:00
reduz
5cecdfa8af Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
jmb462
54de7114c5 Add missing SNAME macro optimization for StringName in some functions 2021-08-20 14:50:24 +02:00
Hugo Locurcio
4a4d977bea
Improve the animation bezier editor
- Allow snapping bezier handles to the timeline.
- Allow precise snapping when holding Shift for keyframes and handles.
  - Previously, it was only allowed for seeking the timeline.
  - This change also impacts the animation track editor,
    not just the bezier editor.
- Invert the Ctrl + mouse wheel behavior to match the zoom direction
  in the animation track editor.
- Increase the line spacing between the "Time:" and "Value:" texts
  to improve readability.
- Tweak box selection styling to match the animation track editor.
- Adjust line widths for hiDPI displays.
2021-08-14 22:04:45 +02:00
Rémi Verschelde
de2c2be19b
Shortcut: Rename shortcut property to event
Having a property which has the same name as its class leads to confusing
situations (e.g. `BaseButton` has a `shortcut` property of type `Shortcut`
which has a `shortcut` property of type `InputEvent`).

Also renames `is_event` to `matches_event`, and `is_valid` to `has_valid_event`
to better reflect what the methods check.
2021-08-05 13:48:43 +02:00
Rémi Verschelde
ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke
4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -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
Lightning_A
97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Tokage
d459766edd fix AnimationTrackEditor's undo with correction invalid method name 2021-05-05 14:00:56 +09:00
Rafał Mikrut
504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Aaron Franke
10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal
b743a2ef3c Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Marcel Admiraal
4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Aaron Franke
1b348b3c17
Remove connect *_compat methods 2020-12-05 17:56:47 -05:00
bruvzg
99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Michael Alexsander
eee9d053a3 Fix timeline cursor not updating on zoom change in the Bezier editor 2020-07-02 16:07:28 -03:00
Michael Alexsander
20c1196bb0 Make timeline cursor in the Bezier editor just as thick as the Animation editor 2020-07-01 23:52:21 -03:00
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
Aaron Franke
540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04: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
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
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
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
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
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
Rémi Verschelde
4faaf6089a Remove unused #if 0'ed code 2020-01-21 21:41:54 +01: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
PouleyKetchoupp
bdb9149d7e Fixed missing argument for clear_selection signal in Bezier Curve editor
Also removed unused clear_selection signal in Animation Track editor (never emitted)

Fixes #32348
2019-09-25 19:35:21 +02:00
Valentin Zagura
fbcb68c15a Animation Bezier Editor : fix double inserts on undo 2019-09-06 13:59:44 +01:00
Rémi Verschelde
2ee0ca3d43
Merge pull request #31916 from puthre/bezier_editor_zoom
Animation Bezier Editor - fixed vertical zoom around mouse
2019-09-03 12:31:53 +02:00
Valentin Zagura
e33f13840d Animation Bezier Editor - fixed vertical zoom around mouse
Fixed vertical zoom so it zooms around the mouse cursor not around the center of the window.
2019-09-03 00:51:55 +01:00
Valentin Zagura
a5ebed211f Animation Bezier Editor: Extended zoom in and zoom out limits and fixed guide lines to accomodate sub unit steps and steps other than powers of 5 2019-08-30 15:12:42 +01:00
qarmin
3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
Ben Hickling
a7ef836c69 Fixed a few issues with the bezier animation track editor, fixed the Travis CI errors, added TTR to bezier value labels and rounded them to 3 decimal points 2019-04-30 10:41:23 +01:00
Michael Alexsander Silva Dias
3ef8238c1c Make translatable some undo/redo operations in the editor 2019-02-21 16:41:01 -03:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Mateus Felipe C. C. Pinto
e7968954e8 Change color of AnimationPlayer curve to "highlight"
This is to be consistent with Curve editor and to be less confusing
related to tangent lines color.
2018-12-18 13:46:03 -02:00
willnationsdev
5436abefe4 Refactor editor icon retrieval 2018-09-14 09:27:56 -05:00
Rémi Verschelde
9eb4d4ab2d Add missing copyright headers 2018-08-29 22:41:17 +02:00
Juan Linietsky
b659fd6d74 Entirely new (and much improved) animation editor. 2018-06-07 12:52:00 -03:00