Commit Graph

150 Commits

Author SHA1 Message Date
Pablo Vazquez
88c2c67ae4 UI: Color Interpolation Icons
Color the interpolation icons matching the new interpolation theme
settings added in 75eaecf350

This makes a clearer connection with the lines drawn in Dope Sheet.

See PR for details and screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/148215
2025-10-18 00:05:23 +02:00
Julian Eisel
2e76bb47bb Refactor: BKE: Move icon header to C++
Was trying to use a C++ type (`blender::Span`) in the header but
couldn't. I would rather not use a less safe raw pointer to a buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/148214
2025-10-16 17:45:26 +02:00
Harley Acheson
6691529dcc Fix #147926: Incorrect Icon used for Generic Collection
We have icons that represent specific individual collections. like
Icon_Outliner_Collection for a default (uncolored) collection, and
Icon_Collection_color_x for ones with colors. For "collections" as a
general thing though we have icon_group. Sometimes we confuse the two,
for example the list of tabs to show in Properties uses a different
icon than the actual category icon. This PR fixes the complaint by
using the correct icon for each of these purposes.

Pull Request: https://projects.blender.org/blender/blender/pulls/147942
2025-10-13 01:26:16 +02:00
Harley Acheson
b11093306b UI: SVG Icons for Collection Colors
A test of using multi-color SVG icons in place of the current "vector"
(custom drawn) style we are using now. These use separate colors for
the box body versus outline, shadow, handhold. Colored by the theme
colors.

Pull Request: https://projects.blender.org/blender/blender/pulls/126307
2025-10-07 02:07:28 +02:00
Campbell Barton
8f548d19c1 Fix: alpha overflow when converted to bytes with SVG icon drawing
The SVG icon outline could be over 1.0 when hovering over icons in the
outliner. This was converted to bytes and set FontBLF::shadow_color[3]
which overflowed the byte range.

Clamp the alpha before passing to BLF SVG drawing.
2025-10-02 09:46:28 +10:00
Jacques Lucke
4e4976804e Core: Add packed linked data-blocks
This adds support for packed linked data. This is a key part of an improved
asset workflow in Blender.

Packed IDs remain considered as linked data (i.e. they cannot be edited),
but they are stored in the current blendfile. This means that they:
* Are not lost in case the library data becomes unavailable.
* Are not changed in case the library data is updated.

These packed IDs are de-duplicated across blend-files, so e.g. if a shot
file and several of its dependencies all use the same util geometry node,
there will be a single copy of that geometry node in the shot file.

In case there are several versions of a same ID (e.g. linked at different
moments from a same library, which has been modified in-between), there
will be several packed IDs.

Name collisions are averted by storing these packed IDs into a new type of
'archive' libraries (and their namespaces). These libraries:
* Only contain packed IDs.
* Are owned and managed by their 'real' library data-block, called an
  'archive parent'.

For more in-depth, technical design: #132167
UI/UX design: #140870

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/133801
2025-09-26 10:53:40 +02:00
Nika Kutsniashvili
28b97afda2 UI: Theme: Generalize geometry attribute properties
This PR generalizes properties for geometry (currently mesh only) attributes
found in 3D Viewport theme, namely:

- Combine "Edge Bevel" and "Vertex Bevel" into one "Bevel" property.
- Combine "Freestyle Edge Mark" and "Freestyle Face Mark" into one "Freestyle" property.
- Remove word "Edge" from Crease, Sharp, and Seam properties, to match others.
- Group all of the above together in the UI.

This is a breaking change (that will be handled with others in migration),
but doesn't introduce any visual changes in the default theme (and almost any theme).

Pull Request: https://projects.blender.org/blender/blender/pulls/146732
2025-09-25 14:02:46 +02:00
Clément Foucault
680fec144c Cleanup: GPU: Remove prefix 'e' from enum types
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/146034
2025-09-15 15:11:02 +02:00
Damien Picard
e50d1c6ff3 I18n: Translate color icons using the Color context
Color icons for Red, Green, Blue, were introduced in c13d3e2f7a. They
are translatable but currently using the default transation context
and the `TIP_()` translation macro.

