32 Commits

Author SHA1 Message Date
Damien Picard
f4dd22b7d9 Cleanup: Remove unused, or deduplicate node enum items
- `rna_enum_node_float_compare_items` has not been in use since
  943b919fe8, remove it.
- `rna_enum_node_combsep_color_items` is defined twice, deduplicate
  it.

Pull Request: https://projects.blender.org/blender/blender/pulls/148054
2025-10-14 16:51:03 +02:00
Sybren A. Stüvel
d33a6a1723 Python: add function for file iteration/remapping bpy.data.file_path_foreach()
Add a function `bpy.data.file_path_foreach()` with a callback function
`visit_path_fn`:

```py
def visit_path_fn(
    owner_id: bpy.types.ID,
    file_path: str,
    _meta: typing.Any,
) -> str | None:
    return file_path.replace('xxx', 'yyy') or None

bpy.data.file_path_foreach(
    visit_path_fn,
    *,
    subset=None,
    visit_types=None,
    flags={},
)
```

When the function returns `None`, nothing happens. When it returns a
string, the reported file path is replaced with the returned string.

`subset` and `visit_types` have the same meaning as `subset` resp.
`key_types` in `bpy.data.file_path_map()`. Since the latter parameter
doesn't affect keys in a map, but rather the visited ID types, I named
it `visit_types` instead.

`flags` wraps most of `eBPathForeachFlag` as `set[str]`, with their
prefixes removed. `BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN` becomes
`RESOLVE_TOKEN`, etc. `BKE_BPATH_FOREACH_PATH_ABSOLUTE` is excluded,
as it only affects a field in the C++ callback structure that is not
passed to Python at all. If it turns out to be useful at some point,
we can always add it.

`_meta` is for future use, and is intended to give metadata of the
path (like whether it's an input or an output path, a single file or
the first file in a sequence, supports variables, etc.). By adding
this to the API now, we avoid a breaking change when this feature is
actually implemented.

Design task: #145734

Pull Request: https://projects.blender.org/blender/blender/pulls/146261
2025-10-06 17:10:49 +02:00
Christoph Lendenfeld
2ae953d7f5 UI: remove the Timeline
This adds versioning code that replaces any timeline with a
dopesheet where the footer is shown, AND it removes the
timeline from the menu options.

If the area is too small to show both, the footer and the
header then only the footer is shown.
This assumes that users created the small timeline
just for the playback controls

Any uses of `SACTCONT_TIMELINE` (except for versioning) have been removed.

part of #145577

Pull Request: https://projects.blender.org/blender/blender/pulls/147058
2025-10-02 09:44:53 +02:00
Brecht Van Lommel
78ae7ec392 Render: Rename render passes for clarity
In very old OpenEXR version there was a limit on the channel names, which meant
the pass names needed to be short like "DiffDir". Change them to be longer like
"Diffuse Direct".

* This breaks forward compatibility. Old Blender version will lose links when
  reading compositing node setups with such passes, but #146571 will fix it
  for 4.5 LTS.
* Add-ons, scripts and compositing setups in other applications that rely on these
  names will also break.
* The find_by_type function for render passes has also been removed, as this was
  already deprecated and replaced by find_by_name.
* We assume spaces in the name are ok, since we have passes with them already
  and have not seen reports about compatibility issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/142731
2025-09-25 18:04:14 +02:00
Omar Emara
149a47ba57 Compositor: Turn Menu options to inputs
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
2025-08-28 08:45:23 +02:00
John Kiril Swenson
644fcd6bfb Cleanup: VSE: Reorganize and clean up sequencer add code
- Deduplicate `scale_fit_methods` enum
- Reorder functions, polls, and code to locations that make sense
- Rename some functions to remove `seq` terminology in favor of `strip`
- Renames `len` in `LoadData` to `count` for images
- Add clarifying comments and improve descriptions
2025-08-18 15:10:42 -06:00
Omar Emara
92d5c2078e Render: Add Media Type option
This patch adds a new Media Type option to image format settings, which
is used in the Render Output panel, File Output node, and Image Saving
operation. The option does not provide any new functionality, but
improves the UX of selecting file types by categorizing the existing file
type option into:

