Commit Graph

102574 Commits

Author SHA1 Message Date
Campbell Barton
34e4916d51 Fix setting curve handles free/aligned/toggle ignoring selected knots
Missed from [0] where handles should be considered selected when the
knot is selected.

[0]: 78b6ed19f3
2023-09-08 15:42:59 +10:00
Campbell Barton
ec89e966d0 BKE_deform: assert on invalid arguments to BKE_defvert_remove_group 2023-09-08 14:56:07 +10:00
Campbell Barton
3bc9971f26 Cleanup: assert the index created in rule_follow_leader is valid
Assert that the partial is part of the particle system before
creating an index. This is a hint to developers that the cast
is safe and using a pointer offset isn't going to cause problems.

Issue raised by !111193.

Co-authored-by: Loren Osborn <linux_dr>
2023-09-08 13:57:53 +10:00
Campbell Barton
a8124a2cb4 Fix potential error casting a pointer offset to int on 64bit systems
When using a pointer offset that may be out-of-bounds the integer
must not truncate the offset.

Issue raised by !111193.

Co-authored-by: Loren Osborn <linux_dr>
2023-09-08 13:46:01 +10:00
Campbell Barton
e5a1e6bcf1 Cleanup: use early returns in deform.cc functions 2023-09-08 13:42:47 +10:00
Harley Acheson
8d71e55d40 UI: Simplified Hover on Tool Items
Tool highlighting that targets RGN_TYPE_TOOLS only, moves
the highlighting to ui_block_func_POPUP

Pull Request: https://projects.blender.org/blender/blender/pulls/112113
2023-09-08 02:27:39 +02:00
Pablo Vazquez
24fe81e602 UI: Do not repeat icon in modifier options menu
"Apply as Shape Key" and "Save as Shape Key" shared the same icon, it
is good practice to not use the same icon for two consecutive items
in the same group in a menu.

Also add a separator to split Shape Key-related items from the rest.
2023-09-08 00:52:29 +02:00
Colin Basnett
5a679ccc28 Fix: Incorrect NodeTreeInterface move functions argument descriptions
Seems to have been a typo in the descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/112109
2023-09-08 00:29:17 +02:00
Hans Goudey
88a7860251 Cleanup: Avoid assuming guarded allocator in corrective smooth modifier
Don't call `MEM_dupallocN` on unknown data. We don't know that this
pointer references a heap allocation, especially not an allocation made
by Blender's allocator. Even if that's the case currently, we don't want
to rely on that in the future as attribute data management gets more
flexible with implicit sharing.

Using `Array` is a simpler way to copy memory, though it does require
a bunch of boilerplate changes in the rest of the modifier.
2023-09-07 18:07:17 -04:00
Hans Goudey
a8bbddc10b Fix #111811: Corrective smooth modifier crash with zero vertices
In the charge splash screen demo file for Blender 3.4, the corrective
smooth modifier is called with a zero vertex mesh, which means it ends
up trying to free a null pointer is creates locally. Checking for null
resolves the crash. A future fix will remove the assumption that
`rest_coords` are allocated with the guarded allocator and can be
used as an argument to `MEM_dupallocN`.
2023-09-07 15:56:53 -04:00
Harley Acheson
9903c4419e Fix #112077: Crash Highlighting Popover menu
Added check for null active region

Pull Request: https://projects.blender.org/blender/blender/pulls/112099
2023-09-07 19:52:41 +02:00
Lukas Tönne
21953e47dc Fix #112073: Add all group outputs first, followed by all inputs
This keeps initial node groups using conventional outputs..inputs
layout.

Pull Request: https://projects.blender.org/blender/blender/pulls/112076
2023-09-07 15:08:52 +02:00
Lukas Tönne
0691ac622f Fix #111969: Remove gaps between panels and fill in the background
Panels are supposed to fill in the background.

Pull Request: https://projects.blender.org/blender/blender/pulls/112078
2023-09-07 15:07:06 +02:00
Lukas Tönne
fc321739f0 Fix #111963: Followup fix to ensure sockets inside panels have unique identifiers
#111972 made sure copied sockets have unique identifiers, but it didn't
cover the case of copying a panel and its children.

- Added an optional `uid_gen` argument to item copy functions which
  generates new unique identifiers for copied items. If not specified
  the items will retain the original identifiers (e.g. when copying an
  entire node tree).
- Removed the `copy_items` panel function from the API. Only used
  internally and requires a uid generator now.

