Commit Graph

279 Commits

Author SHA1 Message Date
Philipp Oeser
48dc788e6d Fix #145488: UI: Flipped rows/columns in custom matrix property
Since matrices are usually indexed **row first**, displaying matrices in
the UI seems flipped.
They are stored as flat arrays.
When `matrix[1][0]` is accessed via python, the logic from
`pyrna_py_from_array_index` will actually look up index 2 in the flat
array (rightfully so).

But UI code was flipped in that regard.
The second value in the flat array **should** show at row 1 column 0,
but it currently doesnt.

Now (hopefully) handled properly (not only in `ui_item_array` but also
made code in `ui_item_rna_size` detect proper row count for a `height`)

Pull Request: https://projects.blender.org/blender/blender/pulls/148197
2025-10-17 10:22:51 +02:00
Richard Antalik
a82f3a0fe0 UI: Add tab filter popover to vertical tabs
This adds unobtrusive tab button for selecting displayed tabs to the
tabs region. The idea is, that this way, the filter is much more
discoverable than it being hidden in options popover. The button is
grayed out, when all tabs are visible.

To only draw arrow, is achieved by setting `UILayout.emboss` to `NONE`
or `NONE_OR_STATUS`

Pull Request: https://projects.blender.org/blender/blender/pulls/135132
2025-10-09 04:51:18 +02:00
Hans Goudey
a68d39e9d9 Cleanup: Formatting
Run `make format` after the library update in the previous commit.
2025-10-02 12:55:42 -04:00
Campbell Barton
b78c5fadf3 Cleanup: various non functional changes for C++ 2025-10-01 23:22:44 +00:00
Guillermo Venegas
9aaefbab5b Refactor: Make layout resolve functions into virtual methods
Following to the uiLayout refactor, this converts each
layout resolve  function as virtuals methods, so `x_`,  `y_`,
`w_` and `h_` properties can become protected.

No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/146185
2025-09-29 16:53:44 +02:00
Pratik Borhade
8de2e6f9fb UI: Gray out labels for non-editable linked items
Similar to !145387, disable layout when rna property is non editable.
Let the widget code handle the theme of the label in
front of the non-editable property. Also do it separately inside
`v3d_object_dimension_buts` for transform properties of N-panel

Resolves #146290

Pull Request: https://projects.blender.org/blender/blender/pulls/146565
2025-09-28 07:06:21 +02:00
Guillermo Venegas
c69dad9b0f Fix #146138: UI: Preferences tabs lost grouping
Error in 4c0114b94e,  the line was warded against
`USE_UIBUT_SPATIAL_ALIGN`, so the check should
be removed too.

Pull Request: https://projects.blender.org/blender/blender/pulls/146144
2025-09-12 18:00:19 +02:00
Guillermo Venegas
4c0114b94e Cleanup: UI: Remove unused interface_align code
The spatial align method has by now 10 years, this removes the old
alignment code since it has not been actively maintained.

-----
This was agreed to be removed in #145051

Pull Request: https://projects.blender.org/blender/blender/pulls/145362
2025-09-12 09:11:13 +02:00
Guillermo Venegas
ad50ee6bf6 Refactor: UI: Make layout estimate functions as virtual methods
Following the uiLayout refactor, this converts each layout estimate
function as virtuals methods, so w_ and y_ properties can become
protected. This includes missing structs for each layout type in
`uiItemType`, but without the `ui` prefix (they eventually will be
moved to the to the `blender::ui` namespace instead)

Pull Request: https://projects.blender.org/blender/blender/pulls/146049
2025-09-12 03:40:17 +02:00
Damien Picard
a8d366b48a Fix #141142: UI: Emboss status not restored in uiLayout
When using `emboss=False` on a UI prop, if `property_split` was
enabled, all subsequent props in the same layout would also be
unembossed.

This is because of the way the emboss status was set.

When drawing a prop, the previous emboss status was stored in a
temporary variable `prev_emboss`. This status was retrieved from the
uiLayout (`this`), but restored to a `layout` uiLayout that could be
another one, because it could be reassigned in the mean while.

Instead the status should just be restored to `this`, otherwise the
layout can keep the same unembossed status for subsequent props.