- Image.
- Multi-Layer EXR.
- Video.

Each option would then list only the file types that fit that media
type. For Multi-Layer and Video, the file type option is no longer drawn
for now since only one option exist for now, OpenEXR Multi-Layer and
FFMPEG respectively. This also improves the experience by not listing
technical terms like FFMPEG in the UI, but rather use "Video" instead.

The original motivation for introducing this option is the recent
redesign of the File Output node. The problem is that the distinction
between images and multi-layers images is not at all clear, while the
behavior of the node changes quite a bit when multi-layer is chosen.
While now with the new option, the distinction is quite clear.

Implementation-wise, the new option is mostly a UI layer that controls
the available enum items for the file format and callbacks to set a
default format if the existing format doesn't match the media type.
However, core code is unaffected and still transparently reads the image
format only.

Pull Request: https://projects.blender.org/blender/blender/pulls/142955
2025-07-25 11:15:28 +02:00
Jacques Lucke
152471ffdb Geometry Nodes: support structure types in closures
This adds support for specifying structure types on closures. The main immediate
benefit is that this makes it possible to use fields with closures (without
having incorrect warnings in the UI).

A closure zone behaves very similar to a node group with respect to structure
type inferencing. The structure types can be inferenced fully automatically, or
the user can specify them manually on the closure inputs. On the evaluate
closure zone, the user has to specify the structure types of the inputs and
outputs explicitly (or leave them as dynamic).

Working on this, I was a bit surprised that `get_output_socket_shape` depended
on the field state. Is that a left-over? It feels like it shouldn't be necessary
since the socket shape shouldn't depend on field inferencing anymore. I removed
that now and couldn't see a difference yet.

The operator that creates a closure zone from an evaluate closure node copies
the input structure types already. Beyond that, there is no automatic syncing of
the structure types yet. The structure types only affect the UI and not what's
actually done during evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/139713
2025-06-10 12:25:51 +02:00
Campbell Barton
12f0164eb0 CMake: match defines & CMake variable names
Avoid mistakes with these variables getting mixed up
(see: bf03a2684b).

Ref !137183
2025-04-09 08:44:36 +00:00
Falk David
20ce477ea0 Geometry Nodes: Add node to set the Grease Pencil depth order
Adds a new node to set the Grease Pencil depth ordering.

Here are the options:
* 2D Layers: Uses the Layer order + Stroke order to calculate the depth ordering.
* 3D Location: Uses the 3D position of the points as the depth.

This reflects the same setting that is available in the Grease Pencil
object-data properties.

The node is added to the `Grease Pencil` > `Write` menu.

Resolves #129458.

Pull Request: https://projects.blender.org/blender/blender/pulls/135914
2025-04-08 15:24:51 +02:00
Falk David
d3ba70190b VSE: Python API: Rename RNA types from Sequence to Strip
This PR renames `bpy.types` that contain `Sequence` (and refer to a strip) to `Strip`.

The `bpy.types.Sequence` has already been renamed to `bpy.types.Strip` in
a previous PR. See !132179.

Additionally, this PR does some cleanup renamings in the sequencer
RNA files (e.g. `sequence` -> `strip`).

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133054
2025-01-16 12:32:59 +01:00
Habib Gahbiche
35ea495bb6 UI: Nodes: Remove some snapping options
Compositor: UI: remove snapping to nodes.

Snapping nodes to other nodes behaves in a very unpredictable way, which makes most snapping options useless.

The patch removes the following:
- Snapping options `Node X`, `Node Y` and `Node XY`
- Menu `Snap Node Element`
- Menu `Snap Target`

New behavior:
- Activating `Snap` always acts as 'Snap to Grid'

Part of https://projects.blender.org/blender/blender/issues/128612