R, G, B as colors should use the BLT_I18NCONTEXT_COLOR context,
and `IFACE_()` since they are not specific to tooltips.
2025-09-12 18:30:56 +02:00
Sybren A. Stüvel
6bf8685628 Anim: drop versioning code for pre-2.50 animation
Drop all support for animation data from Blender versions 2.49 and
older.

- The `IPO` DNA struct is deleted, as is the `IDType_ID_IP` type
  definition.
- Versioning code has been removed in its entirety.
- Loading a pre-2.50 blend file will issue a warning, stating that any
  animation data that was there is now lost, and that the file should
  be loaded & re-saved with Blender 4.5 to properly port the data.

Note that versioning of Action assignments (as in, picking a slot)
still uses the tagging + updating all tagged assignments as a
post-processing step. This is necessary because picking the right slot
is only possible after all Actions (also those from libraries) have
been versioned. We might be able to address this as well, by upgrading
legacy → slotted Actions "on the fly" versioning these Action
assignments. If we do that, I think that would be better in a separate
PR though, as it could introduce issues by itself.

Ref: #134219
Pull Request: https://projects.blender.org/blender/blender/pulls/145188
2025-09-08 14:09:21 +02:00
Brecht Van Lommel
ffa4f8c7ad Refactor: Split off lighter BLI_color_types.hh from BLI_color.hh
Functions for convert between the color types and ostream support are
now outside the classes.

Many files were changed to fix cases where direct includes for headers
were missing.

Pull Request: https://projects.blender.org/blender/blender/pulls/145756
2025-09-05 11:11:32 +02:00
Brecht Van Lommel
92b555452b Refactor: Logging: Replace more printf with CLOG
Mainly for images, and a few individual cases in animation, ply, UI, and WM.

Pull Request: https://projects.blender.org/blender/blender/pulls/143447
2025-08-11 14:07:45 +02:00
Pablo Vazquez
840310f607 UI: Add Icons for Edge/Vertex Crease and others
Edge and Vertex marks such as Crease, Bevel Weight, Seam, Sharp, have
specific use cases and colors assigned to them that users get familiar
with over time.

It can be hard to remember which color belong to what, this PR tries to
address this by introducing colored icons that follow the theme setting
for that edge mark/flag.

See PR for details and screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/144075
2025-08-07 11:09:56 +02:00
Campbell Barton
62aac627a5 Cleanup: rename KM_CLICK_DRAG to KM_PRESS_DRAG for clarity
"Press drag" more accurately describes what the action does.
2025-08-02 13:41:38 +10:00
Harley Acheson
6ac9b974ea Fix #98089: Improved Alignment of Playhead and Keyframes
This PR improves alignment between playhead and keyframe indicators,
especially noticeable at small UI scale sizes where we are currently
always out by one pixel. This is because keyframe icons are all odd
widths while the playhead line is an even width. This PR mostly makes
that line an odd width, with other small adjustments.

Pull Request: https://projects.blender.org/blender/blender/pulls/142904
2025-07-31 21:36:07 +02:00
Damien Picard
f6771d8e21 UI: Improve running jobs labels
Use the form "Processing something..." (gerund, sentence case,
ellipsis) for running jobs progress label, according to Blender's
Human Interface Guidelines.

Pull Request: https://projects.blender.org/blender/blender/pulls/141573
2025-07-31 16:32:41 +02:00
Leon Schittek
6a10812fb6 UI: Improve consistency of node socket symbols
Several changes to make node socket symbols more consistent across
the UI:
* Explicitly use the node editor's theme when looking up the outline
  color for node sockets so they are consistent across editors.
* Use the proper socket drawing function in `widget_nodesocket`,
  rather than relying on the "widget base" shader to draw a colored
  circle
* `uiTemplateNodesocket` now also works in non-embossed layouts.

Pull Request: https://projects.blender.org/blender/blender/pulls/136612
2025-07-22 23:43:22 +02:00
Clément Foucault
32d64d35bb Refactor: GPU: Texture: Replace eGPUTextureFormat by TextureFormat
This offers better semantic and safety of the API.

Part of #130632

