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-04-05Refactor: Unify vertex and sculpt colors into newJoseph Eagar
color attribute system. This commit removes sculpt colors from experimental status and unifies it with vertex colors. It introduces the concept of "color attributes", which are any attributes that represents colors. Color attributes can be represented with byte or floating-point numbers and can be stored in either vertices or face corners. Color attributes share a common namespace (so you can no longer have a floating-point sculpt color attribute and a byte vertex color attribute with the same name). Note: this commit does not include vertex paint mode, which is a separate patch, see: https://developer.blender.org/D14179 Differential Revision: https://developer.blender.org/D12587 Ref D12587
2022-03-09Cleanup: rename wmEvent.prev_click_* to prev_press_*Campbell Barton
At the time of naming these members only some event types generated click events so it made some sense to differentiate a click. Now all buttons support click & drag it's more logical to use the prefix "prev_press_" as any press event will set these values. Also update doc-strings.
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-02-10Refactor: Move PBVH update tag out of MVertHans Goudey
This is part of the project of converting `MVert` into `float3`. (more details in T93602), The pbvh update flag is removed and replaced with a bitmap stored in the PBVH structure. This patch is similar to D13878. This is mainly setup for an eventual performance improvement by removing the extra data from mesh vertices, but if it's consistent with testing in the other patch doing the same thing for another "temp tag", then it may actually increase the speed of sculpt code slightly, since less memory needs to be loaded when checking/changing the flags. Differential Revision: https://developer.blender.org/D14000
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-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-03-13Cleanup: add BKE_pbvh_vertex_iter_begin to clang-formatPablo Dobarro
Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10707
2021-02-10Cleanup: Unindent if statements in sculpt tools codePablo Dobarro
This removes indentations from if statements by converting them to early returns and continue. Most of the code of brushes and tools has loops with a full indented body inside of an if, which was also copied into some of the new tools. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10333
2020-12-24UI: Cleanup spelling of compound wordsYevgeny Makarov
Approximately 138 changes in the spelling of compound words and proper names like "Light Probe", "Shrink/Fatten", "Face Map". In many cases, hyphens were used where they aren't correct, like "re-fit". Other common changes include: - "Datablock" -> "data-block" - "Floating point" -> "floating-point" - "Ngons" -> "n-gons" These changes help give the language used in the interface a consistent, more professional feel. Differential Revision: https://developer.blender.org/D9923
2020-12-24Cleanup: Fix capitalization in various UI stringsYevgeny Makarov
Approximately 195 changes of capitalization to conform to MLA title style. UI labels and property names should use MLA title case, while descriptions should be capitalized like regular prose, generally with only the start of a sentence capitalized. Differential Revision: https://developer.blender.org/D9922
2020-12-15Fix T83201: Cloth brush performance regressionPablo Dobarro
The if statement of the dynamic area mode branch should be an else if. When using local mode, this was running both the local and global code. I moved this code to sculpt_cloth and refactored it to use a switch case to prevent this from happening again. Reviewed By: mont29 Maniphest Tasks: T83201 Differential Revision: https://developer.blender.org/D9762
2020-11-12Fix T82388: Sculpt mode: Unexpected undo behavior.Bastien Montagne
Issue exposed by rB4c7b1766a7f1. Main idea is that non-memfile first undo step should check into previous memfile and tag the ID it is editing as `future_changed`. That way, when we go back and undo to the memfile, said IDs are properly detected as changed and re-read from the memfile. Otherwise, undo system sees them as unchanged, and just re-use the current data instead. Note that currently only Sculpt mode seems affected (probably because it is storing the mode switch itself as a Sculpt undo step instead of a memfile one), but similar action might be needed in some other cases too. Maniphest Tasks: T82388 Differential Revision: https://developer.blender.org/D9510
2020-10-26Cleanup: spellingCampbell Barton
2020-10-26Merge branch 'blender-v2.91-release'Pablo Dobarro
2020-10-26Fix T81904: Cloth brush simulation failing with local area and mirrorPablo Dobarro
When using local area, all nodes need to build their constraints first before activating them for simulation. THis ensures that nodes get their structural constraints from the initial location of each symmetry pass. Reviewed By: sergey Maniphest Tasks: T81904 Differential Revision: https://developer.blender.org/D9303
2020-10-26Sculpt: Implement plane deformation falloff for GrabPablo Dobarro
The plane deformation falloff was introduced in the first version of the cloth brush, but due to the lack of all the new features and fixes in the solver it was causing a lot of artifacts for deformation brushes. In order to avoid that, the cloth brush was always using radial falloff for the grab brush. Now the plane falloff is properly implemented using the deformation constraints. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9320
2020-10-20Sculpt: Reduce the displacement step in the cloth solverPablo Dobarro
Previously the base displacement for solving the constraints was always using 0.5, which may introduce artifacts when multiple constraints of different types are computed for the same vertex. This introduces a factor that reduces the base displacement of the solver, reducing the artifacts. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9202
2020-10-15Fix Cloth brush grab artifacts in the affected areaPablo Dobarro
The cloth brush grab mode was creating constraints at 1.0 strength in the area of the brush where the fade was evaluated to 1. This was causing stability issues in the simulation and not producing ideal results. Now the constraint strength is scaled with an empirically found factor. The values in this patch may require further tweaking after experimenting a little bit more with them. Reviewed By: sergey, zeddb Differential Revision: https://developer.blender.org/D9201
2020-10-15Sculpt: Add global automasking settings support in filtersPablo Dobarro
When using the sculpt filters, global automasking settings that affect all brushes were ignored because the automasking system was not implemented for filters, making filters and brushes react differently to the global sculpt settings which creates confusion. This makes all filter tools (mesh, cloth, color) use the same general automasking settings and features as the brush tools. Filters will now use the settings in the options panel to limit their effect. This also removes the "use Face Sets" option from the Mesh filter code, as it was duplicated from the automasking code just to have that funcitonality. This is now handled by the regular automasking system. The "Use Face Sets" option is still available in the cloth filter as that option limits the action of the forces, not the displacement. After this, it is possible to initialize the automasking system independently from the StrokeCache and Brush settings, so it can also be added to more tools and features in the future. Fixes T81619 Reviewed By: dbystedt, sergey Maniphest Tasks: T81619 Differential Revision: https://developer.blender.org/D9171
2020-10-13Sculpt: Use plasticity for softbody influencePablo Dobarro
Previously the softbody strength property was controlling the strength of the constraints that pin all vertices to the original location. This was causing problems when the forces were trying to deform the vertices too much, like when using gravity or grab brushes. Now softbody is implemented with plasticity, which creates constraints to a separate coordinates array. These coordinates are deformed with the simulation, and the plasticity parameter controls how much the simulation moves the coordinates (plasticity 0), or the coordinates move the simulation back to its previous position (plasticity 1). This creates much better and predictable results and adding softbody plasticity to the brushes can increase its control and the stability of the simulation. Reviewed By: sergey, zeddb Differential Revision: https://developer.blender.org/D9187
2020-10-05Sculpt: Modify damping using the simulation factor of the cloth brushPablo Dobarro
This helps blending artifacts with dynamic simulation areas as the damping increases when the vertex. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D9084
2020-10-02Cleanup: clang-formatLukas Stockner
2020-10-01Fix warnings in cloth brush int castsPablo Dobarro
Use POINTER_AS_INT instead Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D9083
2020-10-01Sculpt: Cloth Simulation Dynamic area modePablo Dobarro
This simulation area mode moves the active area with the brush. When enabled, the cloth brush has no restrictions on stroke length, area or mesh vertex count. In order to work, this enables PBVH nodes dynamically for simulation as the stroke location moves and builds the constraints for new nodes during the stroke. When a node is not inside the simulated area, all the constraints that were created for it and vertex collisions are not computed. The simulation limits falloff areas and constraints tweaking control how the simulated and no simulated nodes blend. Reviewed By: sergey, zeddb Differential Revision: https://developer.blender.org/D8726
2020-09-18Cleanup: Resolve warningsJulian Eisel
Unused variables, missing include for declaration, missing 'static' specifier. Also rename function to match naming convention.
2020-09-18Sculpt: Scale Cloth FilterPablo Dobarro
This filter scales the mesh as it was a softbody, producing folds in the surface. The orientation of the folds can be controlled using the filter axis and orientation. This is an example of a cloth filter that uses deform coordinates instead of forces, but probably it does not make much sense to expose it to the user in a different way and with different parameters. I'll remove FilterCache->enabled_force_axis in a later commit and use always enabled_axis in SCULPT_filter_zero_disabled_axis_components for both forces and deformation filters, so this function can also be used in the mesh filter. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8661
2020-09-18Sculpt: Lower the default cloth deformation constraints strengthPablo Dobarro
The deformation constraints strength were too strong and they were preventing the cloth effects of the brushes with cloth deformation target to create folds properly. This lowers the default, making the simulation follow the deformation in a more relaxed way. I'll make a separate patch to expose this as a property for certain brushes and cloth deformers that may need higher values (like boundary with loop falloff on a low poly mesh), but I think this default will work better for most use cases. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8884
2020-09-18Fix Brushes with deformation target being affected by sim areasPablo Dobarro
Brushes that target the cloth simulation but are not the cloth brush affect the entire mesh, so they don't have simulation areas and falloff. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8885
2020-09-02Fix T80311: Sculpt Filters not working when using vertical splitPablo Dobarro
All filters were using prevclicx, which is in screen coordinates and mval[0], which is in region coordinates to get the filter strength. This fixes the issue in all filters. Reviewed By: Severin Maniphest Tasks: T80311 Differential Revision: https://developer.blender.org/D8776
2020-08-25Sculpt: Cloth Snake Hook BrushPablo Dobarro
This implements Snake Hook as a deform type for the cloth brush. This brush changes the strength of the deformation constraints per brush step to avoid affecting the results of the simulation as much as possible. It allows to grab the cloth without producing any artifacts in the surface and create more natural looking folds than any of the other deformation modes. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8621
2020-08-20Sculpt: Add orientation modes to the Cloth FilterPablo Dobarro
This adds the orientation modes to the Cloth Filter. Similar to the mesh filter, they set the orientation of the axis when limiting the forces. When using the gravity mesh filter, the orientation also sets the gravity direction. In world orientation, cloth will always fall towards the ground plane. In view mode, cloth will always fall down relative to the view. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8618
2020-08-19Cleanup: spellingCampbell Barton
2020-08-18Sculpt: Enable Cloth Simulation Target for Pose and BoundaryPablo Dobarro
This adds a new brush property called "Deformation Target" which controls how the brush deformations is going to affect the mesh data. By default is set to Geometry, which makes the brushes displace the vertices. When set to Cloth Simulation, the deformation of the brush is applied to the cloth solver constraints, so the simulation is responsible to apply the final deformation. This allows to add cloth simulation effects to other sculpt tools with minor modifications to their code. This patch enables Cloth Simulation deformation target for Pose and Boundary brushes, which are tools that are already designed to work in low poly counts and produce large deformations. This allows creating the most common cloth effects, like bending and compressing folds, without relying on collisions. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8578
2020-08-18Sculpt: Sculpt Filter Orientation OptionsPablo Dobarro
Previously, the XYZ deform axis of the Mesh Filter were limited to object space (which is the default for sculpt mode). Now it is possible to limit the XYZ displacement in Local, Global or View space. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8582
2020-08-18Sculpt: Option to limit the forces axis in the Cloth FilterPablo Dobarro
This uses the same concept of the Mesh Filter but for applying the cloth filter forces, so now it can be limited to a specific axis. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8567
2020-08-18Sculpt: Expose the functions to create and init a SculptClothSimulationPablo Dobarro
This will be used for new features like supporting cloth deformation in other brushes and tools outside of the cloth brush code. No functional changes. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8602
2020-08-16UI: Simplify cloth filter type descriptionHans Goudey
Remove extra words in the message and avoid repeating the name in the description.
2020-08-16Merge branch 'blender-v2.90-release'Hans Goudey
2020-08-16Fix T79823: Typo in cloth filter type descriptionHans Goudey
2020-08-12Clenaup: Rename random_access_init to random_access_ensurePablo Dobarro
Reviewed By: sergey Differential Revision: https://developer.blender.org/D8529
2020-08-12Fix Sculpt Filters operator namingPablo Dobarro
Reviewed By: sergey Differential Revision: https://developer.blender.org/D8523
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-07Cleanup: declare arrays arrays where possibleCampbell Barton
2020-08-06Sculpt: Cloth Brush simulation area propertyPablo Dobarro
This makes possible to choose between a local and a global simulation when the cloth brush is used. Local simulation is the current default. When global simulation is enabled, the cloth brush simulates the entire mesh without taking any simulation limits into account. This was possible before by setting the simulation limits to 10 (the current maximum value allowed) so the entire mesh was inside the limits, but this was a hack as the limits scale with the radius and there should not be any limitation on how big the simulated area can be to be able to simulate an entire object. This also allows to make a more clear distinction between cloth brush presets that are intended to be used in local areas to add details or globally to generate the base shape of the mesh. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8481
2020-08-06Cleanup: Paint Cursor RefactorPablo Dobarro
The paint_draw_cursor function was handling the cursor drawing for 2D and 3D views of all paint modes, calculating the brush radius, updating the SculptSession data and updating and drawing all sculpt cursor overlays for different tools. It was almost impossible to understand when and what was being drawn and in which state the GPU matrix was. Now everyting is organized into different functions, with clear separation between modes, sculpt tool overlays and different drawing setups. Update and drawing functions are also separated (this allows to skip one PBVH query on each cursor drawing). Reviewed By: sergey Differential Revision: https://developer.blender.org/D8206
2020-08-06Cleanup: no need for plural for term 'collision'Campbell Barton
2020-08-06Sculpt: Cloth Brush/Filter CollisionsPablo Dobarro
This implements collisions in the solver of the cloth brush/filter. It uses the scene colliders as a regular physics simulation. There are still some parameters (friction, distance to the surface...) that can be exposed as properties in later patches. Thanks to Sebastian Parborg for helping me with the implementation. Reviewed By: sergey, zeddb Differential Revision: https://developer.blender.org/D8019
2020-08-05Sculpt: Cloth brush Pin Simulation Boundary propertyPablo Dobarro
The cloth brush has a defined simulated area with a falloff. In the falloff area (the area between the dashed white circle and the exterior white circle), simulation properties change in order to fade out the simulation deformation effects towards the boundary. With some brushes and stroke types (like anchored strokes with pinching or grabbing with full strength), it is possible to apply more force than what the boundary falloff can compensate, so the simulation breaks when this happens. This option pins the falloff area with softbody constraints, This produces a much better deformation falloff and it is no longer possible to move the vertices near the simulation boundary, so the simulation won't break no matter the strength of the forces applied inside the simulated areas. This is an option as it is particularly useful for some brushes to add localized details, but for brushes that are supposed to deform the entire mesh (like the grab brush in D8424), this can add unwanted softbody constraints that affect the simulation result. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8435
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.