Pull Request: https://projects.blender.org/blender/blender/pulls/127667
2024-11-24 14:30:22 +01:00
Charlie Jolly
bf04513dec Geometry Nodes: new Integer Math node
Provide building block support for integer operations.

Manipulation of integer based data should not be limited to using float math nodes.
Using float math comes with accuracy issues for larger integers and requires unnecessary
type conversions.

The node also adds some integer specific operations like GCM and LCD.

Pull Request: https://projects.blender.org/blender/blender/pulls/110735
2024-09-23 15:01:31 +02:00
Jacques Lucke
809fed764a Geometry Nodes: expose node warnings on modifier in Python API
This exposes warnings that are propagated to the modifier in the Python API.
This allows people to show these warnings in custom UIs for their node groups.

Warnings are accessed like this:
```python
for warning in modifier.node_warnings:
    print(warning.message)
    print(warning.type)
```

Note that this only works on the geometry nodes modifier. These warnings may
be extended with more information in the future. E.g. it could be useful to know
which node created the warning.

Pull Request: https://projects.blender.org/blender/blender/pulls/127193
2024-09-05 19:45:40 +02:00
Julian Eisel
a8c08e4a8c Refactor: Sculpt/Paint: Rename brush "tool" to "brush type"
The term "tool" is historic from before the actual tool system got
introduced. Since then the term was already a bit confusing, because it
wasn't directly related to the tool system, but there was still some
relationship between the two. Now brushes and their types are decoupled
much more from the tool system, with a single "Brush" tool supporting
all kinds of brushes (draw, grab, cloth, smooth, ...).

For a more clear terminology, use "brush type" instead of "tool".

For #126032 we need to write the brush type to the asset metadata (done
in !124618), so we can filter brushes based on the type (so the grease
pencil eraser tool only shows eraser brushes, for example). I'd like to
use future proof names for that to avoid versioning of asset metadata in
future, so I'd rather do the full naming change now.

RNA properties (thus BPY names) are not changed for compatibility
reasons. Can be done in 5.0, see blender/blender#124201.

Pull Request: https://projects.blender.org/blender/blender/pulls/126796
2024-09-03 15:20:34 +02:00
Falk David
0f42f277b7 Grease Pencil: Remove legacy modifiers
This removes the legacy Grease Pencil modifiers from the code.
These should have already been inaccessible from the UI and hidden from
the user. The modifiers have been reimplemented for the new GPv3
data structure.

On top of the modifier code, some other related things have been
removed as well:
 * Operators related to the legacy modifiers.
 * Keymaps for the legacy modifier operators.
 * Some bits of code that used modifier functions.

Some code has to be kept, because it is still used:
 * The core line art code, which is used by the new line art modifier. It's
    moved to `modifiers/lineart`.
 * The DNA structs for the legacy modifiers. They are still needed for
    conversion.
 * A few kernel functions for the modifiers are kept (also for conversion).

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/125102
2024-07-29 10:37:29 +02:00
Jacques Lucke
24dc9a21b1 Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.

We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.

The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.

The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.

If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.

Backpropagation does not work for all nodes, although more nodes can be
supported over time.

This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
  a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
  rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.

In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.

All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.

The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.

Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.

The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
  clicking the gizmo icon next to the value.

Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
Colin Basnett
2fe92c63d3 Geometry Nodes: Add Active Element tool node
This pull request adds an "Active Element" node that exposes the active
vertex, edge, or face index to the geometry node tool context. The
presence of an active element is available as a boolean.