Pull Request: https://projects.blender.org/blender/blender/pulls/112074
2023-09-07 15:06:38 +02:00
Hans Goudey
0783debda8 Geometry Nodes: Hide node group selector for asset modifiers
When adding modifiers from assets in the new modifier menu, switching
the node group the modifier uses afterwards will not be common. The goal
is to replace the builtin modifier directly. In that case it's easier to
just add a new modifier. The "Empty Modifier" item makes it easy to
choose an arbitrary node group anyway.

Combined with hiding the two sub-panels when they are unnecessary,
many node-modifiers will look just as clean as their builtin counterparts.

The option to show the data-block selector is added to the menu
in the node header so it's still accessible though.

Pull Request: https://projects.blender.org/blender/blender/pulls/111995
2023-09-07 14:47:40 +02:00
Hans Goudey
9f998c3e3a Cleanup: Change mesh face triangle count macro to C++ inline function 2023-09-07 08:36:43 -04:00
Christoph Lendenfeld
8134849b12 Fix: Graph Editor extrapolation line drawing issue
Introduced with #110788
Because of the logic introduced there, the first key might not be drawn,
resulting in a wrong extrapolation line.

This fixes it by always adding the first point

Pull Request: https://projects.blender.org/blender/blender/pulls/112072
2023-09-07 10:31:03 +02:00
Lukas Tönne
8f21353b5d Fix #111788: Label width needs to use UI scale to match node width
For the label width the offset from the node width needs to be scaled by
`UI_SCALE_FAC`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112047
2023-09-07 09:21:33 +02:00
Campbell Barton
6a1ba2aca1 Cleanup: remove unused defines, reduce variable scope 2023-09-07 16:22:58 +10:00
Campbell Barton
3f9a15bc30 Fix #112052: Theme access asserts on startup
Resolve an issue where drawing the status-bar's report info could
assert on startup. This was probably caused by accessing theme colors
before drawing.

The reporter traced this back to [0] however I couldn't reproduce the
problem. Remove theme access from INFO_OT_reports_display_update as the
color has not been used since [1].

[0]: 6de294a191
[1]: 694bc4d040
2023-09-07 15:54:55 +10:00
Campbell Barton
3059c3ee26 UI: display a short pulse when displaying reports in the status bar
This functionality was lost in [0].

[0]: 694bc4d040
2023-09-07 15:54:54 +10:00
Campbell Barton
3b0ced2e31 BLI_math: add add_v3_uchar_clamped (previously color_add_v3_i)
Move color_add_v3_i to a public function,
useful for making minor color adjustments.
2023-09-07 15:54:53 +10:00
Campbell Barton
2ed423c23b Cleanup: remove unnecessary UI_GetThemeColorType4ubv call
Store theme colors in variables for reuse.
2023-09-07 15:54:51 +10:00
Hans Goudey
c4cec77b91 Fix: Debug build error after previous commit
Remove debug asserts that don't serve a clear purpose besides testing
something that's clear from the called code, and require accessing mesh
data just for asserts.
2023-09-06 22:57:59 -04:00
Richard Antalik
49a0502f35 Fix mistake in previous commit
In 1fb692e896 values were clamped, but not used.
2023-09-07 04:34:04 +02:00
Hans Goudey
9db02c8617 Cleanup: Change OffsetsIndices::data() to return Span instead of pointer
Accessing the span should be possible. `Span` already allows pointer
access itself.
2023-09-06 22:27:39 -04:00
Richard Antalik
1fb692e896 Fix crash when moving retimed sound strip
Crash happened, when strip start frame has negative value.
Sound properties can not be animated in negative frames.
2023-09-07 03:57:33 +02:00
Hans Goudey
2cc3a63216 Cleanup: Remove mesh validation assert in mesh code
These asserts are helpful for development, but are too expensive and
strict to live permanently in debug builds.

Resolves #112035
2023-09-06 15:37:35 -04:00
Harley Acheson
d99af958d7 UI: Show Selected Tool Item
Show Toolbar items with selected highlight and hover highlight.

Pull Request: https://projects.blender.org/blender/blender/pulls/111939
2023-09-06 19:07:28 +02:00
Julian Eisel
1b2e29e692 Cleanup: Clarify path variable name in thumbnail create function
"filepath" was misleading since this path could also point into a .blend
file. Further, the convention was to use "filepath" for such files, and
"file_path" for when only an actual file path was expected. This is
highly confusing and non-obvious. Plus a (newer?) function broke with
the convention.

