Commit Graph

7725 Commits

Author SHA1 Message Date
Julian Eisel
e425faf696 Cleanup: Replace term "radial" with "pie menu" in UI code
Code was often referring to pie menus using the term "radial" which just
obfuscates that it relates to pie menus. Just call it what it is
directly.

Doesn't replace usages of the term for names that are not strictly tied
to pie menus. Also doesn't change instances of the term in the Python
API to keep compatibility, noted in #110461.

Pull Request: https://projects.blender.org/blender/blender/pulls/122825
2024-06-06 14:55:23 +02:00
Julian Eisel
6a14cca1de Cleanup: Avoid spacial UI list lookup when not necessary
This lookup is only necessary for certain events and if not done in a
pie menu, so it can easily be avoided in many cases. Also reduces
variable scope.
2024-06-06 11:33:47 +02:00
Philipp Oeser
7e73f10f79 Merge branch 'blender-v4.2-release' 2024-06-06 11:10:24 +02:00
Philipp Oeser
9b1d81eec2 Fix #122526: Pie menu executes the active as well as the shortcut button
A bit on shaky ground here, but it looks like we actually dont want to
execute the hovered buttons value/op if we chose another item in the pie
menu. This can be achieved by using the **onfree** arg to
`button_activate_exit` called on the active(hovered) button.

Not sure if this is the correct solution tbh (but maybe it demonstrates
where the bug of #122526 can be located).
I have tested pie menus with this patch and they seems to behave
normally (even nested ones).

Pull Request: https://projects.blender.org/blender/blender/pulls/122567
2024-06-06 11:09:35 +02:00
Campbell Barton
d98a7a7756 Merge branch 'blender-v4.2-release' 2024-06-06 10:23:16 +10:00
Campbell Barton
7f7648c6ed Cleanup: spelling in code comments & minor edits
- Use uppercase NOTE: tags.
- Correct bNote -> bNode.
- Use colon after parameters.
- Use doxy-style doc-strings.
2024-06-06 09:55:13 +10:00
Hans Goudey
84c4ddbbb9 Cleanup: GPU: Use references for some vertex buffer functions
Pull Request: https://projects.blender.org/blender/blender/pulls/122784
2024-06-05 18:47:22 +02:00
Omar Emara
9b33340675 Fix #60940: Film-like mapping is bad for RGB curves
The Film-like curve mapping option in the RGB Curves node in the
compositor produces bad results when editing its RGB curves. That's
because Film-like curve mapping only works with the combined curve by
definition, since it is a hue preserving mapping. Furthermore, the
Film-like option ignored the white balancing step altogether.

To fix this, we hide the current curve option for the File-like option
and only allow editing the combined curve, handing the same case for
versioning and RNA updates. Further, we port the implementation from the
realtime compositor which is both correct and takes white balancing into
account.

Pull Request: https://projects.blender.org/blender/blender/pulls/122762
2024-06-05 13:29:39 +02:00
Pratik Borhade
25351738f7 UI: Add title to tree view context menus
Add new string member in `AbstractView` class to store title/header of
tree view. Later use this to set title (`pup->title`) of context menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/120694
2024-06-05 11:28:44 +02:00
Harley Acheson
f5131cdee0 Fix #122411: Sub-panels Not Clickable When Popover is Scaled
When a popover includes panels, the calculation of whether the mouse
is over the panel header does not take into consideration local 2D
scaling. Therefore the hit area is in the wrong location if scaled.

Pull Request: https://projects.blender.org/blender/blender/pulls/122696
2024-06-04 20:28:12 +02:00
Pratik Borhade
ab5f8d9f3a Fix #122491: DOF pick in context menu grayed out
Caused by 7f8d4df410
Changes in poll function had excluded the case of context menu button.
Fix this by returning true if operator identifier is `UI_OT_eyedropper_depth`

Pull Request: https://projects.blender.org/blender/blender/pulls/122532
2024-06-02 14:59:41 +02:00
Campbell Barton
cfd199b7a2 Fix passing allocated strings to guarded-alloc 2024-06-02 20:39:06 +10:00
Campbell Barton
8f0270731c Cleanup: simplify status text logic
Checking for exact flags known to draw before the current item was
becoming overly complicated, more so now showing extension updates
depends on checking other settings.

Instead, keep track of the status info being populated or not.
2024-06-01 13:07:35 +10:00
Dalai Felinto
26d7fb3df3 UI: Extensions: Status bar offline not showing if updates were available
How to reproduce it:
* Launch Blender
* Make sure there are updates available
* Disable "Allow Online Access"

The offline icon would not show on the status bar.
2024-05-31 14:40:14 +02:00
Dalai Felinto
96424cd2a5 UI: Extensions: Fix status bar
* Show offline icon when offline.
* Don't show the vertical split when there are no updates (since we
  don't draw any information in this case.

Reviewed by Campbell Barton.

Ref !122548
2024-05-31 14:33:21 +02:00
Campbell Barton
8bd3be2160 Extensions: show extension updates in the status bar
Move extension update display from the splash screen to the status bar.
Based on !122413 with minor changes & removal of splash text.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
2024-05-31 21:37:37 +10:00
Julian Eisel
44e9544199 Refactor: Extract button text editing data for input handling
Introduces a `uiTextEditing` struct to hold most data for handling text editing,
with improved naming. This should help untangling this code a bit, reduce
perceived complexity, and make the relation between data and the button state
more clear.

Generally I'd like to try to minimize use of `uiHandleButtonData`, to reduce
complexity while increasing flexibility. For example it would be good if text
editing code could be independent of the active button, so a text button can
receive input while other UI elements remain interactive (e.g. for search
popups, which have their own ad-hoc layout, event handling and drawing code).

This is a rather conservative initial refactor, I might follow up with further
(more risky) changes in separate PRs. But this seems like enough of an
improvement to get in first.

Pull Request: https://projects.blender.org/blender/blender/pulls/122332
2024-05-30 17:09:13 +02:00
Hans Goudey
7ee189416c UI: Show modifier pinning with icon, adjust name
User feedback has been that the pinned modifier looks broken because
there is no feedback in the UI showing that it's pinned (related to the
recently reported #121620). It's also inconvenient to disable the pinning
if it's required to move the modifier up (before another modifier that
controls normals for example). Now the "Pin" icon is displayed here,
and clicking on it turns off the pinning.

