Commit Graph

437 Commits

Author SHA1 Message Date
Jacques Lucke
8ec9c62d3e Geometry Nodes: add Closures and Bundles behind experimental feature flag
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
2025-04-03 15:44:06 +02:00
Campbell Barton
f84e473b1a Cleanup: simplify check if the preferences is already shown
Minor change to !136139.
2025-03-28 11:59:06 +11:00
IREXTIA
e7d1674ca6 UI: preferences.addon_show() | Skip opening another window if there's already a preferences editor in the current window
When viewing extension details, no need to call userpref_show if a
Preferences editor is in the main window, as that will just open a new
Preferences window.

Pull Request: https://projects.blender.org/blender/blender/pulls/136139
2025-03-28 00:21:11 +01:00
Campbell Barton
5e2b421996 WM: support the "Hyper" modifier key on Linux
Add support for a 5th modifier key called "hyper",
this is a modifier supported on Wayland & X11 although
other platforms could support an additional modifier too.

Both GNOME and KDE can map CapsLock to Hyper.
Other compositors can use the XKB_DEFAULT_OPTIONS environment variable.

This allows users to have an additional modifier for their own use
that doesn't conflict with other keys.

Ref !136340
2025-03-26 10:39:55 +11:00
Omar Emara
7c0c31efb0 Nodes: Enable panel toggles in the Compositor
This patch enables panel toggles in the compositor since it now supports
boolean sockets. This essentially reverts c3957f432a.
2025-03-24 10:20:39 +02:00
Guillermo Venegas
61783caa7f UI: Rename Add File Node operator to Add Image as Node
`Add File Node` name is too generic. This operator only handles
opening images and movies as nodes, not script files or other kind of files as nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/122561
2025-03-21 22:49:13 +01:00
Campbell Barton
5b04f13219 Cleanup: wrap long lines 2025-03-21 22:08:31 +11:00
Campbell Barton
bd2c0f2b49 Cleanup: remove unused variable 2025-03-21 15:07:07 +11:00
Pratik Borhade
e82c22f55e Cleanup: Grease Pencil: Remove old IO operator reference
Operator code is removed though they are still referenced in list of
"cleanup operator preset"

Pull Request: https://projects.blender.org/blender/blender/pulls/136062
2025-03-17 07:56:26 +01:00
Campbell Barton
4654855d20 Fix error running edit-mode extrude operators for non-mesh objects
The poll functions for: VIEW3D_OT_edit_mesh_* operators only checked
for an edit-mode object which failed with an unhandled exception for
non-mesh objects.
2025-03-16 19:33:30 +11:00
Habib Gahbiche
d8d09cdadb Geometry Nodes: shortcuts for viewer nodes
Implement shortcuts for viewer nodes. Viewer nodes are now activated using the operator `bpy.ops.node.activate_viewer()` instead of activating the viewer by setting the node to active.

This also unifies the behavior with viewer shortcuts in the compositor (see attachment in the original PR).

Pull Request: https://projects.blender.org/blender/blender/pulls/134555
2025-03-14 11:26:57 +01:00
Campbell Barton
5558491bf1 Merge branch 'blender-v4.4-release' 2025-03-06 15:54:01 +11:00
Campbell Barton
1635595f94 Fix exceptions in node operator poll functions 2025-03-06 15:24:52 +11:00
Campbell Barton
4177b75e7a Cleanup: quiet warnings from ruff, use static sets 2025-03-04 16:02:55 +11:00
Campbell Barton
872e3506f4 Merge branch 'blender-v4.4-release' 2025-03-04 12:05:06 +11:00
Alaska
c30c19ad64 Fix #135391: Python type error reporting that addon is for newer version of Blender
This commits fixes a type error issue when reporting that a addon was
designed for a version of Blender newer than the current one.

Thanks to @Rakete for the fix.

Ref: !135392
2025-03-04 12:02:09 +11:00
Jacques Lucke
c3957f432a Fix: Nodes: only expose panel toggles in geometry and shader nodes
The compositor does not support boolean sockets currently.
2025-02-28 19:23:44 +01:00
Falk David
2822777f13 Nodes: support boolean inputs as toggles in panel headers
Adds the option to create a boolean socket that can be used as a panel toggle.
This allows creating simpler and more compact node group UIs when a panel
can be "disabled".

The toggle input is a normal input socket that is just drawn a bit differently in
the UI. Whether a boolean is a toggle input or not does not affect evaluation.

Also see #133936 for guides on how to add and remove panel toggles.

Pull Request: https://projects.blender.org/blender/blender/pulls/133936
2025-02-28 19:07:02 +01:00
Bastien Montagne
f6ad99c648 Merge branch 'blender-v4.4-release' 2025-02-28 15:48:13 +01:00
Damien Picard
cd7334473a I18n: Translate quick effect data
Quick effects create various physics setups by adding objects,
materials, modifiers, and data layers. This data can now be
translated.
2025-02-28 15:46:33 +01:00
Philipp Oeser
7faee6b33b Merge branch 'blender-v4.4-release' 2025-02-26 09:13:03 +01:00
Philipp Oeser
138ede7194 Fix #134092: Keymap Editor can add an extra . to the end of an attribute
This happened for context attributes if already "complete" attributes
were typed/pasted in.

