Expose existing mask operators as tools in the toolbar.
The primitive tools are commented out since interactively placement
isn't currently supported by the operators.
Ref !136086
Operators registered after the key-map was initialized would not have
their user customization's loaded from user preferences.
Resolve by tagging the keymap to be updated when appending operators
as well as removal, this only runs the updates when appending
operators after startup.
May also resolve#126641.
* Replace G.quiet by CLG_quiet_set/get
* CLOG_INFO_NOCHECK prints are now suppressed when quiet, these were
typically inside a if (!G.quiet) conditional already.
* Change some prints for blend files, color management and rendering to
use CLOG, that were previously using if (!G.quiet) printf().
Pull Request: https://projects.blender.org/blender/blender/pulls/143138
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.
Use `BLI_strncpy_utf8` & `BLI_snprintf_utf8` for fixed size buffers in
DNA and screen data structures such as panels, menus & operators.
This could be considered a fix as copying a UTF8 string into a smaller
buffer without proper truncation can create an invalid UTF8 sequence.
However identifying which of these users are likely to run into would
be time consuming and not especially useful.
Some small tweaks to the messagebox shown when users have graphics
hardware or driver that might not work. The phrase "Your graphics card
or driver has limited support" changed to "Your graphics card or driver
version has limited support" to better indicate the driver has
versioning. "Newer graphics drivers may be available to improve Blender
support." changed to "Newer graphics drivers might be available with
better Blender compatibility." The message saying "Blender will now
close" only shown if Blender will close.
Pull Request: https://projects.blender.org/blender/blender/pulls/142999
This PR switches out the internal scene context function
used from the sequencer. This is done in preparation for
#140271.
Using a separate context function allows us to keep the
existing `context.scene` to refer to the active scene
and use a separate context member to refer to the
sequencer scene in the workspace (which is added in #140271).
Previous attempts simply overrode the `context.scene`
to refer to a different scene than the active one in the window.
This has two issues:
1) Any operator that wants to use the active scene in the window
can't do it in the context of the sequencer. This is a problem for
example for poll functions of operators that don't have anything to
do with the sequencer.
2) For better or for worse, Blender expects the `context.scene` to
always exist. For the sequencer, we'd like to possibly have no
sequence selected.
Using a different context member for the sequencer has some
advantages:
1) Although we have to change quite a few places, it's limited to the
sequencer. We don't have to change other parts of Blender to make
things work.
2) It allows us to prepare for the future when we might want to
separate the VSE from the scene. This is a step in that direction.
Having a different context function makes it easy to find the places
that would need to be refactored.
Pull Request: https://projects.blender.org/blender/blender/pulls/141271
This converts `eButType` and `eButPointerType` as typed enums.
This improves a bit `uiDefBut` self-documentation by taking an
struct with `ButType` and `ButPointerType` types, instead of
using a single `int` to write both enum types and bit index.
Almost all other `uiDefBut*` functions take just a `ButType`
parameter now.
`uiDefButI` for example is equivalent to:
`uiDefBut({ButType(type), ButPointerType::Int},...);`
Pull Request: https://projects.blender.org/blender/blender/pulls/142132
- Cursors in wayland are expected to use pre-multiplied alpha.
Note that cursor generators create straight alpha,
pre multiplier in the wayland backend.
- Invert cursor colors on Wayland since dark cursors are often default,
this could use dark theme settings in the future.
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
This PR introduces a more precise sleep function `BLI_time_sleep_duration`
using high-resolution timers on Windows. By default, Windows only has a
resolution of 15.25ms for the regular `Sleep` function. Using more precise
timers makes sure that Blender can wake from sleep quicker and improves
performance at high frame rates.
High-resolution timers may have better energy efficiency than using
`timeBeginPeriod`/`timeEndPeriod` that change the timer resolution globally
on some versions of Windows.
Pull Request: https://projects.blender.org/blender/blender/pulls/140221
Recent fix to ensure cursors never display negative numbers [0]
didn't work when the input value was std::numeric_limits<int>::min().
Resolve using an unsigned cast before negating.
[0]: 747ab523c3
Displaying negative numbers would attempt to read from a negative
array index on systems that don't support RGBA cursors.
Resolving by making the value absolute before displaying.
- Use a bounding box based on the fonts dimensions to fix jittering
as numbers change because of differences in glyph bounds.
- Always show a cursor even if the text is empty.
- Use integer arithmetic to simplify bounds calculations and avoid
having to round the resulting values.
- Increase the maximum width of the text to twice the cursor size
since the text could be quite small when limited to the cursor size.
- Extract buffer flip-Y into a function.
- Define CURSOR_HARDWARE_SIZE_MAX and reuse this constant.
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
The C++ Vector container has the benefits of the older C type,
along with improved performance, better type and memory safety,
and significantly improved ergonomics.
Pull Request: https://projects.blender.org/blender/blender/pulls/141759
When calculating the font size clamp by the requested cursor size
instead of 256.
This will often make the cursor smaller since allowing 256px wide
cursors is quite large.
Also de-duplicate size checks & round the text size to an integer to
avoid fractional scaling from subtle changes to the text.
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.
- Use "g_" prefix for cursors to signify that it's global but local to
the file.
- Use `const` cast passing pixel data to GHOST_SetCustomCursorShape.
- Remove redundant cast.