Also, change the property name from "Stick to Last" to "Pin to Last".
"Stick" is a weird word in the UI, it sounds uncommon and strangely
physical. "Pin" is more associated with this concept.

---

![Screenshot from 2024-05-29 11-41-06](/attachments/4581d362-e2fb-4edf-83dd-7f1e1b71ec4d)

Pull Request: https://projects.blender.org/blender/blender/pulls/122444
2024-05-30 13:56:42 +02:00
Jacques Lucke
cc38c43198 UI: check if only ctrl is pressed when editing label
Previously, the code only checked that ctrl is pressed. This works, but
also allows other keys to be hold at the same time which might conflict
with other shortcuts. Now the code also makes sure that shift and alt
are not pressed.
2024-05-30 11:14:58 +02:00
Jacques Lucke
cd5eb4aa03 Geometry Nodes: support renaming some sockets in the node directly
This adds support for renaming some sockets in the node UI directly by Ctrl+Clicking
on them. This is sometimes more convenient than going to the sidebar. It affects the
Menu Switch and Bake node as well as the Simulation and Repeat zone.

Some related notes:
* The Group Input and Group Output node are not yet supported, because it currently
  breaks the right-alignment on the Group Input node. I couldn't find a workaround for
  this yet.
* Double-clicking on the socket name does not trigger renaming yet. This seems to
  be a deeper issue in the interface code.
* The highlighting when hovering over sockets that can be renamed is very dim
  making it hard to see. Alternatives like drawing a box around the label when hovering
  it (like in list views) have been discussed but seem to be much more difficult to get to work.

Despite these limitations, it seems reasonable to add this already, as it shouldn't affect
anyone negatively. The nodes still look like before.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121945
2024-05-30 10:41:05 +02:00
Harley Acheson
50bf1f3a52 Fix #122395: Fix Icon Errors Building Headless
Add defines to allow building headless, otherwise we
get undefined symbol errors for UI_icon_from_event_type

