In 2a1a658492, layout functions for nodes were refactored and new
methods were introduced, but this change was not applied to the
translation extraction script.
This commit adds these method names and argument order to Python
extraction: "node_operator", "node_operator_with_outputs",
"simulation_zone", "repeat_zone", "for_each_element_zone",
"closure_zone".
Tooltips specified in a special structure are manually extracted using
`n_()`.
Actual translation is done manually in the UI methods inside NodeMenu,
in order to override the context, which by default would have been
"Operator".
Reported by Ye Gui in #43295.
Pull Request: https://projects.blender.org/blender/blender/pulls/147582
Previously items in the "Group" list would usually show up first because
their menu path is shorter. Now, adjust their search weight so they show
up lower than the corresponding asset. That this is just a heuristic,
because we don't have a good way to directly deduplicate groups
that are just packed assets in the add menu currently.
Pull Request: https://projects.blender.org/blender/blender/pulls/147629
Calling node menus in the context of a different editor can lead to
errors in many places (e.g. checking on space_data tree_type/
node_tree_sub_type), so to resolve, add a very general poll function to
the NodeMenu class.
Pull Request: https://projects.blender.org/blender/blender/pulls/147512
The current placement of the operators make it easy for them to blend in with
other group nodes in that menu.
This patch adds an icon to better indicate the nature of these operators, and
have separators between it and other entries of the menu.
Pull Request: https://projects.blender.org/blender/blender/pulls/147330
Implement a native method to swap between different node and zone types.
This implementation repurposes the existing menu definitions as base
classes, from which both an "Add" and a "Swap" version would be generated
from. This allows both menus to have the same layout, but use their own
operators for handling the different node/zone types.
In this PR, support for all node editors has been implemented.
Invoking the menu is currently bound to `Shift + S`, same as the old
implementation in Node Wrangler. Since "Swap" is implemented as a
regular menu, features that menus already have such as type-to-search
and adding to Quick Favorites don't require any extra caveats to
consider.
Resolves#133452
Pull Request: https://projects.blender.org/blender/blender/pulls/143997
This patch turns node Menu options into menu inputs. This patch only
covers node operations like Filter, Distort, and so on. Pixel nodes like
Color Balance, Matte, and so on will be done in a separate patch.
Pull Request: https://projects.blender.org/blender/blender/pulls/144495
Some items in the node editors' add menus were not properly
translated. The affected items referenced an enum property on a node,
such as Math node's Operation.
Since some of those enums use a specific translation context, the same
context must be used when adding them to the search menus. The context
can simply be retrieved from the bl_rna prop itself.
In addition, some items use labels that are already translated
manually and do not need the auto translation, so disable that in
those cases (translate=False).
No new messages are added by this change.
Reported by Ye Gui in #43295.
Pull Request: https://projects.blender.org/blender/blender/pulls/141629
Geometry Nodes' Add > Input > Import menu includes file format items
such as "Standford PLY (.ply)", "STL (.stl)", "Text (.txt)". The
latter needs to be translated because "Text" is a generic format.
These items are declared using a custom function
`node_add_menu.add_node_type`, with a `label` argument. This commit
adds the `label` argument to the function arguments that can be
extracted from specific node declaration functions, and specifies the
argument position for each:
"add_node_type", "add_node_type_with_outputs", "add_simulation_zone",
"add_repeat_zone", "add_foreach_geometry_element_zone",
"add_closure_zone".
There is currently no facility to specify a translation context but it
could be easily added if the need arises.
Most of these functions do not actually declare new, unique messages,
but it could happen in the future. In addition, two messages were
extracted using manual `iface_()` calls, which are no longer needed
after this change.
Reported by Ye Gui in #43295.
This reduces the search weight of the frame node because it is rarely added
through the add menu. It's much easier to add it with the F key.
By reducing its search weight, the Frame output of the Scene Time node shows up
as first result, which is more desirable.
Pull Request: https://projects.blender.org/blender/blender/pulls/139709
Previously, one had to search for the name of an input node (Geometry, Light
Path, etc.) instead of for the actual desired values.
This patch makes it possible to search for the output names of various input
nodes directly. All other outputs of the input node are hidden automatically.
This was partially support for the Scene Time before.
Supported nodes:
* Compositor: Scene Time
* Geometry Nodes: Camera Info, Mouse Position, Scene Time, Viewport Transform
* Shader Nodes: Camera Data, Curves Info, Geometry, Volume Info, Light Path,
Object Info, Particle Info
Right now, the output names are hardcoded in the menu. We don't have a great way
to access those without an actual node instance currently. For that we'll need
to make the node declarations available in Python, which is a good project but
out of scope for this this feature. It also does not seem too bad to have more
explicit control over what's shown in the search.
Pull Request: https://projects.blender.org/blender/blender/pulls/139477
Previously, when adding a group node it was always called `Group`. This is not
particularly useful. Also it's inconsistent with many other places like adding
modifiers where the name of the modifier depends on what modifier is added.
Now, newly added group node will have the same name as the group that it calls.
Node names still have to be unique though, so e.g. `.001` is still added.
Pull Request: https://projects.blender.org/blender/blender/pulls/139093
Previously, one had to search for "Time" to get the Scene Time node which
provides access to the current frame and second. Intuitively I often start
searching for "frame" or "seconds" instead and only later remember what I
actually have to search for.
This patch improves the UX by allowing to create a Scene Time node by searching
for "frame" or "seconds" directly. This works in Geometry Nodes and the
compositor.
Pull Request: https://projects.blender.org/blender/blender/pulls/138927
Node groups are now hidden based on the "Show Hidden Files/Data-Blocks"
user preference, similar to how the ID selector search filters the
results based on the user preference.
Note that this PR does **not** change filtering behavior when the
setting is off and you search for a dot.
Pull Request: https://projects.blender.org/blender/blender/pulls/138878
The main way to create a new node group right now is to select some nodes and
then press ctrl+G. This works well for the common case when one already has some
nodes to group. However, there is no good alternative currently for when one
wants to create a new group from scratch. A common workaround currently is to
add some dummy node, then press ctrl+G and then to delete the dummy node in the
group again. Obviously, we can do better than that.
This patch adds a `New Group` entry in the menu. It's available in geometry,
compositing and shading Nodes. The operator adds a new node group called
"NodeGroup" (the same default name we use for ctrl+G currently). Then it adds a
new group node and assigns the new group to it. The group itself does not have
any inputs or outputs by default because any such socket would just be a guess
that's likely wrong and more annoying than useful.
A nice side benefit of adding this operator is that the Group menu is not empty
in shading and compositing nodes initially which always looked a bit off.
Pull Request: https://projects.blender.org/blender/blender/pulls/138430
Previously, it was possible to search for specific math operations in
link-drag-search but not in the normal add menu. This patch adds support for
searching for specific operations in various math nodes.
A good trick for adding e.g. a vector add node is to search for `vadd`
(similarly with `iadd`).
The menu itself looks unchanged. This patch only adds additional elements to the
search.
Pull Request: https://projects.blender.org/blender/blender/pulls/138534
This implements bundles and closures which are described in more detail in this
blog post: https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/
tl;dr:
* Bundles are containers that allow storing multiple socket values in a single
value. Each value in the bundle is identified by a name. Bundles can be
nested.
* Closures are functions that are created with the Closure Zone and can be
evaluated with the Evaluate Closure node.
To use the patch, the `Bundle and Closure Nodes` experimental feature has to be
enabled. This is necessary, because these features are not fully done yet and
still need iterations to improve the workflow before they can be officially
released. These iterations are easier to do in `main` than in a separate branch
though. That's because this patch is quite large and somewhat prone to merge
conflicts. Also other work we want to do, depends on this.
This adds the following new nodes:
* Combine Bundle: can pack multiple values into one.
* Separate Bundle: extracts values from a bundle.
* Closure Zone: outputs a closure zone for use in the `Evaluate Closure` node.
* Evaluate Closure: evaluates the passed in closure.
Things that will be added soon after this lands:
* Fields in bundles and closures. The way this is done changes with #134811, so
I rather implement this once both are in `main`.
* UI features for keeping sockets in sync (right now there are warnings only).
One bigger issue is the limited support for lazyness. For example, all inputs of
a Combine Bundle node will be evaluated, even if they are not all needed. The
same is true for all captured values of a closure. This is a deeper limitation
that needs to be resolved at some point. This will likely be done after an
initial version of this patch is done.
Pull Request: https://projects.blender.org/blender/blender/pulls/128340
- Wrap the closing parenthesis onto it's own line
which makes assignments to the return value
read better.
- Reduce right-shift with multi-line function calls.
This adds a new type of zone to Geometry Nodes that allows executing some nodes
for each element in a geometry.
## Features
* The `Selection` input allows iterating over a subset of elements on the set
domain.
* Fields passed into the input node are available as single values inside of the
zone.
* The input geometry can be split up into separate (completely independent)
geometries for each element (on all domains except face corner).
* New attributes can be created on the input geometry by outputting a single
value from each iteration.
* New geometries can be generated in each iteration.
* All of these geometries are joined to form the final output.
* Attributes from the input geometry are propagated to the output
geometries.
## Evaluation
The evaluation strategy is similar to the one used for repeat zones. Namely, it
dynamically builds a `lazy_function::Graph` once it knows how many iterations
are necessary. It contains a separate node for each iteration. The inputs for
each iteration are hardcoded into the graph. The outputs of each iteration a
passed to a separate lazy-function that reduces all the values down to the final
outputs. This final output can have a huge number of inputs and that is not
ideal for multi-threading yet, but that can still be improved in the future.
## Performance
There is a non-neglilible amount of overhead for each iteration. The overhead is
way larger than the per-element overhead when just doing field evaluation.
Therefore, normal field evaluation should be preferred when possible. That can
partially still be optimized if there is only some number crunching going on in
the zone but that optimization is not implemented yet.
However, processing many small geometries (e.g. each hair of a character
separately) will likely **always be slower** than working on fewer larger
geoemtries. The additional flexibility you get by processing each element
separately comes at the cost that Blender can't optimize the operation as well.
For node groups that need to handle lots of geometry elements, we recommend
trying to design the node setup so that iteration over tiny sub-geometries is
not required.
An opposite point is true as well though. It can be faster to process more
medium sized geometries in parallel than fewer very large geometries because of
more multi-threading opportunities. The exact threshold between tiny, medium and
large geometries depends on a lot of factors though.
Overall, this initial version of the new zone does not implement all
optimization opportunities yet, but the points mentioned above will still hold
true later.
Pull Request: https://projects.blender.org/blender/blender/pulls/127331
This adds the ability to customize the default width of a group node that's
created for a node group. This feature works towards the goal of unifying the
features available to built-in nodes and node groups. We often customize the
width of built-in nodes from them to looks slightly better (e.g. to avoid
cut-off labels).
Pull Request: https://projects.blender.org/blender/blender/pulls/126054
Part of modernizing scripts in Blender, where the previous convention
was to use percentage formatting which has become the "old" way to
format strings in Python.
See proposal for details #120453.
Ref !120552
The goal is to support better search experience in the cases where we want to
explicitly influence the ordering instead of relying only on general heuristics.
We used to support this already at some point I think, but not anymore since we
started using menu-search.
The implementation is fairly straight forward. It mainly just forwards the
search weight from the menu definition to the search code through various
required steps. The main annoying thing is that changing the signature of e.g.
`uiItemFullO_ptr` is fairly involved. Even using default parameters for these
functions is a bit annoying and becomes fairly unreadable and error-prone on the
call-site. For now, I worked around this by storing the search weight on the
`uiLayout` and to copy it to the `uiBut` from there. That seems preferable until
we have a better solution for adding parameters to all the `uiItem*` functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/120572
Refactor the Add menu in Shading nodes, with manually created menus,
inspired by Geometry Nodes and more recently the Compositor.
Minor sorting adjustments by splitting categories in groups, with
separators in between groups, and sorted alphabetically. Shading
node group assets are also populated in the menus.
This is the first part of the re-organization of the Add menu,
part of #111746
Pull Request: https://projects.blender.org/blender/blender/pulls/111798
Since these are operations rather than new nodes, they don't make
sense in the add menu. They are also available in the "Node" menu
in the editor's header and in the context menu.
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.
While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.
Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.
Some directories in `./intern/` have also been excluded:
- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.
An "AUTHORS" file has been added, using the chromium projects authors
file as a template.
Design task: #110784
Ref !110783.
The Repeat Zone operator from the Geometry nodes Add Node -> Utilities
menu was not translated because it used the "Operator" translation
context, instead of the default context.
Since the function displaying the menu item, `add_repeat_zone()`, is
only ever called from the Utilities menu, and the label is specified
there as "Repeat Zone", we know in advance that it will have this
name.
For the same reason, this commit also simplifies the function which
creates the menu entry for simulation zones. This function is also
only called from the Simulation menu with a specific label using the
default context, so it should also use this one.
Pull Request: https://projects.blender.org/blender/blender/pulls/110644
This adds support for running a set of nodes repeatedly. The number
of iterations can be controlled dynamically as an input of the repeat
zone. The repeat zone can be added in via the search or from the
Add > Utilities menu.
The main use case is to replace long repetitive node chains with a more
flexible alternative. Technically, repeat zones can also be used for
many other use cases. However, due to their serial nature, performance
is very sub-optimal when they are used to solve problems that could
be processed in parallel. Better solutions for such use cases will
be worked on separately.
Repeat zones are similar to simulation zones. The major difference is
that they have no concept of time and are always evaluated entirely in
the current frame, while in simulations only a single iteration is
evaluated per frame.
Stopping the repetition early using a dynamic condition is not yet
supported. "Break" functionality can be implemented manually using
Switch nodes in the loop for now. It's likely that this functionality
will be built into the repeat zone in the future.
For now, things are kept more simple.
Remaining Todos after this first version:
* Improve socket inspection and viewer node support. Currently, only
the first iteration is taken into account for socket inspection
and the viewer.
* Make loop evaluation more lazy. Currently, the evaluation is eager,
meaning that it evaluates some nodes even though their output may not
be required.
Pull Request: https://projects.blender.org/blender/blender/pulls/109164
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/104924
This commit implements described in the #104573.
The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).
This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.
This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale
This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.
Running `make update` will initialize the local checkout to the changed
repository configuration.
Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).
Pull Request #104755