Pull Request: https://projects.blender.org/blender/blender/pulls/142818
2025-07-22 14:58:54 +02:00
Guillermo Venegas
091db9d52b Cleanup: UI: Use UI_interface_layout.hh instead of UI_interface.hh
This removes the include `UI_interface_layout.hh` from
`UI_interface_c.hh`, and in many places this swaps the include
from `UI_interface.hh` to `UI_interface_layout.hh`.

Also, cleanups some `UI_interface.hh` includes with
`UI_interface_icons.hh` or `UI_interface_types.hh`
2025-06-20 18:07:47 +02:00
Philipp Oeser
ab78ccf391 Merge branch 'blender-v4.5-release' 2025-06-19 18:41:56 +02:00
Philipp Oeser
b7b9add385 UI: actually return an icon for shapekeys in UI_icon_from_idcode
`UI_icon_from_idcode` is used e.g. from the Action Editor to indicate an
Action's Slot Type (and without the icon it is kinda hard to tell what
the slot is suited for...)

Before
![image.png](/attachments/de26790d-d7c1-4eb0-b48e-245ff201f6bf)

After
![image.png](/attachments/64f2e486-8880-424a-b793-b66503cf1087)

Discovered while investigating #140618

Pull Request: https://projects.blender.org/blender/blender/pulls/140658
2025-06-19 18:41:35 +02:00
Clément Foucault
db79a2e737 Fix: GPU: Wrong attribute types for UNORM 8bit attributes
This was a mistake inside e57359726f.
Simply replacing SNORM_8 by UNORM_8 fixes the issue.
2025-06-11 14:21:38 +02:00
Clément Foucault
e57359726f GPU: VertexFormat: Use new data types
This prevents the use of unaligned data types in
vertex formats. These formats are not supported on many
platform.

This simplify the `GPUVertexFormat` class a lot as
we do not need packing shenanigans anymore and just
compute the vertex stride.

The old enums are kept for progressive porting of the
backends and user code.

This will break compatibility with python addons.

TODO:
- [x] Deprecation warning for PyGPU (4.5)
  - [x] Deprecate matrix attributes
- [x] Error handling for PyGPU (5.0)
- [x] Backends
  - [x] Metal
  - [x] OpenGL
  - [x] Vulkan

Pull Request: https://projects.blender.org/blender/blender/pulls/138846
2025-06-10 17:20:45 +02:00
Harley Acheson
370d8956ae Fix #137735: Scale Icon Border Intensity by Icon Alpha
When an icon is drawn with both lowered opacity and a border shadow
(used to increased contrast in Light theme), it will look darker
because more of the dark shadow is visible through the icon. This PR
fixes this by scaling the shadow by the opacity.

Pull Request: https://projects.blender.org/blender/blender/pulls/139610
2025-05-30 02:48:07 +02:00
Hans Goudey
153abc372e GPU: Replace U32/I32 combination with GPU_FETCH_INT_TO_FLOAT in UI code
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
2025-05-14 15:15:21 +02:00
Harley Acheson
48403607dd UI: Status Bar Event Icons for Trackpad Gestures
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
2025-05-07 23:57:03 +02:00
Brecht Van Lommel
fb2ba20b67 Refactor: Use more typed MEM_calloc<> and MEM_malloc<>
Pull Request: https://projects.blender.org/blender/blender/pulls/137822
2025-04-22 11:22:18 +02:00
Brecht Van Lommel
637c6497e9 Refactor: Use more typed MEM_calloc<>, avoid unnecessary size_t cast
Handle some cases that were missed in previous refactor. And eliminate
unnecessary size_t casts as these could hide issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Harley Acheson
dd6b2e648e Fix #116937: Position and Size ICON_TYPE_VECTOR icons by float
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
2025-04-15 23:01:01 +02:00
Jacques Lucke
8ec9c62d3e Geometry Nodes: add Closures and Bundles behind experimental feature flag
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
2025-04-03 15:44:06 +02:00
Brecht Van Lommel
a02e0fa147 Refactor: Improve image buffer save/load function names and arguments 2025-03-27 22:07:51 +01:00
Campbell Barton
42ad772a1f Cleanup: spelling & repeated terms (make check_spelling_*)
Also use comment blocks for English text.
2025-03-27 01:13:34 +00:00
Campbell Barton
5e2b421996 WM: support the "Hyper" modifier key on Linux
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
2025-03-26 10:39:55 +11:00
Campbell Barton
241f626015 Cleanup: use a define for the number of modifiers for key-maps & events 2025-03-26 10:38:08 +11:00
Leon Schittek
821e0024d4 UI: Nodes: Add icons to socket type selection list
Add colored icons for node sockets based on the existing socket
draw function.