Just be explicit about the type of path, even if a bit verbose. It's
good to always have the reminder that this may be more than just a file
path when passing it around.
2023-09-06 18:46:29 +02:00
Harley Acheson
63e210895b UI: Proper Selection Highlight for Confirms
Operator Confirms get blue highlights since we use those like dialogs.

Pull Request: https://projects.blender.org/blender/blender/pulls/111949
2023-09-06 18:24:48 +02:00
Bastien Montagne
eadc54bb5d Fix (unreported) crash when deleting ObData while keeping their ShapeKeys.
Batch deletion of IDs could lead to deleting ObData ones while keeping
the related ShapeKeys.

Orphaned shape keys are not allowed anymore in Blender, they are checked
against in both file write and read code.

This would lead to assert (and crash) e.g. in the liboverride code.

This commit forcefully add shapekeys of deleted meshes, curves etc.,
when calling e.g. `BKE_id_multi_tagged_delete`.

Note that deleting the shapekey when deleting the obdata ID was already
implemented in single ID deletion (`BKE_id_delete` & co), in the
underlying private `id_free`. But this is skipped in `no main` case.
which is used by the batch deletion code for performance optimizations.
2023-09-06 18:21:15 +02:00
Bastien Montagne
fc02d5ee11 Fix (unreported) crash in versioning code of the new Bone Collections.
Code would access invalid (null) `pchan->bone` pointers, presumably due
to the (linked) armature data being heavily modified compared to the
local Object's poses? At least that's the idea of what caused this
invalid state of pose data.

Unfortunately the issue was detected in a very complex case.
Essentially, opening an older snapshot (r3034) of a Pets production anim
file with assets from current repository r3055), which have been heavily
cleaned-up.
This triggers massive amount of missing linked data from the older anim
file, and extremely heavy resyncing process of liboverrides.

In any case, calling `BKE_pose_ensure` before accessing object's pose
data should never be a bad thing. ;)
2023-09-06 18:21:15 +02:00
Jacques Lucke
7f9d51853c UI: support searching in menus
The basic idea is very simple. Whenever a supported menu is open, one can just
start typing and this opens a search that contains all the (nested) menu entries.

The main downside is that this collides with accelerator keys. Those are the
underlined characters in each menu. For now, we just enable this new searching
behavior in a few selected menus: Node Add Menu, View3D Add Menu and
Modifier Add Menu.

This new functionality can be enabled for a menu by setting
`bl_options = {'SEARCH_ON_KEY_PRESS'}` to true in the menu type.

The status bar shows `Type to search...` when a menu is opened that supports search.

Pull Request: https://projects.blender.org/blender/blender/pulls/110855
2023-09-06 18:16:45 +02:00
Lukas Tönne
f9c733dbd6 Fix #112014: Crash making node group with multiple input links
e071288ab2 changed the "make node group" operator for new interfaces,
and in the process added incorrect lines removing a link when a group
input exists already. This crashes when there are multiple sockets
in selected nodes linked to the same non-selected output.

The link should not be removed, this is just lazy-initialization of the
group sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/112027
2023-09-06 18:01:05 +02:00
Julian Eisel
f20853a6c9 Fix possible crash when loading thumbnails from .blend files
When data-block/asset previews were not stored in the thumbnail cache
yet (or were outdated), we'd read them from .blend files. This could
lead to random crashes (but quite reliable with a small number of
previews to be read).

Wasn't clearing runtime memory which could lead to the
`PRV_TAG_DEFFERED` bit being set. This meant we would try to free
deferred preview data since eefee47a8a, which was just garbage memory.
2023-09-06 18:00:20 +02:00
Harley Acheson
d49c3d4d07 UI: Fixes for the highlighting of Selected Enums
Remove need for adding UI_BUT_LIST_ITEM, and replace use
of UI_BUT_ACTIVE_DEFAULT with UI_SELECT_DRAW

Pull Request: https://projects.blender.org/blender/blender/pulls/111938
2023-09-06 17:55:56 +02:00
Pablo Vazquez
9c1d9b6a82 UI: Hide widget emboss if inner color is fully transparent
Allows themes to have fully transparent widgets when the inner and
outline theme colors are set to 0.0f alpha.

Pull Request: https://projects.blender.org/blender/blender/pulls/111980
2023-09-06 17:53:43 +02:00
Harley Acheson
bb31df1054 UI: Allow "New Window" While in Maximized Area
While an editor is in "Maximize Area" mode, allow Window / New Window.

