Commit Graph

7542 Commits

Author SHA1 Message Date
Campbell Barton
3135e766ec Cleanup: replace UI_MAX_NAME_STR with BKE_ST_MAXNAME
Since [0] some comments referencing UI_MAX_NAME_STR were incorrect.
Also correct buffer size for preview_id in uiTemplatePreview so newly
created names are guarantee to be the correct size.

[0]: a180314ac5
2024-03-20 15:14:08 +11:00
Hans Goudey
803c783e52 Merge branch 'blender-v4.1-release' 2024-03-19 11:59:26 -04:00
Sybren A. Stüvel
cd476226d8 Fix #119402: Bone collections layers fail with pinned object or armature #119434
Don't assume armature of active object is what is displayed in the properties editor, both in C++ and Python code.

Object pointer was left out from some notifiers, as this means only that object was changed. But an armature datablock can be shared by multiple objects.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119663
2024-03-19 16:27:06 +01:00
Falk David
462437de20 Fix: GPv3: Assert in LayerTreeView::build_tree()
This was caused by 745fd2a2cb.
The issue was that there was an attempt at calling
`uncollapse_by_default` on a `LayerViewItem`
which can't be collapsed (because it can't have any children).
This then triggered the assert.

The fix removes the call to `uncollapse_by_default` for
`LayerViewItem`.
2024-03-19 11:50:46 +01:00
Harley Acheson
061a9ee885 UI: Add Optional Flags for Tooltip Image Fields
Add more flexibility to tooltip images by adding the ability to specify
if (one of two) checkerboards are added, border, premultiplied
blending, or recoloring.

Pull Request: https://projects.blender.org/blender/blender/pulls/119437
2024-03-18 22:17:45 +01:00
Julian Eisel
0d7ac2542e Merge branch 'blender-v4.1-release' 2024-03-18 19:37:56 +01:00
Julian Eisel
745fd2a2cb Fix: Tree-view items always collapsed by default
Since 660867fa00, having tree-view items uncollapsed by default using
the `set_collapsed()` functions wouldn't work anymore. An attempt to do
this would assert even, so eb71d9f7bc disabled the assert.

I think a function designed to handle exactly this is the best solution,
it makes the intent & behavior more clear than before, and highlights
that this is a special case.

Mitigates #117957, in that it solves the regression, but tree-views still
don't remember their state on screen-layout changes. This is a known
limitation and not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/119166
2024-03-18 19:32:53 +01:00
Brecht Van Lommel
7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00
Harley Acheson
3d85765e14 UI: Position of Tooltips for Labels
Move tooltip position to mouse position rather than bottom of the
region for labels that are taller than one line.

Pull Request: https://projects.blender.org/blender/blender/pulls/117879
2024-03-14 21:35:11 +01:00
Falk David
6a320524b9 Fix: GPv3: Function use_masks returns wrong value
This fixes an issue where the `use_masks` functions on layers
and groups returned the wrong value.
The issue was that the root group doesn't have this flag set
which then propagates to all the layers and groups.
To fix this we invert the `GP_LAYER_TREE_NODE_USE_MASKS` flag (now called `GP_LAYER_TREE_NODE_HIDE_MASKS`).

The API still uses the `use_masks` function.
2024-03-14 15:25:23 +01:00
Falk David
a5229ed125 GPv3: Add layer masks operators and UI
Layer masks were partly already there. This PR completes the implementation and expose them through the UI.

This also adds three operators to:
- add a layer mask
- remove a layer mask
- reorder layer masks

Note: These are not used by the renderer yet. Will be done in a following PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/119433
2024-03-14 14:07:37 +01:00
Harley Acheson
1f1fbda3ee UI: template_ID button Width Minimums
Use the prior fixed button widths as minimum sizes for the template_ID
new and open buttons. That way they will look the same as before under
most circumstances but will still adjust rather than overflow for
longer content or larger text sizes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119330
2024-03-11 17:31:04 +01:00
Sean Kim
1df10d0d25 Fix #119014: Crash on keymap editing for Mac
Due to differences with the libc++ std::sort implementation that has a strong
requirement on strict weak ordering.

Pull Request: https://projects.blender.org/blender/blender/pulls/119189
2024-03-11 16:31:08 +01:00
Harley Acheson
196cd48aad UI: Positioning of 3DView Sidebar Tab Titles
Improve the positioning of the tab titles in the 3D Viewport sidebar
by taking the Text Style size into consideration.

Pull Request: https://projects.blender.org/blender/blender/pulls/119231
2024-03-09 01:34:42 +01:00
Harley Acheson
f85989f5db UI: Adjust template_ID Buttons Width For Content Length
The Template_ID uses fixed widths for "new" and "open" buttons.
Although scaled by resolution scale, they do not take into account
language differences, Text Styles, etc and therefore frequently
overflow. This PR sets the buttons widths from the text size.

