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-09-15Cleanup: use doxy sections, remove outdated commentCampbell Barton
2022-09-15Cleanup: spelling in comments, comment blocksCampbell Barton
2022-09-14Cleanup: Add missing licence headersHans Goudey
Missed in eaf416693dcb
2022-09-14Cleanup: quiet warningsJacques Lucke
2022-09-13Geometry Nodes: Port the trim curve node to the new data-blockMattias Fredriksson
The trim functionality is implemented in the geometry module, and generalized a bit to be potentially useful for bisecting in the future. The implementation is based on a helper type called `IndexRangeCyclic` which allows iteration over all control points between two points on a curve. Catmull Rom curves are now supported-- trimmed without resampling first. However, maintaining the exact shape is not possible. NURBS splines are still converted to polylines using the evaluated curve concept. Performance is equivalent or faster then a 3.1 build with regards to node timings. Compared to 3.3 and 3.2, it's easy to observe test cases where the node is at least 3 or 4 times faster. Differential Revision: https://developer.blender.org/D14481
2022-09-12Geometry: Avoid unnecessary initialization when resizing data arraysHans Goudey
When resizing mesh and curves attribute storage, avoid initializing the new memory for basic types. Also, avoid skipping "no free" layers; all layers should be reallocated to the new size since they may be accessed. The semantics introduced in 25237d2625078c6d1 are essential for this change, because otherwise we don't have a way to construct non-trivial types in the new memory. In a basic test of the extrude node, I observed a performance improvement of about 30%, from 55ms to 42ms. Differential Revision: https://developer.blender.org/D15818
2022-09-12Fix T100874: improve uv unwrap of degenerate geometryChris Blackbourn
Provide reasonable defaults for UV unwrap for triangles with zero area: * Three vertices are arranged in a line. * Two vertices are at the same 3D location. * All three vertices are at the same 3D location. Change fixes quads / ngons which have triangulations with zero area. Change fixes both "Angle Based" method and "Conformal" method. Differential Revision: https://developer.blender.org/D15922
2022-09-09Mesh: Move bevel weight out of MVert and MEdgeHans Goudey
As described in T95966, the goal is to move to a "struct of arrays" approach rather than gathering an arbitrary set of data in hard-coded structs. This has performance benefits, but also code complexity benefits (this patch removes plenty of code, though the boilerplate for the new operators outweighs that here). To mirror the internal change, the options for storing mesh bevel weights are converted into operators that add or remove the layer, like for some other layers. The most complex change is to the solidify modifier, where bevel weights had special handling. Other than that, most changes are removing clearing of the weights, boilerplate for the add/remove operators, and removing the manual transfer of bevel weights in bmesh - mesh conversion. Eventually bevel weights can become a fully generic attribute, but for now this patch aims to avoid most functional changes. Bevel weights are still written and read from the mesh in the old way, so neither forward nor backward compatibility are affected. As described in T95965, writing in the old format will be done until 4.0. Differential Revision: https://developer.blender.org/D14077
2022-09-08Cleanup: Use C++ methods to retrieve attribute accessorsHans Goudey
Replace `mesh_attributes`, `mesh_attributes_for_write` and the point cloud versions with methods on the `Mesh` and `PointCloud` types. This makes them friendlier to use and improves readability. Differential Revision: https://developer.blender.org/D15907
2022-09-08Cleanup: prefer terms verts/polys over vertices/polygonsCampbell Barton
Follows existing naming for the most part, also use "num" as a suffix in some instances (following our naming conventions).
2022-09-07Cleanup: Tweak naming for recently added mesh accessorsHans Goudey
Use `verts` instead of `vertices` and `polys` instead of `polygons` in the API added in 05952aa94d33eeb50. This aligns better with existing naming where the shorter names are much more common.
2022-09-06Cleanup: spelling in comments, formatting, move comments into headersCampbell Barton
2022-09-05Mesh: Remove redundant custom data pointersHans Goudey
For copy-on-write, we want to share attribute arrays between meshes where possible. Mutable pointers like `Mesh.mvert` make that difficult by making ownership vague. They also make code more complex by adding redundancy. The simplest solution is just removing them and retrieving layers from `CustomData` as needed. Similar changes have already been applied to curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of the pointers generally makes code more obvious and more reusable. Mesh data is now accessed with a C++ API (`Mesh::edges()` or `Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`). The CoW changes this commit makes possible are described in T95845 and T95842, and started in D14139 and D14140. The change also simplifies the ongoing mesh struct-of-array refactors from T95965. **RNA/Python Access Performance** Theoretically, accessing mesh elements with the RNA API may become slower, since the layer needs to be found on every random access. However, overhead is already high enough that this doesn't make a noticible differenc, and performance is actually improved in some cases. Random access can be up to 10% faster, but other situations might be a bit slower. Generally using `foreach_get/set` are the best way to improve performance. See the differential revision for more discussion about Python performance. Cycles has been updated to use raw pointers and the internal Blender mesh types, mostly because there is no sense in having this overhead when it's already compiled with Blender. In my tests this roughly halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million face grid). Differential Revision: https://developer.blender.org/D15488
2022-08-31Mesh: Move material indices to a generic attributeHans Goudey
This patch moves material indices from the mesh `MPoly` struct to a generic integer attribute. The builtin material index was already exposed in geometry nodes, but this makes it a "proper" attribute accessible with Python and visible in the "Attributes" panel. The goals of the refactor are code simplification and memory and performance improvements, mainly because the attribute doesn't have to be stored and processed if there are no materials. However, until 4.0, material indices will still be read and written in the old format, meaning there may be a temporary increase in memory usage. Further notes: * Completely removing the `MPoly.mat_nr` after 4.0 may require changes to DNA or introducing a new `MPoly` type. * Geometry nodes regression tests didn't look at material indices, so the change reveals a bug in the realize instances node that I fixed. * Access to material indices from the RNA `MeshPolygon` type is slower with this patch. The `material_index` attribute can be used instead. * Cycles is changed to read from the attribute instead. * BMesh isn't changed in this patch. Theoretically it could be though, to save 2 bytes per face when less than two materials are used. * Eventually we could use a 16 bit integer attribute type instead. Ref T95967 Differential Revision: https://developer.blender.org/D15675
2022-08-31Merge branch 'blender-v3.3-release'Jacques Lucke
2022-08-31Fix: reverse uv lookup fails due to floating point accuracy issuesJacques Lucke
The case when the query uv is almost on an edge but outside of any triangle was handled before. Now the case where the query uv is almost on an edge but inside more than one triangle is handled as well.
2022-08-30Geometry Nodes: Use separate field context for each geometry typeHans Goudey
Using the same `GeometryComponentFieldContext` for all situations, even when only one geometry type is supported is misleading, and mixes too many different abstraction levels into code that could be simpler. With the attribute API moved out of geometry components recently, the "component" system is just getting in the way here. This commit adds specific field contexts for geometry types: meshes, curves, point clouds, and instances. There are also separate field input helper classes, to help reduce boilerplate for fields that only support specific geometry types. Another benefit of this change is that it separates geometry components from fields, which makes it easier to see the purpose of the two concepts, and how they relate. Because we want to be able to evaluate a field on just `CurvesGeometry` rather than the full `Curves` data-block, the generic "geometry context" had to be changed to avoid using `GeometryComponent`, since there is no corresponding geometry component type. The resulting void pointer is ugly, but only turns up in three places in practice. When Apple clang supports `std::variant`, that could be used instead. Differential Revision: https://developer.blender.org/D15519
2022-08-28Curves: Avoid creating types array when unnecessaryHans Goudey
When the curve type attribute doesn't exist, there is no reason to create an array for it only to fill the default value, which will add overhead to subsequent "add" operations. I added a "get_if_single" method to virtual array to simplify this check. Also use the existing functions for filling curve types. Differential Revision: https://developer.blender.org/D15560
2022-08-23Merge branch 'blender-v3.3-release'Jacques Lucke
2022-08-23Fix T100562: Realize Instances node crashes when there is an attribute name ↵Jacques Lucke
collision
2022-08-19Merge branch 'blender-v3.3-release'Jacques Lucke
2022-08-19Fix: nurbs basis cache not computed before it is usedJacques Lucke
2022-08-12Cleanup: repeated words in commentsCampbell Barton
2022-08-11Cleanup: clang-tidy uv_parametrizer.ccCampbell Barton
2022-08-11Cleanup: remove redundant MEM_SAFE_FREECampbell Barton
MEM_SAFE_FREE isn't necessary when the memory is known to be allocated and clearing the value afterwards isn't necessary.
2022-08-11Cleanup: reduce asan lint and clang-tidy warnings on uv_parametrizerChris Blackbourn
2022-08-10Cleanup: fix attr_nonnull error found by asanChris Blackbourn
2022-08-07Cleanup: make formatChris Blackbourn
2022-08-06Cleanup: Move uv_parametrizer.c to C++Chris Blackbourn
Differential Review: https://developer.blender.org/D15618
2022-08-04Cleanup: simplify uv parametrizer in preparation for C++Chris Blackbourn
No functional changes. Add casts required by C++. Simplify types.
2022-08-03Cleanup: Use generic utility to retrieve attributes to transferHans Goudey
2022-08-03Attribute Math: Improve performance of mixer in some casesIliay Katueshenock
The `DefaultMixer` for mixing generic data types has some issues: 1. The full buffer is always zeroed, even if only some is used. 2. Finalizing also works on all values, even if only some are used. 3. "mixing" doesn't allow setting the first value, requiring that everything is cleared beforehand. This commit adds the following functionality: 1. Constructor with the specified `IndexMask` for preliminary zeroing. 2. `set` method to overwrite the value. 3. `finalize` with the specified mask to process a subset of values. This is useful in situations where you want to use the DefaultMixer without having to overwrite all the values many times. A performance improvement was observed for NURBS curve evaluation and attribute interpolation from the point to curve domain of about 15% and 35% respectively (100,000 curves). Differential Revision: https://developer.blender.org/D15434
2022-08-02Cleanup: simplify uv parametrizer in preparation for C++Chris Blackbourn
No functional changes. Add casts required by C++. Simplify destructors. Simplify types.
2022-08-01Cleanup: simplify uv parametrizer in preparation for C++Chris Blackbourn
Replace `PChart` allocation with simpler calloc/free
2022-07-31Cleanup: simplify uv parametrizer in preparation for C++Chris Blackbourn
Replaces PCHART_HAS_PINS with `bool has_pins`.
2022-07-27Fix: missing evaluated offsets in Resample Curve nodeJacques Lucke
Differential Revision: https://developer.blender.org/D15556
2022-07-27Geometry Nodes: Shortest Paths nodesErik Abrahamsson
This adds three new nodes: * `Shortest Edge Paths`: Actually finds the shortest paths. * `Edge Paths to Curves`: Converts the paths to separate curves. This may generate a quadratic amount of data, making it slow for large meshes. * `Edge Paths to Selection`: Generates an edge selection that contains all edges that are part of a path. This can be used with the Separate Geometry node to only keep the edges that are part of a path. For large meshes, this approach can be much faster than the `Edge Paths to Curves` node, because less data is created. Differential Revision: https://developer.blender.org/D15274
2022-07-25Fix: Assert in resample curve node with single point curveHans Goudey
2022-07-25Fix T99851: Subdivide Curve node does not initialize attributes of end pointJacques Lucke
2022-07-25Fix T99889: Fillet Curve node uses wrong radiusJacques Lucke
2022-07-25Curves: add warning when invalid uv map is used when adding curvesJacques Lucke
UV maps that are used for surface attachment must not have overlapping uv islands, because then the same uv coordinate would correspond to multiple surface positions. Ref T99936.
2022-07-25Geometry: detect when the sample uv is in multiple trianglesJacques Lucke
2022-07-22Curves: support sculpting on deformed curvesJacques Lucke
Previously, curves sculpt tools only worked on original data. This was very limiting, because one could effectively only sculpt the curves when all procedural effects were turned off. This patch adds support for curves sculpting while looking the result of procedural effects (like deformation based on the surface mesh). This functionality is also known as "crazy space" support in Blender. For more details see D15407. Differential Revision: https://developer.blender.org/D15407
2022-07-21Cleanup: Rename length parameterization interpolation functionHans Goudey
The name makes more sense as an action, other interpolation methods besides linear probably don't make sense here anyway.
2022-07-20Curves: fix uninitialized curve type when adding new curvesJacques Lucke
2022-07-20Cleanup: Access attributes with new API instead of geometry componentsHans Goudey
Remove the boilerplate of using a local geometry component just to use the attribute API that was necessary before b876ce2a4a4638142439.
2022-07-20Curves: Remove use of CurveEval in sculpt brushesHans Goudey
This commit removes the use of PolySpline for resampling curves and replaces it with the length parameterization utility for that purpose. I didn't test performance, but I would expect the shrinking to be slightly faster because I reused some arrays to avoid allocating them for every curve. I noted some potential improvements in the "add curves" function. Differential Revision: https://developer.blender.org/D15342
2022-07-20Curves: Port fillet node to the new data-blockHans Goudey
This commit ports the fillet curves node to the new curves data-block, and moves the fillet node implementation to the geometry module to help separate the implementation from the node. The changes are similar to the subdivide node or resample node. I've resused common utilities where it makes sense, though some things like the iteration over attributes can be generalized further. The node is now multi-threaded per-curve and inside each curve, and some buffers are reused per curve to avoid many allocations. The code is more explicit now, and though there is more boilerplate to pass around many spans, the more complex logic should be more readable. Differential Revision: https://developer.blender.org/D15346
2022-07-20Point Cloud: Remove redundant custom data pointersHans Goudey
Similar to e9f82d3dc7eebadcc52, but for point clouds instead. Differential Revision: https://developer.blender.org/D15487
2022-07-20Curves: Remove redundant custom data pointersHans Goudey
These mutable pointers present problems with ownership in relation to proper copy-on-write for attributes. The simplest solution is to just remove them and retrieve the layers from `CustomData` when they are needed. This also removes the complexity and redundancy of having to update the pointers as the curves change. A similar change will apply to meshes and point clouds. One downside of this change is that it makes random access with RNA slower. However, it's simple to just use the RNA attribute API instead, which is unaffected. In this patch I updated Cycles to do that. With the future attribute CoW changes, this generic approach makes sense because Cycles can just request ownership of the existing arrays. Differential Revision: https://developer.blender.org/D15486