Age | Commit message (Collapse) | Author |
|
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.
The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.
The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).
**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code
In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).
Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.
**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
- Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
showing that accessing just `MVert` is now more efficient.
- Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
change that at least shows there is no regression.
- Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
but observable speedup.
- Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
shows that using normals in geometry nodes is faster.
- Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
shows that calculating normals is slightly faster now.
- File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
Normals are not saved in files, which can help with large meshes.
As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.
**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
- The subdivision surface modifier is not responsible for calculating
normals anymore. In master, the modifier creates different normals
than the result of the `Mesh` normal calculation, so this is a bug
fix.
- There are small differences in the results of some modifiers that
use normals because they are not converted to and from `short`
anymore.
**Future improvements**
- Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
already retrieves normals if they are needed anyway.
- Copy normals as part of a better CoW system for attributes.
- Make more areas use lazy instead of eager normal calculation.
- Remove `BKE_mesh_normals_tag_dirty` in more places since that is
now the default state of a new mesh.
- Possibly apply a similar change to derived face corner normals.
Differential Revision: https://developer.blender.org/D12770
|
|
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
|
|
This was added in rBd13970de8627, now use in more places.
|
|
Outliner would frame the armature object instead of the bone if the bone
was on a hidden armature layer.
Similar to issues reported in e.g. T58068 and T80464, this is due to the
fact that `BKE_pose_channel_active` always checks for the armature layer
(and returns NULL if a bone is not on a visible armature layer).
Now propose to make this layer check **optional** (and e.g. from the
Outliner be more permissive). This also introduces
`BKE_pose_channel_active_if_layer_visible` which just wraps
`BKE_pose_channel_active` with the check being ON.
Maniphest Tasks: T92930
Differential Revision: https://developer.blender.org/D13154
|
|
Also add groups in some files.
|
|
Use "filepath" which is the current convention for naming full paths.
- Main use "name" which isn't obviously a file path.
- BlendFileData & FileGlobal used "filename" which is often
used for the name component of a path (without the directory).
|
|
Some doc-strings were skipped because of blank-lines between
the doc-string and the symbol and needed to be moved manually.
- Added space below non doc-string comments to make it clear
these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
Ref T92709
|
|
The corresponding vertex group was renamed properly, but the armature
influence was broken for that bone.
Caused by {rB3b6ee8cee708}.
Since above commit, vertex group names are stored on object data (mesh/
lattice/gpencil) and if we update these, we have to inform dependency
graph to have immediate effect.
Maniphest Tasks: T93892
Differential Revision: https://developer.blender.org/D13526
|
|
|
|
|
|
The old names had "{verb} Pose Library Pose"; they are now named
"{verb} Pose Asset", which is shorter & clearer.
|
|
* Rename the 'copy' functions to make it clear they belong to the same
'group' and are to be used together.
* Fix `flag` parameter of `BKE_copybuffer_paste` being a short instead
of an int.
* Improve documentation.
|
|
|
|
|
|
In armature edit mode, the Make/Clear Parent operators don't do anything
in various cases, but only one of these cases was previously indicated,
and it was indicated by hiding the option completely instead of graying
it out.
Clear Parent (Alt+P) problems fixed:
- "Clear Parent" option always showed up, even when none of the selected
bones had a parent.
- "Disconnect Bone" option always showed up, even when use_connected on
all selected bones was already false.
Make Parent (Ctrl+P) problems fixed:
- "Keep Offset" option didn't show up when all selected bones' parent
was already the active bone. This was correct, and this patch tries to
make all behaviours consistent with this.
- "Connected" option always showed up, even when all selected bones'
parent was already the active bone, and they all had use_connect set
to True.
With this patch all options show up all the time, but in cases where
they would do nothing, they will be grayed out.
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D6100
|
|
As can be confirmed by checking generic code for this operation,
it is supposed to blend between the result of Breakdown based on
actual frame range, and the current pose. However for some reason
the quaternion specific code was blending between the current pose
and the current keyframed pose. This means that the operation does
nothing if invoked without modifying the pose first.
This rewrites the code to match the non-quaternion behavior.
Differential Revision: https://developer.blender.org/D13030
|
|
Replace local static mouse coordinate storage with a single function.
also resolve inconsistencies.
- Edit-mesh selection used equality check (ignoring `U.move_threshold`).
- Motion to clear tooltips checked the value without scaling by the DPI.
Also prevent the unlikely case of the previous motion check matching
a different area by resetting the value when the active region changes.
|
|
|
|
Use arrays for wmEvent coordinates, this quiets warnings with GCC11.
- `x, y` -> `xy`.
- `prevx, prevy` -> `prev_xy`.
- `prevclickx, prevclicky` -> `prev_click_xy`.
There is still some cleanup such as using `copy_v2_v2_int()`,
this can be done separately.
Reviewed By: campbellbarton, Severin
Ref D12901
|
|
|
|
This is caused by {rB3b6ee8cee708}.
Since rigging curves with armatures only works with envelopes (if I am
not mistaken), this stirs up the question again why we actually give the
choice for vertex groups in parenting. Anyways, curves can have armature
modifiers and renaming bones should not crash.
Now make sure we only go down the route of `BKE_object_defgroup_list`
and `BKE_object_defgroup_find_name` if vertex groups are actually
supported.
Maniphest Tasks: T92083
Differential Revision: https://developer.blender.org/D12876
|
|
|
|
Blender English should use 'American' variants, not 'British' variants.
|
|
|
|
Adds a new operator to the pose slider tools that blends the
current pose with the neighbouring poses in the timeline.
The operator can be called in pose mode with Shift+Alt+E
or from the "pose" menu under "In betweens/Blend to Neighbour"
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9137#inline-105214
Ref: D9137
|
|
- Show "Lasso Select" in menus (along with Box & Circle select)
- Show "Extrude to Cursor" (along with other extrude actions).
- Rename operators that add/extrude on Ctrl-Click
since their names were inconsistent.
This is mainly for discoverability.
|
|
- Bend (Transform).
- Extrude to Cursor.
- Lasso Select (related operators such as node-cut links, mask.. etc).
- Rip Mesh / UV's.
- Vertex/Edge Slide.
|
|
After applying the pose breakdowner,
the "factor" slider in the redo panel wasn't set to the correct value
This would cause the pose to jump around
once you start dragging the slider
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12187
Ref: D12187
|
|
Change data structure of keylists. Reducing the balancing overhead and therefore increases performance.
| **Function** | **Master** | **Patch** |
|`draw_summary_channel`| 0.202105s| 0.083874s |
When adding items to the keylist it will store it in a linked list. This linked list is
accompanied with the length (key_len) and a `last_accessed_column`. last_accessed_column is a cursor
that improve the performance when adding new items as they are mostly ordered by frame numbers.
last_accessed_column is reset when a new fcurve/mask/... is added to the keylist.
Before searching or array access. the listbase needs to be converted to an array.
`ED_keylist_prepare_for_direct_access`. After that the caller can use
`ED_keylist_find_*` or `ED_keylist_array*` functions.
The internal array can also be accessed via the `ED_keylist_listbase` function.
The items inside the array link to the previous/next item in the list.
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D12052
|
|
Support extracting identifiers RNA paths into fixed size buffer
since the maximum size of the identifier is known all cases.
- Add BLI_str_unescape_ex to support limiting the destination buffer.
- Add BLI_str_quoted_substr to copy values into a fixed size buffer.
|
|
Rely on BLI_str_quoted_substrN to detect if the prefix exists since
this function exists early there is no need to check before calling.
|
|
Having settings such as "extend" saved between executions causes
keymaps that don't include this setting to remember the value
between execution.
No longer store this setting for selection operations & remove
redundant values from the key-maps, see: T90275.
|
|
|
|
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.
This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.
No functional changes.
Reviewed by: Severin
Differential Revision: https://developer.blender.org/D12151
|
|
|
|
|
|
|
|
For T78995 we want to change the data structure of keylists to
improve performance. (Probably a Vector with bin-search capabilities).
This patch hides the internal structure of the keylists behind `AnimKeylist`
structure. This allows us to change the internals without 'breaking' where it is
being used.
The change adds functions to create, free, find and walk over the
keylist.
Reviewed By: sybren
Maniphest Tasks: T78995
Differential Revision: https://developer.blender.org/D11974
|
|
|
|
|
|
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
|
|
|
|
This patch addresses the issue raised in T88340.
When entering a pose sliding operator bones would automatically get hidden.
While technically not a bug it was decided that it is too confusing.
Hiding with 'H' is still possible though, just won't happen automatically
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D11883
Ref: D11883
|
|
|
|
Extract the slider gui implemented for the pose slide tools.
Generalise it so it can be used by other tools as well.
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9314
Ref: D9314
|
|
|
|
While the asset-handle design is supposed to be temporary (see
35affaa971cf), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
|
|
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.
|
|
Convert `pose_backup.c` (in C) to `pose_backup.cc` (in C++). This will
make future improvements easier. For now, it's the same code with just
some additional explicit casts (C++ doesn't allow implicitly casting
`void *`), `NULL` changed into `nullptr`, and some other simple changes.
No functional changes.
|
|
|