Age | Commit message (Collapse) | Author |
|
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
|
|
|
|
|
|
- Use default size consistent with other curve nodes
- Use column instead of row for properties
|
|
|
|
|
|
Before one could only create a new group input using the link drag search.
With this patch it becomes possible to create a Group Input node for an
existing input.
Differential Revision: https://developer.blender.org/D13674
|
|
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
|
|
|
|
This was a regression in rB7e712b2d6a0d257d272ed35622b41d06274af8df.
|
|
This was a mistake in rBfdc4a1a590d8befb1ff which copied the parent
node tree into itself rather than accessing the node group's nodes.
|
|
Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).
Differential Revision: https://developer.blender.org/D13653
|
|
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).
Differential Revision: https://developer.blender.org/D13645
|
|
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
|
|
Before d56bbfea7b420d7, nodes were updated (size calculated and
buttons added) in reverse order. Instead, now calculate the size of
frame nodes after all other nodes. Separating the drawing further
may be a good step to removing the O(n^2) loop later on.
|
|
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
returned `void *`. That leads to having the same type name three times
in the same line. This patch reduces the amount to two and removes the
`sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
of place compared to other allocation methods. Sometimes
`MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
in C++ code. It doesn't look great but it's definitely better. The downside
is that it makes the name of the allocation less useful. That's because
the same name is used for all allocations of a type, independend of
where it is allocated.
This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).
The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.
Differential Revision: https://developer.blender.org/D13502
|
|
The patch fixes some misalignments in the nodes' sockets/options
recently introduced in 26d2caee3ba0, while maintaining the original
fix for T92268.
The original fix made the top padding always of the same size; while
that works when the first row of the other node is `Socket | Socket`,
it doesn't for other more common cases, `like Socket | Node Option`,
where the text results misaligned.
Differential Revision: https://developer.blender.org/D13451
|
|
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
|
|
This patch removes no-op node editor preview code (`PR_NODE_RENDER`)
and most calls to `BKE_node_preview_init_tree`. The only remaining call is
in the compositor.
- Shader nodes previews don't seem to do anything.
- In-node previews for the texture node system doesn't work either.
This is a first step to refactoring to remove `preview_xsize`,
`preview_ysize`, and `prvr` from nodes in DNA, aligned with
the general goal of removing runtime/derived data from data
structs.
Differential Revision: https://developer.blender.org/D13578
|
|
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 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
|
|
|
|
Code is simpler when the uiBlocks used during drawing are simply
stored in an array. Additionally, looping can be simpler when we use
an vector to hold a temporary copy of the tree's linked list of nodes.
This patch also slightly changes how uiBlocks are "named" in
`node_uiblocks_init`. Now it uses the node name instead of the
pointer, which is helpful so we rely less on the node's address.
Differential Revision: https://developer.blender.org/D13540
|
|
This builds off of rBf951aa063f7, adding a weight parameter which can
be used to change the order of items when they have the same match
score. In the future, if string searching gets a C++ API, we could
use an optional parameter for the weight, since it is not used yet.
This will be used for the node link drag search menu (D8286).
Differential Revision: https://developer.blender.org/D13559
|
|
|
|
This ends up including the removed headers in many unnecessary places.
Also, remove unnecessary extern from function definitions.
|
|
Also remove unnecessary function to set a node type's
label function that duplicated its definition, and make
another function static.
|
|
I assume this `butr` rectangle was used more in the past,
but currently its value is set and used less than 10 lines apart,
so it's trivial to remove 16 bytes from every node. The other
rectangles are also runtime data and could be removed, but
they are more difficult.
|
|
Was unused since the first commit:
rB658b4c0d56dffbcf1476c2a2a019fa0ecfb79376
|
|
Though the interfacing with `rctf` becomes slightly more complicated,
this should be more helpful as more of this code usese `float2` instead
of two separate floats.
|
|
Ref T92709
|
|
|
|
The algorithm used is still quite inefficient, but at least the code
is easier to read and a little bit simpler now.
|
|
|
|
|
|
As a followup to 338c1060d5d7, apply the same change to the node
drawing callback. This helps to simplify code when the complexity
of a callback isn't necessary right now.
|
|
Currently there are a few callbacks on `bNodeType` that do the same
thing for every node type except reroutes and frame nodes. Having a
callback for basic things complicates code and makes it harder to
understand, and reroutes and frames are special cases in larger way.
Arguably frame nodes shouldn't even be drawn like regular nodes,
given that it adds a case of O(N^2) looping through all nodes.
"Unrolling" the callbacks makes it easier to see what's happening,
and therefore easier to optimize.
Differential Revision: https://developer.blender.org/D13463
|
|
|
|
This helps to tell when a pointer is expected to be null, and avoid
overly verbose code when dereferencing. This commit also includes
a few other cleanups in this area:
- Use const in a few places
- Use `float2` instead of `float[2]`
- Remove some unnecessary includes and old code
The change can be continued further in the future.
|
|
Also remove some unnecessary includes
|
|
|
|
|
|
The group output node did not have the same size padding as the group
input, leading to the node looking different and actually being smaller.
Differential Revision: https://developer.blender.org/D13092
|
|
Since we have the overlays popover, it makes sense to allow toggling the
context path like in the 3D viewport. This commit adds a property,
and turns it on by default in existing files.
Differential Revision: https://developer.blender.org/D13248
|
|
Currently, custom sockets are no longer supported for automatic linking
when dropping a node on a link. This is because SOCK_CUSTOM is given a
negative priority and is ignored. To fix this, SOCK_CUSTOM is now given
the lowest priority and the rest of the sockets got their priority
incremented.
Reviewed By: Jacques Lucke
Differential Revision: https://developer.blender.org/D13403
|
|
This is only meant to be used for development purposes for now,
not to show warnings to the user.
Differential Revision: https://developer.blender.org/D13348
|
|
`std::stringstream` already returns a `std::string`, and there is no
particular reason to use short here instead of int.
|