Reason is that this copies functionality from our intellisense
codecompletion where this is expected behavior, for context attributes
we cannot really use "tab" to expand, so it is less useful here.

When confirming (with the additional "."), the keymap entry would be
broken, so better solve in a way that we dont end up with those "." by
removing it.

NOTE: there might be ways to enhance the string-search behavior here (by
properly supporting "tab-expanding"), but this is a bit out-of-scope for
this bugfix.

Pull Request: https://projects.blender.org/blender/blender/pulls/135098
2025-02-26 09:12:28 +01:00
Dalai Felinto
e7214cbd31 Fix: missed point_cloud for node tools and more aggressive renaming
The issue was introduced on 1584cd9aa5 (see !134911 for details).

This fixes this and rename the remaining point_cloud from the API.
The DNA is left untouched, so users don't need to re-enable the
experimental point cloud feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/134927
2025-02-24 14:43:08 +01:00
Anthony Roberts
c8929b856a Merge branch 'blender-v4.4-release' 2025-02-20 10:27:08 +00:00
Sybren A. Stüvel
0bb750ee84 Fix: #134636: VSE - Fade In and Out not working
Use the new `action.fcurve_ensure_for_datablock()` function to ensure
the opacity F-Curve exists.

This function also ensures that the Action itself is ready for keying
(it has a layer and a keyframe strip), and ensures the slot for the
Scene exists and is assigned.

Co-authored-by: Pratik Borhade <pratikborhade302@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134753
2025-02-20 11:13:57 +01:00
Campbell Barton
f43e7b2b09 Fix error in grease_pencil.relative_layer_mask_add poll
Resolve exception during menu search by checking the object type is
grease pencil.
2025-02-16 20:49:52 +11:00
Janne Nylander
f702eba53f Grease Pencil: Add python operator for masking with above/below layer
Adds a new python operator to Grease Pencil for adding the layer
above or below  as a masking layers to the active layer.

Creates a new file for Grease Pencil python operators in
`scripts/startup/bl_operators/grease_pencil.py`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134401
2025-02-13 12:24:06 +01:00
Campbell Barton
6fcd84721c Cleanup: quiet some warnings from check_pep8 target 2025-02-04 14:51:17 +11:00
Campbell Barton
ec40ad0b3f Cleanup: use str.format to format strings in Python 2025-01-31 13:22:10 +11:00
Campbell Barton
20c08147b3 Cleanup: resolve warnings from pylint
- `self` -> `cls` for class methods.
- quiet long line & unused variable warnings.
2025-01-31 13:22:04 +11:00
Campbell Barton
c86d3b429e Cleanup: spelling in comments 2025-01-30 14:18:40 +11:00
Habib Gahbiche
4e544a89d6 Fix #133780: Menu search Python error in terminal
`poll()`  method must check properly for space type.

Pull Request: https://projects.blender.org/blender/blender/pulls/133781
2025-01-30 00:28:22 +01:00
Habib Gahbiche
b51c560f6e Compositor: Implement shortcuts for Viewer nodes
Artists often want to quickly switch back and forth between two or more nodes while compositing.

This patch implements two operators `NODE_OT_viewer_shortcut_set` and `NODE_OT_viewer_shortcut_get` that allow users to map a viewer node to a shortcut. For example, pressing `cltr+1` while a node is selected, assigns that node to the shortcut `1`, creates a viewer node if it has none attached and sets that viewer node to active. Pressing `1` will set the active node with shortcut `1` to active.

Shortcuts are saved in DNA to preserve them after saving/loading blend files.

Limitations:
- Only compositor node tree is supported, because shading editor has no viewer node and geometry nodes viewer works differently.

Pull Request: https://projects.blender.org/blender/blender/pulls/123641
2025-01-29 18:35:26 +01:00
Campbell Barton
84c9e6e655 Cleanup: use single quotes for enums 2025-01-21 23:50:17 +11:00
Pablo Vazquez
e2e992a425 UI: Add icons to Batch Rename data type menu
Add icons to better identify data types in the Batch Rename type menu.

Makes it easy for users to recognize icons they are already familiar
with, especially when following tutorials in English while using a
translated UI.

Also fixes 'Light' being singular, while others were plural.

Pull Request: https://projects.blender.org/blender/blender/pulls/130300
2025-01-21 11:31:24 +01:00
Falk David
b9f253564e VSE: Python API: Deprecate sequence properties and replace with new ones
This PR adds new RNA properties that deprecate and replace any `sequence` property.
The old prooperties are still there and fully functional, but the description is changed
to indicate that these will be removed in the future and that the new properties should
be used instead.

| Deprecated property | Replacement property |
| --------------------------------- | ----------------------------------- |
| `context.active_sequence_strip` | `context.active_strip` |
| `context.selected_editable_sequences` | `context.selected_editable_strips` |
| `context.selected_sequences` | `context.selected_strips` |
| `context.sequences` | `context.strips` |
| `SequenceEditor.sequences` | `SequenceEditor.strips` |
| `SequenceEditor.sequences_all` |  `SequenceEditor.strips_all` |
| `MetaStrip.sequences` | `MetaStrip.strips` |

