Mistake in a0e6e16da5
Testing of the previous commit was inadequate, it works when a brush
tool is selected and invoked via the operator search, as the
`active_vert` property will be set by the raycast. When the Mask by
Color tool is actually active, the brush cursor, and thus the function
that performs a racyast is inactive, preventing the operator from
running.
Pull Request: https://projects.blender.org/blender/blender/pulls/134960
This shared state between original data and depsgraphs was added in
98a0bcd425. Other physics systems also share
the pointcache, but not the simulation state to this extent, which leads
to this kind of crash.
The mutex lock is not a great solution, you don't really want both render and viewport to be filling the same cache in parallel. However
this kind of problem also exists in other physics systems, and solving
that is certainly beyond the scope of 4.4, and probably needs to wait
for a bigger physics rewrite. In general the recommendation is to bake
everything before rendering.
Pull Request: https://projects.blender.org/blender/blender/pulls/134779
The issue was that in the macro used, the wrong ID was passed into
the rename function. Since nodetrees are a separate embedded ID,
the rename function couldn't resolve the RNA path and thus failed.
This broke keys and drivers when renaming nodes.
Not only for the compositor, but all node trees.
This was caused by 1c7c1829b6
Pull Request: https://projects.blender.org/blender/blender/pulls/134936
This happend for meshes without UVs.
The call to `texpaint_request_active_uv` in
`DRW_mesh_batch_cache_get_surface_edges` is from 9c010c44f4.
Looks like this is not needed (assumed to be copy paste error).
Pull Request: https://projects.blender.org/blender/blender/pulls/134856
In the Vertex Weights panel of the 3D Viewport sidebar, allow for
normalization of vertex groups when any number of vertex groups are
locked.
As with other normalization operators that handle locked vertex groups,
locked weights are summed, and whatever space is left between that sum
and 1.0 is used to normalize the unlocked weights.
Pull Request: https://projects.blender.org/blender/blender/pulls/134535
Make `action_channelbag_ensure()` and `action_fcurve_ensure()` return a
reference. Earlier it returned pointer that should never be `nullptr`,
but in certain cases (which would indicate a bug, as the function's
preconditions aren't met) could technically still be a `nullptr`.
Instead, the preconditions are checked with `BLI_assert()`, and a
release build will simply assume that they are met. This simplifies the
code of the functions themselves, as well as the callers.
For reference: this was discussed in !134866.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134918
Over time the `FCurveDescriptor` class has grown, and some concern was
raised (!134866) about the performance impact of passing it by value.
It's now passed by const reference instead.
No functional changes. I did find some non-`const` uses that are now
also `const`.
Pull Request: https://projects.blender.org/blender/blender/pulls/134913
The `BKE_fcurve_bezt_shrink()` function had an artificial limitation to
only allow shrinking the `bezt` array. That limitation is now removed,
and therefore the function renamed to `BKE_fcurve_bezt_resize()`.
A note was added to the documentation that newly added array elements
should be initialized by the caller.
Pull Request: https://projects.blender.org/blender/blender/pulls/134864
Split the majority of `animrig::action_fcurve_ensure()` into a new
function `action_channelbag_ensure()`. This ensures that the Action has
a layer, keyframe strip, action slot, and channelbag for the given ID.
`animrig::action_fcurve_ensure()` now just calls into that function, and
then ensures that there is an F-Curve in that channelbag.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134864
Hydra's viewport and final engines conflict on whether the rendering loop
is internal or external. The old approach works for Hydra Delegates that
converge with a single sample (hdStorm) but causes engines relying on sample
accumulation (hdEmrbee) to become stuck.
This minimal change retains compatibility with delegates like Storm while
replicating the behavior of the viewport engine in the final engine.
Pull Request: https://projects.blender.org/blender/blender/pulls/134804
The Grease Pencil extrusion operator didn't transfer the vertex group names
from the old `CurvesGeometry` to the new one, resulting in the `gather_attributes`
function not transferring the vertex group weights correctly. This PR adds
`BKE_defgroup_copy_list` to the operator to remedy this.
Pull Request: https://projects.blender.org/blender/blender/pulls/134695
The interpolation tool is using stroke length to map points between strokes with
uneven number of points. This fails when a source stroke has zero length (all points
in the same location).
Added a special case check to ensure uniform mapping by index is used in this case.
Segment mapping has been moved to a separate function for clarity.
Pull Request: https://projects.blender.org/blender/blender/pulls/134849
Fix an issue where the versioning of Action & slot assignments did not
use RNA properties to do the slot assignment. This caused certain
on-update callbacks to be missed, which in turn meant that an Action
constraint could remain disabled even though its action slot assignment
had been corrected.
This is now resolved by actually using RNA to set the assigned slot in
the versioning code.
Unfortunately that does mean that any reporting done will be by the
generic RNA code as well, and won't be specific to versioning. This
shouldn't be much of an issue in practice, as any warning was only shown
in the rare case of mis-matched `action.idroot` properties.
Pull Request: https://projects.blender.org/blender/blender/pulls/134759
EEVEE crashes when it is not able to allocate buffers. Previously we had a
message showing to the user that it tries to allocate a texture larger than
supported by the GPU. But was not implemented for EEVEE-next. This fix will
add back this error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/134725
The File Output node crashes when saving a 16-bit vector image in an
RGBA image. That's because the OIIO writer assumes 4-channel buffer
while the buffer provided by the node is only 3-channel. To fix this,
the OIIO writer is extended to support all possible combination of
source and target channels.
Pull Request: https://projects.blender.org/blender/blender/pulls/134789
When a text string is longer than the available space it can be at a
scrolled offset, so that you can edit text that is wider than its
container. When selected text is deleted we don't update this offset,
so it is possible to have newly pasted text scrolled out of view. This
PR decreases the offset by the amount of the selected string that is
currently out of view.
Pull Request: https://projects.blender.org/blender/blender/pulls/134815
These were reading in "widths" and not adjusting the values when setting
Blender's "radius" properties.
Found while cleaning up the radius API usage as part of another change.
Pull Request: https://projects.blender.org/blender/blender/pulls/134709
This commit moves the initialization of the node-sized accumulation
array out of the parallel loop to avoid odd optimization errors when
differing between debug and release builds as well as errors due to
integer overflow in both builds.
Additionally it only accumulates results from affected nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134720
The `init_positions` variable that the `ss.sculpt_persistent_co` member
gets set to was not passed into the corresponding calculation function,
resulting in a no-op.
Pull Request: https://projects.blender.org/blender/blender/pulls/134781
With the brush assets project, brushes were moved from being local to
the working blendfile to being linked from asset libraries. This breaks
the Image Paint 'Clone' brush, as it has a brush property that links to
other Image datablocks.
To support this functionality, this commit adds the corresponding
properties into the `ImagePaintSettings` struct so that it is stored
locally with the images that will be used by the tool, inside the main
blendfile.
The source image property is shared with the 3D version of the 'Clone'
brush instead of adding a separate field to preserve old behavior.
Notably, this has the following limitations:
* If clone brush assets have been made and shared with external packs,
they would not work out of the box with linked image assets.
* Despite these settings being stored on the scene, they are populated
inside the tool window under "Brush Settings" which is potentially
misleading. However, this is already the case for the 3D version of
the brush, so further UI refinement will happen outside of this PR.
* Users will be unable to use separate images simultaneously for the
Image editor and the 3D viewport, unlike in pre-4.3 versions. This
can be adjusted in the future if it is a critical workflow.
Because the intended design and functionality of this tool is currently
questionable, this commit opts to make these changes instead of doing
further design to support both accessing data on the brush and on the
scene.
Pull Request: https://projects.blender.org/blender/blender/pulls/134474
The previous attempt to restore this behavior was in
0a2d5d5801
That commit introduced clearing the related `SculptSession` variables
when the paint BVH was freed to avoid bad behaviors seen in 4.2 and
prior. However, this solution is somewhat incorrect, as the prior state
of this data is not necessarily restored when the BVH is recreated,
unlike other temporary mapping data.
This results in the persistent base data being cleared occasionally with
no indication to the user that this is happening, causing the setting to
appear to be inactive.
To fix this, this commit makes a few changes:
* Removes clearing this data in the `BKE_sculptsession_free_pbvh`
function.
* Initializes the displacement arrays to the same size as the position
and normal array.
* Introduce new variables to track the saved multires grid size so
that it is not deleted, only considered invalid when the topology
changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134780
The playhead is redrawn as an overlay, so instead of a full region
redraw using `ARegionType.draw()`, at least an overlay only redraw using
`ARegion.draw_overlay()` needs to be triggered.
Any redrawing within a window is skipped if neither the screen, nor any
of its areas or regions are tagged for redraw. So since there are no
other areas or regions to be fully redrawn in this window, no redrawing
will happen. The screen needs to be tagged for redraw, which will skip
most drawing in this case, and just draw the overlays as wanted.
Pull Request: https://projects.blender.org/blender/blender/pulls/134579
When changing editors within an area we are currently always setting
the subtype if there are modes. This causes problems when returning to
a previous editor versus starting with the correct one. We have tried
various ways of returning to the old editor, but never quite works.
This PR only sets the subtype if we are creating a new area. If not
just leave it as it was so we naturally return to its old state.
Pull Request: https://projects.blender.org/blender/blender/pulls/134642
The new CPU compositor in v4.4 is much slower than the old CPU
compositor in v4.3 on Windows. This is because MSVC does not inline many
of the core methods in the Result class of the compositor. To fix this,
we force inline those methods, adding a new macro for inlining methods
in the process, since the existing macro has the static keyword, which
only works for functions, not methods.
Pull Request: https://projects.blender.org/blender/blender/pulls/134748
Correct two mistakes in [0] which accidentally assigned
flags to the previously declared parameter as well as assigning an
argument to `prop`, then setting the flags on `parm`.
While it seems that "active_property" only became optional by accident
leave this as-is to avoid breaking scripts.
[0]: 113997a03c
Ref #134379.
Conversion was only possible if the active object was editable &
selected, this complicated overriding the operator from Python
since it wasn't enough to override the selection & active-object.
Now it's possible to use bpy.ops.object.convert() from Python
overriding the selected_editable_objects only.
For users the difference isn't so significant:
- Having an active object is no longer required.
- It's possible there are no objects to operate on,
as previously the active object was used to check at least one
object could be converted, although this check wasn't fool-proof
as it didn't check the objects data-type.
Resolves#100664.
Ref !134728.
This commit adds the `filter_region_clip_factors` call to each of the
brush types in vertex and weight paint modes to ensure that the region
clip state is accurately handled.
Pull Request: https://projects.blender.org/blender/blender/pulls/134717
Keeping these as linked datablocks to the brush does not match the idea
that assets should generally be appended, and leads to some confusing
situations with linked materials on objects. Now use either a local
material with matching weak library reference or make a local copy if
it does not exist yet.
This also add weak library references to the materials in the 2D Animation
template, so they will be reused.
A problem is that weak library references include a full path to assets
blend files, including the Blender version for the essentials assets files.
This means weak library references do not work across platforms and
Blender versions.
Another known limitation is that if the (linked) Brush Asset material is
edited, and there is already a local copy of it, this local copy will
remain unchanged and will be used by future strokes as well.
Ref #131186
Pull Request: https://projects.blender.org/blender/blender/pulls/134226
If a sequencer text strip is using a custom font (not the default one)
then don't use the fallback font. This adds a new font flag to disable
the use of fallback.
Pull Request: https://projects.blender.org/blender/blender/pulls/133510
Caused by case sensitive string comparison between RNA enum
name and pre-defined array with extensions.
The array with extensions was also missing ".aac" string.
Pull Request: https://projects.blender.org/blender/blender/pulls/134761
Remove an overly-careful check on an enum value being greater than zero.
The check was added back in the day when this value was declared as
`int` and thus could easily be assigned anything.
The check for the upper limit was kept, and augmented with a
`BLI_assert()` so that failures here will actually go noticed and can
get fixed.
No actually functional changes. The data being checked is purely
runtime, and is assumed to be generated correctly already.
Pull Request: https://projects.blender.org/blender/blender/pulls/134736
Expose the convenience function `blender::animrig::action_fcurve_ensure()`
to RNA as `Action.fcurve_ensure_for_datablock(...)`.
The function requires that the Action is already assigned to the
data-block. It then takes care of slot assignment / creation, as well as
the creation of a layer and a keyframe strip.
This function call:
```python
fcurve = action.fcurve_ensure_for_datablock(ob_cube, "location", index=2)
```
effectively performs this logic:
```python
# Ensure the slot exists and is assigned:
slot = ob_cube.animation_data.slot
if not slot:
slot = find_slot_for_keying(action)
if not slot:
slot = action.slots.new(ob_cube.name)
ob_cube.animation_data.slot = slot
# Ensure a layer exists:
if action.layers:
layer = action.layers[0]
else:
layer = action.layers.new("Layer")
# Ensure a keyframe strip exists:
if layer.strips:
strip = layer.strips[0]
else:
strip = layer.strips.new('KEYFRAME')
# Ensure the channelbag exists:
channelbag = strip.channelbag(slot, ensure=True)
# Ensure the F-Curve exists:
fcurve = channelbag.fcurves.find("location", index=1)
if not fcurve:
fcurve = channelbag.fcurves.new("location", index=1)
```
Here `find_slot_for_keying()` represents the logic that's also used when
creating keys via the user interface or the `bpy_struct.keyframe_insert()`
function.
Pull Request: https://projects.blender.org/blender/blender/pulls/134686
Update the Action RNA descriptions, to clarify which parts of the API are
considered legacy. These will only act on the action's first slot, in an
attempt to be backward-compatible with the pre-4.4 (non-slotted) actions.
No actual functional changes, just a change in the descriptions.
Pull Request: https://projects.blender.org/blender/blender/pulls/134683
New version of b22670d927 (which was reverted with 9d33dd88d5).
I rather keep `uiHandleButtonData` private to the handling code. It
does the allocation as part of its implementation details, so it should
also handle freeing.
This reverts commit afec64739a.
The commit introduces a regression where opening the Asset Browser opens
the File Browser instead, same for other editor sub-types, see
blender/blender#134630.
blender/blender!134642 proposes a different solution and reverts this,
which I prefer too. Better to the revert separately from trying a
different fix for the initial bug, makes reviewing easier too.
This main thread check was introduced in 4536a4c610. At the time OpenGL
only ever worked in the main thread, but that limitation was lifted in
Blender 2.80.
With this operator being converted to use the jobs system, it now needs
to work in non-main threads. Note that this code does not run in parallel
with main thread drawing anyway, because of WM_job_main_thread_lock_acquire
and draw manager locks. What changed is that we can now activate OpenGL
contexts on other threads.
Pull Request: https://projects.blender.org/blender/blender/pulls/134696