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
2021-12-29Fix T94113: Local view + Geometry Nodes is broken for instancesGermano Cavalcante
`GeometrySet::compute_boundbox_without_instances` may not initialize min max in some cases such as meshes without vertices. This can result in a Bounding Box with impossible dimensions (min=FLT_MAX, max=-FLT_MAX). So repeat the same solution seen in `BKE_object_boundbox_calc_from_mesh` and set boundbox values to zero. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13664
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-02Cleanup: Move public docs to BKE_spline.hh headerHans Goudey
2021-11-22CurveEval: Add total_length() and total_control_point_size() methodsJohnny Matthews
Add the following methods to the CurveEval class: total_length() : returns the total length of the curve without needing to allocate a new array total_control_point_size() : returns the total number of control points without needing to allocate a new array
2021-11-11Fix: Prevent use of uninitialized memory when creating Bezier splineMartijn Versteegh
When Constructing bezier splines from dna, the positions of the left/right handles were set directly in the internal vectors, by requesting a reference to them. The problem is that BezierSpline::handle_positions_left() calls ensure_auto_handles() before returning the reference. That function does some calculations on uninitialized memory if the positions array is not yet filled. Differential Revision: https://developer.blender.org/D13107
2021-11-02Cleanup: Improve curve point attribute assertHans Goudey
This properly checks the order of point domain attributes on each spline, and avoids the map, which makes the code easier to understand. The assert is also added to realizing instances and the join node. Differential Revision: https://developer.blender.org/D13071
2021-10-29Geometry Nodes: do cache invalidation after writing attributesJacques Lucke
This is a better and more general fix for T92511 and T92508 than the ones that I committed before. Previously, we tagged caches dirty when first accessing attributes. This led to incorrect caches when under some circumstances. Now cache invalidation is part of `OutputAttribute.save()`. A nice side benefit of this change is that it may make things more efficient in some cases, because we don't invalidate caches when they don't have to be invalidated. Differential Revision: https://developer.blender.org/D13009
2021-09-21Geometry Nodes: Curve Sample NodeHans Goudey
This node allows sampling positions, tangents, and normals at any arbitrary point along a curve. The curve can include multiple splines, all are taken into account. The node does not yet support transferring generic attributes like radius, because some more general tooling will make that much more feasible and useful in different scenarios. This is a field node, so it is evaluated in the context of a data-flow node like "Set Position". One nice thing about that is it can easily be used to move an entire geometry like the follow path constraint. The point along the curve is chosen either with a factor of the total length of the curve, or a length into the curve, the same choice used in the curve trim node. Differential Revision: https://developer.blender.org/D12565
2021-09-20Cleanup: Fix/improve variable names and commentsHans Goudey
2021-09-09Geometry Nodes: fields and anonymous attributesJacques Lucke
This implements the initial core framework for fields and anonymous attributes (also see T91274). The new functionality is hidden behind the "Geometry Nodes Fields" feature flag. When enabled in the user preferences, the following new nodes become available: `Position`, `Index`, `Normal`, `Set Position` and `Attribute Capture`. Socket inspection has not been updated to work with fields yet. Besides these changes at the user level, this patch contains the ground work for: * building and evaluating fields at run-time (`FN_fields.hh`) and * creating and accessing anonymous attributes on geometry (`BKE_anonymous_attribute.h`). For evaluating fields we use a new so called multi-function procedure (`FN_multi_function_procedure.hh`). It allows composing multi-functions in arbitrary ways and supports efficient evaluation as is required by fields. See `FN_multi_function_procedure.hh` for more details on how this evaluation mechanism can be used. A new `AttributeIDRef` has been added which allows handling named and anonymous attributes in the same way in many places. Hans and I worked on this patch together. Differential Revision: https://developer.blender.org/D12414
2021-07-23Cleanup: Add function to check a curve's spline typesHans Goudey
The need for this has come up a few times.
2021-07-15Cleanup: ensure one newline at end of file, strip trailing spaceCampbell Barton
2021-06-28Cleanup: Add function to create a CurveEval from a nurbs listHans Goudey
Sometimes the current spline list isn't part of the original curve, like when using the deformed control points, etc. This will be helpful in the curve modifier stack.
2021-06-21Curves: Multithread Curve to CurveEval conversionHans Goudey
A different data structure / implementation is used for curves in the node tree currently. Converting from the DNA `Curve` structure to this wasn't slow, but it's nice to decrease overhead. In a test of 14000 splines with 128000 points, this halves the runtime from about 5ms to about 2.5ms.
2021-06-16Splines: Add resize method to CurveEvalHans Goudey
This helps when adding splines to a new curve in parallel.
2021-05-19Geometry Nodes: Support for dynamic attributes on curve splinesHans Goudey
With this patch you will be able to add and remove attributes from curve data inside of geometry nodes. The following is currently implemented: * Adding attributes with any data type to splines or spline points. * Support for working with multiple splines at the same time. * Interaction with the three builtin point attributes. * Resampling attributes in the resample node. The following is not implemented in this patch: * Joining attributes when joining splines with the join geometry node. * Domain interpolation between spline and point domains. * More efficient ways to call attribute operations once per spline. Differential Revision: https://developer.blender.org/D11251
2021-05-19Cleanup: Use copy constructor for CurveEvalHans Goudey
There is no need for a special "copy" method with a copy constructor, which will be necessary to explicitly copy attributes anyway.
2021-05-16Cleanup: Improve commentsHans Goudey
2021-05-16Splines: Convenience methods for point offsets of multiple splinesHans Goudey
Since spline data is stored separately for each spline, the data often needs to be flattened into a separate array. It's helpful to have the necessarily-sequential part of that split off into a separate method. I've found myself using functions like these in quite a few places.
2021-05-12Cleanup: Splines: Add accessors to spline vectorHans Goudey
Not allowing external direct access to the vector of splines in the curve will help for things like reallocating custom data when a spline is added or removed.
2021-05-03Geometry Nodes: Initial basic curve data supportHans Goudey
This patch adds initial curve support to geometry nodes. Currently there is only one node available, the "Curve to Mesh" node, T87428. However, the aim of the changes here is larger than just supporting curve data in nodes-- it also uses the opportunity to add better spline data structures, intended to replace the existing curve evaluation code. The curve code in Blender is quite old, and it's generally regarded as some of the messiest, hardest-to-understand code as well. The classes in `BKE_spline.hh` aim to be faster, more extensible, and much more easily understandable. Further explanation can be found in comments in that file. Initial builtin spline attributes are supported-- reading and writing from the `cyclic` and `resolution` attributes works with any of the attribute nodes. Also, only Z-up normal calculation is implemented at the moment, and tilts do not apply yet. **Limitations** - For now, you must bring curves into the node tree with an "Object Info" node. Changes to the curve modifier stack will come later. - Converting to a mesh is necessary to visualize the curve data. Further progress can be tracked in: T87245 Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes Differential Revision: https://developer.blender.org/D11091