Pull Request: https://projects.blender.org/blender/blender/pulls/122406
2024-05-29 17:32:28 +02:00
Harley Acheson
707503bf73 Fix #122403: Show correct Hex values for managed colors
Adjusted calculation of hex values so that what is shown matches what
is displayed for material colors as well as for theme colors.

Pull Request: https://projects.blender.org/blender/blender/pulls/122409
2024-05-29 01:13:50 +02:00
Campbell Barton
0cbadd00a3 Cleanup: various non functional changes 2024-05-28 14:09:40 +10:00
Campbell Barton
ca9b105e6c Cleanup: spelling in comments 2024-05-28 13:47:43 +10:00
Julian Eisel
71b0e9d92a UI: Don't refresh searchbox region blocks on text input
Refreshing refers to the recreation of the block and it's buttons in
this case.

Refreshing popup regions on text input was added in 7d80fde033. It can
be useful to update the popup contents on text input, searchboxes have
their completely own update handling however.
2024-05-27 21:25:28 +02:00
Damien Picard
b37d121e0a I18n: extract and disambiguate a few messages
Extract
- Add to Quick Favorites tooltip.
- "Mask", the name of a newly created mask (DATA_).
- "New" in the context of the new mask ID button.
- A few strings using BLI_STR_UTF8_ defines were not extracted.
  Take the special characters out of the translation macros.
- "External" menu items from the filebrowser's Files context
  menu (right-click on a file). These items were already extracted,
  but not translated.

Improve
- Separate formatted error message "%s is not compatible with
  ["the specified", "any"] 'refresh' options" into two messages.

Disambiguate
- Use Action context for new F-modifiers' names. This is already used
  for the "type" operator prop.
- Translate ImportHelper's default confirmation text using the
  Operator context, as it uses the operator name which is extracted
  with this context.
- "Scale" can be a noun, the scale of something, or a verb, to scale
  something. The latter mostly uses the Operator context, so apply
  this context to verbs, and the default contexts to nouns.
- "Scale Influence" can mean "Influence on Scale" (tracking
  stabilization) and "to Scale the Influence" (dynamic paint canvas).
- "Object Line Art" as type of Line Art to add, as opposed to the
  active object's Line Art settings.
- Float to Integer node: use NodeTree context for the node label, as
  this is already extracted and used for the enum.

Do not translate
- Sequencer labels containing only a string formatting field.

Some issues reported by Gabriel Gazzán and Ye Gui.

Pull Request: https://projects.blender.org/blender/blender/pulls/122283
2024-05-27 19:33:35 +02:00
Julian Eisel
2fbf206491 UI: Allow passing named strings via context
Sometimes it is necessary to pass additional data through generic UI entities,
to specific implementations. For example to pass additional options to panel
polling & drawing when instantiating a panel through its panel type. Or storing
additional data in a button, without hardcoding it in the button struct/class.

Passing data via context is a simple solution to this, however so far this only
works using hardcoded context queries or RNA pointers. For passing arbitrary
strings we've used workarounds like creating an RNA type to wrap it already.
For example `RNA_AssetCatalogPath`, which is used to dynamically populate menu
items based on an asset catalog path, via a generic menu type.
type instantiation. This makes it possible to invoke specific asset shelves as
popover panels.

Idea is simply to let `bContextStore` entries hold copies of the string (as
`std::string`), avoiding lifetime issues. Context APIs are extended to support
setting/querying strings via a context member name.

Pull Request: https://projects.blender.org/blender/blender/pulls/122113
2024-05-27 18:46:19 +02:00
Philipp Oeser
6256e2a838 Fix #122150: UI: layout.template_search() crash without an active item
`template_search` was introduced in c20c203b82

Seems it assumed an active item is always there.
Without an active item, we are running into a crash trying to get the
textbut width.

So solution is to not draw that text button at all until an active item
is chosen.

This also goes in line with what `template_ID` is doing (it also skips
the text button without an active item).

Pull Request: https://projects.blender.org/blender/blender/pulls/122165
2024-05-27 14:04:32 +02:00
Philipp Oeser
9c534cda00 Fix: Still allow unpacking of editable linked datablocks
Similar to 918d34a9ed, enable the button in `template_ID()`

Ref #122092

