Improves the screenshot selection UX by ensuring the selection
rectangle stays within the window.
**Changes**
- Clamp the selection rectangle while dragging the cursor,
preventing it from extending outside the window.
- When shifting the selection area, movement is constrained
so that the entire rectangle remains within the window.
- When `force_square` is `true`, the square is clamped to the
largest possible square that fits within the window bounds
if it would otherwise exceed them.
Pull Request: https://projects.blender.org/blender/blender/pulls/139805
Fix#140813 crash, when bevel operation doesn't choose proper representative
face (called frep, facerep or rep_face in code). In such scenario a nullptr
would be assigned to uv_face->attached_frep field in register_uv_face function
and later, as a result of that, BM_face_vert_share_loop function would crash
during call to update_uv_vert_map function.
This commit also includes additional safety check in register_uv_face function,
as well as removes compiler warning about assigned but unused center_bme variable.
This is from PR https://projects.blender.org/blender/blender/pulls/140864
but applied to the 4.5 release branch.
The metaball selection radius was inside the cube and could only
be selected with wire-frame shading.
Resolve by expanding the radius by the dimensions of the cube.
The issue was that the summary channel was marked as
possible to do NLA mapping in `ANIM_nla_mapping_allowed`.
When it comes to doing the actual mapping it would silently do nothing
though because `bAnimListElem.adt` is always a `nullptr` for the summary.
However in `action_select.cc:580` the `KED_F1_NLA_UNMAP`
and `KED_F2_NLA_UNMAP` flags were already removed.
Those flags tell the summary line to do NLA mapping in `keyframes_edit.cc:368`.
(We may be able to remove those in the future)
The fix is to ensure that the summary line is
recognized as unable to do NLA mapping. That makes sense to
me at least because the summary line points to data but in itself
does not know about the NLA.
As a side effect, this also fixes circle select.
Pull Request: https://projects.blender.org/blender/blender/pulls/140664
Regression in [0] which moved the logic from
knife_closest_constrain_to_edge from 2D to 3D space.
The 3D location used (kcd->curr.cage) didn't have constraints
applied, causing snap not to lock to the constrained axis.
Resolve by passing in the constrained location which is then used when
edge snapping is calculated.
[0]: 7249b78b6b
One obvious problem is that `mr.use_simplify_normals` was assigned after
face corner normals were retrieved. The other more complex problem is
that now the normals caches automatically mix custom normals from other
domains. This can cause the expensive "Tangent Space" normals to be
calculated even though we don't explicitly request face corner normals.
To fix this, clarify the purpose of the option to only apply to that custom
normals format and use the true normals instead in that case.
Pull Request: https://projects.blender.org/blender/blender/pulls/140879
Problem - offset collision check for bevels did not consider the reduced
offset when using bevel edge weights, thus greatly reducing the allowed offset.
Solution - calculate the offset check using the weighted value and not
the full offset.
Alternatives - Since this error was introduced in the patch dd334faa58
a solution would be to revert the patch. This is not optimum since the
patch did correct the inf/inf condition in the offset calculation (ex at
90 degs, tan is 1/0).
Limitations - This patch is a correction to return the bevel function to
it's previous abilities. Further work is needed to properly handle edge
offset interference when looking at n-gons with reflex angles. There are
also situations where the bevel operation exceeds the checked offset distance
(exs. inner arc spread and bevel profiles that are not normal to the bevelled edge).
It is possible for a vertex to be processed by some function that
attempts to calculate the average of an attribute of all neighboring
elements when all elements are hidden. This results in NaN when using
`math::rcp` for the size of the related indices.
This commit switches the `rcp` call for the safe variant and removes an
invalid assert that previously existed.
Further cleanup to consolidate the various different average methods
will occur in the main branch (e.g. the `check_loose` and `interior`
functions)
Pull Request: https://projects.blender.org/blender/blender/pulls/140569
Typically, we use this function to determine whether or not a subset of
data that has been collected with `gather` needs to be then persisted
into a larger array with `scatter`. As such, it makes sense to assert on
equality of the indices and smaller array size.
Pull Request: https://projects.blender.org/blender/blender/pulls/140752
The code around view transform selection accidentally got too coupled
to the scene. However, the file output settings do not have scene, so
the enumerator getter was crashing.
Caused by 7ceb4495c5.
This patch brings the code closer to the Blender 4.4 behavior by
maintaining a global from view name to an ID.
There is still a bug in the code which displays views from the active
scene's display settings in the override panel. This is because the
itemf() callback is hardcoded to use the display settings from the
active scene (via bContext). However, this issue exists since the
initial commit of the color management override option.
Pull Request: https://projects.blender.org/blender/blender/pulls/140729
When movie strip is added and redo panel is tweaked, operator failed to
re-execute.
Caused by c4eab49b9. This added `sequencer_generic_invoke_xy__internal`
call in operator exec function, but did not specify `SEQPROP_NOPATHS`
argument, which caused `directory` and `filepath` properties to be
overwritten.
This PR adds clarification for `SEQPROP_NOPATHS` use case, because it
isn't immediately obvious what this is doing.
Pull Request: https://projects.blender.org/blender/blender/pulls/140736
Correct an oversight in df6d345bb4: without proportional editing, all
the transform data is "selected" by definition. This means that the
assumption "the selected data is sorted first in the array" is
trivially true, without calling any sorting function. So instead of
using the sorted index map in these cases, just fall back to regular
iteration.
To make the code handle this nicely, I made two "foreach" functions.
The first one transparently uses the sorted index map when available,
and performs regular iteration otherwise. The second function only
visits the selected items.
This makes the usage of these functions clearer, and the fact that
selected items are expected to be sorted first (either trivially or
explicitly) can be documented in a central place.
Pull Request: https://projects.blender.org/blender/blender/pulls/140720
Restore expected behavior of the NDOF, especially in the context of
non-3D editors. It addresses the following issues:
- Object mode, 3D viewport:
With "Lock Horizon" off, the rotation axes will invert unexpectedly,
making the camera behave similar to a "Fly mode".
- Fly mode, 2D editors:
Changing a navigation mode to "Fly" makes no effect.
Applies to UV and Nodes editors, Camera Preview etc.
Related to #140165
This includes some minor API changes back-ported from `main`
since the PR was created for `main`.
Co-authored-by: Patryk-Skowronski <patryk_skowronski@3dconnexion.com>
Ref !140537
Incoming string attributes from USD have never been fully processed yet
they were added to our list of convertible types. This list originally
came from the Mesh reader before it was made common, but for Meshes the
string type was being skipped elsewhere so there was no harm. Now that
Point Clouds and Curves use this common code, it does matter.
Files containing string attributes for these object types will hit the
`BLI_assert_unreachable` call inside `copy_primvar_to_blender_attribute`
and trace an error to the console requesting the user to file bugs. This
was discovered while looking into the old Moana scene.
Remove the string entry for now as there's no regression in behavior and
it prevents the assert from firing (functionally harmless in Release
builds but the output to the terminal is unnecessary).
Pull Request: https://projects.blender.org/blender/blender/pulls/140681
When creating depsgraph relationships for drivers, avoid creating the
'unshare' depsgraph node for drivers on custom properties and on
shapekey `value` properties.
This should fix a significant part of the performance regression
mentioned in #140706.
Pull Request: https://projects.blender.org/blender/blender/pulls/140724
Resolve reference counting error in the RNA API which mixed up ownership
between ExtensionRNA::data & StructRNA::py_data.
In practice this generally worked as RNA_struct_free_extension behaved
as if ExtensionRNA owned the reference instead of StructRNA, so as long
as only one reference was removed, there wasn't any difference.
When re-registering Python classes with RNA, ownership wasn't handled
properly which could result in negative reference counts,
crashing in some cases.
After using the Purge Unused Data operator, hovering mouse over outliner
makes outliner tree dirty as the tree is not being rebuilt. The operator is
defined in python which calls `ANIM_armature_bonecoll_remove`. Add
notifier in that function code so that `outliner_main_region_listener`will tag
the outliner region for full redraw.
Pull Request: https://projects.blender.org/blender/blender/pulls/140256
Python 3.14 has moved some functionality into the public API,
use the updated names even with older Python versions.
Also resolve an error caused by variable reuse with delayed annotation
evaluation for TextureProperties_MixIn on startup.
Resolve#140695.
When dragging an area from one window to another it is possible for the
bScreen->active_area to be be invalid for a short period of time. This
is constantly updated so normally not noticeable but will cause ASAN
errors when trying to show keymaps in the status bar as this is use
after free. This PR just sets these to nullptr.
Pull Request: https://projects.blender.org/blender/blender/pulls/140683
`UI_icon_from_idcode` is used e.g. from the Action Editor to indicate an
Action's Slot Type (and without the icon it is kinda hard to tell what
the slot is suited for...)
Before

