The conversion from int to float is not supported natively
so it ends up happening beforehand on the CPU or as a
step before the vertex buffer can be used. It's better to just
upload floats in the first place.
Related to:
- 1e1ac2bb9b
- 617858e453
Pull Request: https://projects.blender.org/blender/blender/pulls/138855
Adding three icons to represent panning, rotate, and zoom gestures
and using them for status bar event icons for
GHOST_kTrackpadEventScroll, GHOST_kTrackpadEventRotate, and
GHOST_kTrackpadEventMagnify.
Pull Request: https://projects.blender.org/blender/blender/pulls/138569
We have an icon type called ICON_TYPE_VECTOR that are dynamically drawn
at runtime. These are created in icon_draw_size, which takes float
positions, but their callbacks all use integers instead. Truncating so
early in the process takes away flexibility to draw these at more ideal
sizes or to center them better. The complaint is a situation where we
mix ICON_TYPE_VECTOR for the colored collections and ICON_TYPE_SVG_MONO
for the white ones. Even though they both ultimately just draw the same
SVG icon the former way truncates position and size so there are times
they won't exactly line up.
Pull Request: https://projects.blender.org/blender/blender/pulls/132338
This implements bundles and closures which are described in more detail in this
blog post: https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/
tl;dr:
* Bundles are containers that allow storing multiple socket values in a single
value. Each value in the bundle is identified by a name. Bundles can be
nested.
* Closures are functions that are created with the Closure Zone and can be
evaluated with the Evaluate Closure node.
To use the patch, the `Bundle and Closure Nodes` experimental feature has to be
enabled. This is necessary, because these features are not fully done yet and
still need iterations to improve the workflow before they can be officially
released. These iterations are easier to do in `main` than in a separate branch
though. That's because this patch is quite large and somewhat prone to merge
conflicts. Also other work we want to do, depends on this.
This adds the following new nodes:
* Combine Bundle: can pack multiple values into one.
* Separate Bundle: extracts values from a bundle.
* Closure Zone: outputs a closure zone for use in the `Evaluate Closure` node.
* Evaluate Closure: evaluates the passed in closure.
Things that will be added soon after this lands:
* Fields in bundles and closures. The way this is done changes with #134811, so
I rather implement this once both are in `main`.
* UI features for keeping sockets in sync (right now there are warnings only).
One bigger issue is the limited support for lazyness. For example, all inputs of
a Combine Bundle node will be evaluated, even if they are not all needed. The
same is true for all captured values of a closure. This is a deeper limitation
that needs to be resolved at some point. This will likely be done after an
initial version of this patch is done.
Pull Request: https://projects.blender.org/blender/blender/pulls/128340
Add support for a 5th modifier key called "hyper",
this is a modifier supported on Wayland & X11 although
other platforms could support an additional modifier too.
Both GNOME and KDE can map CapsLock to Hyper.
Other compositors can use the XKB_DEFAULT_OPTIONS environment variable.
This allows users to have an additional modifier for their own use
that doesn't conflict with other keys.
Ref !136340
Some of the existing logic checked that modifiers were KM_MOD_HELD,
other logic checked the value wasn't KM_NOTHING or KM_ANY.
Simplify checks by comparing against KM_MOD_HELD in all cases
as this won't be set to other values.
This adds icons for ICON_RGB_RED, ICON_RGB_GREEN, and ICON_RGB_BLUE
that display with those colors. This does not remove the existing
monochrome ICON_COLOR_* icons. This also allows the translation of
the "R", "G", "B" characters shown, for languages that prefer color
words that do not start with these.
Pull Request: https://projects.blender.org/blender/blender/pulls/136154
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.
* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.
Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.
Following discussions in !134452.
NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.
Pull Request: https://projects.blender.org/blender/blender/pulls/134771
Move the code dealing with converting float3 to GPU normals
out of the vertex format header into a separate header. Use a
proper C++ namespace and remove duplication by only using
the more recently added C++ templated conversions.
Most of the diff comes from the removal of the indirect includes
from GPU_vertex_format.hh. A lot of files ended up mistakenly
depending on that.
Pull Request: https://projects.blender.org/blender/blender/pulls/134873
The "Red Alert" color is currently hard-coded, which causes problems in
themes. It also has an Enum value of 0, which precludes using this
value as "unset". We also use Error, Warning, and Info colors that are
part of the Info Editor. This PR moves these out of the Info Editor
and into the "State" part of the theme. And then makes TH_REDALERT use
the TH_ERROR color.
Pull Request: https://projects.blender.org/blender/blender/pulls/131127
Show a dimmed loading icon while previews are being loaded in a
background thread. The asset shelf and asset/file browsers do this
similarly already.
This is implemented in drawing code, so the loading icon will always
appear when an in-progress preview is being drawn. I experimented with
doing this in `ui_def_but_icon()`, but this won't update correctly with
popups that don't support full refreshing.
This also makes any normal icon that is drawn as preview use the normal
icon size. These icons are usually made for smaller sizes and look very
outblown when displayed at the size of a preview. Yet it's useful to
sometimes pass a normal icon. E.g. for the asset shelf we would already
draw the data-block type icon in place of the preview if there was no
preview to display, and we'd use the normal, smaller size already.
Larger can still be drawn differently.
I don't know of any current cases this would affect though.
Pull Request: https://projects.blender.org/blender/blender/pulls/133880
When loading preview images from disk, we'd first scale them to the
standard preview image size (in `icon_copy_rect()`) and then scale them
again to the drawing size when eventually drawing to screen. The first
scaling would happen on the CPU, which is slow, and without filtering.
Now the image is stored in its original size and only scaled when
drawing, which uses scaling on the GPU with mipmaps and bi-linear
filtering. While a bit more blurry, the resulting image has less
artifacts and represents the original image better. Keeping the images
unscaled means memory footprint is bigger, we could cap the size if
necessary.
Noticed while working on #131871. Asset shelf previews would have more
artifacts than before.
See pull request for comparisons.
Pull Request: https://projects.blender.org/blender/blender/pulls/133559
Requesting an icon from an invalid icon ID was always handled
gracefully, resulting in the icon not being shown and an error print in
debug mode. 2b7a968909 caused a null pointer dereference in that case,
leading to a crash.
Changing Icon Alpha in Preferences / Themes / User Interface / Styles /
Icon Alpha is meant to change the opacity of the UI icons. It should not
change the opacity of the previews of Matcaps and Studio lights as this
changes the color because of mixing with the background. This PR just
skips this icon type when changing the alpha for this preference.
Pull Request: https://projects.blender.org/blender/blender/pulls/131690
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.
For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`
For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`
Resolves#127374.
Pull Request: https://projects.blender.org/blender/blender/pulls/128604
In order to recolor icons based on themes, some svg icons have specific
ID names. These names are currently of the pattern "blender.some_name".
However, although CSS ID names are allowed to contain a period in them,
these are problematic as selectors. This is because #tagname.something
looks like a combination of ID and class name. Although these can be
escaped like #tagname\.something that is a pain. This PR replaces the
periods with underscores.
Pull Request: https://projects.blender.org/blender/blender/pulls/126709
API: merged IMB_scalefastImBuf, IMB_scaleImBuf, IMB_scaleImBuf_threaded
into one function IMB_scale with enum IMBScaleFilter {Nearest, Bilinear, Box}
and bool "threaded" param.
Performance:
- Box filtering (nee IMB_scaleImBuf) can be multi-threaded now.
- Nearest filtering (nee IMB_scalefastImBuf) can be multi-threaded now.
Also fix performance regression on float images caused by fix in #126234
- Bilinear filtering (nee IMB_scaleImBuf_threaded) is several times faster now.
Correctness:
- Nearest and Box filtering: no longer loses half of edge pixels when scaling
up.
- Box: fixed garbage results (and possible out of bounds reads) for non-4
channel float images.
- Bilinear: no longer shifts image when scaling up.
- Bilinear: properly filters when scaling down by 2x2.
Test coverage:
- Add gtest coverage for various IMB_scale modes.
- Add a IMB_performance_test performance test, ran manually.
More details, images and performance numbers in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/126390
#125625 moved the File Browser Thumbnail type icon location from the
bottom-left of the thumbnail extent to the bottom-left of the item
bounds. This does the same for the indication of offline and for
shortcut. This adds a new icon for shortcut instead of current use of
ICON_LOOP_FORWARDS, which doesn't look right. The new icon looks like
the Mac Alias arrow, but this also works fine for other platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/126469
Show the autokeying indicator (record button) on the Timeline header in
red when enabled. With a white outline on dark theme, or with a black
outline on light theme. The red color is user changeable.
Pull Request: https://projects.blender.org/blender/blender/pulls/126344
For the times we need to obtain the bitmap of an SVG icon, send these
through the new theme coloring callback if they are multi-color. This
removes some code duplication by adding a new function that gets an
imBuf from SVG Icon. This allows, for "About" logo, Dialog icons, and
file system icons the optional ability to use a single SVG source file
that works as both monochrome (themed by text color) or multicolor with
internal parts themed.
Pull Request: https://projects.blender.org/blender/blender/pulls/126215
Allow color SVG icons to have their fill colors modified by theme
colors using a callback. This is done just before rasterization so
only happens once per requested size, before these are cached for
reuse.
Pull Request: https://projects.blender.org/blender/blender/pulls/125146
When we draw SVG icons we have an optional argument that specifies to
treat it as multicolor. This PR allows doing the same thing when
requesting a bitmap from an icon. This is only currently done for
Dialog boxes and the About screen. The purpose of this isn't really
to allow multicolor dialog icons, but to get to the point where a
single SVG source file could be used as monochrome (changing the one
color with text color) or multi-color (changing internal colors with
themes) without needing multiple copies of the source file
Pull Request: https://projects.blender.org/blender/blender/pulls/126193
This PR corrects some mistakes in the conversion between RGBA bitmaps
created when rasterizing SVG icons and the monochrome coverage maps
when displaying these in a single color. This only occurs when we need
a bitmap from an icon for About screen and for dialogs. The bitmap
from NanoSVG is already premultiplied so don't do it again. When
converting from coverage map to RGBA use map value for all components
rather than FFF for colors. When converting to coverage map from RGBA
use perceptual grayscale level of color, not just alpha value.
Pull Request: https://projects.blender.org/blender/blender/pulls/126192
When we use icons that are multi-color, like for Tool icons, we'll
still need the ability to change their alpha at runtime. We do this
for hover effects, and as a theme setting.
Pull Request: https://projects.blender.org/blender/blender/pulls/126063
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
Refactor of how "event icons" are created, using custom SVG icons for
key outlines and some complex keys. Allows multiple key widths so that
"Ctrl", "Insert", etc can be readable. Strings are automatically sized
rather than hardcoded. Also allows these strings to be translated.
Supports the UI icon alpha preference. Also supports local aspect in
case we ever want to allow 2D zooming there.
Pull Request: https://projects.blender.org/blender/blender/pulls/125591
We have a number of event icons, used on the Status Bar, to indicate
mouse actions. It is currently difficult to align these nicely because
they vary in width and design. This PR makes them all the same design
width and aligned to the left edge. This removes a need to add negative
spacing before any of them and only requires space after some of them.
This also adds a new one to indicate "double left click" as my current
use of this looks a bit sus. This also adds a "mouse wheel scroll"
Pull Request: https://projects.blender.org/blender/blender/pulls/125731
Commit adds support for new format of RawInput packets used by
3Dconnexion devices: SpaceMouse Enterprise, Keyboard Pro and Numpad Pro
specifically. This required distinguishing processing button data
delivered as a bitmask and as a numbers array.
Basically it allows for using said devices buttons in Blender including
using these buttons in shortcuts.
Changes work only for Windows. MacOS will allow only for older format
that is bitmask.
Details:
- NDOF button event values have been moved into the public GHOST_Types.h
header and are no longer aligned to the WM event values.
This was done so the values could be changed to match hardware/drivers
without breaking key-maps stored in user preferences.
- Keyboard Pro and Numpad Pro buttons are not currently used because
they don't map to any standard keyboard events.
These could be supported, see the PR for details.
Ref: !124155
Properties category icons with new SVG icons are slightly brighter than
before, and therefore do not seem to brighten on hover. This PR makes
them match exactly. Was assigning an alpha instead of multiplying. And
an earlier refactor for outlines made these icons not show initially
dimmer unless there is also an outline.
Pull Request: https://projects.blender.org/blender/blender/pulls/125029
A rename of the icon type ICON_TYPE_MONO_TEXTURE to ICON_TYPE_SVG_MONO
to better reflect the underlying function. This new name makes a nice
matched set with new ICON_TYPE_SVG_COLOR used for SVG in full color.
Pull Request: https://projects.blender.org/blender/blender/pulls/123957