Pull Request: https://projects.blender.org/blender/blender/pulls/122199
2024-05-26 11:30:56 +02:00
Julian Eisel
717389887b Cleanup: Keep panel functions internal to UI code
These were added/exposed in aa03646a74.

There's no need to expose them in the public UI API, and they don't seem
like functions that should be used outside of the UI internals.
2024-05-24 20:29:37 +02:00
Julian Eisel
46f5079f11 Fix: Various crashes and issues with popups
Fixes #121902, #121865, #121905 and some other reports that were closed
as duplicates.

Reverts a change done as part of 7d80fde033.

Reverting this change breaks the yet-to-be-used asset shelf popup a bit,
in that refreshing it won't work propery anymore. Think that's fair
given that 1) the popup isn't in use yet, 2) its refreshing implementation
causes a bunch of high priority bugs, and 3) #122068 is in review with a
better solution to handle refreshing. Namely, it converts the popup to a
popover, which handles refreshing differently, and thus makes the change
being reverted here unnecessary anyway.
2024-05-23 13:22:39 +02:00
Jeroen Bakker
eb20f30e15 Fix: Crash in interface layout when using custom nodes
`node_socket_add_tooltip_in_node_editor` doesn't set a free function.
but uiLayoutSetTooltipFunc didn't check on it. Documentation states
that the free_arg parameter is optional.

Pull Request: https://projects.blender.org/blender/blender/pulls/122115
2024-05-23 08:22:48 +02:00
Campbell Barton
3b21b0deb1 Fix invalid length passed to BLF_str_selection_boxes
Correct recent fix 643f23f4ed.
2024-05-23 13:08:09 +10:00
Harley Acheson
79847acd0c Cleanup: Make format
Just formatting changes resulting from Make Format.
2024-05-22 16:43:32 -07:00
Lalit Shankar Chowdhury
b561771f50 Fix #122110: Remove long text selection flickering
Fix flickering when selecting long (scrolled) text from the left.

Pull Request: https://projects.blender.org/blender/blender/pulls/122123
2024-05-23 01:41:56 +02:00
Harley Acheson
643f23f4ed Fix #122047: Correct text selection when text is scrolled
Correct calculation of start of visual string and position of the
selection start when the text is scrolled (showing a subset of the
text) within an input box.

Pull Request: https://projects.blender.org/blender/blender/pulls/122110
2024-05-22 19:40:37 +02:00
Pratik Borhade
dada0c41ee GPv3: Getter and setter for active node
This adds the functions `get_active_node` and `set_active_node`.
It also changes the the parameter of the `set_active_layer` to be
non-const.

Requested in !121970.

Pull Request: https://projects.blender.org/blender/blender/pulls/122006
2024-05-22 15:25:00 +02:00
Philipp Oeser
c6aa1fec2b Fix: Dont unpack resources that are packed in linked files
These remain linked, so data remains to be read/loaded from the packed
version from the library (making this a useless and wasteful
duplication, also changes could be perceived as lost). Tooltip was also
reading "Unpack all files packed **into this .blend** to external ones",
so that bring it in line with the tooltip.

This came up in #122033

Pull Request: https://projects.blender.org/blender/blender/pulls/122092
2024-05-22 14:50:25 +02:00
Julian Eisel
20df089341 Assets: Clear asset data by default on all "Make Local" actions
Fixes #107880.

When making a linked asset local, you typically wouldn't want this new
data-block to suddenly be part of the asset libraries this file is in. To the
user it seems like making such a data-block local also implicitly makes it an
asset.  Appending an asset already handles this, and clears the asset data by
default.

This patch modifies the `bpy.types.ID.make_local()` method, as well as all
internal calls to the make local functions, so that asset data is cleared by
default. The Python method has a new `clear_asset_data` parameter (optional,
true by default). Maybe this should not be optional.

Pull Request: https://projects.blender.org/blender/blender/pulls/110197
2024-05-21 20:41:16 +02:00
Brecht Van Lommel
5f9f3116db Libraries: Support editing linked datablocks from some libraries
For the brush assets, this mechanism makes brush, texture, node tree and
image datablocks editable even when library linked.

This commit should introduce no functional change yet, as the code to
actually tag such libraries as editable will come later.

