Commit Graph

8402 Commits

Author SHA1 Message Date
Guillermo Venegas
eed8e10b91 Refactor: UI: Remove uiItemIntO API
This function has not python equivalent, using the
returned pointer to write properties seems enough
as equivalent as how is done in python.

Also, this removes the unused `uiItemFloatO` API.

Pull Request: https://projects.blender.org/blender/blender/pulls/139355
2025-05-24 16:15:51 +02:00
Pratik Borhade
0ad79ca541 Fix #139170: Regression: The Linked Node Group Socket Name is Editable
This probably have occured after migration from UIList. When nodetree ID
is linked form another file, disable the layout for individual rows and
the add/remove operator. Also tweak `supports_renaming()` function so that
individual tree element cannot be renamed when linked.

Pull Request: https://projects.blender.org/blender/blender/pulls/139269
2025-05-23 12:19:41 +02:00
Jacques Lucke
1307137f27 Nodes: clarify socket visibility methods
Node sockets have many different aspects that affect their visibility and
whether they are grayed out. This patch cleans up the methods used to check if
sockets are visible and adds descriptions that should make it more obvious which
ones should be used.

This also fixes a few places where the wrong method was used which is more
obvious now.

Pull Request: https://projects.blender.org/blender/blender/pulls/139251
2025-05-23 06:10:03 +02:00
Guillermo Venegas
99e9b2522b Refactor: UI: Remove uiItemBooleanO API
This function has not python equivalent, using the
returned pointer to write properties seems enough,
equivalent to how it is done in Python.

Pull Request: https://projects.blender.org/blender/blender/pulls/139295
2025-05-23 01:07:12 +02:00
Hans Goudey
cb77f6fd14 Cleanup: UI: Remove unused arguments for operator buttons 2025-05-22 16:26:46 -04:00
Guillermo Venegas
b3eb84f624 Refactor: UI: Remove uiLayout::op id properties parameter
This was an alternative way to write properties for layout operator buttons,
for the most cases are more than enough to use the returned pointer.

There were just 2 cases where this was useful, the quick access menu
that reuses operator property values, this now overrides the id property group
data pointer generated for the operator, also for `uiItemsFullEnumO_items`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139242
2025-05-22 20:19:18 +02:00
Campbell Barton
99a4c93081 Cleanup: inline array sizes in code-comments
Use a similar convention for struct member identifiers,
(the identifiers without surrounding spaces). This allows the values
to be scanned and validated.
2025-05-23 00:41:39 +10:00
Jacques Lucke
9ac3e44ce6 Spreadsheet: move context path to left side bar
Previously, we were drawing the context path in the header of the spreadsheet.
However, that had some problems:
* When using a viewer that's somewhere deep in a node group, the viewer path
  wouldn't fit.
* Standard editor menus didn't fit in. Also we wanted to add spreadsheet
  specific operators that should be in a new menu.
* Couldn't fit more useful data for the context path (like the inspection index
  for repeat zones).

This patch solves this by moving the entire context path to the left side bar.
This frees up the header for menus.

The new context panel information is added at the top of the side bar because
then there is a proper hierarchy: `Object > Evaluation State > Viewer Path
(optional) > Instance Selection > Domain Selection`

This patch also adds information about the current inspection index for for-each
and repeat zones. They are not editable yet, but that can be implemented
separately as it might require a few more changes for everything to update
correctly.

The new Viewer Path panel is only displayed when actually showing viewer data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138477
2025-05-22 15:04:41 +02:00
Campbell Barton
dbf86f291c Cleanup: prefer term "unreliable" over "flaky"
Avoid slang terms, also correct typo.
2025-05-22 13:51:29 +10:00
Jacques Lucke
40177a8426 UI: Tree View: support drag&drop below last element
Previously, when reordering a tree view item to the end, one had to move it drop
it fairly precisely on the lower half of the last item in the list. This patch
makes it possible to just drop it below the last item too. The outliner has the
same functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/139025
2025-05-21 17:56:39 +02:00
Jacques Lucke
6e29616c49 UI: support scrolling over fully visible tree view
Currently, nothing happens when trying to scroll while hovering a tree view that
is fully visible (i.e. does not have a scroll bar). This patch makes it so that
the scroll event is passed through in this case so that one can scroll the
entire region even when hovering the tree view. If the tree view does have a
scrollbar, then the scroll-event is still captured by that even if scroll all
the way up/down already.

