BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:
- Move it out into a separate BLI_enum_flags.hh header, instead of
"random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
bit value. This originally was added in a31a87f89 (2020 Oct), in
order to silence some UBSan warnings that were coming
from GPU related structures (looking at current GPU code, I don't
think this is happening anymore). However, that caused actual
user-visible bugs due to incorrectly specified max. enum bit value,
and today 14% of all usages have incorrect highest individual
bit value spelled out.
- I have reviewed all usages of operator ~ and none of them are
used for directly producing a DNA-serialized value; all the
usages are for masking out other bits for which the new ~
behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
that are set in C++ enum class cases; update existing cases to use
that instead of three other ways that were used.
Pull Request: https://projects.blender.org/blender/blender/pulls/148230
Add a command line option to load Blender without a window frame.
Currently this is only used on Wayland, enabled for WITH_UI_TESTS since
attempting to load LIBDECOR caused the tests to crash on start on Fedora.
For tests there is no need to use LIBDECOR, so disable the window frame.
This can also be used by users who don't want to use the X11 fallback if
LIBDECOR can't be found.
Ref !147716
Includes the following changes to the existing Locomotion system for VR Scene Inspection:
* new VR Navigation Preferences and VR Session Settings
* changes to XR raycast logic and its visualization
* new XR vignette that appears when moving
* snap turning
Pull Request: https://projects.blender.org/blender/blender/pulls/144241
The fix introduced a high severity bug where exiting Blender after
working with the GPU compositor crashes Blender. We consider #144526 to
be less severe than the newly introduced bug, hence the revert for now.
This reverts commit b2b23e3619.
Pull Request: https://projects.blender.org/blender/blender/pulls/146096
This PR adds code for setting the Quality of Service (QoS) level of the
process on Windows. This can, e.g., make sure that on hybrid systems
P-cores are utilized even when the app window is out of focus.
In the following cases, it is adjusted from the default behavior:
- In wm_jobs.cc the QoS level is raised while a priority job is running.
- The command line option `--qos [high|eco|default]` can be used to
change the QoS level of the process.
- By default, the QoS level is raised for the EEVEE performance tests,
as they check viewport rendering performance and would otherwise be
reliant on never going out of focus to not get a downgraded QoS level.
By default, they are created with an out of focus window at the time
of landing this PR. This PR makes sure that they actually measure the
animation replay performance attainable during real-world use.
Pull Request: https://projects.blender.org/blender/blender/pulls/144224
* Improve accuracy of warning when HDR display is not supported, taking into
account HDR mode on/off on Windows.
* When HDR mode is disabled on Windows, don't create a HDR swapchain. This
saves memory, and avoids a color difference on NVIDIA. That's because NVIDIA
is the only GPU we've tested that allows a HDR swapchain when HDR mode is
off, and we don't currently know the expected transforms for that case.
* Recreate swapchain when HDR mode on/off switch is detected.
* Update HDR info when window gains focus.
Note this means there is no wide gamut when Windows HDR is off, but it was
already not working. For that we may need to add support for something like
10bit VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, or whatever is commonly
available outside of HDR mode.
Pull Request: https://projects.blender.org/blender/blender/pulls/144959
The crash is caused by libepoxy GL functions pointing to nullptrs.
libepoxy "Automatically initializes as new GL functions are used.",
so to call a function without a GL context bound, the function must
have been called before with a bound context.
This PR ensures there's a valid GL context bound for the whole
`WM_exit` scope.
(4.5 backport candidate)
Pull Request: https://projects.blender.org/blender/blender/pulls/144572
wm.progress displayed a percentage in a cryptic
2x2 grid of numbers, so:
```
75
23
```
Represents `75.23%`. This is now shown as `75.23%`
on systems that support RGBA cursors.
Support showing vector cursors at the appropriate size based on each
monitors DPI.
This solves incorrectly sized cursors with Hi-DPI outputs as well as
supporting outputs with different DPI's.
Instead of passing pixel data, pass an object that can generate cursors,
GHOST/Wayland can then ensure the correct size is used based on the
display the cursor is shown on.
While may sound overly complicated it actually simplifies displaying
cursors on Wayland, especially for multiple monitors at different DPI's.
Showing cursors at higher or lower resolutions than the monitor's DPI
also behaves differently on GNOME & Plasma, resulting in situations
where the cursor would show larger/smaller than expected.
Details:
- Take advantage of the recently added SVG cursors & BLF time cursor
!140990 & !141367.
- Setting bitmap cursors via GHOST_SetCustomCursorShape is now a no-op
for Wayland since it's no longer used. This was supported in an
earlier version of this PR and could be restored if needed.
- While fractional scaling works it relies on the compositor downscaling
the cursors. Ideally they would be rendered at the target size but
this isn't a priority as the difference isn't noticeable.
Ref !141597
Different operations may need to lock different part of the interface,
e.g. for rendering, the image editor may still need refreshing while the
interface is locked, but when baking data into a scene, the image editor
needs to be locked because it is not thread safe to get data from a
partially evaluated depsgraph.
This is a better fix on top of 7c8b8b2457
that addresses the root cause with more flexibility for future
operations that requires different interface locking strategy as
well.
Pull Request: https://projects.blender.org/blender/blender/pulls/141866
Instead of relying on the the `U.ui_scale` being set when activating
the window, calculate the cursor size from the windows DPI.
This also de-duplicates cursor scale calculation.
This PR replaces our current custom mouse cursors (defined in
wm_cursors.cc using bitmaps and masks that we edit with a python
program) with SVG sources that are rasterized at the exact size when
needed. For Windows this would also replace the 29 platform-specific
"cur" files, although this PR does not actually remove those. For Linux
this creates the same kind of cursor as now (1bpp XBitMap) but at a
better size.
Pull Request: https://projects.blender.org/blender/blender/pulls/140990
Apply the "Zoom direction" preference to the rotation axis.
Until now, this preference was limited to translations.
Note that the X/Y swap is now applied in the accessor functions instead
of wmNDOFMotionData::tvec because swapping the X/Y axis doesn't work
well in some cases (color picker for example), and it's confusing
of axis swapping is handled in different parts of the code for
rotation & translation.
Ref !140975
Co-authored-by: Patryk-Skowronski <patryk_skowronski@3dconnexion.com>
The theme cursor size was ignored when setting custom cursors
such as the knife, only the DPI from GHOST was taken into account.
This meant cursors such as the knife would sometimes display too small.
Now when the theme-size is larger, a larger cursor will be used.
Currently the theme size is read from XCURSOR_SIZE environment variable
however it may be read from the system preferences in the future.
Also fix the software cursor sizes which incorrectly used the UI scale
preference which is ignored by cursor sizes.
Restore expected behavior of the NDOF, especially in the context of
non-3D editors. It addresses the following issues:
- Object mode, 3D viewport:
With "Lock Horizon" off, the rotation axes will invert unexpectedly,
making the camera behave similar to a "Fly mode".
- Fly mode, 2D editors:
Changing a navigation mode to "Fly" makes no effect.
Applies to UV and Nodes editors, Camera Preview etc.
Related to #140165
This includes some minor API changes back-ported from `main`
since the PR was created for `main`.
Co-authored-by: Patryk-Skowronski <patryk_skowronski@3dconnexion.com>
Ref !140537
- Use return values for NDOF access functions.
- Pass in event data by const reference as this is never null.
- Don't scale the angle from WM_event_ndof_to_axis_angle by the time
delta since other functions don't do this, it's strange to make
this an exception.
- Replace the term "pan" with "translation" since pan in Blender
typically refers to moving the view in 2D using cursor input,
not 3D transaction.
- Use a more descriptive term "time_delta" for the time between NDOF
motion events.
- Pass the exit code back from WM_main_playanim instead of calling exit.
- Errors are printed to the stderr.
- Resolve some leaks on exit.
Note that this addresses noisy leaks reported by ASAN which were
flooding the output, but doesn't attempt to address all leaks.
- Navigation modes has been redefined a bit and introduced in a form of
an enum so that new ones can me implemented in the future.
Additionally switching between modes shouldn't require any additional
configurations like inverting all the axes.
Currently there are only 2 modes implemented,
but 2 more are planned and will be proposed in follow-up PRs.
Implemented modes are:
- Object: works like "Orbit" option.
but has all axes implicitly inverted
- Fly: works the same as "Free".
- "Turntable" option has been turned into "Lock Horizon".
This single option works for both normal navigation and Fly/Walk
modes now.
- Pan and Rotation axes inversion has been removed from default
configuration.
- UI has been simplified following the design from #136880.
- Zoom Invert has been removed since it looks like a duplication of
`NDOF_PANZ_INVERT`.
Ref !139343
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.
Pull Request: https://projects.blender.org/blender/blender/pulls/139596
Regression in [0] which incorrectly swapped the check for the
`use_scripts` property being set with the value it was set to.
Resolve this error as well as the "Recover Last" operator
which never worked.
[0]: 8c688a052c
Part of #82877
When drawing specialized cursors for the different paint modes via the
`wmPaintCursor` draw callback, tablet tilt direction is unavailable to
use to customize the drawing for the user.
To enable this functionality, this commit adds the `x_tilt` and `y_tilt`
data read while processing MOUSEMOVE events to the `eventstate` variable
so it can be used by consuming functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/137189
Use enum types for event modifier and types,
`wmEventModifierFlag` & `wmEventType` respectively.
This helps with readability and avoids unintended mixing with other
types. To quiet GCC's `-Wswitch` warnings many `default` cases needed
to be added to switch statements on event types.
Ref !136759
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.
This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.
It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.
Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.
No functional changes expected.
Ref !136227
Part of #134755 / #134766.
Adds options to the new Import Settings popover (added in 7a6beb65f4)
to toggle collection instancing for dragging in collections. It can be
toggled separately for linking and appending, since it's typical to use
instancing for linking, but not appending (current default, also with
this change).
Previously, toggling collection instancing was only possible via the
Adjust Last Operation panel but this wasn't obvious, many people were
not aware. Adding this option based on feedback by the Blender Studio.
Pull Request: https://projects.blender.org/blender/blender/pulls/135996
WM_report was originally added for special cases however new code
has been using this in operators for example, where reports should be
sent to the operator via BKE_report, so the caller can handle,
and so Python can catch the errors.
Rename the functions to make them less easily confused with BKE_report
and add a code-comment on why their use should be avoided.
Also use Vector to store menu search items instead of a linked
list. And extend the change into the autocomplete API slightly.
The main benefit is to avoid measuring the length of strings over
and over, but the code also gets simpler.
- Expand on the code-comment regarding tests & WM_capabilities_flag and
move it from the caller into the functions body since this is useful
for other callers, also mention in the doc-string.
- Use a common prefix for `WM_window_decoration_style_*` functions.
- Add a doxy-section for decoration style functions.