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-03-26Cleanup: Geometry Nodes: Allow using "Auto" domain to avoid adaptingHans Goudey
Now that we have `ATTR_DOMAIN_AUTO`, it makes sense to use it to skip automatic domain interpolation. This can make code that depends on the non-interpolated domain of the attribute a bit simpler.
2021-03-25Geometry Nodes: rename attribute domainsJacques Lucke
This patch renames two domains: * `Polygon` -> `Face` * `Corner` -> `Face Corner` For the change from `polygon` to `face` I did a "deep rename" where I updated all (most?) cases where we refere to the attribute domain in code as well. The change from `corner` to `face corner` is only a ui change. I did not see a real need to update all code the code for that. It does not seem to improve the code, more on the contrary. Ref T86818. Differential Revision: https://developer.blender.org/D10803
2021-03-23Cleanup: allow looking up size of unsupported domainsJacques Lucke
There isn't really a reason for not supporting it.
2021-03-23Cleanup: use BLI_assert_unreachable in some placesJacques Lucke
2021-03-17Cleanup: improve gathering supported domains by geometry typeJacques Lucke
2021-03-13Geometry Nodes: Revert current normal attribute implementationHans Goudey
After further thought, the implementation of the "normal" attribute from D10541 is not the best approach to expose this data, mainly because it blindly copied existing design rather than using the best method in the context of the generalized attribute system. In Blender, vertex normals are simply a cache of the average normals from the surrounding / connected faces. Because we have automatic interpolation between domains already, we don't need a special `vertex_normal` attribute for this case, we can just let the generalized interpolation do the hard work where necessary, simplifying the set of built-in attributes to only include the `normal` attribute from faces. The fact that vertex normals are just a cache also raised another issue, because the cache could be dirty, so mutex locks were necessary to calculate normals. That isn't necessarily a problem, but it's nice to avoid where possible. Another downside of the current attribute naming is that after the point distribute node there would be two normal attributes. This commit reverts the `vertex_normal` attribute so that it can be replaced by the implementation in D10677. Differential Revision: https://developer.blender.org/D10676
2021-03-09Cleanup: Complete earlier geometry component refactorHans Goudey
This was meant to be part of rB9ce950daabbf, but the change dropped from the set at some point in the process of updating and committing. Sorry for the noise.
2021-03-07Geometry Nodes: simplify allocating dynamically sized buffer on stackJacques Lucke
2021-03-06Cleanup: commentsCampbell Barton
2021-03-06Geometry Nodes: Expose vertex normals as an attributeHans Goudey
This attribute exposes mesh vertex normals as a `vertex_normal` attribute for use with nodes. Since the normal vector stored in vertices is only a cache of data computable from the surrounding faces, the attribute is read-only. A proper error message for attempting to write this attribute is part of T85749. A write-only normal attribute will likely come later, most likely called `corner_normal`. The normals are recomputed before reading if they are marked dirty. This involves const write-access to the mesh, protected by the mutex stored in `Mesh_Runtime`. This is essential for correct behavior after nodes like "Edge Split" or nodes that adjust the position attribute. Ref T84297, T85880, T86206 Differential Revision: https://developer.blender.org/D10541
2021-03-02Fix T86172: check if attribute is actually accessibleJacques Lucke
The crash happened when the density in the Point Distribute node was above zero but so small, that no point was generated. In this case, there was a point cloud component, but the point cloud was empty, making some attributes unavailable. One could also make more attributes available in this case, but that can be done separately if necessary.
2021-02-25Cleanup: quiet warningJacques Lucke
"loop variable 'item' is always a copy because the range of type ..."
2021-02-23Geometry Nodes: improve accessing attribute meta dataJacques Lucke
This allows accessing attribute meta data like domain and data type without having to create a `ReadAttribute`. I kept the `attribute_names` method for now to keep the patch more self contained. Differential Revision: https://developer.blender.org/D10511
2021-02-19Geometry Nodes: forbid creating attribute with empty nameJacques Lucke
Empty attribute names are just a recipe for problems.
2021-02-18Geometry Nodes: support adapting point to corner domainJacques Lucke
This allows accessing per-point attributes on the corner domain, which can be useful e.g. when adding per-point displacement to per-corner uv coordinates. Also it is required to make an upcoming patch work well, that makes the Point Distribute node use density weights per corner instead of per point, giving the user more precise control over the distribution.
2021-02-18Geometry Nodes: support accessing vertex colorsJacques Lucke
This makes vertex colors available in geometry nodes similar to how uvs are available. They can be used using the attribute system. Vertex colors are stored per corner (as are uvs, but not like vertex weights). Ref T84297. Differential Revision: https://developer.blender.org/D10454
2021-02-17Geometry Nodes: Expose material index attributeHans Goudey
The `material_index` attribute can adjust which material in the list will be applied to each face of the mesh. There are two new things about this attribute that haven't been exposed by the attribute API yet. Each comes with limitations: 1. Integer data type: Most attribute nodes are currently written to use float data types. This means that they can't write to this attribute because they can't change the type of a built-in attribute. 2. Polygon domain: This is our first attribute using the polygon domain, meaning until some of the interpolations are implemented, some operations may not work as expected. Currently the two nodes that work with this attribute are Attribute Fill and Attribute Randomize. Differential Revision: https://developer.blender.org/D10444
2021-02-16Geometry Nodes: move some attribute utilities to blenkernelJacques Lucke
I need to access these utilities from modifier code as well. Therefore, they should not live in the nodes module.
2021-02-12Fix T85545: changing position attribute does not tag normals dirtyJacques Lucke
This makes it so that normals are tagged dirty whenever the position attribute is requested for writing. This seems like a good default. If the calling code is aware of normals, it could untag normals when they are not changed by the operation. Differential Revision: https://developer.blender.org/D10397
2021-02-10Fix Geometry Nodes: Broken built-in attribute exists checkHans Goudey
Fixes an issue in a node setup with the point separate node, where muting a node that does nothing breaks the operation, resulting in the point separate not copying the position attrbute to either result. The fix is straightfoward, it looks just like a typo. Differential Revision: https://developer.blender.org/D10379
2021-02-10Cleanup: spellingCampbell Barton
2021-02-09Geometry Nodes: initial attribute interpolation between domainsJacques Lucke
This patch adds support for accessing corner attributes on the point domain. The immediate benefit of this is that now (interpolated) uv coordinates are available on points without having to use the Point Distribute node. This is also very useful for parts of T84297, because once we have vertex colors, those will also be available on points, even though they are stored per corner. Differential Revision: https://developer.blender.org/D10305
2021-02-09Geometry Nodes: refactor internal attribute access architectureJacques Lucke
Goals: * Clarify the distinction between builtin and other attributes at the code level. * Reduce number of places that need to be modified to add more builtin attributes. * Reduce number of virtual methods that need to be implemented by e.g. `MeshComponent`. To achieve these goals, this patch implements the concept of "attribute providers". An attribute provider knows how to give access to attributes on a geometry component. Each geometry component can have multiple attribute providers, whereby each provider manages an different set of attributes. The separation of builtin and other attributes is now done at the attribute provider level. There are two types of attribute providers. One for builtin attributes and one for all others. This refactor also helps with T84297. Differential Revision: https://developer.blender.org/D10341
2021-01-21Merge branch 'blender-v2.92-release'Falk David
2021-01-21Geometry Nodes: fix losing data when attribute has incorrect typeJacques Lucke
Differential Revision: https://developer.blender.org/D10165
2021-01-16Merge branch 'blender-v2.92-release'Jacques Lucke
2021-01-16Fix T84757: feedback loop with when modifying vertex group with nodesJacques Lucke
The issue was that the mesh shared its vertex weights with the original mesh (to reduce memory consumption). The solution is to make a local copy of the vertex weights in this case.
2021-01-15Merge branch 'blender-v2.92-release'Hans Goudey
2021-01-15Geometry Nodes: Use a default value in the point scale nodeHans Goudey
This commit adds the ability to provide a default value to `attribute_try_get_for_output` and uses it for the `Point Scale` node, which is important because the node uses multiplication. The idea is to keep "name-specific" functionality in nodes rather than in the attribute API, otherwise the complexity will be hard to keep track of. So this fix doesn't apply to the Attribute Vector Math node, but hopfully that is okay since that's now a lower level node for this purpose anyway. Differential Revision: https://developer.blender.org/D10115
2021-01-14Geometry Nodes: support accessing UV layers with attribute systemJacques Lucke
Note that uv layers still can't be accessed with nodes, because those only access attributes on the point domain currently, while uv data is stored per corner. Implicit domain conversion hasn't been implemented yet.
2021-01-14Geometry Nodes: don't delete existing attribute before new attribute is computedJacques Lucke
This fixes the behavior of some nodes when the same attribute name is used for input and output. If both attributes have a different type, they can't exist at the same time. Therefore, the input attribute has to be removed in order to create the output attribute. Previously, the input attribute was remove before it was used in any computations. Now, the output is written to a temporary buffer and only later saved in the geometry component. This allows both attributes to coexist within the node. The temporary attribute is only create when necessary. The normal case without name collisions still works the same as before. Differential Revision: https://developer.blender.org/D10109 Ref T83793.
2021-01-12Geometry Nodes: support reading from spans of WriteAttributeJacques Lucke
Previously, the span returned by `WriteAttribute`s might not contain the current value of the attribute for performance reasons. To avoid some bugs, the span now always contains the old values (they might have to be copied over from the internal storage, dependending on how the attribute is stored). The old behavior is still available with the `get_span_for_write_only` method. The span that it returns might not contain the current attribute values. Therefore, it should only be used when you want to overwrite an attribute without looking at the old values.
2020-12-17Geometry Nodes: Make random attribute node stableHans Goudey
Currently, the random attribute node doesn't work well for most workflows because for any change in the input data it outputs completely different results. This patch adds an implicit seed attribute input to the node, referred to by "id". The attribute is hashed for each element using the CPPType system's hash method, meaning the attribute can have any data type. Supporting any data type is also important so any attribute can be copied into the "id" attribute and used as a seed. The "id" attribute is an example of a "reserved name" attribute, meaning attributes with this name can be used implicitly by nodes like the random attribute node. Although it makes it a bit more difficult to dig deeper, using the name implicitly rather than exposing it as an input should make the system more accessible and predictable. Differential Revision: https://developer.blender.org/D9832
2020-12-16Geometry Nodes: Boolean attribute typeHans Goudey
This adds a boolean attribute and custom data type, to be used in the point separate node. It also adds it as supported data types in the random attribute and attribute fill nodes. There are more clever ways of storing a boolean attribute that make more sense in certain situations-- sets, bitfields, and others, this commit keeps it simple, saving those changes for when there is a proper use case for them. In any case, we will still probably always want the idea of a boolean attribute. Differential Revision: https://developer.blender.org/D9818
2020-12-10Geometry Nodes: Add helper function to check if attribute existsHans Goudey
2020-12-09Geometry Nodes: simplify supporting different input socket types for attributesJacques Lucke
This is a non-functional change. The functionality introduced in this commit is not used in master yet. It is used by nodes that are being developed in other branches though.
2020-12-04Cleanup: Clang-Tidy, modernize-use-overrideSybren A. Stüvel
No functional changes.
2020-12-02Geometry Nodes: initial scattering and geometry nodesJacques Lucke
This is the initial merge from the geometry-nodes branch. Nodes: * Attribute Math * Boolean * Edge Split * Float Compare * Object Info * Point Distribute * Point Instance * Random Attribute * Random Float * Subdivision Surface * Transform * Triangulate It includes the initial evaluation of geometry node groups in the Geometry Nodes modifier. Notes on the Generic attribute access API The API adds an indirection for attribute access. That has the following benefits: * Most code does not have to care about how an attribute is stored internally. This is mainly necessary, because we have to deal with "legacy" attributes such as vertex weights and attributes that are embedded into other structs such as vertex positions. * When reading from an attribute, we generally don't care what domain the attribute is stored on. So we want to abstract away the interpolation that that adapts attributes from one domain to another domain (this is not actually implemented yet). Other possible improvements for later iterations include: * Actually implement interpolation between domains. * Don't use inheritance for the different attribute types. A single class for read access and one for write access might be enough, because we know all the ways in which attributes are stored internally. We don't want more different internal structures in the future. On the contrary, ideally we can consolidate the different storage formats in the future to reduce the need for this indirection. * Remove the need for heap allocations when creating attribute accessors. It includes commits from: * Dalai Felinto * Hans Goudey * Jacques Lucke * Léo Depoix