Pull Request: https://projects.blender.org/blender/blender/pulls/138930
2025-05-21 17:18:12 +02:00
Damien Picard
9ce0a2d1d5 I18n: Add translation contexts to node panels
Node UIs can now have panels. Some of those may need to have their
labels translated using translation contexts. PanelDeclarations
already had a translation_context member, this commit adds a way to
specify this context, and to use it for translation on drawing the
node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139124
2025-05-21 13:54:11 +02:00
Campbell Barton
8f1cd941ce UI: show an icon in the "slots" menu for
A small quality of life change to indicate which slots are used.

This only applies to the slots menu, the UI List could show these too
however this requires extending the RNA API.

Ref: !138651
2025-05-21 11:09:25 +10:00
Guillermo Venegas
5b82ee11df Refactor: UI: Replace uiItemFullO_ptr with class method uiLayout::op
This converts the public `uiItemFullO_ptr` function to an object
oriented API (an `uiLayout::op` overload), matching recents changes
in the API.

Changes include rearranging the `IDProperty *properties` parameter to be
the last parameter. Now is optional (but will be removed), also instead
of using a return parameter the function now returns the pointer to
write properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/139166
2025-05-21 02:55:04 +02:00
Guillermo Venegas
44160a0524 Refactor: UI: Replace uiItemFullO with class method uiLayout::op
This converts the public `uiItemFullO` function to an object oriented
API (an `uiLayout::op` overload), matching recents changes in the API.

Changes includes the removal of the paramether `IDProperty *properties`
that seems unused (all places just sets `nullptr`, can be added as last
argument with `nullptr` as default value though), and instead of using a
return paramether the function now returns the pointer to write properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/138961
2025-05-20 15:19:34 +02:00
Nathan Vegdahl
d9d399ccb1 Fix: Truncated filepath fields give incorrect path template errors
The Path Template errors reported in tooltips could be incorrect,
depending on whether the field was visually truncated in the UI or not.

For example, if you had a path `/tmp/{blend_name}{foo`, the error is
that the template expression `{foo` is unclosed.  However, if the
available space for the field in the UI is too small, the displayed path
could end up as `/tmp/{blend_na...`.  This is for display purposes only,
and shouldn't effect things like template errors.  However, it did, and
the error checking would be run on that display string, and report that
`{blend_na...` is unclosed, which is incorrect.

The issue was that the code doing the live error checking for the UI was
using the display string because it was conveniently available.

This fixes the issue by properly querying the property value via RNA,
and using that.

Pull Request: https://projects.blender.org/blender/blender/pulls/139144
2025-05-20 11:26:51 +02:00
Campbell Barton
1f37a7d363 Cleanup: remove unused defines 2025-05-20 04:33:43 +00:00
Hans Goudey
6562033a4a Cleanup: Use StringRef for some UI string arguments
Instead of StringRefNull.

Pull Request: https://projects.blender.org/blender/blender/pulls/139095
2025-05-19 17:25:52 +02:00
Jacques Lucke
5fc33bb343 Cleanup: Nodes: simplify drag & drop code for node group interface tree view
This is extracted out of #138747. Some code can be reused for multiple
tree interface items.
2025-05-17 11:33:24 +02:00
Jacques Lucke
b2b22cb66d Cleanup: Nodes: switch using enum instead of int
This simplifies adding more interface item types, because there will
be a compiler warning when it's not handled somewhere.
2025-05-17 11:31:08 +02:00
Campbell Barton
b3dfde88f3 Cleanup: spelling in comments (check_spelling_* target)
Also uppercase acronyms: API, UTF & ASCII.
2025-05-17 10:17:37 +10:00
Pratik Borhade
52b8eba9eb Fix: UI: Invert button doesn't work for some UIList instances
invert button doesn't work quite well when `filter_items()` is used in
UIList (eg. workspace, attributes list). First issue is, when search
string is empty and invert button is pressed, none item is shown. Now
fixed with extra condition of `filter_byname[0]`. Another issue is when
search string is non-empty then invert button should show elements that
doens't match with the string but it doesn't work. This occurs due to
filtering elements twice. First inside
`filter_items_by_name(reverse=true)` then `UI_list_item_index_is_filtered_visible`.
Remove `UILST_FLT_EXCLUDE` so only once the items are filtered with
invert condition.

Noticed this during !138756

Pull Request: https://projects.blender.org/blender/blender/pulls/138761
2025-05-16 16:44:45 +02:00
Sebastian Parborg
e4aa758d70 Fix #137346: IME input getting lost when using Wayland
Our IME input system relied on passing around pointers to global variables.
However this will not work as the Wayland input handling is multithreaded so the content of the global variable would change while the event loop were reading the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138871
2025-05-16 14:21:06 +02:00
Harley Acheson
755336b17f Fix #138832: Panel Category Background Out By One Pixel
The drawing of the background of panel categories is out by one pixel,
but was covered by the area borders until recently. This PR just draws
one pixel more to the edge.

