Reduce cognitive complexity of `ui_but_anim_flag()`. Early returns, less
indentation, and variable declarations close to where they are used.
No functional changes.
This pull request adds the ability for the `propagation_steps` value
for certain automasking settings to be applied globally instead of
using the per-brush attribute.
Previously, while the flag settings were stored at the brush and global
level, the `propagation_steps` value would always change the brush
attribute even when using the global menu.
Addresses #102377
Pull Request: https://projects.blender.org/blender/blender/pulls/117316
Connecting an empty menu to the node group inputs causes a memory leak.
The `id_property_int_update_enum_items` function was always allocating
a new `enum_items` list, but then discarding it if there are no enum
items.
In the M/Shift+M popup menus (3D viewport, armature pose/edit mode),
disable menu items for operators that are owned by a linked armature.
You can only (un)assign bones to local bone collections (so local armature
or added via local library override).
`add_or_move_to_collection_bcoll()` already checked for linked collections,
but the caller didn't properly do a `nullptr` check. Adding that check
fixed the crash.
The next commit will actually disable the menu for such collections, so
that it's clear in the UI that it cannot work.
The problem was that `grease_pencil_edit_batch_ensure` would not return early if the buffers already exist, meaning that multiple buffers could be create but only the last ones would be freed.
Pull Request: https://projects.blender.org/blender/blender/pulls/117580
Previously, one could easily "loose" baked data by undoing. The data was not
actually deleted, but Blender didn't find it anymore. This happened because
`update_existing_bake_caches` was expected to be called after changes to
`NodesModifierData.bakes`. However, this was not called after undo.
It was also not possible to call this function from `blend_read`, because it
required access to the referenced node tree.
Now, the bake cache is lazily created during depsgraph evaluation, which
partially solves the problem. It can still seem that Blender lost data, but that
fixes itself much more quickly after the next evaluation. The remaining issue
should be solved a future patch that keeps the bake cache intact over undo
steps using `foreach_cache`.
With the addition of F82 tinting to the Principled BSDF, metals now use
the specular tint parameter.
This can cause issues when converting materials from older versions
of Blender to newer versions if the Specular Tint isn't handled
properly for these materials.
This commit attempts to fix this by adjusting the Specular Tint color
based on the Metallic input to try and keep converted materials
consistent with older versions of Blender.
Thank you to @LukasStockner for helping out.
Pull Request: https://projects.blender.org/blender/blender/pulls/114518
While investigating Blender compilation time for windows-arm64, we
identified two compilation units that were taking a long time to compile
(~1h each). This affects windows-x64 builds as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/117534
Adds file handlers for the C++ import operators.
This will allow these operators to be invoked with drag-and-drop
filepath data in the 3D Viewport or the Outliner.
When the operators are called with drag-and-drop data a dialog popup
will be used instead of invoking the file select window.
Previously OPTYPE_REGISTER tag had no effect, now since these operators
can run as popup dialogs this flag is removed to prevent heavy io
operations in the redo panel.
Also includes drawing functions for ply and stl and a missing
event notifications to collada import.
Important: Presets can override file path properties, so if a preset is
used, file paths provided by drag and drop will be lost. This will be
addressed in follow up changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/116873
This was part of #117528, but the description is not suitable as a title
in general and this breaks various existing popups. It is often tool long
and detailed, or just not worded in a way that works as a title.
Based on an instrumented set of our container classes, this code path
was found to be producing an excessive number of Set resizes that are
trivial to remove.
The Set's inline buffer size was tuned from 4 to 16 which eliminates all
allocations, about 77k of them, during FBX import of the Zero-Day
"Measure One" scene[1]. It also eliminates ~90% of allocations, about
844k of them, when loading the Charge demo scene. For additional
context, using a size of 8 would reduce allocs by ~65% for Zero-Day.
[1] Zero-Day, Open Research Content Archive (ORCA):
https://developer.nvidia.com/orca/beeple-zero-day
Pull Request: https://projects.blender.org/blender/blender/pulls/117432
Based on an instrumented set of our container classes, it was found that
an excessive number of Vector reallocations were occurring in the corner
normals code path.
The allocations were reduced by increasing inline buffer sizes for the
Vectors in question. The total number of reallocs falls from 433k to
194k when importing the Zero-Day FBX scene[1]. Profiling time spent in
`MEM_lockfree_mallocN_aligned` falls from ~1.3% to ~1.15%
[1] Zero-Day, Open Research Content Archive (ORCA):
https://developer.nvidia.com/orca/beeple-zero-day
Pull Request: https://projects.blender.org/blender/blender/pulls/117431
Fixes issue where motion blur would not display for
certain objects intermittently due to uninitialized
parameters in the ObjectKey struct causing the
motion object map look-up to fail and for motion
parameters to be reset to default, disabling the
effect for the given objects.
Authored by Apple: Michael Parkin-White
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117560
- Only calculate the necessary normals based on smooth/flat/mixed shading
- Use cached face normals instead of computing them
- Use a `VectorSet` for deduplication instead of a `Map`
- Deduplicate vertex normals and store indices in separate loops
- Avoid unnecessary duplication of face normal indices
- Inline simple function for slicing index span
Export time (ms) of 1.8m vertex mesh:
| Normals Domain | Before | After |
| --------------- | ------ | ----- |
| Face (flat) | 559 | 469 |
| Vertex (smooth) | 659 | 466 |
| Corner (mixed) | 656 | 640 |
The change of using normals from different domains and using a
VectorSet for de-duplication change the order of normals in the OBJ
files. Other than that, the results should be unchanged.
Fixes#117510
Pull Request: https://projects.blender.org/blender/blender/pulls/117522
A draw list bundles multiple draw commands for the same geometry
and sends the draw commands in a single command. This reduces
the overhead of pipeline checking, resource validation and can
keep the load higher on the gpu as more work needs to be done.
Previously the draw list didn't bundle any commands and would still
send each call separately to the GPU. This PR implements the bundling
of the commands.
Pull Request: https://projects.blender.org/blender/blender/pulls/117548
This was the case for custom normals.
There was an optimization in 91b4f9f1f6 that was skipping computation of
existing normals if the Mix Factor in the UI was at 1.0 (under the
assumption that in this case no old normals would be needed.
Problem is that the resulting mix factor is the product of the Mix
Factor in the UI and the weights, so just doing the check as in the
culprit commit is not enough.
Need to consider if weights are used.
Pull Request: https://projects.blender.org/blender/blender/pulls/117538
This is because the `NODE_OT_group_edit` operator reuses the last value
of the `Exit` property and once this is set it would always try to pop
(instead of push [which is what we want from the icon]) the nodegroup.
Callers of the operator set `Exit` explicitly elsewhere (just not
from node drawing -- where the way it is called [via a more general
callback] makes it difficult to set operator properties from there).
Solve by not saving the property for following usages (flag
`PROP_SKIP_SAVE`).
Fixes#117530.
Pull Request: https://projects.blender.org/blender/blender/pulls/117542
By default, Color Palettes are only drawn in the UI in the context of
**painting**.
UI button code then tries to update an appropriate brush from edits to
the palette.
So a valid `Paint` and `Brush` were assumed. This is not a problem for
objectmode (because `BKE_paint_get_active_from_context` then defaults to
`ImagePaintSettings`'s `Paint`), but other modes dont guarantee this
(editmode only returns a valid `Paint` when uv sculpting).
In the report, a palette was created and displayed via python, making
changes in editmode would then crash.
Solve by checking we have a valid Paint in corresponding UI code to
begin with.
Similar to 9e82e48937 .
Pull Request: https://projects.blender.org/blender/blender/pulls/117544
This adds a proper poll function to the `brush_stroke` operator.
Ensures that this operator is only used by tools that are brushes.
Also changes the poll for the drawing of the cursor to only run
with tools that are brushes.
This patch adds support for _Menu Switch_ nodes and enum definitions in
node trees more generally. The design is based on the outcome of the
[2022 Nodes Workshop](https://code.blender.org/2022/11/geometry-nodes-workshop-2022/#menu-switch).
The _Menu Switch_ node is an advanced version of the _Switch_ node which
has a customizable **menu input socket** instead of a simple boolean.
The _items_ of this menu are owned by the node itself. Each item has a
name and description and unique identifier that is used internally. A
menu _socket_ represents a concrete value out of the list of items.
To enable selection of an enum value for unconnected sockets the menu is
presented as a dropdown list like built-in enums. When the socket is
connected a shared pointer to the enum definition is propagated along
links and stored in socket default values. This allows node groups to
expose a menu from an internal menu switch as a parameter. The enum
definition is a runtime copy of the enum items in DNA that allows
sharing.
A menu socket can have multiple connections, which can lead to
ambiguity. If two or more different menu source nodes are connected to a
socket it gets marked as _undefined_. Any connection to an undefined
menu socket is invalid as a hint to users that there is a problem. A
warning/error is also shown on nodes with undefined menu sockets.
At runtime the value of a menu socket is the simple integer identifier.
This can also be a field in geometry nodes. The identifier is unique
within each enum definition, and it is persistent even when items are
added, removed, or changed. Changing the name of an item does not affect
the internal identifier, so users can rename enum items without breaking
existing input values. This also persists if, for example, a linked node
group is temporarily unavailable.
Pull Request: https://projects.blender.org/blender/blender/pulls/113445
EEVEE uses an HiZ buffer. The size of the HiZ buffer is based on the render extent.
Probes assume that the render extent is always bigger than needed for rendering
probes. This assumption is incorrect.
Although this PR fixes this by allocating the required size, it is still renders with
artifacts. These artifacts originate from the lighting module and also needs to be
fixed.
Pull Request: https://projects.blender.org/blender/blender/pulls/117502