Previously, rna paths for animation data on strips started with `sequence_editor.sequences`.
This PRadds versioning for the rna paths to make sure to use
the new naming scheme. This does mean that in previous versions of blender,
the animations don't show but the data is not lost (even if the file is saved in the older version).

Also do some cleanup of existing python scripts inside the source to use the
new properties.

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133156
2025-01-21 11:30:20 +01:00
Campbell Barton
be0c9174aa Cleanup: argument wrapping for Python scripts
- 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.
2025-01-14 12:53:32 +11:00
Damien Picard
ec9c7ba465 I18n: Disambiguate "Spaces"
"Spaces" as a character in a text, not a Blender UI element.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
c3d071e469 I18n: Disambiguate "Power"
- In the context of color balance, refers to a power function. Uses
  ID_MOVIECLIP context, because the ID_NODE is already used for math
  functions.
- In the context of the scale constraint, also a power function.
- In the context of physics and particle settings, refers to a
  falloff.
- In the context of property subtypes and units, refers to a
  quantity.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
88dbe8dcd1 I18n: Disambiguate "Pattern"
- "Pattern" can mean type of texture.
- It can also refer to refers to a type of matching wildcard.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
466af92f7a I18n: Disambiguate "Light"
"Light" already has multiple contexts, but some were missing:
- In general, "Light" refers to a Blender Light object. In many cases,
  this comes from an `id_type` enum, already using the ID context. Use
  it also for properties that were missing that context.
- In the context of render passes, "Light" is the actual illumination
  factor, not the light emitor. A new "Render Layer" translation
  context is introduced for this purpose as no existing ones are both
  specific and explicit enough.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
45f0d52dc8 I18n: Disambiguate "Extension"
"Extension" means how to extend an image past its bounds, as opposed
to file extension.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Campbell Barton
7b174109d1 Fix #132734: Follow Active Quads fails with non-manifold meshes
Support walking over non-manifold edge loops since calculating a
per-edge UV length only makes sense if all UV's that use that edge
are taken into account.
2025-01-08 14:02:32 +11:00
Campbell Barton
6ac52551d3 Cleanup: edit comments to avoid confusion type-checking commands
These comments caused vulture to fail.
2025-01-06 16:27:27 +11:00
Campbell Barton
c5203ef7fd Cleanup: use context-manager for opening files 2025-01-04 22:26:18 +11:00
Campbell Barton
0f1e1bcdae Fix error adding presets with Python 3.13
A separate name-space from the functions body is cleaner
and avoids unlikely but possible errors if names ever conflict.
2025-01-04 22:24:00 +11:00
Campbell Barton
a7bc3e3418 Cleanup: quiet Python linter warnings 2024-12-11 11:26:24 +11:00
Campbell Barton
38a76db083 UI: remove redundant undo pushes for menu operators
Operators that trigger menus should not enable UNDO.

Resolves #95906

Ref !131467
2024-12-07 00:41:36 +11:00
Nathan Vegdahl
aa83738d44 Anim: change parameters of slots.new() RNA function
`Action.slots.new()` in the Python API previously took either an ID or nothing
as a parameter. In the former case it would create a slot with the appropriate
`id_root` and name for that ID. In the latter case it would create a default
slot with an unspecified `id_root` and default name.

This had several issues:

1. You couldn't create a slot with a specific `id_root` without already having
   an ID of that type. In theory this isn't a problem, but in practice in larger
   scripts/addons you don't necessarily have such an ID on hand at the call
   site.
2. You couldn't directly create a slot with a desired name without an existing
   ID with that name. This isn't so important, since you can always just set the
   name afterwards. But it's a bit annoying.
3. Most other `new()` APIs in Blender *require* you to specify the name of the
   item being created. So calling this with no parameters was violating that
   norm.
4. Ideally, we want to eliminate unspecified `id_root`s, since they cause other
   weirdness in the API such as slot identifiers changing upon slot assignment.

To resolve these issues, and just generally to make the API more
straightforward, this PR changes `slots.new()` to take two required parameters:
an ID type and a name. For example:

`slots.new(id_type='CAMERA', name="My Camera Data Slot")`.

This fully specifies everything needed for the slot identifier upon creation,
and doesn't require any outside data items to create a slot with the desired
type and name.

In the future if we decide we still want a `for_id`-style slot creation API, we
can reintroduce it as a separate function.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130970
2024-12-02 17:04:37 +01:00
Alaska
e84103d958 Fix #130822: Update built-in Python scripts to use new EEVEE material settings
In Blender 4.3 all the EEVEE Legacy compatibility Python API calls for
materials in were removed. All Python code that makes use of that API
need to be updated to make use of the new API.

This commit updates two built in Python scripts to use the new API
to avoid errors like the one reported in #130822

Candidate for 4.3.1 corrective release

Pull Request: https://projects.blender.org/blender/blender/pulls/130873
2024-11-25 10:51:45 +01:00