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-24Cleanup: spelling in commentsCampbell Barton
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-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-11-13Cleanup: spelling in comments, comment block formattingCampbell Barton
2021-10-24Cleanup: spelling in commentsCampbell Barton
2021-08-21Cleanup: spelling in comments & minor cleanupCampbell Barton
Also hyphenate 'mouse-move' use doxy sections in render_update.c & move function comment from the header to the source.
2021-08-06Cleanup: use MEM_SAFE_FREE macroCampbell Barton
2021-07-20Cleanup: reserve C++ comments for disabled codeCampbell Barton
Use C comments for plain text.
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-07-02Cleanup: Further use of const when accessing evaluated meshHans Goudey
Also resolve a warning from the previous commit. The next blocker to using const is `BKE_mesh_wrapper_ensure_mdata`.
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-24Cleanup: comment blocks, trailing space in commentsCampbell Barton
2021-06-22Cleanup: deduplicate free codeGermano Cavalcante
It is more appropriate that `depths` is freed in `ED_view3d_depths_free`.
2021-06-21Refactor: Do not keep a copy of depth buffer in RegionView3DGermano Cavalcante
The depth cache (located in `RegionView3D::depths`) is used for quick and simple occlusion testing in: - particle selection, - "Draw Curve" operator and - "Interactive Light Track to Cursor" operator, However, keeping a texture buffer in cache is not a recommended practice. For displays with high resolution like 8k this represents something around 132MB. Also, currently, each call to `ED_view3d_depth_override` invalidates the depth cache. So that depth is never reused in multiple calls from an operator (this was not the case in blender 2.79). This commit allows to create a depth cache and release it in the same operator. Thus, the buffer is kept in cache for a short time, freeing up space. No functional changes.
2021-06-01GPU: add 2D projection functionCampbell Barton
When projecting into screen space Z value isn't always needed. Add 2D projection functions, renaming them to avoid accidents happening again. - Add GPU_matrix_project_2fv - Add ED_view3d_project_v2 - Rename ED_view3d_project to ED_view3d_project_v3 - Use the 2D versions of these functions when the Z value isn't used.
2021-05-07Fix inconsistency setting particle edit-modeCampbell Barton
The check to include particle edit mode in the object-mode drop-down didn't match the poll function to edit particle edit mode. Share the check between both functions.
2021-03-30Cleanup/Refactor: Unify functions that redraw the depth bufferGermano Cavalcante
Now `ED_view3d_backbuf_depth_validate`, `ED_view3d_draw_depth` and `ED_view3d_draw_depth_gpencil` are unified in `ED_view3d_depth_override`. This new function replaces `ED_view3d_autodist_init`. Also, since `ED_view3d_depth_update` depends on the render context, and changing the context is a slow operation, that function also was removed, and the depth buffer cached is now updated inside the new unified drawing function when the "bool update_cache" parameter is true. Finally `V3D_INVALID_BACKBUF` flag has been renamed and moved to `runtime.flag`. Differential revision: https://developer.blender.org/D10678
2021-03-18Cleanup: spellingCampbell Barton
2021-02-26Cleanup: use boolean argumentsCampbell Barton
2021-02-26Fix particle-edit crash on undo/redoCampbell Barton
Undo/redo was crashing & asserting. There ware two bugs: - Entering particle system edit-mode requires an evaluated depsgraph. - The active object could get out of sync when undo/redo moves between different modes. The new test 'view3d_mesh_particle_edit_mode_simple' in `tests/ui_simulate/test_undo.py` exposes both issues.
2021-02-14Cleanup: use doxy sectionsCampbell Barton
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2021-01-27UI: Fix incorrect RNA percentage property definitionsHans Goudey
In two cases the percentage property was actually used incorrectly, as pointed out in T82070. The range was [0, 1], but the properties were still displayed as percentages. There is a preference to control whether to display factors or percentages, so it usually doesn't make sense to manually define properties as percentages. Resolves T82070 Differential Revision: https://developer.blender.org/D9344
2021-01-20Cleanup: remove extra in trailing asteriskCampbell Barton
Comment blocks not conforming to convention.
2021-01-07Fix T84142: crash when mirroring hair emitted from verticesJacques Lucke
The hair mirroring code seems to expect that hair is emitted from faces. The PE_mirror_x contains the following expression: mirrorfaces[pa->num * 2]. This only makes sense when pa->num is a face index. The simplest short term solution is to disable the mirror operator when the particles haven't been emitted from faces. Diffferential Revision: https://developer.blender.org/D10002
2020-11-20Merge branch 'blender-v2.91-release'Jeroen Bakker
2020-11-19Fix T82769: remove thread local data from PTCacheMemJacques Lucke
The issue was that the same point cache was read by multiple threads at the same time (the same object was evaluated for render and for the viewport). Both threads incremented PTCacheMem->cur which lead to the crash. The fix is to remove the PTCacheMem->cur and store it on the stack instead. This way every thread has its own cur. Reviewers: brecht Differential Revision: https://developer.blender.org/D9606
2020-11-06Cleanup: follow our code style for float literalsCampbell Barton
2020-10-19Spelling: Then Versus ThanHarley Acheson
Corrects incorrect usages of the words 'then' and 'than'. Differential Revision: https://developer.blender.org/D9246 Reviewed by Campbell Barton
2020-10-10Cleanup: use C comments for descriptive textCampbell Barton
Follow our code style guide by using C-comments for text descriptions.
2020-10-08Hair: Remove warning about undo when Delete EditDalai Felinto
Deleting the particle editmode is fully supported by undo now. No need to warn the user about that anymore.
2020-10-03Cleanup: Remove/replace C standard library assert() and header usagesJulian Eisel
We have our own assert implementation, `BLI_assert()` that is prefered over the C standard library one. Its output is more consistent across compilers and makes termination on assert failure optional (through `WITH_ASSERT_ABORT`). In many places we'd include the C library header without ever accessing it.
2020-09-30Cleanup: convert gforge task ID's to phabricator formatValentin
Cleanup old tracker task format to the new. e.g: [#34039] to T34039 Ref D8718
2020-09-18Unify all XYZ symmetry options using Mesh SymmetryPablo Dobarro
This adds XYZ symmetry as a property of meshes and updates all modes to use the mesh symmetry by default to have a consistent tool behavior between all modes and when switching objects. Reviewed By: brecht, mano-wii, campbellbarton Maniphest Tasks: T79785 Differential Revision: https://developer.blender.org/D8587
2020-09-18Fix T80900: Crash lasso-selecting in particle editmode in certainPhilipp Oeser
situations In the situation that the PTCacheEdit is not available (e.g. when editing unbaked Cloth or Softbody caches - or, as in the report, being in Cloth or Softbody Editing Type for Hair particles), accesing the corresponding ParticleSystem or ParticleSystemModifierData would crash. Now access these later (after PE_start_edit had the chance to return early on this non-valid situation). Reviewers: JacquesLucke Maniphest Tasks: T80900 Differential Revision: https://developer.blender.org/D8941
2020-09-04Cleanup: Clang-Tidy readability-redundant-preprocessor fixesSybren A. Stüvel
Remove redundantly nested `#if` and `#ifdef` statements. One nested `#if 0` block was left untouched, as it's in particle code that's no longer maintained. Furthermore, that block also has some explanation as to the differences between the enabled & disabled parts. One nested `#if 0` construct was completely removed, leaving only the actually used bit of code. There was no explanation as to the usefulness of the disabled code, and it hasn't been touched in years. No functional changes.
2020-08-18GPUState: GPU_blend final API renamingClément Foucault
We now use GPU_blend for enabling / disabling blending and explicitly set the blend equation.
2020-08-08Cleanup: use array syntax for sizeof with fixed valuesCampbell Barton
Also order sizeof(..) first to promote other values to size_t.
2020-08-01Cleanup: use term init instead of initialize/initialiseCampbell Barton
The abbreviation 'init' is brief, unambiguous and already used in thousands of places, also initialize is often accidentally written with British spelling.
2020-07-03Cleanup: Editors, Clang-Tidy else-after-return fixesSybren A. Stüvel
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors` module. No functional changes.
2020-06-29Fix T78415: Particle Edit mode Add brush with a radius > 181px crashesPhilipp Oeser
Caused by short overflow, change to int instead. Maniphest Tasks: T78415 Differential Revision: https://developer.blender.org/D8148
2020-06-04Cleanup: split particle & texture paint mode switching into utility functionsCampbell Barton
2020-06-04Cleanup: remove window manager argument for paint cursor APICampbell Barton
This caused an additional argument when exiting object modes and many other low level functions which don't need to access context. This simplifies fixing T77073.
2020-05-25Cleanup: typoJacques Lucke
2020-05-19Merge branch 'blender-v2.83-release'Campbell Barton
2020-05-19Fix switching to particle edit-mode from editmodeCampbell Barton
Similar to T76859
2020-05-08Cleanup: clang-formatCampbell Barton
2020-05-08Fix T76498: Refactoring - Rename BKE modifiers funtionsAntonio Vazquez
2020-05-05Cleanup: use int instead of short for lasso array lengthCampbell Barton
There was no reason to use a short here, this was just a convention from existing code.
2020-05-04Cleanup: rename mcords to mcoordsCampbell Barton
- 'coords' is an abbreviation for coordinates, not 'cords'. - Rename 'moves' to 'coords_len'.