Age | Commit message (Collapse) | Author |
|
|
|
Supported multi-threading for bm_mesh_loops_calc_normals.
This is done by operating on vertex-loops instead of face-loops.
Single threaded operation still loops over faces since iterating
over vertices adds some overhead in the case of custom-normals
as the order used for accessing loops must be the same as iterating
of a faces loops.
From isolated timing tests of bm_mesh_loops_calc_normals on high
poly models, this gives between 3.5x to 10x speedup,
with larger gains for meshes with custom-normals.
NOTE: this is part one of two patches for multi-threaded auto-smooth,
tagging edges as sharp is still single threaded.
Reviewed By: mont29
Ref D11928
|
|
The need for this has come up a few times.
|
|
Because these handles are calculated lazily, we need to make sure they
are calculated before switching to a manually positioned mode.
I doubt it would ever be necessary, but theoretically this could happen
on a per-point level, to avoid calculating handles not in the selection.
|
|
When exiting editmode, customdata [and thus attributes] are copied from
**BMesh** to **Mesh** (in `BM_mesh_bm_to_me`).
When adding attributes, these were always added via
`CustomData_add_layer_named` only.
Instead (if we are in mesh editmode), we need to go through
`BM_data_layer_add_named` to properly update the **BMesh** (see
`update_data_blocks`) so we have stuff available to copy back to
**Mesh** when exiting editmode.
Same is done for removing (also going through BMesh).
This is now done, DomainInfo is updated to point to BMesh (instead of
Mesh) customdata when in editmode.
Maniphest Tasks: T90026
Differential Revision: https://developer.blender.org/D11998
|
|
This node takes a curve and a point selection and allows you to set the
specified (or all) points left/right or both handles to a given type.
Differential Revision: https://developer.blender.org/D11992
|
|
Bump Blender's sub-version to make sure the pose_library add-on isn't
auto-enabled on every run of Blender.
|
|
This new variable was introduced with 7898089de3f2. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.
This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
|
|
Some asserts were never raised because of invalid checks.
|
|
|
|
|
|
|
|
Fix segfault in `BKE_armature_find_selected_bones_test` by property
initializing the bone hierarchy listbases.
No functional changes to Blender.
|
|
Remove the assumption of the pose library that Action groups are named
after the bones in the armature. Even though this assumption is correct
when the keys are created by Blender, action groups can be renamed. Keys
created by Python scripts can also use arbitrary group names.
Since there is more code in Blender making this assumption, and looping
over selected bones is also a common occurrence, this commit contains
some generic functionality to aid in this:
- `BKE_armature_find_selected_bones`: function that iterates over all
bones in an armature and calls a callback for each selected one. It
returns a struct with info about the selection states (all or no bones
selected).
- `BKE_armature_find_selected_bone_names(armature)` uses the above
function to return a set of selected bone names.
- `BKE_pose_find_fcurves_with_bones()` calls a callback for each FCurve
in an Action that targets a bone, also passing it the bone name.
|
|
The node tagged polys normals dirty, but the function to calculate the
normals didn't clear the dirty flags for polys. Now clear the poly and
corner dirty normal flags.
|
|
While doxygen supports both, conform to our style guide.
Note that single back-tick's are already used in a majority of comments.
|
|
Use C comments for plain text.
|
|
|
|
Also use `const Curve *` instead of `const Object *`, since the
function works at a lower level than objects anyway.
And also remove another unused function. Since this section of code
for converting curves to meshes will likely be replaced, it's nicer to
see which parts actually remain used at this point.
|
|
|
|
|
|
|
|
This reverts commits
bfa3dc91b75407b063f2ac991b176d98c050f92d,
52b94049f2a71a74f52247f83657cf3a5c8712b4,
ae379714e4f1eca74f5f77532a6e959f29445236,
a770faa811ee62837eb540b0bd83ca0770f16663,
4ed029fc02b022cb5ff28ed3ce70992c450d2be5,
101a493ab556c6597ac91fba204059be67b35990 and
62a2faa7ef39130446716d7a06215cd1df1eb2ac.
And fixes T89955.
Changing the dependency graph is a can of worms and the result is
a kind of unpredictable.
A different solution will be planned.
|
|
Falback is not really necessary, and causes
`BKE_object_data_batch_cache_dirty_tag` to run multithreaded in an
unsafe way.
No functional changes.
|
|
These have not been in use since 2.57
fafbd9d71b95776d1c7583476de74fccefab7f10.
|
|
This node implements shortening each spline in the curve based on
either a length from the start of each spline, or a factor of the
total length of each spline, similar to the "Start & End Mapping"
panel of curve properties.
For Bezier curves, the first and last control points are adjusted
to maintain the shape of the curve, but NURB splines are currently
implicitly converted to poly splines.
The node is implemented to avoid copying where possible, so it outputs
a changed version of the input curve rather than a new one.
Differential Revision: https://developer.blender.org/D11901
|
|
This section of code deals with evaluated points,
so that is the size it should use.
|
|
Just a small change to make the function slightly shorter.
|
|
Also remove an unecessary null check, and make inner loop simpler.
|
|
This will help enable development on optimizations to the perimeter
calculation here. Using C++ data structures like Array can make the
code easier to read as well.
Longer term, this can help improve integration with attributes
and possibly the new curve code (since strokes and curves are
quite similar in theory).
Differential Revision: https://developer.blender.org/D11941
|
|
The object type was checked twice unnecessarily. Also use a function
for the check to be more explicit.
|
|
|
|
|
|
|
|
Replaces current ID Mask node Anti-Aliasing operation by SMAA
operations with default settings as proposed by Jeroen Bakker.
SMAA produces smoother edges.
Reviewed By: manzanilla
Differential Revision: https://developer.blender.org/D11881
|
|
It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.
Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.
Fixes T89877, and also the failing `deform_modifiers` test.
Differential Revision: https://developer.blender.org/D11936
|
|
The new Asset Browser-based pose library is partially implemented in an
add-on. This commit enables the add-on by default, as the old pose
library was built-in and thus always enabled.
The ability to disable the add-on is there mostly for cases where
people/studios want to use their own custom pose library.
|
|
Correct cases where the X-axis of the bone (in pose space) aligns with
the pose-space Y or Z-axis. In these cases the decomposition of the
matrix fails, and a negative scale of the X-axis turns into a 180°
rotation around the Y-axis. An extra -1 scale to the X and Z axes of the
resulting matrix seems to fix things.
|
|
The asset view UI template is a mini-version of the Asset Browser that
can be placed in regular layouts, regions or popups. At this point it's
made specifically for placement in vertical layouts, it can be made more
flexible in the future.
Generally the way this is implemented will likely change a lot still as
the asset system evolves.
The Pose Library add-on will use the asset view to display pose
libraries in the 3D View sidebar.
References:
* https://developer.blender.org/T86139
* https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building
* https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport
Notes:
* Important limitation: Due to the early & WIP implementation of the
asset list, all asset views showing the same library will show the
same assets. That is despite the ID type filter option the template
provides. The first asset view created will determine what's visible.
Of course this should be made to work eventually.
* The template supports passing an activate and a drag operator name.
The former is called when an asset is clicked on (e.g. to apply the
asset) the latter when dragging (e.g. to .blend a pose asset). If no
drag operator is set, regular asset drag & drop will be executed.
* The template returns the properties for both operators (see example
below).
* The argument list for using the template is quite long, but we can't
avoid that currently. The UI list design requires that we pass a
number of RNA or custom properties to work with, that for the Pose
Libraries should be registered at the Pose Library add-on level, not
in core Blender.
* Idea is that Python scripts or add-ons that want to use the asset view
can register custom properties, to hold data like the list of assets,
and the active asset index. Maybe that will change in future and we
can manage these internally.
As an example, the pose library add-on uses it like this:
```
activate_op_props, drag_op_props = layout.template_asset_view(
"pose_assets",
workspace,
"active_asset_library",
wm,
"pose_assets",
workspace,
"active_pose_asset_index",
filter_id_types={"filter_action"},
activate_operator="poselib.apply_pose_asset",
drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
```
|
|
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.
No functional changes for users.
* Split the huge template function into more manageable functions, with
clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
callback called from BKE. This is UI data and should be managed at
that level.
* Replace boolean arguments with bit-flags (easily extendable and more
readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
.blends) into function. This is a quite important bit and a later
commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.
As part of further cleanups I'd like to move this to an own file.
|
|
Add function `BKE_pose_apply_action_blend()`, which blends a given
Action into current pose. The Action is evaluated at a specified frame,
and the result is applied to the armature's pose.
A blend factor can be given to blend between the current pose and the
one in the Action. Quaternions are interpolated with SLERP; it is
assumed that their FCurves are consecutively stored in the Action.
This function will be used in the upcoming new Pose Library.
|
|
New function `BKE_pose_apply_action_all_bones()`, which will be
necessary for the upcoming pose library v2.0.
This renames the function `BKE_pose_apply_action` to
`BKE_pose_apply_action_selected_bones`, to reflect that it only works on
selected bones, to contrast it to the new function.
|
|
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.
However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
|
|
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.
This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
|
|
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.
As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
|
|
Update vertex weights between simulation steps if they have changed.
This allows for animated vertex weights in the cloth sim.
Reviewed By: Sebastian Parborg
Differential Revision: http://developer.blender.org/D11640
|
|
parameter.
|
|
|
|
Mainly naming (also droping the `layer_collection` in favor of just
`layer` for internal code, this is clear enough and much shorter). Add
proper parent/child identifiers, `r_` prefix for parameters also used as
return values, etc.
Also made some parameters const.
|
|
The original refactor for vertex groups (3b6ee8cee708)
forgot to bump the minimum file requirement.
I'm also bumping the subversion to 12 so everyone can switch to a
working subversion number.
Differential Revision: https://developer.blender.org/D11931
|