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-17Cleanup: Deduplicate Alembic procedural bounding box mesh creationHans Goudey
This removes the manual construction of a box mesh in the mesh sequence cache modifier when the Alembic procedural is enabled. It also removes the use of `BKE_object_boundbox_get` which doesn't make sense on a non-evaluated object. Differential Revision: https://developer.blender.org/D14958
2022-05-13Cleanup: Use standard variable names for curvesHans Goudey
2022-05-13Fix build error without unity build after recent changesBrecht Van Lommel
float3 should have been declared within the blender namespace. And forward declaration is difficult with templated classes so just include header.
2022-05-11Cleanup: use '_num' suffix, mostly for curves & spline codeCampbell Barton
Replace tot/amount & size with num, in keeping with T85728.
2022-05-11Cleanup: spelling in commentsCampbell Barton
Revert change from [0] that assumed UNORM was a mis-spelling of UNIFORM. [0]: 2c75857f9fc0dc5d524e4a0407e0a68856e5906e
2022-05-11Cleanup: use '_num' suffix instead of '_size' for CurveGeometryCampbell Barton
Follow conventions from T85728.
2022-05-10Curves: Interpolate point count in add brushHans Goudey
This commit adds an option to interpolate the number of control points in new curves based on the count in neighboring existing curves. The idea is to provide a more automatic default than manually controlling the number of points in a curve, so users don't have to think about the resolution quite as much. Internally, some utilities for creating new curves are extracted to a new header file. These can be used for the various nodes and operators that create new curves. The top-bar UI will be adjusted in a separate patch, probably moving all of the settings that affect the size and shape of the new curves into a popover. Differential Revision: https://developer.blender.org/D14877
2022-05-10Cleanup: remove non-existent includeCampbell Barton
guardedalloc was already included.
2022-05-10Cleanup: Move mesh primitive cube to the geometry moduleHans Goudey
This allows easy reuse elsewhere in Blender.
2022-05-09Cleanup: Remove incorrect statement after recent refactorHans Goudey
2022-05-09Refactor: Move resample curves code to the geometry moduleHans Goudey
This commit moves the code for the resample curves node to the geometry module, to allow reusing it in any editor. Split from D14870.
2022-04-28Cleanup: unbalanced doxy sections, add some sectionsCampbell Barton
2022-04-26Geometry Nodes: refactor array devirtualizationJacques Lucke
Goals: * Better high level control over where devirtualization occurs. There is always a trade-off between performance and compile-time/binary-size. * Simplify using array devirtualization. * Better performance for cases where devirtualization wasn't used before. Many geometry nodes accept fields as inputs. Internally, that means that the execution functions have to accept so called "virtual arrays" as inputs. Those can be e.g. actual arrays, just single values, or lazily computed arrays. Due to these different possible virtual arrays implementations, access to individual elements is slower than it would be if everything was just a normal array (access does through a virtual function call). For more complex execution functions, this overhead does not matter, but for small functions (like a simple addition) it very much does. The virtual function call also prevents the compiler from doing some optimizations (e.g. loop unrolling and inserting simd instructions). The solution is to "devirtualize" the virtual arrays for small functions where the overhead is measurable. Essentially, the function is generated many times with different array types as input. Then there is a run-time dispatch that calls the best implementation. We have been doing devirtualization in e.g. math nodes for a long time already. This patch just generalizes the concept and makes it easier to control. It also makes it easier to investigate the different trade-offs when it comes to devirtualization. Nodes that we've optimized using devirtualization before didn't get a speedup. However, a couple of nodes are using devirtualization now, that didn't before. Those got a 2-4x speedup in common cases. * Map Range * Random Value * Switch * Combine XYZ Differential Revision: https://developer.blender.org/D14628
2022-04-26Cleanup: use boolean arguments and return valuesCampbell Barton
2022-04-25Curves: Cache the number of curves of each typeHans Goudey
Remembering the number of curves of every type makes it fast to know whether processing specific to a single curve type has to be done. This information was accessed in quite a few places, so this should be an overall reduction in overhead for the new curves type. The cache is computed eagerly, in other words every time after changing the curve types. In order to reduce verbosity I added helper functions for some common ways to set the types. Differential Revision: https://developer.blender.org/D14732
2022-04-20Mesh: Avoid unnecessary normal calculation and dirty tagsHans Goudey
This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected.
2022-04-16Fix T96988: Merge by distance node crash with certain inputHans Goudey
If the `wpoly` vector was small, the `wpoly_new` pointer could point to part of its inline buffer on the stack, which becomes invalid out of that scope. Instead, store `wpoly_new` as a span, and assign it properly from the moved vector.
2022-04-16Cleanup: Return earlyHans Goudey
2022-04-07Fix: Division by zero in UV packing functionAleksi Juvani
If all islands had a size of zero, a division by zero would occur in `GEO_uv_parametrizer_pack`, causing the UV coordinates to be set to NaN. An alternative approach would be to skip packing islands with a zero size, but If UV coordinates are for example outside the 0-1 range, it's better if they get moved into that range. Differential Revision: https://developer.blender.org/D14522
2022-04-07Curves: Name mutable data retrieval functions explicitlyHans Goudey
Add "for_write" on function names that retrieve mutable data arrays. Though this makes function names longer, it's likely worth it because it allows more easily using the const functions in a non-const context, and reduces cases of mistakenly retrieving with edit access. In the long term, this situation might change more if we implement attributes storage that is accessible directly on `CurvesGeometry` without duplicating the attribute API on geometry components, which is currently the rough plan. Differential Revision: https://developer.blender.org/D14562
2022-04-04Cleanup: Remove unused functionHans Goudey
Unused after 943b919fe807
2022-03-31Cleanup: spelling, trailing space for comment-blocksCampbell Barton
2022-03-30Cleanup: Move UV edit parameterize code to geometry moduleAleksi Juvani
This will allow reusing it elsewhere, such as in a geometry node. Differential Revision: https://developer.blender.org/D14453
2022-03-25Cleanup: Further renaming in new curves codeHans Goudey
A follow-up to e253f9f66d6f. Follow the policy from T85728 completely (using "num" as a prefix) and rename another function.
2022-03-24Cleanup: Adjust naming in new curves codeHans Goudey
Rename "size" variables and functions to use "num" instead, based on T85728 (though this doesn't apply to simple C++ containers, it applies here). Rename "range" to "points" in some functions, so be more specific. Differential Revision: https://developer.blender.org/D14431
2022-03-19BLI: move generic data structures to blenlibJacques Lucke
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-18BLI: move CPPType to blenlibJacques Lucke
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367. Differential Revision: https://developer.blender.org/D14367
2022-03-18Cleanup: Remove unused includesHans Goudey
2022-03-18Cleanup: Rename "spline" variables to "curve"Hans Goudey
Ref T95355
2022-03-11Fix: Handle handles reset when realizing with other curve typesHans Goudey
The result handle attributes for non-bezier types are zeroed. By mistake though, the entire array was zeroed, not just the area corresponding to that curves source.
2022-03-10Cleanup: Reduce duplication in realize instances codeHans Goudey
Realizing and copying attributes of meshes, curves, and points are very similar processes, but currently the logic is duplicated three times in the realize instances code. This commit combines the implementation for copying generic attributes and creating the result id attribute. The functions for threaded copying and filling should ideally be in some file elsewhere, since they're not just useful here. But it's not clear where they would go yet. Differential Revision: https://developer.blender.org/D14294
2022-03-09Fix: Add missing breakHans Goudey
2022-03-09Fix: Use "construct" instead of "assign" for uninitialized memoryHans Goudey
The realize instances code used "assign", but the attribute buffers on the result aren't necessarily initialized. This doesn't make a difference for trivial types like `int`, but it would with more complex types.
2022-03-09Curves: Port realize instances node to the new data-blockHans Goudey
This commit replaces the temporary conversion to `CurveEval` with use of the new curves data-block. The end result is that the process looks more like the other components-- somewhere in between meshes and point clouds in terms of complexity. The final result is that the logic between meshes and curves is very similar. There are a few different strategies to reduce duplication here, so I'll investigate that separately. There is some special behavior for the radius and handle position attributes. I used the attribute API to store spans of these attributes temporarily. Using access methods on `CurvesGeometry` would be reasonable to, storing spans separately feels a bit more predictable for now though. There should be significant performance improvements in some cases, I haven't tested that specifically though. Differential Revision: https://developer.blender.org/D14247
2022-03-08Curves: Port mesh to curve node to new data-blockHans Goudey
The main improvement is a code simplification, because attributes don't have to be transferred separately for each curve, and all attributes can be handled generically. Performance improves significantly when the output contains many curves. Basic testing with a 2 million curve output shows an approximate 10x performance improvement.
2022-02-28Cleanup: Rename geometry set "curve" functions to "curves"Hans Goudey
Ref T95355
2022-02-28Geometry Nodes: Begin conversion to new curvesHans Goudey
This commit changes `CurveComponent` to store the new curve type by adding conversions to and from `CurveEval` in most nodes. This will temporarily make performance of curves in geometry nodes much worse, but as functionality is implemented for the new type and it is used in more places, performance will become better than before. We still use `CurveEval` for drawing curves, because the new `Curves` data-block has no evaluated points yet. So the `Curve` ID is still generated for rendering in the same way as before. It's also still needed for drawing curve object edit mode overlays. The old curve component isn't removed yet, because it is still used to implement the conversions to and from `CurveEval`. A few more attributes are added to make this possible: - `nurbs_weight`: The weight for each control point on NURBS curves. - `nurbs_order`: The order of the NURBS curve - `knots_mode`: Necessary for conversion, not defined yet. - `handle_type_{left/right}`: An 8 bit integer attribute. Differential Revision: https://developer.blender.org/D14145
2022-02-15BLI: Change dependencies in vector math filesHans Goudey
This patch reverses the dependency between `BLI_math_vec_types.hh` and `BLI_math_vector.hh`. Now the higher level `blender::math` functions depend on the header that defines the types they work with, rather than the other way around. The initial goal was to allow defining an `enable_if` in the types header and using it in the math header. But I also think this operations to types dependency is more natural anyway. This required changing the includes some files used from the type header to the math implementation header. I took that change a bit further removing the C vector math header from the C++ header; I think that helps to make the transition between the two systems clearer. Differential Revision: https://developer.blender.org/D14112
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-09Cleanup: make file headers more consistentCampbell Barton
Also some descriptive text into doc-strings.
2022-01-31Fix T95205: remove attribute only onceJacques Lucke
The bug was caused by a typo.
2022-01-26Cleanup: spelling in commentsCampbell Barton
2022-01-25Fix T95169: Assert in weld modifier codeGermano Cavalcante
Return early before accessing the array when all edges are merged.
2022-01-25Geometry Nodes: Port weld modifier to the merge by distance nodeHans Goudey
This commit moves the weld modifier code to the geometry module so that it can be used in the "Merge by Distance" geometry node from ec1b0c2014a8b91c2. The "All" mode is exposed in the node for now, though we could expose the "Connected" mode in the future. The modifier itself is responsible for creating the selections from the vertex group. The "All" mode takes an `IndexMask` for the selection, and the "Connected" mode takes a boolean array, since it actually iterates over all edges. Some disabled code for a BVH mode has not been copied over, it's still accessible through the patches and git history anyway, and it made the port slightly simpler. Differential Revision: https://developer.blender.org/D13907
2022-01-25Geometry Nodes: Initial merge by distance nodeHans Goudey
This implements a merge by distance operation for point clouds. Besides the geometry input, there are two others-- a selection input to limit the operation to certain points, and the merge distance. While it would be a reasonable feature, the distance does not support a field currently, since that would make the algorithm significantly more complex. All attributes are merged to the merged points, with the values mixed together. This same generic method is used for all attributes, including `position`. The `id` attribute uses the value from the first merged index for each point. For the implementation, most of the effort goes into creating a merge map to speed up attribute mixing. Some parts are inherently single-threaded, like finding the final indices accounting for the merged points. By far most of the time is spend balancing the KD tree. Mesh support will be added in the next commit. Differential Revision: https://developer.blender.org/D13649
2021-12-23Fix: Curve trim node test failureHans Goudey
Caused by 60c59d7d611dfd726. The position wasn't copied into the correct place on each spline. Somehow I didn't catch that in the tests I ran.
2021-12-23Cleanup: Remove spline add_point method, refactor mesh to curve nodeHans Goudey
It's better to calculate the size of a spline before creating it, and this should simplify refactoring to a data structure that stores all point attribute contiguously (see T94193). The mesh to curve conversion is simplified slightly now, it creates the curve output after gathering all of the result vertex indices. This should be more efficient too, since it only grows an index vector for each spline, not a whole spline.
2021-12-19Cleanup: Clang tidy lamda function nameHans Goudey
2021-12-14Geometry Nodes: support instance attributes when realizing instancesJacques Lucke
This patch refactors the instance-realization code and adds new functionality. * Named and anonymous attributes are propagated from instances to the realized geometry. If the same attribute exists on the geometry and on an instance, the attribute on the geometry has precedence. * The id attribute has special handling to avoid creating the same id on many output points. This is necessary to make e.g. the Random Value node work as expected afterwards. Realizing instance attributes has an effect on existing files, especially due to the id attribute. To avoid breaking existing files, the Realize Instances node now has a legacy option that is enabled for all already existing Realize Instances nodes. Removing this legacy behavior does affect some existing files (although not many). We can decide whether it's worth to remove the old behavior as a separate step. This refactor also improves performance when realizing instances. That is mainly due to multi-threading. See D13446 to get the file used for benchmarking. The curve code is not as optimized as it could be yet. That's mainly because the storage for these attributes might change soonish and it wasn't worth optimizing for the current storage format right now. ``` 1,000,000 x mesh vertex: 530 ms -> 130 ms 1,000,000 x simple cube: 1290 ms -> 190 ms 1,000,000 x point: 1000 ms -> 150 ms 1,000,000 x curve spiral: 1740 ms -> 330 ms 1,000,000 x curve line: 1110 ms -> 210 ms 10,000 x subdivided cylinder: 170 ms -> 40 ms 10 x subdivided spiral: 180 ms -> 180 ms ``` Differential Revision: https://developer.blender.org/D13446
2021-12-09Cleanup: move public doc-strings into headers for 'geometry'Campbell Barton
Ref T92709