Pull Request: https://projects.blender.org/blender/blender/pulls/138956
2025-05-15 22:42:23 +02:00
Guillermo Venegas
89a3478e35 Refactor: UI: Replace uiItemMenuF and uiItemMenuFN with uiLayout methods
This converts the public `uiItemMenuF` and `uiItemMenuFN`
functions to an object oriented API (an `uiLayout::menu_fn`
and `uiLayout::menu_fn_argN_free` respectively), following
recent uiLayout changes.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138902
2025-05-15 21:26:49 +02:00
Campbell Barton
e97e9c2904 Cleanup: various non functional changes for C++ 2025-05-15 10:26:47 +10:00
Guillermo Venegas
351fbff95b Refactor: UI: Replace uiItemM_ptr and uiItemM with uiLayout::menu
This converts the public `uiItemM_ptr` and `uiItemM` functions
to an object oriented API (an `uiLayout::menu` overloads),
matching the python API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138895
2025-05-14 23:22:56 +02:00
Aaron Carlisle
6329e00cd1 UI: Improvements to shading layout
Improve labels and UI consistency.

- Update color labels: Object, Wireframe, Background
- Rename 'Single' shading color to 'Custom'. Move to the end.
- Rename 'Viewport' color to 'Custom' for consistency.
- Fix alignment of Object Color item labels

