Commit Graph

2916 Commits

Author SHA1 Message Date
Harley Acheson
bdee3dfaa2 Fix #128906: Remove Docking Draw Callbacks After Deactivate
If we lose focus while splitting or docking we need to make sure that
the overlay drawing callbacks are stopped.

Pull Request: https://projects.blender.org/blender/blender/pulls/128957
2024-10-13 20:24:35 +02:00
Harley Acheson
8675533448 Fix #128868: Hide Sharp Corners in Docking Split
While splitting areas the two parts are shown with rounded outlines,
but some of the underlying content can show through in the corners,
spoiling the effect. This PR just erases anything in those corners,
making it look cleaner and rounder.

Accidentally merged to main first with c3ea941273.
2024-10-11 12:31:23 -07:00
Lukas Tönne
12b4ac87ea Fix #128789: GPv3: Context property missing nullptr check
`grease_pencil` context property has to check for valid active object.
Added in 70c7fb6da2

Pull Request: https://projects.blender.org/blender/blender/pulls/128791
2024-10-09 12:22:51 +02:00
Harley Acheson
dc6e021472 Fix #128616: Allow Docking to work from Menu shortcut
Allow Docking to work correctly if using a shortcut to the area header
context menu item. There is no longer a need to set the source or
target area locations.

Pull Request: https://projects.blender.org/blender/blender/pulls/128730
2024-10-08 21:37:54 +02:00
Lukas Tönne
a57206dd59 GPv3: Remove unused legacy editor functions for GPv2
Removes all unused functions in ED_gpencil_legacy.hh

Pull Request: https://projects.blender.org/blender/blender/pulls/128597
2024-10-07 18:21:28 +02:00
Falk David
70c7fb6da2 Fix: GPv3: Context object has no attribute grease_pencil
When opeing the 2D Animation template, there was a UI error:
`AttributeError: 'Context' object has not attribute 'grease_pencil'`
This was because the context function `grease_pencil` was missing.
The fix adds this function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128580
2024-10-04 14:24:31 +02:00
Lukas Tönne
c986aa03b9 GPv3: Remove unused GPv2 keymap entries
This should free up references to GPv2 types and operators and should
in turn make their removal easier.

- Remove keymaps for GPv2 operators from `blender_default.py` and
  `industry_compatible_data.py`
- Remove keymap poll callback assignment from `gpencil_ops.cc`
- Remove keymap handler registration from `area.cc:ed_default_handlers`

Pull Request: https://projects.blender.org/blender/blender/pulls/128480
2024-10-03 11:18:31 +02:00
Campbell Barton
0f3fdd25bc Cleanup: various non-functional changes for C++
- Remove redundant parenthesis
- Use strings macros
- NULL -> nullptr
2024-10-02 15:47:05 +10:00
Harley Acheson
44168c32ff Fix #128406: Editor Highlight Edge Roundness
This separates out the edge drawing from the edge highlighting, needed
for the edge drawing shader. Also slightly improves the alignment of
the two.

Pull Request: https://projects.blender.org/blender/blender/pulls/128453
2024-10-01 21:58:02 +02:00
Harley Acheson
bfe693c8c2 UI: Changes to Docking Mouse Cursors
This makes one change and another correction to the mouse cursors used
during Docking. The change is to use WM_CURSOR_EDIT for Mac while just
hovering over the corner action zones. This means that Mac users will
transition from this to WM_CURSOR_HAND_CLOSED, instead using two hand
cursors.  The correction is to use the "split" cursors while splitting
areas. That it doesn't do that now is a mistake made during #127810.

