Age | Commit message (Collapse) | Author |
|
Unity build saves 5 seconds off the total build time when compiling `bf_nodes_function`.
Total build times went from 25s to 20s (20% reduction),
tested with ninja on linux running i5 8250U.
|
|
In the future this will be used to support unity builds for function nodes
Differential Revision: https://developer.blender.org/D13682
|
|
|
|
To be used in the future to support unity builds
|
|
Using the output declarations is incorrect because there is a
declaration for each type. Instead loop over the names directly,
since it will make it easier to add an integer mode that only
supports some of the outputs.
|
|
In the future this will be used to support unity builds for composite nodes
Differential Revision: https://developer.blender.org/D13678
|
|
To be used in the future to support unity builds
|
|
The calls to `.fill` were overwriting indices that are processed by
other threads.
|
|
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.
Differential Revision: https://developer.blender.org/D13673
|
|
This node is a bit special in that it uses two internal sockets
for a hack for Eevee; see rBffd5e1e6acd296a187e7af016f9d7f8a9f209f87
As a result, the `SOCK_UNAVAIL` flag is exposed to socket builder API.
Reviewed By: JacquesLucke, fclem
Differential Revision: https://developer.blender.org/D13496
|
|
Also simplify the allocation name to `__func__`
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13665
|
|
I suppose this was done to reduce then dependencies.
However, most nodes already depend on UI code so this isnt too useful.
|
|
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
|
|
Needed for D13496
|
|
Typically a node group should only have a single Group Output node.
However, currently Blender already supports having multiple group outputs,
one of which is active. This wasn't handled correctly by geometry nodes.
Differential Revision: https://developer.blender.org/D13611
|
|
This looks like a copy and paste error from the original commit.
The virtual array output used the number of mesh polygons instead
of the number of edges.
|
|
If the input mesh had no materials already, the new material would
become the only material on the mesh, meaning the material was
added to all of the faces, instead of just the selected faces.
The mesh primitive nodes in geometry nodes already add an empty
slot by default, so this only affects outside geometry.
The fix is just adding an empty slot before the new slot, so the
non-selected material indices can still point to an empty slot.
Differential Revision: https://developer.blender.org/D13654
|
|
Previously only the float version of the node was connected to.
This adds connection operations for vector sockets, and exposes
the "Steps" socket properly when it's selected.
|
|
|
|
|
|
Caused by capturing local variables by reference in a function that
outlives the scope it was created in. Also use a more generic function
for the first two inputs.
|
|
This should be faster because it avoids reallocating the internal
vectors when the size is known beforehand, but it may also help
a potential refactor to a different data structure (see T94193).
|
|
These pointers point to the new nodes when duplicating,
and their even used to point to "original" nodes for
"localized" trees. They're just a bad design decision
that make code confusing and buggy.
Instead, node copy functions now optionally add to a map
of old to new socket pointers. The case where the compositor
abused these pointers as "original" pointers are handled
by looking up the string node names.
Differential Revision: https://developer.blender.org/D13518
|
|
|
|
Goals of this refactor:
* More unified approach to updating everything that needs to be updated
after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
more centralized update procedure.
The refactor consists of two main parts:
* Node tree tagging and update refactor.
* Generally, when changes are done to a node tree, it is tagged dirty
until a global update function is called that updates everything in
the correct order.
* The tagging is more fine-grained compared to before, to allow for more
precise depsgraph update tagging.
* Depsgraph changes.
* The shading specific depsgraph node for node trees as been removed.
* Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
tagged when the output of the node tree changed (e.g. the Group Output
or Material Output node).
* The copy-on-write relation from node trees to the data block they are
embedded in is now non-flushing. This avoids e.g. triggering a material
update after the shader node tree changed in unrelated ways. Instead
the material has a flushing relation to the new `NTREE_OUTPUT` node now.
* The depsgraph no longer reports data block changes through to cycles
through `Depsgraph.updates` when only the node tree changed in ways
that do not affect the output.
Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.
Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
`ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.
Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.
Differential Revision: https://developer.blender.org/D13246
|
|
The duplicated edges were caused by 'oversubdivided' edges, i.e. edges
where some of the vertices on them are only connected to two polygons.
The fix finds these vertices and 'dissolves' them so that only one edge
is created.
For most 'normal' meshes this shouldn't occurr, or only very little, so
the performance impact of this change should be neglegible. In practice
this is also avoidable by triangulating the mesh first.
Differential Revision: https://developer.blender.org/D13445
|
|
These are useful for development, but when the primitive nodes
aren't actively changing, the performance cost is not worth it.
|
|
On a Ryzen 3700x, this ended up 2.5x faster than before. More
benchmarking details are included in the differential revision.
For smaller grids, all this should do is increase the
code size a bit, and add a few more if statements.
Differential Revision: https://developer.blender.org/D13617
|
|
Similar to the previous commit, this allowed removing a function to set
a single pixel of a node preview.
|
|
This is a follow-up to rB43875e8dd1d76ee, removing some
processing of non-existent node previews in the shader and
texture nodes systems.
|
|
|
|
When dragging from the inputs of function nodes, other function
nodes wouldn't connect, because their socket declaration field types
weren't set correctly. Instead, they relied on code properly checking
the *node* declaration's `is_function_node()` method. However,
that increases complexity and requires passing the node instead of
just the socket in more places. Instead, set the proper field types
in the socket declaration during building.
Differential Revision: https://developer.blender.org/D13600
|
|
Includes use of memcpy to avoid warnings about deprecated members.
|
|
After recent refactoring in 4e98d974b596.
|
|
|
|
This was an oversight in rB8e2c9f2dd3118bfdb69ccf0ab2b9f968a854aae4.
|
|
|
|
Now that point clouds can be rendered with cycles, it makes sense
to allow assigning a material to them. Note that like volumes, they
only support a single material though.
|
|
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.
This commit moves most of the node layout functions for composite nodes into their respected
`source/blender/nodes/composite/nodes` file.
In the future, these functions will be simplified to `node_layout` once files have their own namespace.
See {D13466} for more information.
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13523
|
|
|
|
|
|
Some nodes didn't check the type of the link's socket for filtering.
Do this with a combination of manually calling the node tree's validate
links function and using the helper function for declarations.
Also clean up a few cases that added geometry sockets manually
when they can use the simpler helper function.
|
|
This was missing from rB11be151d58ec0ca955f.
It uses the same approach as the quadrilateral node.
|
|
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.
A few special operators for creating a reroute or a group input node
are also added to the search.
Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.
A small "+" is displayed next to the cursor to give a hint about this.
Further improvements are possible after this first iteration:
- Support custom node trees.
- Better drawing of items in the search menu.
- Potential tweaks to filtering of items, depending on user feedback.
Thanks to Juanfran Matheu for developing an initial patch.
Differential Revision: https://developer.blender.org/D8286
|
|
This adds a bool field selection input to the Attribute Statistics node.
This is useful for running calculations on a subset of the input field data
rather that then whole set.
Differential Revision: https://developer.blender.org/D13520
|
|
|
|
This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.
|
|
This replaces lost functionality from the old GN Attribute Map Range node.
This also adds vector support to the shader version of the node.
Notes:
This breaks forward compatibility as this node now uses data storage.
Reviewed By: HooglyBoogly, brecht
Differential Revision: https://developer.blender.org/D12760
|
|
This commit refactors the way the socket lists for group nodes,
and group input/output nodes are verified to match the group's
interface.
Previously the `bNodeSocket.new_sock` pointer was used to
temporarily mark the new sockets. This made the code confusing
and more complicated than necessary.
Now the old socket list is saved, and sockets are moved directly from
the old list to a new list if they match, or a new socket is created
directly in the new list.
This change is split from D13518, which aims to remove the `new_node`
and `new_sock` pointers. In the future this code might be removed
entirely in favor of using node socket declarations.
Differential Revision: https://developer.blender.org/D13543
|
|
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
|