Pull Request: https://projects.blender.org/blender/blender/pulls/137408
2025-05-14 16:24:51 +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
Guillermo Venegas
3b1e123361 Refactor: UI: Replace uiItemS and uiItemS_ex with uiLayout::separator
This merges the public `uiItemS` and `uiItemS_ex` functions into an
object oriented API (`uiLayout::separator`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code
(or vice-versa), making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138826
2025-05-13 17:54:26 +02:00
Clément Foucault
617858e453 GPU: Unified DataFormat enum
This unifies vertex and texture data formats
into a single base enum class.

`TextureFormat` and `VertexFormat` then mask
the invalid format for their respective usage.

Having a base enum allows casting between
`TextureFormat` and `VertexFormat` possible
(needed for Buffer Textures).

It also makes it easier to write and read data
to buffers/textures as each format will have an
associated host type.

These enum is generated from MACRO expansion.
This allow to centralize all information about
the formats in one place. This avoid duplicating
the list of enums for each backend.

This only creates the new enum. Porting older enums will
be done in other PRs.

Normalized integer CPU format are missing and waiting for #130640

Rel #130632

Pull Request: https://projects.blender.org/blender/blender/pulls/138069
2025-05-13 17:08:32 +02:00
Endor H
309ce182b8 Nodes: Allow dragging Group Inputs from the panel into the nodes editor
This patch adds support for creating Group Input nodes by dragging input sockets
and panels from the group interface tree-view in the side bar. This
significantly simplifies creating a Group Input node for a specific input when
there are lots of them.

These cases are supported:
* Dragging an input socket creates a Group Input node just for that socket.
* Dragging a panel without panel-toggle creates a Group Input node containing
  all sockets in the panel.
* Dragging a panel with panel-toggle creates a Group Input for the panel-toggle.
* Dragging a panel with panel-toggle while holding Ctrl creates a Group Input
  with the panel-toggle and all sockets in the panel.

This is supported in all node tree types.

Pull Request: https://projects.blender.org/blender/blender/pulls/137739
2025-05-13 07:17:48 +02:00
Campbell Barton
9deea7677f Cleanup: use doxygen doc-strings, correct file references in UI headers
Also move implementation note from doc-string into the body of the
function.
2025-05-13 11:14:27 +10:00
Campbell Barton
64a43fff20 Fix #138652: Crash editing an ID name after undo
Regression in [0] which missed updating the old-buttons data,
causing it to reference freed Main & ID pointers after undo.

Apply the same fix for uiBut::pushed_state_func.

[0]: 3e03576b09
2025-05-13 09:48:11 +10:00
Harley Acheson
87dcf4907a UI: Add Hide to Properties NavBar Item Context Menu
Add an item to hide the NavBar to the Context Menu for the items on the
NavBar.

Pull Request: https://projects.blender.org/blender/blender/pulls/138786
2025-05-13 00:57:10 +02:00
Guillermo Venegas
a017a6cc54 Refactor: UI: Replace uiItemO with class method uiLayout::op
This converts the public `uiItemO` function to an object oriented
API (`uiLayout::op`).
Also this rearranges `idname` paramether, since this the only one
required, and to make format similar to `uiItemFullO`

Note: One of the benefits of moving from a public function to class
method is to reduce API usage difference between C++ and Python. In
Python this method is called `UILayout::operator`, however `operator`
is a reserved keyword in C++.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138776
2025-05-12 22:14:38 +02:00
Clément Foucault
91dcea8efc Fix: UI: Invalid scissors in interface drawing
These were causing asserts on Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/138684
2025-05-12 17:49:16 +02:00
Christoph Lendenfeld
6a31554394 Anim: add extra poll checks to bone eyedropper
It was unclear when the bone eyedropper could be used
since it stayed active even though it would be impossible to pick something.

The limitation is that an armature has to be in pose or edit mode to pick from.
Since that is the case we can check in the poll function if the active
object is an armature and if that armature is either in pose or edit mode.

Follow up to: #138182

Pull Request: https://projects.blender.org/blender/blender/pulls/138498
2025-05-12 10:49:14 +02:00
Campbell Barton
5e75a9c1e8 Cleanup: spelling in comments 2025-05-11 17:00:47 +10:00
Jacques Lucke
bf696320f6 UI: support detecting good width for searchbox
Sometimes, the default size of the search box is not wide enough for the items
it shows. Currently, we sometimes hardcode an extra width factor and rely on
automatic name shortening with `...`. Both options are not ideal because they
are either often too wide or are hard to read with shortened names.

This patch implements an alternative solution. It adds a new function that
computes a good width for the search box based on its content. A certain minimum
and maximum width are still enforced.

Right now, this feature is only used in the Ctrl+F search in node editors, but I
guess it makes sense in most search boxes.

This also fixes #138641. While it's nice to have ways to use shorter search
terms, the search box should generally be able to deal with long items too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138653
2025-05-10 04:48:30 +02:00
Guillermo Venegas
858abf43c3 Refactor: UI: Replace uiItemFullR with class method uiLayout::prop
This converts the public `uiItemFullR` function to an object oriented
API (an overload of `uiLayout::prop`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138683
2025-05-10 03:39:31 +02:00
Sergey Sharybin
7ceb4495c5 Refactor: OpenColorIO integration
Briefly about this change:
- OpenColorIO C-API is removed.
- The information about color spaces in ImBuf module is removed.
  It was stored in global ListBase in colormanagement.cc.
- Both OpenColorIO and fallback implementation supports GPU drawing.
- Fallback implementation supports white point, RGB curves, etc.
- Removed check for support of GPU drawing in IMB.

Historically it was implemented in a separate library with C-API, this
is because way back C++ code needed to stay in intern. This causes all
sort of overheads, and even calls that are strictly considered bad
level.

This change moves OpenColorIO integration into a module within imbuf,
next to movie, and next to IMB_colormanagement which is the main user
of it. This allows to avoid copy of color spaces, displays, views etc
in the ImBuf: they were used to help quickly querying information to
be shown on the interface. With this change it can be stored in the
same data structures as what is used by the OpenColorIO integration.
While it might not be fully avoiding duplication it is now less, and
there is no need in the user code to maintain the copies.

In a lot of cases this change also avoids allocations done per access
to the OpenColorIO. For example, it is not needed anymore to allocate
image descriptor in a heap.

The bigger user-visible change is that the fallback implementation now
supports GLSL drawing, with the whole list of supported features, such
as curve mapping and white point. This should help simplifying code
which relies on color space conversion on GPU: there is no need to
figure out fallback solution in such cases. The only case when drawing
will not work is when there is some actual bug, or driver issue, and
shader has failed to compile.

The change avoids having an opaque type for color space, and instead
uses forward declaration. It is a bit verbose on declaration, but helps
avoiding unsafe type-casts. There are ways to solve this in the future,
like having a header for forward declaration, or to flatten the name
space a bit.

There should be no user-level changes under normal operation.
When building without OpenColorIO or the configuration has a typo or
is missing a fuller set of color management tools is applies (such as the
white point correction).

Pull Request: https://projects.blender.org/blender/blender/pulls/138433
2025-05-09 14:01:43 +02:00
Jacques Lucke
4acd6d46d4 UI: rename Tooltip Label to Quick Tooltip
Change the mentions of "tooltip label" to "quick tooltip" to make this feature more
universally useful. The new name was suggested in #138583.

Pull Request: https://projects.blender.org/blender/blender/pulls/138639
2025-05-09 13:34:35 +02:00
Campbell Barton
cab63d272c Cleanup: rename str_len to str_maxncpy
By convention str_len excludes the nil terminator.

Also assert the increment is a single unit as larger numbers aren't
supported (or needed currently).
2025-05-09 12:34:41 +10:00
Guillermo Venegas
38c08b515f UI: Allow drag multiple files from Blender File Browser
After c00c8b1b37 its possible to handle drag-n-drop with multiple
paths, this commit enables Blender internal File Browser to have
support to start drag events with multiple files.

Pull Request: https://projects.blender.org/blender/blender/pulls/116474
2025-05-08 23:56:38 +02:00
Guillermo Venegas
dafdced6ab Refactor: UI: Replace uiItemR with class method uiLayout::prop
This converts the public `uiItemR` function to an object oriented
API (`uiLayout::prop`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138617
2025-05-08 20:45:37 +02:00
Harley Acheson
9741ced8c0 UI: Hover Increment/Decrement For Strings & Toggles
This is loosely related to #136285, which allows changing numerical
values while in text entry mode. Outside of that, just hovering over
numerical inputs we are currently able to increment and decrement by
Ctrl + Mouse Wheel. This works for integers, floats, sliders. Current
code also allows cycling through expanded enums. This PR extends that
so Ctrl + Mouse Wheel also changes toggles and checkboxes and also
changes values inside of strings.

Pull Request: https://projects.blender.org/blender/blender/pulls/138344
2025-05-08 19:52:56 +02:00
Guillermo Venegas
e5dcd0de99 Refactor: UI: Replace uiItemL with class method uiLayout::label
This converts the public `uiItemL` function to an object oriented
API (`uiLayout::label`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138608
2025-05-08 17:21:08 +02:00
Nathan Vegdahl
e0beb7afe6 Templates for render output paths
This adds basic templating support to render output paths. By putting
"{variable_name}" in the path string, it will be replaced by the named
variable's value when generating the actual output path. This is similar
to how "//" is already substituted with the path to the blend file's
current directory.

This templating system is implemented for both the primary render output
path as well as the File Output node in the compositing nodes. Support
for using templates in other places can be implemented in future PRs.

In addition to the "{variable_name}" syntax, some additional syntax is
also supported:

- Since "{" and "}" now have special meaning, "{{" and "}}" are now
  escape sequences for literal "{" and "}".
- "{variable_name:format_specifier}", where "format_specifier" is a
  special syntax using "#", which allows the user to specify how numeric
  variables should be formatted:
  - "{variable_name:###}" will format the number as an integer with at
    least 3 characters (padding with zeros as needed).
  - "{variable_name:.##}" will format the number as a float with
    precisely 2 fractional digits.
  - "{variable_name:###.##}" will format the number as a float with at
    least 3 characters for the integer part and precisely 2 for the
    fractional part.

For the primary render output path: if there is a template syntax error,
a variable doesn't exist, or a format specifier isn't valid (e.g. trying
to format a string with "##"), the render that needs to write to the
output path fails with a descriptive error message.

For both the primary and File Output node paths: if there are template
syntax errors the field is highlighted in red in the UI, and a tooltip
describes the offending syntax errors. Note that these do *not* yet
reflect errors due to missing variables. That will be for a follow-up
PR.

In addition to the general system, this PR also implements a limited set
of variables for use in templates, but more can be implemented in future
PRs. The variables added in this PR are:

- `blend_name`: the name of the current blend file without the file
  extension.
- `fps`: the frames per second of the current scene.
- `resolution_x` and `resolution_y`: the render output resolution.

Pull Request: https://projects.blender.org/blender/blender/pulls/134860
2025-05-08 15:37:28 +02:00
Philipp Oeser
a5db664d61 Fix #138157: Image Editor Fill tool slight color inaccuracy
`ImagePaintMode` `paint_bucket_fill` does a double colorspace conversion
atm. (which is a lossy process).

Since this is lossy, painting with the same color as was used for
filling can give slight differences (very noticable though if painting
e.g. bump maps).

For comparison, `ProjectionPaintMode` `paint_bucket_fill` (so in the 3D
viewport) does not suffer the same issue (it keeps track of both sRGB
brush color and a linear version of such color).

Currently `paint_2d_bucket_fill` expects linear space color values, so
for filling byte images, we first convert the brush color to linear
(`srgb_to_linearrgb_v3_v3`) then inside `paint_2d_bucket_fill`, we
convert back (`linearrgb_to_srgb_v3_v3`).

We can avoid the double conversion though, make `paint_2d_bucket_fill`
expect sRGB space color values and only convert to linear if we a
filling float images.

Pull Request: https://projects.blender.org/blender/blender/pulls/138540
2025-05-08 08:07:22 +02:00