Pull Request: https://projects.blender.org/blender/blender/pulls/119229
2024-03-08 23:30:10 +01:00
Harley Acheson
4dd11c458a UI: Adjust template_ID String Length for Pin Icon
Fix text overflow in Scene selector. This Template_ID uses a "pin" icon
which will cause the name to clip at some sizes.  Also decreases the
minimum width because of this fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/119227
2024-03-08 21:49:12 +01:00
Hans Goudey
1050d6147f Cleanup: Remove unnecessary C wrappers for UI view classes 2024-03-08 09:16:07 -05:00
Campbell Barton
cb4351665a Cleanup: format, trailing space 2024-03-08 11:31:01 +11:00
Hans Goudey
744f3b2823 Cleanup: Grammar in comments: Fix uses of "own"
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own",  "her own", or "the object's own".
It also isn't used separately to mean something like "separate".

Also, "its own" is correct instead of "it's own" which is a misues of the verb.
2024-03-07 16:23:35 -05:00
Hans Goudey
d8252cdff7 Cleanup: Use "this->" to call class methods 2024-03-07 16:23:35 -05:00
Harley Acheson
7e8baea394 Revert #119181: Popover Button Padding for Arrow
Reverting aa328e898e as this causes unintended changes elsewhere. Even
if made more conservative with just allowing UI_LAYOUT_PANEL and
force_menu.  Will need further investigation for a better solution.

Pull Request: https://projects.blender.org/blender/blender/pulls/119187
2024-03-07 22:22:31 +01:00
Harley Acheson
aa328e898e UI: Popover Button Padding for Arrow
Currently UI_BTYPE_POPOVER with icon and without text will get enough
extra padding to fit a downward arrow, only if in a header region. This
PR allows it to get the same padding in other areas when "force_menu"
is true.

Pull Request: https://projects.blender.org/blender/blender/pulls/119181
2024-03-07 22:01:56 +01:00
Sybren A. Stüvel
90ef46baa1 Anim: DNA for Animation data-block
Introduce new DNA for the `Animation` data-block and its sub-data.

This includes the blenkernel code for reading & writing to blend files,
and for memory management (freeing, duplicating). Minimal C++ wrappers
are included, with just the functionality needed for blenkernel to do
its job.

The Outliner code is extended so that it knows about the new data-type,
nothing more.

For more info, see issue #113594.

Pull Request: https://projects.blender.org/blender/blender/pulls/119077
2024-03-07 16:41:25 +01:00
Germano Cavalcante
dd0e60fb51 3D View: Do not recalculate the depth buffer for 'Auto Depth'
This is a solution to avoid redrawing the depth buffer for each Zoom
with `Auto Depth`.

The solution is to move the `ED_view3d_depth_override` function out of
`ED_view3d_autodist` and only call `ED_view3d_depth_override` if the
depth buffer is not used by any current engine.

Pull Request: https://projects.blender.org/blender/blender/pulls/113026
2024-03-07 15:16:41 +01:00
Bastien Montagne
23ce5b6567 Merge branch 'blender-v4.1-release' 2024-03-06 10:06:08 +01:00
Bastien Montagne
bb00621965 Fix recent regression preventing animation on any linked data.
Regression in 427eed292d.

Root of the issue was that animation system was using a single same
check to decide if an F-Curve/driver was valid to use to animate some
data, and whether user can create/edit animation for that data.

Both cases are actually different, since e.g. linked data is not
user-editable, but it can still be animated (either by related linked
Actions, drivers defined in the linked data, or some more hackish
changes like py API/RNA scripting).

This commit now defines two checks:
 * `RNA_property_animateable`: whether a RNA pointer & propoerty is
   animateable, based on their types and definition.
 * `RNA_property_anim_editable`: whether a specific data referenced by
   the RNA pointer and property is effectively user-editable.

The new `driveable` check added by 427eed292d is also renamed to
`RNA_property_driver_editable` (since the basic type-based
`RNA_property_animateable` is also valid for drivers currently).

Pull Request: https://projects.blender.org/blender/blender/pulls/119089
2024-03-06 10:02:53 +01:00
Harley Acheson
615edb3f3c UI: Props Dialog Default Properties
Allow activating numerical buttons upon opening of props dialogs. Set
defaults for some dialogs where appropriate.

