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.
The Windows and Wayland platforms can both create antialiased mouse
cursors from SVG sources. Platforms with WM_CAPABILITY_CURSOR_RGBA
can therefore show a better version of "WM_cursor_time". Instead of
four blocky digits in two rows this displays beautiful digits in a
single row.
Pull Request: https://projects.blender.org/blender/blender/pulls/141367
Regression in 3.6 caused the orthographic camera gizmo to enter a
feedback loop where the gizmo range was changed while being interacted
with.
Resolve by preventing the range being updated during modal interaction.
Blender expects float buffers to be in scene linear space, which was
violated bu the 1012bit movie reading code. While such image buffers
can be displayed correctly, performing operations in various areas
of Blender might lead to unexpected results.
The non-linear colorspace for ImBuf is expected to be "internal-only"
to a specific area, like VSE.
This is only done for Image and MovieClip data-blocks, sequencer still
reads movie files in their original colorspace as it helps performance and
sequencer can not be referenced from places where linear colorspace
for float buffer is really important.
Pull Request: https://projects.blender.org/blender/blender/pulls/141603
The numeric levels have no obvious meaning. This removes the distinction
between severity and levels, instead there is a single list of named levels
with defined meaning.
Debug means information that's mainly useful for developers, and trace is for
very verbose code execution tracing.
Pull Request: https://projects.blender.org/blender/blender/pulls/140244
* Remove bke, ed and wm prefixes
* Add prefixes like: geom, object, blend, lib.
* Shorten some category names
* A few log level changes to improve --log-level info output
Pull Request: https://projects.blender.org/blender/blender/pulls/140244
When selecting gizmos (such as one of the scale handles in the
Transform tool), the depth test state does not match what is shown in
the viewport. This can lead to unintuitive gizmo selection.
The issue is caused by the incorrect assumption that the depth state is
already `GPU_DEPTH_NONE` before rendering the gizmos for selection.
The solution is to ensure the status before rendering.
Pull Request: https://projects.blender.org/blender/blender/pulls/141412
This commit takes the previously defined `Paint_Runtime` struct and
moves it into the BKE namespace, initializing it on demand instead of it
being a default-allocated member. This data does not need to be
persisted and is runtime only.
Pull Request: https://projects.blender.org/blender/blender/pulls/141413
This renames `UI_block_layout` API as `blender::ui::block_layout`,
following uiLayout refactors.
This function now returns a layout reference instead of pointer,
this changes applies this return type where the layout can be used
as such reference.
Changes includes the use of `blender::ui::LayoutDirection` and
`blender::ui::LayoutType` as typed enum parameters.
Part of: #117604
Pull Request: https://projects.blender.org/blender/blender/pulls/141401
Currently drag and drop expects to selection to be in the same folder,
but blender internal file browser allows to select files from different
folders when recursion is active.
When writing to operator properties the `directory` is taken now from
the first file provided, and `files` are now relative to this
`directory` instead of just taking the file name.
When reading from operator properties filepaths are normalized.
I notice this issue while reading about #140942, the issue would
require a proper fix too.
Pull Request: https://projects.blender.org/blender/blender/pulls/140948
While calculating the scaling factor when rasterizing SVG files to
cursors there is an extra code line left in that was only used
during testing. Basically the size is correctly calculated and then
this extra line does it again, but in a different way. This can result
in the very bottom single line of the cursor being cut off at some
sizes.
Pull Request: https://projects.blender.org/blender/blender/pulls/141410
When playing back render result a separate process is started for
playback. This process didn't call the GPU_context_frame_begin/end
functions resulting in post-poning destroying discarded resources until
the playback process was 'exited'.
Pull Request: https://projects.blender.org/blender/blender/pulls/141376
Avoid overly long paths in the title bar using the `~` prefix.
Based on feedback from !141059 there is consensus on supporting this
on Linux, that PR also supports abbreviations on other systems but
platform maintainers had concerns (see PR for details).
Apply the functionality for generic Linux/Unix systems,
the functionality for other platforms can be evaluated separately.
Follow up to #140668 that fixes the same issue when using multiple
windows & scenes. This is needed as the active tool can apply to
multiple scenes.
Ref !141260
Rename `render_bmp` to `bitmap_rgba` since BMP has an assassination
with the BMP file format, and this is an RGBA equivalent of an existing
`bitmap` variable.