Pull Request: https://projects.blender.org/blender/blender/pulls/111999
2023-09-06 17:50:19 +02:00
Julian Eisel
a24fa35120 Cleanup: Avoid redundant/confusing variable in thubnail create function
This confused me plenty of times. If there are two local variables I
assume they contain different things. In fact these two were equal
throughout the function.
2023-09-06 17:41:44 +02:00
Bastien Montagne
3ce87be27f LibOverride: Expose the 'needs resync' status of libraries to RNA/Py API.
Could be useful for automated update/sanitizer tools in a production
pipeline.

Note that this propoerty is left editable for now, on purpose (external
tools may want to clear the flag).
2023-09-06 17:14:46 +02:00
Bastien Montagne
1a4225d746 Fix (studio-reported) missing clearing of 'need resync' library tag.
The `Library.tag` data is supposed to be runtime only, so needs to be
cleared when reading data from blendfile.

This fixes the 'need resync' status of a library staying around forever
once set, annoying visual warning in the Outliner.
2023-09-06 17:14:46 +02:00
Hans Goudey
4e97def8a3 Geometry Nodes: Expose sharp edge status with builtin nodes
Change the existing "Is Shade Smooth" node to be named "Is Face Smooth"
and add a new "Is Edge Smooth" node. Also give the "Set Shade Smooth"
node the ability to set face or edge smoothness.

The fact that the nodes process "smooth" data reversed from the builtin
"sharp" attributes can be reversed with versioning in a separate commit.

While it's tempting to abstract the sharpness status into a single node,
face and edge smoothness are accessed separately in edit mode, and the
subtlety of interacting with data on different domains would make that
confusing. Instead, a separate "Is Shade Smooth" node group asset will
give all the sharp elements taking into account both builtin attributes.

The fact that sharpness is stored separately on two domains makes the
best design for simple operations non-obvious. For example, you should be
able to remove all sharpness or make everything flat with a single node.
The behavior depends on whether the two attributes exist and the
combination of values between the domains.

---

![image](/attachments/c3f053c4-2b0f-44ac-9227-62071065fe56)

![image](/attachments/fd489fb3-314b-42ff-a5a9-e79578cbdfe7)

Pull Request: https://projects.blender.org/blender/blender/pulls/112029
2023-09-06 17:12:27 +02:00
Julian Eisel
1ee584c137 Cleanup: Add comments to thumbnail creation function
The function is quite confusing, this should clarify things a bit.
2023-09-06 16:58:07 +02:00
Julian Eisel
6659579abc Cleanup: Move variable declarations close to usage in thumbnail function
This function is rather big and it's not clear what state variables are
in without a bunch of scrolling around. Plus, having the declarations
close to the function calls that set them makes it more clear that these
functions use the variables as output parameters. So this change should
help understanding the function flow.
2023-09-06 16:56:30 +02:00
Philipp Oeser
5b6e1c0cf6 Fix #111898: Custom normals data transfer modifier does not work
Mistake/typo in 5e9ea9243b (mixing up very similarly named variables -
leading to heap buffer overflow).

Pull Request: https://projects.blender.org/blender/blender/pulls/112037
2023-09-06 16:54:46 +02:00
Bastien Montagne
00a36cbf24 Fix #111970: Regression: Crash with assertion after delete scene when some 3D Views have Local Collection enabled
This is a nasty gathering of several issues, main one being that 'local
collections' of 3DViews are still updated immediately instead of the
deferred update used for all other viewlayer cases.

The change in a16bcb6576 led to internal references to the Scene's
master collection to become invalid, which is the expected behavior.
But this turns the Scene's view_layers into invalid state too.

Ideally, there should never be resync of viewlayers of a scene being
deleted anyways.

For now, take the (hopefully!) safe approach of explicitely forbidding
any viewlayer update during ID deletion process, and deferring it at the
end of the process.

Note that this change may also give some marginal gerformance
improvements in some rare edge cases (like deleting a very heavy scene
with many collections and 'local collection' 3DViews ?).
2023-09-06 16:21:55 +02:00
Miguel Pozo
e850df06ee Workbench: Remove next postfix
Pull Request: https://projects.blender.org/blender/blender/pulls/111993
2023-09-06 15:54:50 +02:00
Miguel Pozo
2aa7961e6f Workbench: Remove old implementation 2023-09-06 15:54:48 +02:00
Clément Foucault
209bbf8274 GPU: Rename ROG to SubpassInput, add tests and documentation
This is in order to follow the vulkan terminology
like the rest of the module.

Other implementations (GL, VK) are not supposed to work yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/112026
2023-09-06 14:39:38 +02:00