Pull Request: https://projects.blender.org/blender/blender/pulls/119007
2024-03-05 18:54:50 +01:00
Falk David
a11335d19a Cleanup: Move BKE_fcurve.h to C++
No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119094
2024-03-05 18:39:08 +01:00
Harley Acheson
a1f92f5820 Refactor: ui_draw_popover_back Impossible Null Dereference
The function ui_draw_popover_back has a "block" argument, that is
checked for null, but then has an "else" that would require it and
cause a null pointer dereference. This is an internal function that has
one caller, in response to a condition on that same block's flag.
Therefore this PR removes this function's check for null and the else
code as this condition is not possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/119092
2024-03-05 17:39:35 +01:00
Hans Goudey
ce80cc1526 Cleanup: Remove unused UI button creation function
Last used over 11 years ago apparently.
2024-03-04 12:22:50 -05:00
Jacques Lucke
fdc9bcf523 Merge branch 'blender-v4.1-release' 2024-03-03 00:35:37 +01:00
Jacques Lucke
cce2b6671e Fix #114110: background dots clipping in node editor
The clipping was introduced because it looked a bit like the dots are
above the scrollbar. However, the clipping looks worse and the dots
are actually below the scrollbar. If we don't want stuff to be visible
through the scrollbar, it should be more opaque.
2024-03-03 00:34:16 +01:00
Hans Goudey
aab9ecc396 Cleanup: Remove very old hack to fix linking in interface module
Pull Request: https://projects.blender.org/blender/blender/pulls/118988
2024-03-01 23:47:18 +01:00
Hans Goudey
840307c59a Fix: Build error on MSVC after recent cleanup, make format
captured structured bindings are a C++20 extension [-Wc++20-extensions]
2024-03-01 14:54:01 -05:00
Hans Goudey
d29ce3d531 UI: Remove uiBut a1 and a2 values
Over the last couple years (!) UI buttons have moved to derived classes,
meaning we don't need to use the same "a1" and "a2" variables to store
different information. At this point, that information is set specifically
by internal UI code, or functions like `UI_but_*_set`.

These values are only set to their default 0 values now (or -1 in some
non-meaningful cases). This commit removes the values from buttons
and removes the remaining a1 and a2 arguments from the UI API.
2024-03-01 14:27:57 -05:00
Hans Goudey
8c63889241 Cleanup: UI: Use derived struct for list scroll bars, remove a1, a2 usage 2024-03-01 14:27:57 -05:00
Hans Goudey
365966d51d Cleanup: UI: Use derived struct for label buttons, remove a1, a2 usage 2024-03-01 14:27:56 -05:00
Hans Goudey
7053aef448 Cleanup: Correct comments about uiBut a1 and a2 2024-03-01 14:27:56 -05:00
Hans Goudey
f4e670af2c Refactor: UI: Use regular button callbacks for curve, color ramp templates
Previously these used a special "menu func" that used an argument value
passed through each menu button's a2 value. This was more complex than
necessary given the existence of generic button callbacks.

So use std::function in these remaining cases, and remove the now-unused
`butm_func` and `butm_func_arg` values in the uiBlock.
2024-03-01 14:27:56 -05:00
Bastien Montagne
1653b8b998 Merge branch 'blender-v4.1-release' 2024-03-01 18:24:22 +01:00
Bastien Montagne
427eed292d Fix #117970: Fix RNA checks for animatable properties, add a check for drivable ones.
The `RNA_property_animateable` would check for some conditions, where it
is not valid to add or edit animations (e.g. if using a linked Action
ID...).

Add a new `RNA_property_drivable`, which is essentially a call to
`RNA_property_animateable` with extra checks in liboverride cases, as
drivers are stored directly in the AnimData struct, instead of their own
dedicated ID.

Pull Request: https://projects.blender.org/blender/blender/pulls/118809
2024-03-01 18:19:38 +01:00
Harley Acheson
5e669d99d7 Refactor: UI_BTYPE_SEPR_LINE Without Need for uiBut->a1
The line separator needs to know vertical or horizontal orientation
at draw time, and is independent of button rect. This PR removes the
use of uiBut->a1 for this in favor of a derived struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/118969
2024-03-01 18:09:02 +01:00
Hans Goudey
e1023b22f1 Cleanup: UI: Remove more uses of a1 and a2 arguments
Remove uses for `uiDefButS`. -1 was passed as a2 still in a few
places, but that was most likely just because of copy & paste,
it doesn't look like that's actually used anywhere.
2024-02-29 22:39:37 -05:00
Hans Goudey
aabd5de1f9 Cleanup: Remove unused UI button creation function 2024-02-29 22:39:37 -05:00
Hans Goudey
9018c8b99b Cleanup: Remove unnecessary use of uiBut::a2
The color luminosity was written to this value, but never read
anywhere. uiBut::a2 is only read in three more places, none of
which could reasonably use this value.
2024-02-29 22:39:37 -05:00
Hans Goudey
121ded625f Cleanup: Remove unnecessary a1 and a2 arguments for some UI functions 2024-02-29 22:39:37 -05:00
Hans Goudey
0e2fed5a57 Refactor: UI: Avoid a1 and a1 values for search button preview grid size 2024-02-29 22:39:37 -05:00
Campbell Barton
7db790c4b7 Cleanup: spelling in comments 2024-02-28 12:13:20 +11:00
Bastien Montagne
920b9ab134 Merge branch 'blender-v4.1-release' 2024-02-26 18:49:24 +01:00
Bastien Montagne
3748e49034 LibOverride: When created from IDTemplate UI, ensure instanciation of hierarchy root.
When a new liboverride is created from the IDTemplate UI widget, in case
its hierarchy root is different than the liboverride itself, ensure that
it is also instanciated in the scene, if possible (i.e. if it's an
object or collection).

Should allow for better representation of liboverride hierarchies
created that way, and reduce the risk of getting key liboverrides hidden
from the scene's hierarchy (in the Outliner ViewLayer view e.g.).
2024-02-26 18:48:37 +01:00