Pull Request: https://projects.blender.org/blender/blender/pulls/145883
2025-09-11 11:03:10 +02:00
Guillermo Venegas
6f85f3be2e Cleanup: UI: Make some uiLayout members private
This makes child_items_layout_, scale_, align, active_,
active_default_, activate_init_, enabled_, redalert_,
variable_size_, alignment_, emboss_, units_ & search_weight_
private members as follow up from recent UI refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/145844
2025-09-07 00:26:22 +02:00
Guillermo Venegas
7959156876 Cleanup: UI: Make some uiLayout members private
Make root_, context_ , parent_  ,items_ and heading_ uiLayout into
private members. Follow up from recent UI refactors.
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/145698
2025-09-05 16:46:42 +02:00
Harley Acheson
9a3f80b8f2 UI: Generalized Alert and Popup Block Error Indication
This PR adds an optional block alert level, defaulting to none. Then
for error-level alerts only it adds a red line and a color icon.
Dialogs with other alert types do not change at all. This also adds
a UI_alert function to create such dialogs.

Pull Request: https://projects.blender.org/blender/blender/pulls/134084
2025-08-16 02:45:36 +02:00
Guillermo Venegas
ead9643fe4 Cleanup: UI: Remove uiItem::flag_ public access
Follow up from recent UI refactors.
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/143724
2025-08-15 21:50:39 +02:00
Omar Emara
68dc278fe5 Compositor: Redesign File Output node
This patch redesigns the File Output node to provide better UX and UI.
This is mainly achieved by allowing the user to create inputs by
dragging into an Extend socket and adjust existing inputs using the
familiar UI list design available in Blender. Additionally, various UI
changes were done:

- The Use Node Format option was renamed to Override Node Format for
  clarity.
- Socket types are now fixed and do not change as new links are made,
  allowing users to specify the exact output type and employ implicit
  conversion if needed.
- The distinction between images and Multi-Layer EXR was made clearer.
- Final output paths are drawn in the UI to remove guess work.
- The Base Path was split into a Directory and a File Name.
- Panels were added to group options, include a panel for the node
  format, items, and item formats.

Pull Request: https://projects.blender.org/blender/blender/pulls/141091
2025-08-07 14:46:34 +02:00
Guillermo Venegas
0cc1c212a8 Cleanup: UI: Remove public access to uiItem::type_
Follow up from recent UI refactors.
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/143324
2025-07-30 07:17:00 +02:00
Hans Goudey
32c9bd8b81 Cleanup: UI: Remove unused min/max arguments to uiDefIconTextBut
These min and max arguments are unused, 0 is passed everywhere.
2025-07-28 11:27:52 -04:00
Campbell Barton
e8f9e2d1d1 Cleanup: use UTF8 string functions in editors & related logic
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 16:41:19 +10:00
Guillermo Venegas
52403b686f UI: Move block layout methods to namespace
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/143232
2025-07-25 19:33:15 +02:00
Guillermo Venegas
230813f2ab Cleanup: UI: Remove redundant namespace prefixes
A follow-up from recent UI refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/141920
2025-07-21 15:08:12 +02:00
Guillermo Venegas
9c98ea1a18 Refactor: UI: Make button type params typed enums
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
2025-07-18 13:12:16 +02:00
Hans Goudey
63a3499674 Cleanup: Use StringRef, std::string for node panel toggles
Just a slight simplification of this code to make a null
check unnecessary and avoid using char arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141939
2025-07-16 20:22:55 +02:00
Julian Eisel
c2497d16e3 Cleanup: Remove redundant parameter in new UI layout function
Mistake in 2658754324.

This was changed from a free standing to a member function during review. But
forgot to update the parameters accordingly. This can be confusing since you
can call the function on one layout, but pass it another one that it will
actually operate on.
2025-07-16 17:10:11 +02:00
Julian Eisel
2658754324 UI: New internal API function to add a simple button
For blender/blender!141292, we need a simple icon and text button that
executes a callback on click. The size should be determined based on the
text and icon, as it's typically done with the `UI_interface_layout.hh`
API. Trying to do this with `uiDefIconTextBut()` is annoyingly
complicated, mostly because we'd have to duplicate size calculations.

Instead expand the `UI_interface_layout.hh` API to cover this.

* Allow passing a button type to `uiItemL_()` and rename it to
  `uiItem_simple()`. The code in this function is commonly useful, not
  just for label buttons. It's a convenient way to add a single button
  with normal size calculations. The function stays internal to
  `interface_layout.cc`.
