Age | Commit message (Collapse) | Author |
|
Close all active buttons when hiding a region as this can be called
from Python a popover is open from that region.
Failure to do this causes the popover to read from the freed button.
Also rename UI_screen_free_active_but to
UI_screen_free_active_but_highlight since it only frees highlighted
buttons.
|
|
Conflicts:
source/blender/windowmanager/intern/wm_files_link.c
|
|
This reverts the changes to fix T87448, where entering the same value in number
buttons causes an unnecessary update. This is not stable enough for 3.0 and so
is being reverted, better to have an unnecessary update than no update in other
cases.
This effectively reverts the changes from rBeb06ccc32462 and follow up fixes
rBe1a9ba94c599, rBbbb52a462ef9, rBec30cf0b742f, and rB071799d4fc44. The code is
disabled with a comment on how it could be implemented better.
|
|
Use a map to speed up search for UI block names.
Time to redraw the node editor was decreased from
around 75-120ms to 40-70ms in a tree with many
Geometry Nodes.
Differential Revision: https://developer.blender.org/D13225
|
|
This patch removes a bunch of specific code for drawing the spreadsheet
data set region, which was an overly specific solution for a generic UI.
Nowadays, the UI tree view API used for asset browser catalogs is a much
better way to implement this behavior.
To make this possible, the tree view API is extended in a few ways.
Collapsibility can now be turned off, and whether an item should
be active is moved to a separate virtual function.
The only visual change is that the items are now drawn in a box,
just like the asset catalog.
Differential Revision: https://developer.blender.org/D13198
|
|
|
|
Mistake from rB2743d746ea4f38c098512f6dd6fc33d5a62429d3
|
|
|
|
|
|
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX`
operator context enum. This adds type safety, allows the compiler to
produce better warnings and helps understanding what a variable is for.
Differential Revision: https://developer.blender.org/D13113
Reviewed by: Campbell Barton
|
|
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.
In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
|
|
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.
In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
|
|
Adds the needed bits to the UI tree-view API to support dragging
tree-view items. This isn't used yet, but will be in the following
commit for asset catalogs.
There will probably be some further tweaks to the design at some point,
for now this should work well enough for our use-cases.
|
|
|
|
|
|
|
|
|
|
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.
Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0.
|
|
|
|
|
|
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.
Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0
|
|
Improve readability using underscores for separators, e.g.
prev_click_time instead of prevclicktime.
|
|
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.
Reviewed By: campbellbarton
Ref D12950
|
|
Use arrays for wmEvent coordinates, this quiets warnings with GCC11.
- `x, y` -> `xy`.
- `prevx, prevy` -> `prev_xy`.
- `prevclickx, prevclicky` -> `prev_click_xy`.
There is still some cleanup such as using `copy_v2_v2_int()`,
this can be done separately.
Reviewed By: campbellbarton, Severin
Ref D12901
|
|
|
|
Tree-view items can now easily define their own context menu. This works
by overriding the `ui::AbstractTreeViewItem::build_context_menu()`
function. See the documentation:
https://wiki.blender.org/wiki/Source/Interface/Views#Context_Menus
Consistently with the Outliner and File Browser, the right-clicked item
also gets activated. This makes sure the correct context is set for the
operators and makes it clear to the user which item is operated on.
An operator to rename the active item is also added, which is something
you'd typically want to put in the context menu as well.
|
|
In a couple of places in the UI, we show superimposed icons on buttons
to execute an operation (called "Extra Icons" internally). Hovering them
would show the tooltip of the underlying button, which is misleading and
confusing.
There are cases where it's not obvious what an icon does, so a tooltip
would be quite useful here. It's likely we are going to use superimposed
icons in more places in the future, e.g. see D11890.
The extra icon basically acts as an override for the button in the
tooltip code.
Differential Revision: https://developer.blender.org/D11894
Reviewed by: Campbell Barton
|
|
|
|
This reworks how tree rows are constructed in the layout and how they
behave in return.
* To open or collapse a row, the triangle/chevron icon has to be clicked
now. The previous behavior of allowing to do it on the entire row, but
only if the item was active already, was just too unusual and felt
weird.
* Reduce margin between chevron icon and the row label.
* Indent child items without chevron some more, otherwise they feel like
a row on the same level as their parent, just without chevron.
* Fix renaming button taking entire row width. Respect indentation now.
* Fix double-clicking to rename toggling collapsed state on each click.
Some hacks/special-handling was needed so tree-rows always highlight
while the mouse is hovering them, even if the mouse is actually hovering
another button inside the row.
|
|
Catalogs can now be renamed by double clicking them in the Asset
Browser. This is mostly done through the tree-view API, the asset
specific code is very little.
There is some polish left to be done here, e.g. the double click
currently also collapses/uncollapses and activates the clicked item. And
the rename button takes the full width of the row. But addressing these
is better done as part of some other behavioral changes that are planned
anyway.
|
|
|
|
With this it is possible to select any number of assets in the Asset
Browser and drag them into catalogs. The assets will be moved to that
catalog then. However, this will only work in the "Current File" asset
library, since that is the only library that allows changing assets,
which is what's done here.
While dragging assets over the tree row, a tooltip is shown explaining
what's going to happen.
In preparation to this, the new UI tree-view API was already extended
with custom drop support, see 4ee2d9df428d.
----
Changes here to the `wmDrag` code were needed to support dragging multiple
assets. Some of it is considered temporary because a) a proper #AssetHandle
design should replace some ugly parts of this patch and b) the multi-item
support in `wmDrag` isn't that great yet. The entire API will have to be
written anyway (see D4071).
Maniphest Tasks: T91573
Differential Revision: https://developer.blender.org/D12713
Reviewed by: Sybren Stüvel
|
|
This follows three main targets:
* Make creation of new tree UIs easy.
* Groundwork to generalize tree UIs (so e.g. Outliner, animation
channels, asset catalogs and spreadsheet data-sets don't have to
re-implement basic tree UI code) or even other data-view UIs.
* Better separate data and UI state. E.g. with this, tree-item selection
or the open/collapsed state can be stored on the UI level, rather than
in data. (Asset Catalogs need this, storing UI state info in them is
not an option.)
In addition, the design should be well testable and could even be
exposed to Python.
Note that things will likely change in master still. E.g. the actually
resulting UI isn't very nice visually yet.
The design is documented here:
https://wiki.blender.org/wiki/Source/Interface/Views
Differential Revision: https://developer.blender.org/D12573
|
|
Support waiting for input so operators that depend on the
cursor location are usable from menus / buttons.
Use an operator type flag which the user interface code checks for,
waiting for input when run from a menu item.
This patch only supports this feature, there are no functional changes.
The motivation for this change is discoverability since some actions
were either hidden or broken when accessed from menus
(where the behavior of the operator depended on the menu location).
In general, waiting for input is *not* an efficient way to access tools,
however there are over 50 operators with a "wait_for_input" property
so this isn't introducing a new kind of interaction,
rather exposing this in a way that does not need to be hard-coded into
each operator, or having modal callbacks added for the sole purpose
of waiting for input.
Besides requiring boiler plate code using a "wait_for_input" property
has the added down-side of preventing key shortcuts from showing.
Only the menu items will enable the property,
causing them not to match key-map items.
Reviewed By: Severin
Ref D12255
|
|
Various changes to reduce risk of out of bounds errors in utf8 seeking.
- Remove BLI_str_prev_char_utf8
This function could potentially scan past the beginning of a string.
Use BLI_str_find_prev_char_utf8 instead which takes a limiting
string start argument.
- Swap arguments for BLI_str_find_prev_char_utf8 so the stepping
argument is first and the limiting argument is last.
This matches BLI_str_find_next_char_utf8.
- Change behavior of these functions to return it the start or end
pointers instead of NULL, which complicated use of these functions
to calculate offsets.
Callers that need to check if the limits were reached can compare
the return value with the start/end pointers.
- Return 'const char *' from these functions
so they don't remove const from the input arguments.
|
|
Rename:
- BLI_str_utf8_invalid_byte (was BLI_utf8_invalid_byte)
- BLI_str_utf8_invalid_strip (was BLI_utf8_invalid_strip)
|
|
Also hyphenate 'mouse-move' use doxy sections in render_update.c &
move function comment from the header to the source.
|
|
This patch removes the "Kerning Style" option for UI widget font
drawing and uses only the current default of "Fitted", since the other
option of "Unfitted" is just the result of truncation errors.
see D12231 for much more information.
Differential Revision: https://developer.blender.org/D12231
Reviewed by Campbell Barton
|
|
|
|
|
|
|
|
While doxygen supports both, conform to our style guide.
Note that single back-tick's are already used in a majority of comments.
|
|
|
|
This button type shows a preview image above centered text, similar to
the File Browser files in Thumbnail Display Mode or the default Asset
Browser display. In fact we may want to port these over to use the new
button type at some point.
Will be used by the asset view UI template that will be added in a
following commit. That is basically a mini version of the Asset Browser
that can be displayed elsewhere in the UI.
|
|
If a text button is activated that is not in view (i.e. scrolled away),
the scrolling will now be adjusted to have it in view (with some
small additional margin). While entering text, the view may also be
updated should the button move out of view, for whatever reason. For the
most part, this feature shouldn't be needed and won't kick in, except
when a clicked on text button is partially out of view or very close to
the region edge. It's however quite important for the previously
committed feature, that is, pressing Ctrl+F to start searching in a UI
list. The end of the list where the scroll button appears may not be in
view. Plus while filtering the number of visible items changes so the
scrolling has to be updated to keep the search button visible.
Note that I disabled the auto-scrolling for when the text button spawned
an additional popup, like for search-box buttons. That is because
current code assumes the button to have a fixed position while the popup
is open. There is no code to update the popup position together with the
button/scrolling.
I also think that the logic added here could be used in more places,
e.g. for the "ensure file in view" logic the File Browser does.
|
|
Makes it possible to create tooltips for UI list rows, which can be
filled in .py scripts, similar to how they can extend other menus. This
is used by the (to be committed) Pose Library add-on to display pose
operations (selecting bones of a pose, blending a pose, etc).
It's important that the Python scripts check if the UI list is the
correct one by checking the list ID.
For this to work, a new `bpy.context.ui_list` can be checked. For
example, the Pose Library add-on does the following check:
```
def is_pose_asset_view() -> bool:
# Important: Must check context first, or the menu is added for every kind of list.
list = getattr(context, "ui_list", None)
if not list or list.bl_idname != "UI_UL_asset_view" or list.list_id != "pose_assets":
return False
if not context.asset_handle:
return False
return True
```
|
|
Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.
Note from Julian:
In combination with the following commit, this has the important
limitation that the list's custom activate operator won't be called when
"walking over" an item that is scrolled out of the list. That is because
we don't actually create any buttons for those that could be used for
the handling logic. For our purposes of the pose libraries that should
be fine since the asset view list is always made big enough to display
all items. Solving this might be difficult, we don't properly support
nesting boxes with proper scrolling in regular layouts. It's all just
hacked a bit for UI-lists to work. Overlaps quite a bit with T86149.
Differential Revision: https://developer.blender.org/D11063
|
|
For pose libraries, we need to be able to apply a pose whenever
activating (clicking) an item in the Pose Library asset view and blend
it by dragging (press & move). And since we want to allow Python scripts
to define what happens at least when activating an asset (so they can
define for example a custom "Apply" operator for preset assets), it
makes sense to just let them pass an operator name to the asset view
template. The template will be introduced in a following commit.
|
|
This shows the text as part of the assertion message.
|
|
|