* These libraries and their datablocks are preserved when loading a new
  blend file, much like the UI can be preserved.
* Operators that create new datablocks to be assigned to such datablocks
  will put the datablocks in the same library immediately. This was
  implemented for datablocks relevant for brush assets.
* RNA does not allow assignment of pointers from such linked datablocks
  to local datablocks.

Co-authored-by: Bastien Montagne <bastien@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/121920
2024-05-21 18:16:36 +02:00
Campbell Barton
57707ca9ae Cleanup: const pointers for FCurves where possible 2024-05-21 13:17:35 +10:00
Hans Goudey
5445fae9cf Refactor: Use more standard storage for PreviewImage runtime data
Using a non-virtual derived struct for polymorphism is error prone,
especially combined with the requirements of DNA. Instead, use a
separately allocated runtime struct as done for many other DNA structs.

In a followup commit, the remaining runtime members of `PreviewImage`
could be moved to the new runtime struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/121509
2024-05-20 14:25:44 +02:00
Campbell Barton
096eed9d7f Cleanup: spelling in comments 2024-05-20 10:23:54 +10:00
Iliya Katueshenock
14233be92f Nodes: hide reroute input socket in sidebar
The same as d27a1c47fa. Reroute node is
value-less and there is no actual value of input socket that should be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/121150
2024-05-19 21:35:10 +02:00
Harley Acheson
24873963a6 BLF: String length to cursor position, not INT_MAX
BLF_str_offset_from_cursor_position is being called with a str_len of
INT_MAX, so max buffer size instead of string length. This works fine
right now but will not when this gets more complex. For example if we
need to call functions like BLI_str_cursor_step_next_utf8, which
assumes that str_len is the actual end of the string.

Pull Request: https://projects.blender.org/blender/blender/pulls/121966
2024-05-19 05:53:56 +02:00
Habib Gahbiche
567012ef1d Fix cursor remains visibile in sequencer editor while panning and zooming
Cursor is already set to invisible by the gizmo in `WIDGETGROUP_navigate_setup()`. Setting the cursor visibility again in the operator overwrites the desired behavior of gizmos.

Pull Request: https://projects.blender.org/blender/blender/pulls/121927
2024-05-18 12:46:38 +02:00
Harley Acheson
ba36c69c9f Refactor: Add BLF Function to determine input selection boxes
Add a separate function that calculates text selection box positioning
given a string's selection start and end offsets. Moves this to a
better place and allows to have more complex boxes in future when we
might have multi-line and/or multi-directional text input.

Pull Request: https://projects.blender.org/blender/blender/pulls/121448
2024-05-18 00:13:32 +02:00
Brecht Van Lommel
a926f5b67d Refactor: Replace ID_IS_LINKED by !ID_IS_EDITABLE
Add new ID_IS_EDITABLE macro that checks if the ID can be edited in the
user interface. Replace usage of ID_IS_LINKED where it is used with this
meaning.

Also add a corresponding ID.is_editable property for Python.

This prepares for the ability to edit some linked datablocks for brush
assets.

Pull Request: https://projects.blender.org/blender/blender/pulls/121838
2024-05-16 14:53:09 +02:00
Julian Eisel
7d80fde033 UI: Popup version of the asset shelf
Developed as part of the brush assets project, see #106303. No user visible
changes at this point.

Makes it possible to display asset shelves as popups. These popup asset shelves
use static storage for their settings, mainly to remember the active catalog
and filter string, while keeping them separate from the permanent asset shelf
region. Further, the popup can be displayed in any editor, making asset
selectors possible to add anywhere in the UI. When an asset is chosen, an
operator passed to the asset shelf as bl_activate_operator is called, with an
asset weak-reference to refer to the activated asset stored in the operator
properties.

Adds UILayout.template_asset_shelf_popover() to insert asset shelf popup
buttons, taking an asset shelf idname and some normal UI parameters.
2024-05-16 00:11:47 +02:00
Harley Acheson
bef05382a0 Fix #121765: Default Separator for Pie Menu Should be UI_BTYPE_SEPR
As described in the report, pie menus can show horizontal lines if they
use separators without explicit type. This just makes them use blank
space by default instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/121839
2024-05-15 20:55:08 +02:00