* Add `uiItemBut()` as public API function to call this and assign an
  on-click callback.

No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/141900
2025-07-16 13:10:22 +02:00
Jacques Lucke
fc05a70dcd UI: support fully custom layout tooltips
The goal is to be able to build fully custom tooltips for entire layouts (e.g.
for all `uiBut` for a socket). We already support tooltip callbacks for layouts
and fully custom tooltips for `uiBut`, however not fully custom tooltips for an
entire layout.

This will be used by #140540.

The main noteworthy thing here is that now `uiBut` is passed into the custom
tooltip function. This is necessary when the tooltip still has to be customized
for the exact hovered `uiBut`. For example, we generate a tooltip that applies
to an entire vector socket, but when hovering over e.g. the X input value, the
Python tooltip should show the path for that specific property.

This also fixes a bug in `ui_but_is_interactive_ex` which didn't consider custom
and quick tooltips before.

`uiLayoutSetTooltipCustomFunc` is pretty much the same as its non-custom
counterpart.

Pull Request: https://projects.blender.org/blender/blender/pulls/142044
2025-07-16 13:09:29 +02:00
Guillermo Venegas
1a247fbaa8 Refactor: WM: Make OperatorCallContext an enum class, move to namespace
This allows forward declaring `OpCallContext`, avoiding the
transitive include `WM_Types.hh` in `UI_interface_layout.hh`

Pull Request: https://projects.blender.org/blender/blender/pulls/141804
2025-07-15 03:08:04 +02:00
Guillermo Venegas
c97195cd63 Refactor: UI: Replace uiItemMenuEnumFullO* with class methods
This converts the public uiItemMenuEnumFullO* functions to an
object-oriented API (as uiLayout::op_menu_enum overloads),
matching recent changes in the API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141797
2025-07-11 19:52:58 +02:00
Guillermo Venegas
1f34dc9155 Refactor: UI: Replace uiItemsEnumO with class method uiLayout::op_enum
This converts the public uiItemsEnumO and uiItemsFullEnumO functions
to an object-oriented API (as uiLayout::op_enum overloads), matching
recent changes in the API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141748
2025-07-11 15:25:30 +02:00
Guillermo Venegas
f22ea2e0ae Refactor: UI: Remove uiItemEnumO* functions
Similar to other removed UI layout functions, this removes uiItemEnumO*
functions and replaces them by calling `uiLayout::op` and writing enum
properties to the returned RNA pointer.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141632
2025-07-10 07:57:21 +02:00
Guillermo Venegas
5cc4b4322a Refactor: UI: Move UI_block_layout_resolve to C++ namespace, rename
This renames UI_block_layout API as blender::ui::block_layout_resolve,
following uiLayout refactors.

This simplifies usage by returning block layout size as C++ int2 instead
of using return parameters, in fact some places were providing
unused variables.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141432
2025-07-08 21:16:57 +02:00
Guillermo Venegas
b36e5b4b06 Refactor: UI: Replace UI_block_layout with blender::ui::block_layout
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
2025-07-03 22:00:46 +02:00
Guillermo Venegas
d00a0f29b4 UI: Make uiLayout NonCopyable and NonMovable
Almost all uiLayout methods that creates sub-layouts returns a uiLayout
reference, API users must use the returned sub-layout to add items,
this prevents a accidental copy that could break Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/141051
2025-07-02 18:31:04 +02:00
Guillermo Venegas
a0f9e25682 Refector: UI: Add uiLayout decorator, menu_contents and progress_indicator methods
This replaces uiItemMContents, uiItemDecoratorR* and
uiItemProgressIndicator API with uiLayout methods following
uiLayout refactors and the Python API.