Resolves #89898

Pull Request: https://projects.blender.org/blender/blender/pulls/136212
2025-03-25 18:11:27 +01:00
Campbell Barton
ec511316d2 Cleanup: minor changes to wmKeyMapItem modifier comparisons
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.
2025-03-25 12:14:27 +11:00
Harley Acheson
c13d3e2f7a UI: Color Icons for Red, Green, & Blue
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
2025-03-21 01:57:32 +01:00
Campbell Barton
d616c87d03 Cleanup: spelling in comments (make check_spelling_*) 2025-03-21 11:51:50 +11:00
Bastien Montagne
dd168a35c5 Refactor: Replace MEM_cnew with a type-aware template version of MEM_callocN.
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
2025-03-05 16:35:09 +01:00
Harley Acheson
a021176ff4 UI: Show "Not Found" Icon when Not Found
In the unlikely event that an icon is requested that is not found, show
a specific icon that is meant to indicate this state, in "Error" color.

Pull Request: https://projects.blender.org/blender/blender/pulls/134959
2025-03-03 22:25:42 +01:00
Aras Pranckevicius
cc2c6692c0 Cleanup: Name more IMB things as "byte" or "float" instead of "rect" and "rectFloat"
- IB_rect -> IB_byte_data
- IB_rectfloat -> IB_float_data
- Rename some functions:
	- IMB_get_rect_len -> IMB_get_pixel_count
	- IMB_rect_from_float -> IMB_byte_from_float
	- IMB_float_from_rect_ex -> IMB_float_from_byte_ex
	- IMB_float_from_rect -> IMB_float_from_byte
	- imb_addrectImBuf -> IMB_alloc_byte_pixels
	- imb_freerectImBuf -> IMB_free_byte_pixels
	- imb_addrectfloatImBuf -> IMB_alloc_float_pixels
	- imb_freerectfloatImBuf -> IMB_free_float_pixels
	- imb_freemipmapImBuf -> IMB_free_mipmaps
	- imb_freerectImbuf_all -> IMB_free_all_data
- Remove IB_multiview (not used at all)
- Remove obsolete "module" comments in public IMB headers

Pull Request: https://projects.blender.org/blender/blender/pulls/135348
2025-03-03 17:11:45 +01:00
Hans Goudey
d0a6189b50 Refactor: DRW: Centralize and clean up packed normals conversion
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
2025-02-24 16:08:30 +01:00
Harley Acheson
5956752eb7 UI: Themeable RedAlert, Error, Warning, Info Colors
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
2025-02-12 20:59:47 +01:00
Campbell Barton
df3d1bf506 Cleanup: use const arguments & variables where appropriate 2025-02-05 14:38:56 +11:00
Julian Eisel
1f88645728 UI: Draw loading icon while previews load
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
2025-02-03 16:03:06 +01:00
Brecht Van Lommel
3725fad82f Cleanup: Various clang-tidy warnings in editors
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Julian Eisel
9d83061ed4 UI: Don't re-query invalid preview images from disk
Loading a custom preview/icon from disk can fail, e.g. if the image file
is corrupted. This was never handled that well, and I think since
315e7e04a8 we'd continuously re-query such previews.

Fixes #133617.
Also needed for #131871.

Pull Request: https://projects.blender.org/blender/blender/pulls/133679
2025-01-28 19:32:54 +01:00
Julian Eisel
315e7e04a8 UI: Avoid double scaling of preview images, improve filtering
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
2025-01-24 19:46:33 +01:00
Brecht Van Lommel
890455affe Refactor: Rename function to clarify it's for sRGB only
Pull Request: https://projects.blender.org/blender/blender/pulls/133368
2025-01-21 18:05:56 +01:00
Hans Goudey
c6f5c44350 Cleanup: Remove unused includes in editors modules
Pull Request: https://projects.blender.org/blender/blender/pulls/133166
2025-01-16 23:17:51 +01:00