Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-13Refactor: Move normals out of MVert, lazy calculationHans Goudey
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
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2021-12-21Cleanup: use BKE_pose_is_layer_visible in more placesPhilipp Oeser
This was added in rBd13970de8627, now use in more places.
2021-12-21Fix T92930: Outliner "Show Active" bone fails in certain situationsPhilipp Oeser
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
2021-12-14Cleanup: correct unbalanced doxygen groupsCampbell Barton
Also add groups in some files.
2021-12-13Cleanup: use "filepath" term for Main, BlendFileData & FileGlobalCampbell Barton
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).
2021-12-10Cleanup: move public doc-strings into headers for various API'sCampbell Barton
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
2021-12-09Fix T93892: Changing bone name leaves non-functional vertex groupPhilipp Oeser
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
2021-11-20Cleanup: Else after returnHans Goudey
2021-11-18Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-18Pose Library: clarify apply/blend operator namesSybren A. Stüvel
The old names had "{verb} Pose Library Pose"; they are now named "{verb} Pose Asset", which is shorter & clearer.
2021-11-12Cleanup/document BKE_blender_copybuffer.Bastien Montagne
* 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.
2021-11-09Cleanup: spelling, C style commentsCampbell Barton
2021-11-09Cleanup: clang-formatCampbell Barton
2021-11-09Armature Make/Clear Parent: Grey out options that don't do anythingDemeter Dzadik
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
2021-11-08Fix T92043: Relax/Push Pose does nothing for quaternion rotation.Alexander Gavrilov
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
2021-10-27WM: de-duplicate cursor motion checks for selection pickingCampbell Barton
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.
2021-10-21Cleanup: Use array utility for cursor eventsAaron Carlisle
2021-10-20Cleanup: use an array for wmEvent cursor position variablesAaron Carlisle
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
2021-10-20Cleanup: use elem macrosCampbell Barton
2021-10-15Fix T92083: Crash renaming bone used in Armature modifier on curvePhilipp Oeser
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
2021-10-12Cleanup: spelling in commentsCampbell Barton
2021-10-04Cleanup: `Neighbour` -> `Neighbor`. and other minor UI messages fixes.Bastien Montagne
Blender English should use 'American' variants, not 'British' variants.
2021-10-03Cleanup: spelling in commentsCampbell Barton
2021-09-22Animation: Pose Slide Operator - Blend to NeighbourChristoph Lendenfeld
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
2021-09-17UI: expose "Lasso Select" & "Extrude to Cursor" in menusCampbell Barton
- 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.
2021-09-17UI: enable the depend-on-cursor flag for some operatorsCampbell Barton
- Bend (Transform). - Extrude to Cursor. - Lasso Select (related operators such as node-cut links, mask.. etc). - Rip Mesh / UV's. - Vertex/Edge Slide.
2021-09-14Fix T89027: "factor" field in pose breakdowner not updatedChristoph Lendenfeld
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
2021-09-10Anim: Keylist drawing optimization by using arrays.Jeroen Bakker
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
2021-09-04RNA: support extracting names from paths without allocating memoryCampbell Barton
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.
2021-09-01Cleanup: remove redundant strstr callsCampbell Barton
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.
2021-08-25Cleanup: skip saving selection properties set in the keymapCampbell Barton
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.
2021-08-09Cleanup/fixes in UI messages.Bastien Montagne
2021-08-06Cleanup: rename `FileList::asset_library` → `asset_library_ref`Sybren A. Stüvel
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
2021-08-06Cleanup: use const result in `ED_keyframes_find_*` functions.Jeroen Bakker
2021-08-06Cleanup: use MEM_SAFE_FREE macroCampbell Barton
2021-08-05Cleanup: remove redundant parenthesisCampbell Barton
2021-08-03Cleanup: Hide implementation details for ED_keyframe_keylist.Jeroen Bakker
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
2021-07-30Cleanup: clang-format (re-run after v12 version bump)Campbell Barton
2021-07-27Cleanup: comment spelling & punctuationYimingWu
2021-07-26Fix: Instantly hide bones after hitting H key in pose slidingChristoph Lendenfeld
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
2021-07-26Cleanup: clang tidyJacques Lucke
2021-07-24Fix: Remove automatic hiding of bones when using the pose sliderChristoph Lendenfeld
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
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-07-23Animation: Generic Slider implementationChristoph Lendenfeld
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
2021-07-21Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")Campbell Barton
2021-07-20Cleanup: Getters for asset-handle dataJulian Eisel
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.
2021-07-20Pose Library: remove assumption about Action group namesSybren A. Stüvel
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.
2021-07-20Pose backup: convert from C to C++Sybren A. Stüvel
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.
2021-07-20Cleanup: Clang formatAaron Carlisle