Pull Request: https://projects.blender.org/blender/blender/pulls/128396
2024-10-01 21:04:20 +02:00
Campbell Barton
c6fd26a3f5 Cleanup: spelling in comments 2024-10-01 09:59:33 +10:00
Harley Acheson
89d7f00ff8 UI: Fix Editor Highlight Top Bar
New editor highlighting (#116684) will sometimes highlight a nearby
area when hovering over the Top Bar. This is caused by the use of the
top-left corner for testing. This just uses the region midpoint
instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/128394
2024-09-30 22:17:56 +02:00
Harley Acheson
b2eb8cc0df UI: Edge Highlighting While Resizing Editors
Highlighting of the active edges of editors while resizing.

Pull Request: https://projects.blender.org/blender/blender/pulls/120998
2024-09-27 00:56:52 +02:00
Harley Acheson
28e5c1412e UI: Editor Edge Highlighting
Customizable highlighting of editor edges that can be used to help
differentiate between areas, indicate active area, and/or help users
with visual impairment. Can be completely removed as well. This
replaces the active area header highlighting, which doesn't work for
transparent headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/116684
2024-09-26 21:55:26 +02:00
Campbell Barton
381898b6dc Refactor: move BLI_path_util header to C++, rename to BLI_path_utils
Move to a C++ header to allow C++ features to be used there,
use the "utils" suffix as it's preferred for new files.

Ref !128147
2024-09-26 21:13:39 +10:00
Campbell Barton
473bd60164 Cleanup: clarify arguments using const or r_ prefixed return args 2024-09-26 15:03:24 +10:00
Harley Acheson
8450aa275f UI: Area Docking as Regular Feature, Not Experimental
This PR makes "Interactive Editor Docking" a regular feature, available
by default, and removes the option from Experimental Preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/127810
2024-09-24 23:23:48 +02:00
Bastien Montagne
3e03576b09 Add more control over ID renaming behavior.
This commit adds low-level logic in BKE to support three behaviors in
case of name conflict when renaming an ID:
1. Always tweak new name of the renamed ID (never modify the other ID
  name).
2. Always set requested name in renamed ID, modifying as needed the
  other ID name.
3. Only modify the other ID name if it shares the same root name with the
  current renamed ID's name.

It also adds quite some changes to IDTemplate, Outliner code, and
RNA-defined UILayout code, and the lower-level UI button API, to allow
for the new behavior defined in the design (i.e. option three from above list).

When renaming from the UI either 'fails' (falls back to adjusted name) or forces
renaming another ID, an INFO report is displayed.

This commit also fixes several issues in existing code, especially
regarding undo handling in rename operations (which could lead to saving
the wrong name in undo step, and/or over-generating undo steps).

API wise, the bahavior when directly assigning a name to the `ID.name`
property remains unchanged (option one from the list above). But a new
API call `ID.rename` has been added, which offers all three behaviors.

Unittests were added to cover the new implemented behaviors (both at
BKE level, and the RNA/Py API).

This commit implements #119139 design.

Pull Request: https://projects.blender.org/blender/blender/pulls/126996
2024-09-20 13:36:50 +02:00
Harley Acheson
b5fc1683fd UI: Use WM_CURSOR_EDIT For Corner Hover Cursor with Docking
Prior behavior when hovering over the corner action zones the mouse
cursor would change to WM_CURSOR_EDIT (like a plus sign). With docking
that is WM_CURSOR_HAND, but on other platforms it is WM_CURSOR_MOVE.
Unfortunately on some platforms WM_CURSOR_MOVE does not show a
different cursor from default so there isn't an change when hovering
the corner.  This PR changes this back to WM_CURSOR_EDIT for non-Mac
platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/127878
2024-09-19 20:22:13 +02:00
Jonas Holzman
aa5385f648 Fix: Interactive Docking modal operator re-run glitch
Docking can close windows during its operation. If the current window
does not match before and after an operator has run our event handling
code can assume that a new blend file has been loaded and will rerun
the operator. This PR avoid this problem by just not starting if the
event initiating it is of type WINDEACTIVATE. There might be a later
fix that addresses the underlying issue, but this is simple, small, and
harmless.

Pull Request: https://projects.blender.org/blender/blender/pulls/126379
2024-09-19 00:47:37 +02:00
Campbell Barton
94183b9e2e Refactor: add a function to access the window size in pixels
Replace uses of WM_window_native_pixel_x,y with
WM_window_native_pixel_size() which returns an int2 for convenience
and avoids an unnecessary call to GHOST_GetNativePixelSize(..).
2024-09-16 11:38:57 +10:00
Campbell Barton
9b39b4c91c Cleanup: use const pointers/references 2024-09-15 23:14:09 +10:00
Campbell Barton
1104e4233d Cleanup: pass string by const reference 2024-09-15 23:14:08 +10:00
Campbell Barton
9be29e1bbc Cleanup: match function & declaration names 2024-09-15 23:14:07 +10:00
Sybren A. Stüvel
3fdc9e9637 Refactor: convert BKE_action.h to C++
Move the contents of `BKE_action.h` into `BKE_action.hh` and remove
C-isms.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/127407
2024-09-10 14:55:47 +02:00
Campbell Barton
2593fffa4d Fix local view failing to restore axis-roll
Entering local-view, then setting an axis via the num-pad and exiting
local view would restore the original axis but not the axis-roll.

Store the axis-roll for local-view & smooth-view operations.
2024-09-10 17:31:06 +10:00
Harley Acheson
565f9f6b8a UI: Do Not Allow Docking into Temp Windows
Do not allow dragging screen areas into Temp windows, like Properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/127379
2024-09-10 02:43:07 +02:00
Harley Acheson
72a0be0944 UI: Mac Cursors While Docking
With docking enabled, for Mac hovering over the corner actions zones
shows an open hand cursor, while dragging it uses the closed hand
cursor. For other platforms this just uses the "move" cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/127291
2024-09-10 00:55:52 +02:00
Harley Acheson
382244c258 UI: Docking Drag Mouse Cursor
This shows the docking feedback very similar to how tooltips are shown
elsewhere. It describes the operation and also includes the icon and
name of the moving/changing area.

Pull Request: https://projects.blender.org/blender/blender/pulls/126898
2024-09-04 22:43:57 +02:00
Campbell Barton
de7fced7eb Fix #126990: Changing editors doesn't set the default tool
Regression in [0].

[0]: 83fe5712ab
2024-09-04 19:34:15 +10:00
Harley Acheson
04652334f3 UI: Fix Docking Issue With No Overlay
Docking uses window overlays during feedback and these have to be
stopped and changed if you move the target from window to window.
The logic of changing the window that gets the overlay will sometimes
fail when the target window is null and old window was null - it
gets stopped (because they are equal) but not started again. This PR
just adds a check for null window.

Pull Request: https://projects.blender.org/blender/blender/pulls/126906
2024-08-29 04:36:49 +02:00
Harley Acheson
c30d7bb458 UI: Fix Docking Issues for Very Narrow Areas
When docking to very narrow areas it is only possible to dock to a
subset of three zones. This PR corrects mistakes in that code so that
you can correctly dock to tiny areas.

Pull Request: https://projects.blender.org/blender/blender/pulls/126868
2024-08-28 05:32:23 +02:00
Harley Acheson
9665b32320 UI: Remove OPTYPE_INTERNAL from SCREEN_OT_area_join
SCREEN_OT_area_join now works when called from a menu item, shortcut,
or quick favorites, so remove OPTYPE_INTERNAL so it can be found in
operator search.

Pull Request: https://projects.blender.org/blender/blender/pulls/126862
2024-08-28 01:56:44 +02:00
Harley Acheson
a0df365b77 UI: Add Snapping to Docking Status Bar Entries
While docking, show snapping keys on status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/126742
2024-08-25 00:31:50 +02:00
Jonas Holzman
13eb41959e Fix: UI: Editor window(s) title update when using interactive docking
When using Interactive Docking, window titles are not properly updated.
This change makes sure they get updated in `area_join_modal`.

Pull Request: https://projects.blender.org/blender/blender/pulls/126383
2024-08-24 21:08:05 +02:00
Harley Acheson
f08ade0523 UI: Docking Improvements From Menu Item or Shortcut
Small changes to improve docking when initiated from a menu item or
keyboard shortcut, rather than corner action zones. Process gives
feedback immediately. Split assumes a start from top-left corner.
Canceling always resets mouse cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/126704
2024-08-23 21:03:38 +02:00
Harley Acheson
6792d6dfbe UI: Docking Snapping
While docking, by default a snap to 50%. Pressing Alt gives greater
control without snapping to center. Pressing Ctrl snaps to eights.

Pull Request: https://projects.blender.org/blender/blender/pulls/126669
2024-08-23 03:02:08 +02:00
Harley Acheson
810687ad5b UI: Improvement to Screen Area Options Menu Invoke Area Join
Right-clicking on an edge between editors, the "Screen Area Options"
menu has a number of items including for Area Join.  When docking is
NOT enabled this gives the prior behavior of interactive join where
you can change direction and requires Enter to confirm.  If docking
is enabled then there are instead instant join options but now with
a specific icon for each direction.

Pull Request: https://projects.blender.org/blender/blender/pulls/126616
2024-08-22 20:25:51 +02:00
Harley Acheson
1d1ea87617 UI: Fix Docking Multi-Window Highlighting
When docking between multiple windows the highlight showing the icon
representing the moved area does not display correctly if the target
window differs from the source. This corrects that by using the
dpi-corrected values from the event, not win->eventstate

Pull Request: https://projects.blender.org/blender/blender/pulls/126659
2024-08-22 19:38:01 +02:00
Harley Acheson
ae3bf84f35 UI: Docking Interactive Resizing
This is a change to the docking process so that the target area SIZE
can be specified at the same time as selecting the location. This also
changes to a drag-and-drop style of mouse pointer indication.

Pull Request: https://projects.blender.org/blender/blender/pulls/126447
2024-08-22 02:38:46 +02:00
Harley Acheson
9bbe669cad Fix #126612: Area Join Exec Tag Source for Redraw
Non-interactive join - area_join_exec - needs to tag the source area
for redraw. Otherwise Outliner can attempt a partial redraw when a full
is needed, triggering an assert.

Pull Request: https://projects.blender.org/blender/blender/pulls/126615
2024-08-21 23:39:11 +02:00
Campbell Barton
83fe5712ab Fix #126525: Gizmo flickering when a Blender window is resized 2024-08-21 23:03:31 +10:00
Campbell Barton
4cea295fcb Fix #126392: Crash loading a file with "Load UI" disabled
Resolve regression in [0].

Loading a blend file from the command line with "Load UI" disabled
was crashing.

Resolve by including the window in the temporary context override.

[0]: 7fcd4e2429
2024-08-20 16:37:34 +10:00
Jonas Holzman
6e72f00d4e Fix: UI: Wrong single editor window titles due to unset area sub-spacetype
This PR moves new area space subtype update to ED_area_newspace so that
it is applied right after a new space is initialized. This is currently
done in rna_Area_ui_type_update, but after rna_Area_type_update.
Without the subtype set this can result in an incorrect titling of
single-area windows.

Pull Request: https://projects.blender.org/blender/blender/pulls/126224
2024-08-17 01:35:52 +02:00
Harley Acheson
b04c0da6f0 UI: Increase the Editor Edge Move Zone Size
This increases the hit size for the zone that allows resizing editors.
By approximately one more pixel on each side. This should make sizing
a little bit easier, especially with pens. Corner zone and region
reveal zone take precedence so I haven't found any time this causes any
interference.

Pull Request: https://projects.blender.org/blender/blender/pulls/126376
2024-08-16 21:05:38 +02:00
Campbell Barton
b5e0b59736 Cleanup: remove space around identifiers in C-style comments 2024-08-15 20:46:00 +10:00
Harley Acheson
8f996f1786 UI: Simplified Feedback for Docking
This simplifies the feedback shown while using the "Interactive Editor
Docking" experimental feature.  It removes the "X" icon shown on areas
that are removed. It does not show an icon for the areas that are left
over and altered. It only shows an icon for the active target area, and
does so without the outline of the icon. The result is a calmer
experience and it is easier to see exactly where the area is going.

Pull Request: https://projects.blender.org/blender/blender/pulls/126304
2024-08-14 00:21:39 +02:00
Campbell Barton
b1be5b15c4 Cleanup: various non functional changes
Remove struct, use string copy macros.
2024-08-10 11:32:43 +10:00
Jonas Holzman
6bb2e5a691 WM API: Improve naming of WM_window_pixels_* functions
The WM API has WM_window_pixels_{x,y,coords}` functions that returns the
window size/point coordinate in the host native pixel size.

As "pixels" in itself doesn't really mean anything the intent of
these functions wasn't really clear. To clarify this, this commit
renames their prefix from `WM_window_pixels_` to
`WM_window_native_pixel_`.

Pull Request: https://projects.blender.org/blender/blender/pulls/125994
2024-08-07 22:30:31 +02:00
Jacques Lucke
5861b078f7 Core: rename ID.flag and ID.tag values
Previously, values for `ID.flag` and `ID.tag` used the prefixes `LIB_` and
`LIB_TAG` respectively. This was somewhat confusing because it's not really
related to libraries in general. This patch changes the prefix to `ID_FLAG_` and
`ID_TAG_`. This makes it more obvious what they correspond to, simplifying code.

Pull Request: https://projects.blender.org/blender/blender/pulls/125811
2024-08-07 12:12:17 +02:00