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-04-21Merge branch 'blender-v2.93-release'Jacques Lucke
2021-04-21Fix T87659: crash when creating reroute loop in geometry nodesJacques Lucke
This was a regression introduced in rB0ff3f96a1b0193d69dae5ca69e7c93d6cdf34558.
2021-04-17Geometry Nodes: use virtual arrays in internal attribute apiJacques Lucke
A virtual array is a data structure that is similar to a normal array in that its elements can be accessed by an index. However, a virtual array does not have to be a contiguous array internally. Instead, its elements can be layed out arbitrarily while element access happens through a virtual function call. However, the virtual array data structures are designed so that the virtual function call can be avoided in cases where it could become a bottleneck. Most commonly, a virtual array is backed by an actual array/span or is a single value internally, that is the same for every index. Besides those, there are many more specialized virtual arrays like the ones that provides vertex positions based on the `MVert` struct or vertex group weights. Not all attributes used by geometry nodes are stored in simple contiguous arrays. To provide uniform access to all kinds of attributes, the attribute API has to provide virtual array functionality that hides the implementation details of attributes. Before this refactor, the attribute API provided its own virtual array implementation as part of the `ReadAttribute` and `WriteAttribute` types. That resulted in unnecessary code duplication with the virtual array system. Even worse, it bound many algorithms used by geometry nodes to the specifics of the attribute API, even though they could also use different data sources (such as data from sockets, default values, later results of expressions, ...). This refactor removes the `ReadAttribute` and `WriteAttribute` types and replaces them with `GVArray` and `GVMutableArray` respectively. The `GV` stands for "generic virtual". The "generic" means that the data type contained in those virtual arrays is only known at run-time. There are the corresponding statically typed types `VArray<T>` and `VMutableArray<T>` as well. No regressions are expected from this refactor. It does come with one improvement for users. The attribute API can convert the data type on write now. This is especially useful when writing to builtin attributes like `material_index` with e.g. the Attribute Math node (which usually just writes to float attributes, while `material_index` is an integer attribute). Differential Revision: https://developer.blender.org/D10994
2021-04-15Geometry Nodes: refactor implicit conversionsJacques Lucke
This refactor simplifies having standalone function pointer that does a single conversion. It also speeds up implicit type conversion of attributes.
2021-04-15Cleanup: move type conversions to separate fileJacques Lucke
2021-04-12UI/Nodes: Improve feedback when adding node fails (e.g. on drag & drop)Julian Eisel
This is especially useful when trying to add a node group instance, e.g. via drag & drop from the Outliner or Asset Browser. Previously this would just silently fail, with no information why. This is a source of confusion, e.g. earlier, it took me a moment to realize I was dragging a node group into itself, which failed of course. Blender should always try to help the user with useful error messages. Adds error messages like: "Nesting a node group inside of itself is not allowed", "Not a compositor node tree", etc. Adds a disabled hint return argument to node and node tree polling functions. On error the hint is reported, or could even be shown in advance (e.g. if checked via an operator poll option). Differential Revision: https://developer.blender.org/D10422 Reviewed by: Jacques Lucke
2021-04-08Cleanup: spellingCampbell Barton
2021-04-07Fix T87195: Boolean node multi-input socket only accepts one linkHans Goudey
The default insert link callback for nodes was trying to move the existing link away, since it didn't properly handle multi-input sockets (though the problem wasn't exposed for the join node). We can basically skip all of this "moving existing links" for multi-input sockets, unless we are at the link limit.
2021-04-07Cleanup: Various cleanup of node link handling functionsHans Goudey
Use LISTBASE_FOREACH macro, rename variables, comment formatting, simplification of logic, etc.
2021-04-01BLI: rename resource collector to resource scopeJacques Lucke
Differential Revision: https://developer.blender.org/D10857
2021-04-01Cleanup: use bool instead of intJacques Lucke
2021-04-01Cleanup: move node_exec.c to c++Jacques Lucke
Doing this, because it might make it easier to replace the implementation of `bNodeInstanceHash`.
2021-04-01Geometry Nodes: add socket value logging capabilityJacques Lucke
The node tree evaluator now calls a callback for every used socket with its corresponding value(s). Right now the callback does nothing. However, we can use it to collect attribute name hints, socket values for debugging or data that will be displayed in the spreadsheet. The main difficulty here was to also call the callback for sockets in nodes that are not directly executed (such as group nodes, muted nodes and reroutes). No functional changes are expected.
2021-03-26Cleanup: Use enum for "in" vs. "out" node socketsHans Goudey
2021-03-26Geometry Nodes: Implicit conversion change for float/int/color to boolCharlie Jolly
Change `float to boolean` and `int32 to boolean` to return false for zero and negative values. This aligns with how artists would expect these values to work. This is in contrast to what a coder would expect. It was determined on blender.chat that this was a better default. This means that a negative float value would give a boolean false. Change `Color4f to boolean` to return false for zero and negative grayscale values. Likewise, for color to boolean, to account for negative value colors, the grayscale value would be used for determining if a colour was false or not. See {T86454} Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10685
2021-03-23Cleanup: use BLI_assert_unreachable in some placesJacques Lucke
2021-03-23Nodes: Add Refract and Faceforward functions to Vector Maths nodesCharlie Jolly
Cycles, Eevee, OSL, Geo, Attribute Based on outdated refract patch D6619 by @cubic_sloth `refract` and `faceforward` are standard functions in GLSL, OSL and Godot shader languages. Adding these functions provides Blender shader artists access to these standard functions. Reviewed By: brecht Differential Revision: https://developer.blender.org/D10622
2021-03-22Functions: make multi functions smaller and cheaper to construct in many casesJacques Lucke
Previously, the signature of a `MultiFunction` was always embedded into the function. There are two issues with that. First, `MFSignature` is relatively large, because it contains multiple strings and vectors. Secondly, constructing it can add overhead that should not be necessary, because often the same signature can be reused. The solution is to only keep a pointer to a signature in `MultiFunction` that is set during construction. Child classes are responsible for making sure that the signature lives long enough. In most cases, the signature is either embedded into the child class or it is allocated statically (and is only created once).
2021-03-21Functions: move CPPType creation related code to separate headerJacques Lucke
This does not need to be included everywhere, because it is only needed in very few translation units that actually define CPPType's.
2021-03-20Cleanup: quiet warningJacques Lucke
2021-03-20Nodes: implement dot graph exporter for derived node treeJacques Lucke
This visualization of nested node groups makes it easier to debug some issues. Muted nodes, muted links, reroute nodes and unavailable sockets are removed from the visualization to keep it clean. Nested node groups are visualized using colored clusters.
2021-03-19Nodes: make distinction between directly and logically linked sockets more clearJacques Lucke
This also moves the handling of muted nodes from derived node tree to node tree ref.
2021-03-17Nodes: make derived link data more obvious in NodeTreeRefJacques Lucke
`NodeTreeRef` is a thin wrapper on top of `bNodeTree`. By default it should not hide anything from the underlying `bNodeTree` (before this it was hiding muted links). For convenience some "derived" data is cached on sockets. For example all the connected sockets when reroutes and muted links are ignored. A nice side benefit of this refactor is that `NodeTreeRef` requires less memory than before.
2021-03-17Nodes: Add support to mute node wiresCharlie Jolly
This patch adds the ability to mute individual wires in the node editor. This is invoked like the cut links operator but with a new shortcut. Mute = Ctrl + Alt Cut = Ctrl Dragging over wires will toggle the mute state for that wire. The muted wires are drawn in red with a bar across the center. Red is used in the nodes context to indicate invalid links, muted links and internal links. When a wire is muted it exposes the original node buttons which are normally hidden when a wire is connected. Downstream and upstream links connected using reroute nodes are also muted. Outside scope of patch: - Add support for pynodes e.g. Animation Nodes - Requires minor change to check for muted links using the `is_muted` link property or the `is_linked` socket property. Maniphest Tasks: T52659 Differential Revision: https://developer.blender.org/D2807
2021-03-16Geometry Nodes: Implicit conversion add int to colorCharlie Jolly
Add implicit `int32 to Color4f` conversion. Matches `int32 to float3` conversion logic. This may not be the most useful conversion but prevents an error in the Attribute Convert node. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10686
2021-03-16Geometry Nodes: Implicit conversion change from distance to averageCharlie Jolly
Use average instead of distance when converting from float3/float2 to float. This matches behaviour of shader nodes. See: https://developer.blender.org/T86454 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10684
2021-03-14Nodes: Add distance float socket typeHans Goudey
This is necessary to make float sockets display a value with the unit system. `PROP_DISTANCE` will be used quite a lot by the mesh primitives geometry nodes patch. Differential Revision: https://developer.blender.org/D10711
2021-03-13Fix geometry nodes implicit conversion to booleans reversedHans Goudey
The result value should be true if the input values are not zero. Note that there is ongoing conversation about these conversions in D10685. This is simply a fix though.
2021-03-11Geometry Nodes: improve handling when the same socket is connected twiceJacques Lucke
The multi-input-socket cannot be connected to the same socket twice currently. However, it is still possible to achieve this using an intermediate reroute node. In this case the origin socket should be listed twice in the `linked_sockets_` list. Higher level functions can still deduplicate the list of they want.
2021-03-10Geometry Nodes: Add color to boolean implicit conversionHans Goudey
This conversion works the same way as a combination of the existing color to float3 to boolean conversions, so the boolean result will be false if the color is black, otherwise true, and the alpha is ignored.
2021-03-10Nodes: Sortable Multi Input SocketsFabian Schempp
This Patch removes the auto sorting from Multi-Input Sockets and allows the links to be sorted by drag and drop instead. As a minor related change, it fixes the drawing of the mute line to connect to the first input instead of the socket's center.
2021-03-09Fix: only follow first input of multi-input-socket when mutedJacques Lucke
Otherwise muting a Join Geometry node has no effect, when there are multiple Join Geometry nodes in a row.
2021-03-07Cleanup: fix compiler warningJacques Lucke
2021-03-07Cleanup: remove dead codeJacques Lucke
2021-03-07Cleanup: compiler warningsJacques Lucke
2021-03-06Nodes: refactor derived node treeJacques Lucke
This is a complete rewrite of the derived node tree data structure. It is a much thinner abstraction about `NodeTreeRef` than before. This gives the user of the derived node tree more control and allows for greater introspection capabilities (e.g. before muted nodes were completely abstracted away; this was convenient, but came with limitations). Another nice benefit of the new structure is that it is much cheaper to build, because it does not inline all nodes and sockets in nested node groups. Differential Revision: https://developer.blender.org/D10620
2021-03-05Cleanup: Rename func occurences to _fnSebastián Barschkis
Use _fn as a suffix for callbacks.
2021-03-04Nodes: improve NodeTreeRefJacques Lucke
This adds a couple more utility methods to various node tree ref types. Also `InternalLinkRef` has been added to get simpler access to internal links.
2021-03-04Fix T86204: support multiple group inputs in node groupJacques Lucke
Note that this still does not work when in the node group directly referenced by the modifier, only in sub-node-groups. This limitation will be removed at some point.
2021-03-03UI: Allow translation for node error messagesHans Goudey
This commit exposes the strings used in the node error messages for localization. It also changes the message tooltip creation to automatically add the period at the end, to be more consistent with the (arguably bad) design of other tooltips in Blender. Calling `TIP_` directly in the node implementation files allows us to continue using `std::string` concatenation instead of passing variadic arguments. It's also more explicit about which part of the message is translated and which isn't. The files already include the translation header anyway.
2021-03-03Nodes: store references to bNodeLinks in NodeTreeRefJacques Lucke
Sometimes it is useful to have this information available to be able to read information from links.
2021-02-25Fix T85979: Attribute missing warning with empty geometryHans Goudey
An error doesn't make sense in these situations because we don't expect to find attributes on empty geometry, and an empty geometry set is a valid situation. Note that we can't use `component.is_empty` here, because often the component is visually "empty" but still has a point cloud with no points or a mesh with no vertices.
2021-02-19Nodes: ensure ui storage implicitelyJacques Lucke
This makes it easier to use the api.
2021-02-17Geometry Nodes: Node error messagesHans Goudey
This patch adds icons to the right side of nodes when they encounter a a problem. When hovered, a tooltip displays describing the encountered while evaluating the node. Some examples are: attribute doesn't exist, mesh has no faces, incorrect attribute type, etc. Exposing more messages to the system will be an ongoing process. Multiple warnings per node are supported. The system is implemented somewhat generically so that the basic structure can also be used to store more information from evaluation for the interface, like a list of available attributes. Currently the messages are just button tooltips. They could be styled differently in the future. Another limitation is that every instance of a node group in a parent node tree will have the same error messages, the "evaluation context" used to decide when to display the tooltips must be extended to support node tree paths. Differential Revision: https://developer.blender.org/D10290
2021-02-16Cleanup: Used derived node in geometry exec paramsHans Goudey
Since the derived node tree is already build for the evaluation system, it's simpler to pass a derived node to the params struct. This will also allow context lookups in nested node groups for node error messages, since the derived node has that information readily accessible.
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-12Geometry Nodes: Allow attribute nodes to use different domainsHans Goudey
Currently every attribute node assumes that the attribute exists on the "points" domain, so it generally isn't possible to work with attributes on other domains like edges, polygons, and corners. This commit adds a heuristic to each attribute node to determine the correct domain for the result attribute. In general, it works like this: - If the output attribute already exists, use that domain. - Otherwise, use the highest priority domain of the input attributes. - If none of the inputs are attributes, use the default domain (points). For the implementation I abstracted the check a bit, but in each node has a slightly different situation, so we end up with slightly different `get_result_domain` functions in each node. I think this makes sense, it keeps the code flexible and more easily understandable. Note that we might eventually want to expose a domain drop-down to some of the nodes. But that will be a separate discussion; this commit focuses on making a more useful choice automatically. Differential Revision: https://developer.blender.org/D10389
2021-02-03Geometry Nodes: Multi-Input SocketsFabian Schempp
Normally sockets only have one input link. This commit adds the back-end changes needed to use multiple input links per socket. Multi-input sockets can be defined with a new flag in `bNodeSocketType`. The changes necessary to make the sockets work in the geometry nodes evaluator are generalizing input socket values as a vector of values, and supporting this in the derived node tree structure. This patch should contain no functional changes. Two upcoming patches will use this system for the "Join Geometry" node and expose link picking and updated display in the UI: D10069 and D10181. Reviewed By: Jacques Lucke, Hans Goudey Differential Revision: https://developer.blender.org/D10067
2021-01-22Functions: use better conversion from float2 to float3Jacques Lucke
Previously float2 was converted to float3 by implicitly converting to a float pointer first, which was then passed to the float3 constructor. This leads to uninitialized memory in the z component of the new float3. Ideally this should be solved in float2/float3 itself, but my first fix for that resulted in a compile error: rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82 This is an alternative fix that can be used for now. Will have to look into the conversion in more detail again.
2021-01-14Geometry Nodes: add implicit conversions for float2 and othersJacques Lucke
Some of these conversions are arbitrary to some degree. However, the user experience is better when at least something happens when converting between types, instead of just getting zeros. I left out a few conversions that I wasn't sure about yet. I also added conversions for float2.