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-05-15Cleanup: Remove includes from DerivedMesh headerHans Goudey
Headers should only include other headers when absolutely necessary, to avoid unnecessary dependencies and increasing compile times. To make this change simpler, three DerivedMesh functions with a single use were removed.
2022-04-14Cleanup: Declare variables where initializedHans Goudey
Also adjust comment formatting and use nullptr where the previous commit missed.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-01-25Fix depsgraphs sharing IDs via evaluated edit meshSergey Sharybin
The evaluated mesh is a result of evaluated modifiers, and referencing other evaluated IDs such as materials. It can not be stored in the EditMesh structure which is intended to be re-used by many areas. Such sharing was causing ownership errors causing bugs like T93855: Cycles crash with edit mode and simultaneous viewport and final render The proposed solution is to store the evaluated edit mesh and its cage in the object's runtime field. The motivation goes as following: - It allows to avoid ownership problems like the ones in the linked report. - Object level is chosen over mesh level is because the evaluated mesh is affected by modifiers, which are on the object level. This patch allows to have modifier stack of an object which shares mesh with an object which is in edit mode to be properly taken into account (before the change the modifier stack from the active object will be used for all objects which share the mesh). There is a change in the way how copy-on-write is handled in the edit mode to allow proper state update when changing active scene (or having two windows with different scenes). Previously, the copt-on-write would have been ignored by skipping tagging CoW component. Now it is ignored from within the CoW operation callback. This allows to update edit pointers for objects which are not from the current depsgraph and where the edit_mesh was never assigned in the case when the depsgraph was evaluated prior the active depsgraph. There is no user level changes changes expected with the CoW handling changes: should not affect on neither performance, nor memory consumption. Tested scenarios: - Various modifiers configurations of objects sharing mesh and be part of the same scene. - Steps from the reports: T93855, T82952, T77359 This also fixes T76609, T72733 and perhaps other reports. Differential Revision: https://developer.blender.org/D13824
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
2021-12-07Cleanup: move public doc-strings into headers for 'blenkernel'Campbell Barton
- 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. - Minor improvements to doc-strings. Ref T92709
2021-09-02Fix regression in recent change 0708733c46cb6b50697c1b80a6541d6fb410267eCampbell Barton
Adding a mirror modifier in edit-mode crashed. Freeing meshes that hold a shallow copy happens in multiple places while calculating modifiers, making it impractical to clear the edit-mode pointer before freeing the mesh (as done in BKE_editmesh_free_derived_caches). Add a struct member to the edit-mesh struct so evaluated copies don't free the edit-mesh contents.
2021-09-02Cleanup: remove redundant edit-mesh memory allocationCampbell Barton
This memory was only duplicated to satisfy mesh_data_free which was incorrectly freeing the pointer (but nothing else).
2021-09-02Fix T91123: Freeing meshes in edit-mode leaks memoryCampbell Barton
Freeing the edit-mesh pointer wasn't free the edit-mesh data it's self. Unlinking from the outliner or through the Python API leaked memory. This didn't often cause leaks in practice since ED_editors_exit exits edit-mode for all objects. Now freeing mesh data frees the edit-mode data as well, this matches the behavior of other object types that support edit-mode.
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-07-13Cleanup: minor changes to edit-mesh API callsCampbell Barton
Rename: - EDBM_mesh_free -> EDBM_mesh_free_data BKE_editmesh_free -> BKE_editmesh_free_data Since this doesn't free the edit-mesh pointer. - BKE_editmesh_free_derivedmesh -> BKE_editmesh_free_derived_caches Since this no longer uses derived-mesh, match naming for the related object function BKE_object_free_derived_caches. Also remove `do_tessellate` argument from BKE_editmesh_create, since the caller can explicitly do this if it's needed, with the advantage that it can be combined with normal calculation which is faster on high-poly meshes.
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-18Fix error passing in false as instead of a structCampbell Barton
Error in 8a1860bd9aecddf611b64e3e842bdc8c76f15cc6.
2021-06-14BMesh: support face-normal calculation in normal & looptri functionsCampbell Barton
Support calculating face normals when tessellating. When this is done before updating vertex normals it gives ~20% performance improvement. Now vertex normal calculation only needs to perform a single pass on the mesh vertices when called after tessellation. Extended versions of normal & looptri update functions have been added: - BM_mesh_calc_tessellation_ex - BM_mesh_normals_update_ex Most callers don't need to be aware of this detail by using: - BKE_editmesh_looptri_and_normals_calc - BKE_editmesh_looptri_and_normals_calc_with_partial - EDBM_update also takes advantage of this, where calling EDBM_update with calc_looptri & calc_normals enabled uses the faster normal updating logic.
2021-06-05Edit Mesh: partial updates for normal and face tessellationCampbell Barton
This patch exposes functionality for performing partial mesh updates for normal calculation and face tessellation while transforming a mesh. The partial update data only needs to be generated once, afterwards the cached connectivity information can be reused (with the exception of changing proportional editing radius). Currently this is only used for transform, in the future it could be used for other operators as well as the transform panel. The best-case overall speedup while transforming geometry is about 1.45x since the time to update a small number of normals and faces is negligible. For an additional speedup partial face tessellation is multi-threaded, this gives ~15x speedup on my system (timing tessellation alone). Exact results depend on the number of CPU cores available. Ref D11494 Reviewed By: mano-wii
2021-06-01BMesh: remove checks for tessellating 2 sided facesCampbell Barton
2 sided faces aren't supported and will cause problems in many areas of Blender's code. Removing (implied) support for faces with fewer than 3 sides means the total number of triangles is known ahead of time. This simplifies adding support for multi-threading and partial updates to an existing tessellation - as the face and loop indices can be used to access the range of triangles associated with a face. Also correct outdated comments.
2020-10-14Cleanup: commented includesCampbell Barton
2020-10-14Fix T81511: Loop-cut overlay doesn't follow deformed cageCampbell Barton
With constructive + deform modifiers, loop-cut visualization wasn't following the displayed mesh. This now gets the coordinates from the cage when available.
2020-07-01Cleanup: spellingCampbell Barton
2020-06-10Cleanup: move BKE_mesh_wrapper functions into own headerCampbell Barton
2020-05-25Mesh: skip conversion from edit-mesh to mesh in edit-modeCampbell Barton
This resolves a performance regression in 2.8x where every edit-mode update performed an edit-mesh to mesh conversion. Now the conversion will be lazily initialized if/when it's required. New BKE_mesh_wrapper_* functions abstract over mesh data access. Currently only edit-mesh and regular meshes are supported. In the future sub-surface meshes may be supported too.
2020-04-08Fix T67098: Inset causes shape keys to reset exiting edit-modeCampbell Barton
Edit-mesh interactive redo reset the meshes shape-key index. Also copy the selection mode when copying meshes.
2020-03-19Cleanup: `make format` after SortedIncludes changeDalai Felinto
2020-02-26Cleanup: reduce CDDM use, remove unused function callsCampbell Barton
2020-02-10Cleanup/refactor: Rename `BKE_library` files to `BKE_lib`.Bastien Montagne
Note that `BKE_library.h`/`library.c` were renamed to `BKE_lib_id.h`/`lib_id.c` to avoid having a too generic name here. Part of T72604.
2020-01-07BMesh: remove BMEditMesh.ob use BKE_editmesh_lnorspace_* APICampbell Barton
Note that this is a bit clumsy having both edit-mesh and mesh, BKE_editmesh_ensure_autosmooth & BKE_editmesh_lnorspace_update are often called together, these could be made into a single functions.
2020-01-07BMesh: remove BMEditMesh.ob use for vert coord access, projectionCampbell Barton
2019-12-24Cleanup: remove unused statvis code & struct membersCampbell Barton
This code has been moved into the draw manager.
2019-11-21Object: edit-mode data support for object vertex coordinate accessCampbell Barton
Allows to access/transform/restore edit-mode coordinates in a generic way.
2019-09-23Fix selection and snapping misusing texture space as boundboxBrecht Van Lommel
This fixes the regression from T70103 introduced by the fix for T70103.
2019-08-25Cleanup: rename mesh looptri/tessface functionsCampbell Barton
Use consistent terminology.
2019-08-21Cleanup: vertex coordinate access, naming & minor changesCampbell Barton
This also splits vertex access and allocation so it's possible to copy coordinates into an existing array without allocating it.
2019-08-16Cleanup: spellingCampbell Barton
2019-05-21Cleanup: clang-format, sort structsCampbell Barton
2019-05-20Normal UI: for all ops needing autosmooth on, enable it if needed.Howard Trickey
Now Normal menu operations and rotate normals (r n) do not need manual enabling of autosmooth first. See T64324 for discussion of Normal UI changes.
2019-04-27Cleanup: comments (long lines) in blenkernelCampbell Barton
2019-04-22Cleanup: style, use braces for blenkernelCampbell Barton
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
2019-02-18doxygen: add newline after \fileCampbell Barton
While \file doesn't need an argument, it can't have another doxy command after it.
2019-02-17Cleanup: rename Mesh.edit_btmesh -> edit_meshCampbell Barton
When bmesh was in a branch we had both edit_mesh and edit_btmesh, now there is no reason to use this odd name.
2019-02-06Cleanup: remove redundant doxygen \file argumentCampbell Barton
Move \ingroup onto same line to be more compact and make it clear the file is in the group.
2019-02-01Cleanup: remove redundant, invalid info from headersCampbell Barton
BF-admins agree to remove header information that isn't useful, to reduce noise. - BEGIN/END license blocks Developers should add non license comments as separate comment blocks. No need for separator text. - Contributors This is often invalid, outdated or misleading especially when splitting files. It's more useful to git-blame to find out who has developed the code. See P901 for script to perform these edits.
2018-10-17Cleanup: remove some #if 0 blocksJacques Lucke
Reviewers: brecht, campbellbarton Differential Revision: https://developer.blender.org/D3802
2018-10-15Cleanup: remove references to DerivedMeshCampbell Barton
2018-10-09Edit Mesh: replace DerivedMesh w/ MeshCampbell Barton
DerivedMesh is now removed from edit-mesh modifier evaluation.
2018-09-25Edit Mesh: Move Edit Mesh display settings to overlay'sClément Foucault
This makes the Edit Mesh display settings common to all objects. They can also be set differently per viewport. Modifying extra data (seams, sharp edges etc...) will no longer set them automaticaly visible. Bumping version because we need to force set all extra draw options for older files.
2018-08-21Cleanup: trailing spaceCampbell Barton
2018-08-04Fixed comment formatting in editmesh.cRohan Rathi
2018-08-01Some more minor typo fixes in comments.Bastien Montagne