`eButProgressType` is changed to a typed enum class
`blender::ui::ButProgressType`

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141189
2025-07-02 10:06:48 +02:00
Guillermo Venegas
86d6855ee8 Refactor: UI: Add uiLayout op_menu_hold, popover and separator_spacer
This replaces `uiItemFullOMenuHold_ptr`, `uiItemFullR_with_popover`,
`uiItemFullR_with_menu`, `uiItemPopoverPanel`* and `uiItemSpacer` API
with methods following uiLayout refactors and the Python API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141050
2025-06-26 21:48:52 +02:00
Guillermo Venegas
e460ae24cb Refactor: UI: Replace uiItemEnumR* funtions with uiLayout methods
This converts the public functions to add enum specific property buttons
with uiLayout methods matching the python API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/140941
2025-06-25 22:03:31 +02:00
Hans Goudey
8c71719dfd Refactor: UI: Use std::string for uiLayout heading string
Changes the size of uiLayout from 408 to 184 bytes.
2025-06-24 15:09:21 -04:00
Guillermo Venegas
2e5138fed8 Refactor: UI: Replace uiItemPointerR with uiLayout::prop_search
This converts the public uiItemPointerR and uiItemPointerR_prop
functions to an object-oriented API (uiLayout::prop_search overloads),
matching the python API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/140930
2025-06-24 20:47:54 +02:00
Guillermo Venegas
e300d44e69 Refactor: UI: Add uiLayout use_property_decorate methods
This replaces uiLayout use_property_decorate API with uiLayout
methods, following uiLayout refactors and the Python API naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/140887
2025-06-24 03:52:17 +02:00
Guillermo Venegas
d600b1002a Refactor: UI: Add uiLayout use_property_split methods
This replaces uiLayout use_property_split API with uiLayout methods,
following uiLayout refactors and the Python API naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/140874
2025-06-23 19:07:09 +02:00
Guillermo Venegas
cc5ba71114 Refactor: UI: Add uiLayout fixed_size, red_alert, root_panel, search_weight and width methods
This replaces API for accessing the uiLayout fixed_size,
red_alert, root_panel, search_weight and width properties
with methods, following uiLayout refactors and the
Python API naming

Pull Request: https://projects.blender.org/blender/blender/pulls/140673
2025-06-23 06:55:01 +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
Guillermo Venegas
ff9b80cc81 Cleanup: UI: Remove unused uiLayout::keepaspect_ property
Python API was removed since a78ef19054

Pull Request: https://projects.blender.org/blender/blender/pulls/140675
2025-06-19 18:39:51 +02:00
Guillermo Venegas
96dee123d1 Refactor: UI: Add uiLayout aligment methods
This replaces uiLayout aligment API with uiLayout methods,
following uiLayout refactors and the Python API naming.

Also this converts the layout aligment enum to a fixed enum class.

Pull Request: https://projects.blender.org/blender/blender/pulls/140622
2025-06-19 02:57:37 +02:00
Guillermo Venegas
aa1dcddb3d Refactor: UI: Add uiLayout context_store methods
This replaces uiLayout context_store API with uiLayout methods,
following uiLayout refactors, following the Python API naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/140566
2025-06-18 06:32:40 +02:00
Guillermo Venegas
ba55e16532 Refactor: UI: Add uiLayout block get method
This replaces API for obtaining the uiLayout block with a method,
following uiLayout refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/140549
2025-06-17 19:30:11 +02:00
Guillermo Venegas
b03e64223c Refactor: UI: Add active_default, activated_init, enabled methods
This replaces API for accessing the uiLayout  active_default,
acviated_init, enabled properties with methods, following uiLayout
refactors and the Python API naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/140226
2025-06-16 20:23:28 +02:00
Guillermo Venegas
ff9c883154 Refactor: UI: Add uiLayout active get and set methods
This replaces API for accessing the uiLayout active state
with methods, following uiLayout refactors and the Python
API naming.

Part of #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139963
2025-06-10 19:12:00 +02:00
Guillermo Venegas
69d2a43b7a Refactor: UI: Add uiLayout scale and ui_units get and set methods
This replaces API for accessing layout scale and ui-units with methods,
following uiLayout refactors and the Python API naming.
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139944
2025-06-06 20:17:56 +02:00
Guillermo Venegas
df75f965d0 Refactor: UI: Add uiLayout default operator call context get and set methods
This converts `uiLayoutSetOperatorContext` and
`uiLayoutGetOperatorContext` function APIs to objects methods
following recent `uiLayout` refactors.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139890
2025-06-06 06:38:09 +02:00
Guillermo Venegas
25873ccf53 Refactor: UI: Replace uiLayoutSetEmboss and uiLayoutGetEmboss with uiLayout methods
This converts `uiLayoutSetEmboss` and `uiLayoutGetEmboss` function APIs
to objects methods following recent `uiLayout` refactors.
Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139811
2025-06-05 06:00:02 +02:00