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
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
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.
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
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
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
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
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
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
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
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
These functions were refactored recently, e.g. see e300d44e69. In some cases
it's less clear now which functions are getters and which are setters. Case in
point, I first thought `layout.use_property_split()` would enable property
split (that's what the name suggests). Previous names like
`uiLayoutGetPropDecorate()` and `uiLayoutSetPropDecorate()` were more clear.
By using the `[[nodiscard]]` attribute for getters, the compiler will emit
warnings when using such functions like a setter, without using the returned
value.
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
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
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
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
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
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
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
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
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
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
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
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