This node enables the creation of "active-to-selected" style operators.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121333
2024-05-20 21:01:30 +02:00
Hans Goudey
e3894f0a07 UV: Remove UV sculpt use of brushes
For the brush assets project (#116337) all editors with brushes are
getting an asset shelf, and the brush tools are combined, with
individual brushes accessed in the shelf. That design seems way
overkill for UV sculpting which is just three very simple tools.

In order to avoid one editor with inconsistent use of brushes, which
would significantly increase the complexity of the system after the
brush assets merge, port the three UV sculpt tools to be regular
modal operators that don't use the brush or paint system at all.

To be clear, this is a compromise that doesn't feel ideal, but no
one could think of a better solution. Theoretically this removes
some flexibility from UV edit "sculpting", in practice it probably
won't be a noticeable change.

Pull Request: https://projects.blender.org/blender/blender/pulls/120797
2024-04-26 17:10:04 +02:00
Jacques Lucke
01ee34ebd1 Curves: add operator to set bezier handle types
This adds an operator to set the handle types of bezier curves. It also
adds the same shortcut that is available in the legacy curve edit mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/120426
2024-04-10 13:08:50 +02:00
Bastien Montagne
43c801ed92 Cleanup: typo in rna_enum_asset_library_type_items name. 2023-11-24 11:47:38 +01:00
Hans Goudey
89e3ba4e25 Mesh: Replace auto smooth with node group
Design task: #93551

This PR replaces the auto smooth option with a geometry nodes modifier
that sets the sharp edge attribute. This solves a fair number of long-
standing problems related to auto smooth, simplifies the process of
normal computation, and allows Blender to automatically choose between
face, vertex, and face corner normals based on the sharp edge and face
attributes.

Versioning adds a geometry node group to objects with meshes that had
auto-smooth enabled. The modifier can be applied, which also improves
performance.

Auto smooth is now unnecessary to get a combination of sharp and smooth
edges. In general workflows are changed a bit. Separate procedural and
destructive workflows are available. Custom normals can be used
immediately without turning on the removed auto smooth option.

**Procedural**

The node group asset "Smooth by Angle" is the main way to set sharp
normals based on the edge angle. It can be accessed directly in the add
modifier menu. Of course the modifier can be reordered, muted, or
applied like any other, or changed internally like any geometry nodes
modifier.

**Destructive**
Often the sharp edges don't need to be dynamic. This can give better
performance since edge angles don't need to be recalculated. In edit
mode the two operators "Select Sharp Edges" and "Mark Sharp" can be
used. In other modes, the "Shade Smooth by Angle" controls the edge
sharpness directly.

### Breaking API Changes
- `use_auto_smooth` is removed. Face corner normals are now used
  automatically   if there are mixed smooth vs. not smooth tags. Meshes
  now always use custom normals if they exist.
- In Cycles, the lack of the separate auto smooth state makes normals look
  triangulated when all faces are shaded smooth.
- `auto_smooth_angle` is removed. Replaced by a modifier (or operator)
  controlling the sharp edge attribute. This means the mesh itself
  (without an object) doesn't know anything about automatically smoothing
  by angle anymore.
- `create_normals_split`, `calc_normals_split`, and `free_normals_split`
  are removed, and are replaced by the simpler `Mesh.corner_normals`
  collection property. Since it gives access to the normals cache, it
  is automatically updated when relevant data changes.

Addons are updated here: https://projects.blender.org/blender/blender-addons/pulls/104609

### Tests
- `geo_node_curves_test_deform_curves_on_surface` has slightly different
   results because face corner normals are used instead of interpolated
   vertex normals.
- `bf_wavefront_obj_tests` has different export results for one file
  which mixed sharp and smooth faces without turning on auto smooth.
- `cycles_mesh_cpu` has one object which is completely flat shaded.
  Previously every edge was split before rendering, now it looks triangulated.

Pull Request: https://projects.blender.org/blender/blender/pulls/108014
2023-10-20 16:54:08 +02:00
Hans Goudey
bd4c310a19 Fix: Missing edge domain in node tool set selection node
This wasn't implemented in the initial commit because we didn't have
a function to flush edge selections to vertices and faces. But using the
existing domain interpolations makes that trivial, so it may as well be
added now to avoid the arbitrary limitation from the user perspective.

See https://devtalk.blender.org/t/node-tools-feedback/31388/5

Pull Request: https://projects.blender.org/blender/blender/pulls/113367
2023-10-17 09:56:24 +02:00
Hans Goudey
4e97def8a3 Geometry Nodes: Expose sharp edge status with builtin nodes
Change the existing "Is Shade Smooth" node to be named "Is Face Smooth"
and add a new "Is Edge Smooth" node. Also give the "Set Shade Smooth"
node the ability to set face or edge smoothness.

The fact that the nodes process "smooth" data reversed from the builtin
"sharp" attributes can be reversed with versioning in a separate commit.

While it's tempting to abstract the sharpness status into a single node,
face and edge smoothness are accessed separately in edit mode, and the
subtlety of interacting with data on different domains would make that
confusing. Instead, a separate "Is Shade Smooth" node group asset will
give all the sharp elements taking into account both builtin attributes.

The fact that sharpness is stored separately on two domains makes the
best design for simple operations non-obvious. For example, you should be
able to remove all sharpness or make everything flat with a single node.
The behavior depends on whether the two attributes exist and the
combination of values between the domains.

---

![image](/attachments/c3f053c4-2b0f-44ac-9227-62071065fe56)

![image](/attachments/fd489fb3-314b-42ff-a5a9-e79578cbdfe7)

Pull Request: https://projects.blender.org/blender/blender/pulls/112029
2023-09-06 17:12:27 +02:00
Christoph Lendenfeld
11fe57cab8 Animation: Move Snapping to Scene
Part of #91973

Moving the snapping code for the
* Graph Editor
* Action Editor
* and NLA editor

into the common system that lives on the scene.
This includes the Magnet icon for turning
snapping on and off.

The old settings translate to the new in the following way:
* `Frame Step` -> `Frame`
* `Second Step` -> `Second`
* `Nearest Frame` -> `Frame` + `Absolute Time Snap`
* `Nearest Second` -> `Second` + `Absolute Time Snap`
* `Nearest Marker` -> `Nearest Marker`

Since this moves the location of the snapping settings
from the editor to the scene, it changes the behavior.
Previously each editor could have different snapping
settings, where now they are all synced.

Pull Request: https://projects.blender.org/blender/blender/pulls/109015
2023-09-05 10:06:55 +02:00
Marcos Perez
1015bed2fd VSE: Sound equalizer modifier
The sound equalizer is using the Audaspace FFT Convolver.
The blender part creates an array of descriptions of power per "band"
and orders the creation of Equalizer (ISound) in the Audaspace.

Modifier can be created on sound strips. It lets you define
amplification or attenuation over frequency range from 30Hz to 20 kHz.
The power is limited to -30 db - 30 db. This is done using curve
mapping widget.

Co-authored-by: menda <alguien@aqui.es>
Co-authored-by: Richard Antalik <richardantalik@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/105613
2023-08-30 22:36:36 +02:00
Campbell Barton
09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Lukas Tönne
ea3d85b9d7 Node panels: RNA for node group interfaces
Part 2/3 of #109135, #110272

Defines the RNA API for the new node tree interfaces.

The bulk of the RNA definition lives in `rna_node_tree_interface.cc`. The legacy socket interfaces remain in place and will be removed later.

Since the socket items share the `bNodeSocketValueXXX` structs with the `bNodeSocket` types they also use the same RNA. The `rna_def_node_socket_interface_subtypes` function is exposed so that when defining the interface RNA it can use the same code as the regular socket RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/110952
2023-08-21 15:40:19 +02:00
Aaron Carlisle
3ea7117ed1 PyAPI Docs: Fix generation after recent node RNA changes
This commit allows both `rna_enum_` and `rna_node_`to be used for enum prefixes

This also fixes one enum by adding `rna_` to the prefix.

Together these changes fix the API documentation generation.
2023-08-16 17:37:41 -04:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
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.
2023-08-16 00:20:26 +10:00
Iliya Katueshenock
63fd2575e6 Nodes: move more rna code to geometry node files
Continuation of 43667b807e.
Only geometry nodes with shared enum arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/111056
2023-08-12 17:36:42 +02:00
Jacques Lucke
cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00