On Windows an entire directory may be locked when any files inside it
are opened by another process. This can cause operations that
recursively remove a directory (uninstalling & updating) to fail
with a partially removed extension.
The case of uninstalling was already handled, where failure to remove
a directory would stage the extension for later removal.
In the case of updating however, the user could be left with a broken
(partially removed) extension where some files were removed, as the
directory was locked, the update would fail to extract new files.
Address this issue by renaming the directory before recursive removal.
The following logic has been implemented:
- If any files in the directory are locked, renaming will fail.
So even though the operation fails the extension is left intact.
- If renaming succeeds, it's possible to apply the update.
While it's possible (albeit unlikely) recursive removal fails,
which could be caused by file-system permissions issues corruption or
a process could open a file between rename & removal.
In this case the renamed directory is staged for later removal.
Other changes:
- Resolve a related problem where the user could install an
extension previously staged for removal, now installing an extension
ensured it's not removed later.
This would occur if uninstalling failed, the user resolves
directory-lock, uninstalls again, then re-installs the extension.
- When an extension fails to be removed, don't attempt to remove
user configuration for that extension.
Prefer to keep the extension & it's settings in their "current state"
if it can't be removed.
Remove the box select tool from the timeline to simplify selection
logic, avoid confusion for users, and make maintaining the code
easier in the future. It also brings the selection system closer
to other industry-standard NLEs.
It also fixes an issue caused by d2091b4b1.
More details in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/128051
When using the `create_collection` parameter during import, the newly
created Collection would be assigned a fake user which isn't necessary
and caused the user count to be 2 instead of the more natural 1 here.
Remove the fake user and add test coverage for the scenario in general.
Pull Request: https://projects.blender.org/blender/blender/pulls/128348
Clang doesn't allow to capture structured bindings in lambdas.
Instead, remove the structured bindings and just use a const
reference to the item iterator.
This adds a function to merge layers in original Grease Pencil geometry.
It also adds an operator to merge layers as well as some tests for the `merge_layers` function.
The operator has 3 modes:
* `Merge Down`: Combine the active layer with the layer just below (if there is one).
* `Merge Group`: Combine all the layers in a group into one single layer and remove
the group. Can be accessed in the right-click menu of groups.
* `Merge All`: Combine all the layers of the object into one single layer.
All of these can be accessed in the `Extras` menu next to the layer tree.
Pull Request: https://projects.blender.org/blender/blender/pulls/128201
The `pre` handler is called after blender internal code is done populating
the link/append context with data to be processed, and before this data
starts being linked from library files.
The `post` handler is called after blender is done linking, and
potentailly appending and/or instantiating, the requested data and all
of their dependencies.
Both handlers are called with a single argument, the link/append
context.
An new RNA sets of wrappers have been added to expose relevant info from
these internal C++ structures.
NOTE: !113658 is very similar (but tied to asset drag & drop), whereas
this PR is more general (these could probably live hand-in-hand / side-
by-side).
Implements #122357
Pull Request: https://projects.blender.org/blender/blender/pulls/128279
-----------------
Some quick py example code:
```python
import bpy
def my_handler_pre(lapp_context):
print("About to {}:\n\t".format("link" if "LINK" in lapp_context.options else "append"),
"\n\t".join("{} '{}', from libs ['{}']".format(item.id_type, item.name,
"', '".join([l.filepath for l in item.source_libraries]))
for item in lapp_context.import_items))
def my_handler_post(lapp_context):
print("{}:\n\t".format("Linked" if "LINK" in lapp_context.options else "Appended"),
"\n\t".join("{} '{}', from lib '{}'".format(item.id.id_type, item.id.name, item.source_library.filepath)
for item in lapp_context.import_items))
bpy.app.handlers.link_append_pre.append(my_handler_pre)
bpy.app.handlers.link_append_post.append(my_handler_post)
```
Remove the 'Slotted Actions' (`use_animation_baklava`) experimental flag
from the preferences RNA, in non-experimental builds.
The experimental flag is already zeroed out when loading the
preferences. This commit ensures that it stays zeroed out. The rest of
the code assumes that the flag is always `false` in non-experimental
builds.
Pull Request: https://projects.blender.org/blender/blender/pulls/128483
Avoid running a Python unit test for layered Actions in non-experimental
builds.
Due to a misunderstanding, enabling the user preference for the 'Slotted
Actions' experimental feature is still possible on release builds, which
caused this test to fail on non-experimental builds (because it's
intentionally missing a chunk of experimental code).
No functional changes to Blender itself.
Pull Request: https://projects.blender.org/blender/blender/pulls/128483
Remove some `#ifdef WITH_ANIM_BAKLAVA` guards to make a unit test
succeed. The code is handling slots when assigning Actions to IDs.
Non-experimental builds will only deal with legacy Actions, and thus the
slot assignment is a no-op anyway.
The unit test is explicitly creating layered Actions and running tests
on them. Since this also covers some new code introduced for Action
assignments (unified code for both legacy & layered Actions), I'd feel
more comfortable keeping the test enabled.
Note that when loading a blend file with layered Actions in a
non-experimental build will actually load them as legacy Actions.
Pull Request: https://projects.blender.org/blender/blender/pulls/128483
This copies the legacy mode toggling operators to a new file
and renames the operators to use the `GREASE_PENCIL_OT` prefix
like the rest of the operators. No functional changes expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/128477
This fixes two memory leaks:
* Drawings were not properly freed because `MEM_delete` was called on the DNA
base type which does not have the destructor.
* `CustomData` of layers was not freed before it was overridden.
Pull Request: https://projects.blender.org/blender/blender/pulls/128476
This follows the same pattern as attribute panels for Mesh, Curves, and
Point Cloud. Only the layer domain is supported. The _add_ operator now
has to validate the domain setting on invoke, because layer attributes
don't support the default `Point` domain.
Pull Request: https://projects.blender.org/blender/blender/pulls/128471
The UI code assumed that either a layer or a group is always
active which is not always the case. It can happen that nothing
is active.
The fix makes sure the this case is handled correctly.
The offset from the surface was calculated based on only the normal
which didn't used to be the case.
The fix computes the offset based on the surface point and the direction
of the view.
Also makes sure to not draw overlays when computing the depths using
`V3D_DEPTH_NO_GPENCIL`.
Wrong `points_num` when resizing the `CurvesGeometry`.
Otherwise, any attriute span will have wrong size, this triggers crash
when writing value in these attribute spans.
Pull Request: https://projects.blender.org/blender/blender/pulls/128472
Implements scrolling support for tree-views, as well as changing the size of the
scroll-able tree-view. This is important to be able to place them in many places
in the UI, where a compact layout is preferred over an every expanding one
(causing following contents to be scrolled out of view). UI-lists would use
scrolling and resizing to ensure this, now tree-views are on par.
Enables scrolling and resizing for:
- Bone collection UI (`UILayout.template_bone_collection_tree()`)
- Grease Pencil layer UI (`UILayout.template_grease_pencil_layer_tree()`)
- Light link collection UI (`UILayout.template_light_linking_collection()`)
- UI to define a node tree interface (`UILayout.template_node_tree_interface()`)
These are all cases where compact UIs make more sense than expanding ones.
Internally this is enabled by calling the `set_default_rows()` method of the
tree-view, although the API might change still. It shouldn't be quite simple to
implement this for grid-views too if necessary, or other potential view types.
Although I'd like to do some smaller code quality improvements still, this
feature is important for some other modules (e.g. grease pencil module for the
layers UI in grease pencil v3), so I decided to prioritize merging this.
Pull Request: https://projects.blender.org/blender/blender/pulls/119668
Previously, Cycles only supported the Henyey-Greenstein phase function for volume scattering.
While HG is flexible and works for a wide range of effects, sometimes a more physically accurate
phase function may be needed for realism.
Therefore, this adds three new phase functions to the code:
Rayleigh: For particles with a size below the wavelength of light, mostly athmospheric scattering.
Fournier-Forand: For realistic underwater scattering.
Draine: Fairly specific on its own (mostly for interstellar dust), but useful for the next entry.
Mie: Approximates Mie scattering in water droplets using a mix of Draine and HG phase functions.
These phase functions can be combined using Mix nodes as usual.
Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/123532
The File Output node doesn't write invalid and single value layers,
which can cause differences in EXR structures when rendering animations.
To fix this, we write a dummy image that has the same dimensions as the
other layers in the file, filled with the value of the single value
input.
Pull Request: https://projects.blender.org/blender/blender/pulls/128454
The `DyntopoSymmetrize` undo type fulfills the same function as the
`Geometry` push for Mesh and Multires, i.e. it indicates that a full,
mesh-wide change has occurred instead of a small delta.
Pull Request: https://projects.blender.org/blender/blender/pulls/128460
This makes one change and another correction to the mouse cursors used
during Docking. The change is to use WM_CURSOR_EDIT for Mac while just
hovering over the corner action zones. This means that Mac users will
transition from this to WM_CURSOR_HAND_CLOSED, instead using two hand
cursors. The correction is to use the "split" cursors while splitting
areas. That it doesn't do that now is a mistake made during #127810.
Pull Request: https://projects.blender.org/blender/blender/pulls/128396
The geometry of objects behind Curves was being considered for snapping
even when occluded.
The occlusion test logic has been reworked and simplified when the snap
target is a Curve.
As a result, Snap to Face now works correctly for the active Curve.
The snap-to-grid constraint in the rotation operation should not be
limited to the grid closest to the constraint axis, as this restricts
rotational freedom.
This adds the layer adjustments back.
There is a the `Adjustment` panel under the layer properties with
the tint color, the tint factor, and the radius offset (now in meters).
The tint and radius offsets are stored as layer attributes.
For compatibility and the sake of not making the conversion code more complicated,
legacy layer adjustments are always converted to modifiers.
Pull Request: https://projects.blender.org/blender/blender/pulls/126777
Move the Layer selector to the header, centered, with icons and
without labels, to match other modes that display the source
there (such as Vertex Groups, Color Attributes, etc).
Additionally, move the tool settings from the header to the right
hand side of the toolbar. Matching mesh and other modes.
Pull Request: https://projects.blender.org/blender/blender/pulls/128439
As discussed in #128066, we want that activating a brush makes sure the
most appropriate tool is activated. For example activating an eraser
brush should activate an eraser tool, if available. This makes the
tool and brush binding two ways, which is more clear. Plus it means that
users don't have to care about tools at all if they don't want to, they
can just keep switching brushes and Blender takes care of the tool.
Implementation wise, this works by letting a Python operator lookup a
tool for a given brush type name, when activating a brush.
Design Task: https://projects.blender.org/blender/blender/issues/128066
Since brush assets were merged, all sculpt and paint modes have a unified
"Brush" tool that is used for all brushes. Based on feedback, this mixes brush
types a bit too much, so some specific tools that use brushes should be brought
back. These brush types just behave very different from the main brush types,
and users expect them to be easily accessible from the toolbar. This also makes
them more discoverable and having tools that remember their last used brush can
be useful too (e.g. assigning shortcut to eraser tool to switch back to last
used eraser, rather than a specific eraser brush).
Note that further changes are planned, to get a true "best of both worlds"
design, where people can use a global brush library without having to worry
about tools, but brushes can also be accessed via tool categorization.
The new design works well with both mental models without being a compromise
in-between.
a79f9100a6 already brought back some tool for grease pencil draw mode, with this
commit the design is now applied to all sculpt & paint modes.
See PR for a list of tools that were brought back.
Design Task: https://projects.blender.org/blender/blender/issues/128066
Pull Request: https://projects.blender.org/blender/blender/pulls/128038