After

Discovered while investigating #140618
Pull Request: https://projects.blender.org/blender/blender/pulls/140658
After a recent commit, multiple drawings were always written using the
same address because we used the same stack memory in a loop. This
causes the blend file reading to not be able to distinguish between the
structs, meaning the file is corrupt. However, we already had the same
problem in some cases because of the inline buffer in `BlendWriteData`.
To resolve this, make all "temporary" data for writing live as long as
the writing is going on for the ID. This is somewhat inefficient since
it makes memory reuse impossible for this temporary data. In the future
we should use a technique like #127706 to address this.
For testing, I saved and loaded multiple production files with Grease
Pencil objects, with and without the "write with attribute storage"
option enabled. The fix still goes to 4.5 though, because the first
mentioned issue is present there, and the `CustomDataLayer` vector
address reuse is potentially a problem too.
Pull Request: https://projects.blender.org/blender/blender/pulls/140667
Fix#79163 bug related to the bevel operation producing disconnected UVs for
new bevel faces. This change replaces previous approach using scattered and
selective usage of functions: bev_merge_uvs, bev_merge_edge_uvs and
bev_merge_end_uvs with one coherent technique for all stages of the bevel operation.
It is utilizing a concept of loop (BMLoop) buckets to keep track of UV vertices
that should be merged at the end of bevel operation by a single call to
bevel_merge_uvs function. This approach doesn't touch initial UV position
calculation done by interpolation algorithm in bev_create_ngon function and
keeps the concept of representative faces (called frep, facerep or rep_face in
code) to help decide to which bucket specific loops should be assigned.
This is from PR https://projects.blender.org/blender/blender/pulls/139595,
which has more explanation and discussion.
GreasePencil ID type did not list `ID_OB` as its potential ID dependency
type, leading to lack of remapping of its layers' parents objects
pointers (e.g. on Object deletion), leading to crash from accessing
freed data.
We detected that the gpu/draw tests could lead to
crashes after the tests where finished. It was
identified that the crash happened as the submission
runner wasn't exited, uses a mutex, that is being
destroyed by the main thread.
Solution is to wait until the submission runner has
finished, before destroying resources.
Pull Request: https://projects.blender.org/blender/blender/pulls/140650
Avoid modifying the order of transform system data. Instead, create an
index map and use that to traverse the data arrays in sorted order.
The issue observed in #139042 stems from the assumption, in _some_ of
the code, that `tc->data[i]`, `tc->data_ext[i]`, and `tc->data_2d[i]`
all contain information about the same "transformable thing". Since
`tc->data` was sorted (by selection state and, optionally for
proportional editing, by distance) but the other arrays were not, this
caused issues.
The most obvious solution, sorting all arrays the same way, turned out
to be hard to do, as some elements in one array have pointers to
elements in another array. Reordering those arrays would therefore
also make it necessary to find and update those pointers.
Instead, I decided to implement a sorted index map. The arrays can
then be kept in their original order, and the index map can be used to
visit them in sorted order.
Pull Request: https://projects.blender.org/blender/blender/pulls/140132
The issue was that the wrong flag was passed to
`ANIM_nla_mapping_apply_if_needed_fcurve` resulting
in the handles not moved back in this method.
This issue was only visible when pasting on top of a single keyframe,
or when the key had free handles. That is because the handles would
be recalculated otherwise.
Pull Request: https://projects.blender.org/blender/blender/pulls/140542
MESH_GGT_spin_redo (for the operator) depended on MESH_GGT_spin
(for the tool) having already been initialized however the order
gizmos are initialized currently isn't guaranteed.
Workaround the problem by adding a null check.
See the report for details.
Co-authored-by: Philipp Oeser <philipp@blender.org>
The logic to access the edit-mesh for the selection engine didn't match
the logic used for drawing.
Resolve using the edit-mesh from: BKE_object_get_pre_modified_mesh
Ref !140525
Some USD files have the displacement input specified in the shader but
do not have it marked as an output in either the shader or the material.
Skip processing if we do not have a valid displacement source.
Pull Request: https://projects.blender.org/blender/blender/pulls/140619
`blend_write_prepare` expects to work on a shallow copy of the
`CurvesGeometry` struct. This is necessary because it changes
the struct to contain only the layers being written. This is
particularly important with writing with the new format enabled,
where attributes are written as part of `AttributeStorage`.
Writing with a shallow copy of the struct also gives us the
flexibility to zero the runtime pointer in the written file which
is generally a good practice.
Pull Request: https://projects.blender.org/blender/blender/pulls/140560
For UILists that doesn't use `filter_items()`, search filter doesn't work
along with invert button. For filter_items, invert case is already
handled in filter_items_by_name. In absense of that function,
handle the invert case inside `UI_list_filter_and_sort_items`. Existing logic
is a bit wrong. Now flags are adjusted, i.e. when search string matches, check
for invert status to decide whether items should be in the list or not.
Pull Request: https://projects.blender.org/blender/blender/pulls/139523
This was caused by a hash colision caused by an incorrect
auto conversion from `Object*` to `ObjectRef`. The `ObjectRef`
would then not contain any instancing data and would create
the same hash for the same particle system on each instance
(since only `foreach_hair_particle_handle` was constructing
`ObjectKey` from an `Object*` it did not affect the instance
itself).
Marking the incriminating constructor `explicit` to avoid
more issues. Changing the `ObjectKey` creation for psys to use
`ObjectRef` fixes the issue.
Pull Request: https://projects.blender.org/blender/blender/pulls/140544
We should never select something that is hidden in the viewport.
Generally, there can be multiple reasons why keyframe handles are not
shown in the Graph Editor:
- the `View` > `Show Handles` option is disabled
- the `Only Show Selected Keyframes Handles` is enabled
- a keyframe `Interpolation` method is anything but `Bezier`
This PR corrects the first.
Details:
- In `box_select_graphkeys()`, the `incl_handles` parameter is only
be passed to `initialize_box_select_key_editing_data()`
- add a separate `KEYFRAME_ITER_HANDLES_INVISIBLE` flag (representing
SIPO_NOHANDLES)
- "include_handles" purely represents operator setting / user intend now
- "final" decision about handles/their visibility is done in
`keyframe_ok_checks()` etc
For consistency, add "include_handles" option to Lasso/Circle as well
Part of #139314
Pull Request: https://projects.blender.org/blender/blender/pulls/139349