Commit Graph

3108 Commits

Author SHA1 Message Date
Andrej730
380e8455e8 PyDoc: Fix typing issues with bpy.utils.register_tool
- Add `type[]` for the `tool_cls` as it's expecting tool type class,
  not the instance (similar to #132420)
- Add `set[str]` to `after` type as it's seems to be the way it's used
  the most widely, e.g. in "UI Tool Simple" example that comes with Blender:

`bpy.utils.register_tool(MyTool, after={"builtin.scale_cage"}, separator=True, group=True)`

Pull Request: https://projects.blender.org/blender/blender/pulls/133975
2025-02-05 07:06:53 +01:00
Campbell Barton
4083b9ce62 Cleanup: use a more specific name for NDOF's guide
Prepare for having a second guide (!129594).
2025-02-05 15:19:35 +11:00
Nicola
6f80dba66c Sculpt: Add 'Plane' brush type
This patch introduces the `Plane` brush, a generalization of the
existing `Flatten`, `Fill` and `Scrape` brushes, with the objective of
providing more flexibility when sculpting.

This brush has the following key features:
* `Height` and `Depth` parameters to control the range of the brush in
  the local z-axis.
* Stabilizers for the normal and center of the brush plane.

When inverting, the user can choose between two options:
* `Invert Displacement`: Identical to the existing behavior, displacing
  vertices away from the plane.
* `Swap Height and Depth`: Exchanges the roles of `Height` and `Depth`.
  For example a brush with `Height` = 0.7 and `Depth` = 0.3 behaves as
  if it had `Height` = 0.3 and `Depth` = 0.7. In particular, this
  ensures that a scrape brush (`Height` = 1, `Depth` = 0) becomes
  equivalent to a fill brush (`Height` = 0, `Depth` = 1)  when inverted,
  and viceversa.

In the existing planar brushes, the influence on a vertex is determined
by the 3D Euclidean distance between the vertex and the cursor position,
multiplied by the vertex's distance from the brush plane (and other
factors common to all brushes).

In the `Plane` brush, the 3D distance is between the vertex and the
plane center instead of the cursor position.

The Plane brush introduces two parameters — `Stabilize Normal` and
`Stabilize Plane`. These can be thought of as the non-binary version of
the `Original Normal` and `Original Plane` options found in existing
brushes. These values are a weighted moving average across a window of
previous stroke steps.

Pull Request: https://projects.blender.org/blender/blender/pulls/132723
2025-02-04 22:38:23 +01:00
Christoph Lendenfeld
358a0479e8 Anim: create pose assets to different libraries
Similar to how brush assets are created and managed this
PR allows to export pose assets into a different library.
Because of this there is a limitation to this where each
asset is stored in a separate blend file.
This may be lifted in the future as there are planned changes in
the design phase: #122061

### Create Asset

Now available in the 3D viewport in the "Pose" menu: "Create Pose Asset".
The button in the Dope Sheet will now call this new operator as well.

Clicking either of those will open a popup in which you can:

* Choose the name of the asset, which library and catalog it goes into.
* Clicking "Create" will create a pose asset on disk in the given library.

It is possible to create files into an outside library or add it in the current file.
The latter option does a lot less since it basically just creates the
action and tags it as an asset.

If no Asset Shelf **AND** no Asset Browser is visible anywhere in Blender,
the Asset Shelf will be shown on the 3D viewport from which
the operator was called.

### Adjust Pose Asset

Right clicking a pose asset that has been created in the way described
before will have options to overwrite it.
Only the active object will be considered for updating a pose asset

Available Options (the latter 3 under the "Modify Pose Asset" submenu):
* Adjust Pose Asset: From the selected bones, update ONLY channels that
are also present in the asset. This is the default.
* Replace: Will completely replace the data in the Pose Asset from
the current selection
* Add: Adds the current selection to the Pose Asset. Any already existing
channels have their values updated
* Remove: Remove selected bones from the pose asset

Currently this refreshes the thumbnail. In the case of custom
thumbnails it might not be something want

### Deleting an existing Pose Asset

Right click on a Pose Asset and hit "Delete Pose Asset". Works in the shelf
and in the asset library. Doing so will pop up a confirmation dialog,
if confirming, the asset is gone forever. Deleting a local asset is basically the
same as clearing the asset. This is a bit confusing because you get
two options that basically do the same thing sometimes,
but "Delete" works in other cases as well.
I currently don't see a way around that.

Part of design #131840

Pull Request: https://projects.blender.org/blender/blender/pulls/132747
2025-02-04 11:29:05 +01:00
Campbell Barton
6fcd84721c Cleanup: quiet some warnings from check_pep8 target 2025-02-04 14:51:17 +11:00
John Kiril Swenson
f79df39171 VSE: Move snap toggle to global SequencerCommon
This allows the keybind to be invoked from either the Sequencer or
Preview view types, now that snapping is also possible in the Preview.
2025-02-03 15:02:41 -06:00
Julien Duroure
6999f34ec1 glTF: Bump version to 4.4.42 after recent changes 2025-02-03 20:35:05 +01:00
Julien Duroure
c089c176cb Refactor: glTF: followup ActionKeyframeStrip.channels() rename
- Use slot identifier instead of slot handle
- Change API calls after changes in Blender (in PR #133868)
- Refactoring, avoiding duplicate functions

Pull Request: https://projects.blender.org/blender/blender/pulls/133915
2025-02-03 20:32:00 +01:00
Sybren A. Stüvel
226486aa91 Refactor: Anim, rename and adjust ActionKeyframeStrip.channels()
Rename `ActionKeyframeStrip.channels()` to `.channelbag()`, and change
its first parameter from `slot_handle` to `slot`.

This is to be consistent with `ActionKeyframeStrip.channelbags`, which is
the array of channelbags in the keyframe strip. Having a function that's
singluar makes sense for finding a single element in the array.

The change from using the slot handle to using the slot is to be consistent
with `.channelbags.new(slot)`. Furthermore, the Python API should be using
slot handles as little as possible (they're basically meaningless numbers).
Using the slots directly is preferred. If that's not possible, it is
recommended to use the slot identifier (`slot.identifier`) instead, as that
can be used to look up the slot (`action.slots[slot_identifier]`).

This breaks the glTF add-on, which will be fixed in !133915.

Pull Request: https://projects.blender.org/blender/blender/pulls/133868
2025-02-03 20:19:00 +01:00
T0MIS0N
a9c6889eb4 Fix #133453: Canvas button cannot be enabled
This fixes an issue where the Canvas button is always disabled when
trying to use the experimental feature, Sculpt Texture Paint.

This bug was caused by the new Asset System since it changed how paint
tools work. Before, the UI would check the current tool being used and
determine if the Canvas button should be activated. With the new Asset
System, painting is done with modular brushes instead of tools, so
previous methods of checking tool properties have stopped working.

This is fixed by activating the Canvas button based on the properties
of the current brush. If the brush's type is either Paint or Smear,
then the Canvas button is activated.

Co-authored-by: T0MIS0N <50230774+T0MIS0N@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/133566
2025-02-03 19:50:33 +01:00
Sybren A. Stüvel
fa2b131395 Fix #105216: Rigify (ui.py) console error, expected str not float
Use string formatting instead of the `+` operator, so that it doesn't
matter which exact type is used for the `rig_id` custom property.

Also reshuffle the code a bit to reduce indentation.

Pull Request: https://projects.blender.org/blender/blender/pulls/133967
2025-02-03 12:55:36 +01:00
John Kiril Swenson
16c6b227da VSE: Add keymap item for seq_slide with ctrl
Allows the user to select strips at the same time (`linked_time`) while
dragging so that they don't have to re-click to drag the handles.
2025-02-02 23:03:07 -06:00
Campbell Barton
59732c95d8 Cleanup: strip trailing space for TOML,HTML & XML 2025-02-02 13:58:34 +11:00
Julien Duroure
8abac73cbd glTF exporter: avoid crash when no tracks are exported 2025-02-01 19:06:45 +01:00
Julien Duroure
196cda9eef glTF exporter: Fix typo leading to crash at animation export (nla track mode) 2025-02-01 19:05:14 +01:00
Julien Duroure
83f9ed8771 glTF: New way of registering UI for hooks
- Explicit registration for hook UI
- Added some example in upstream repo: https://github.com/KhronosGroup/glTF-Blender-IO/blob/main/example-addons/example_gltf_exporter_extension/__init__.py
2025-02-01 18:59:03 +01:00
Julien Duroure
cccd45e32a glTF exporter: Create output directory if not exists
This should happen mainly for Collection Exporter or using api
2025-02-01 18:55:46 +01:00
Julien Duroure
3d2f45b408 glTF: Collection Exporter: Set collection custom props as glTF Scene extras
As we are exporting Collection only, it makes sense that the collection customs props
can be exported as glTF Scene extras, as the scene includes only objects from the collection
2025-02-01 18:52:53 +01:00
Julien Duroure
6aae3004fc glTF exporter: add pre & post export hooks 2025-02-01 18:49:38 +01: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
448e3c2009 Cleanup: remove redundant setting & add NUMPAD_1 for direct lookups
Add NUMPAD_1 to match NUMBERS_1 to avoid inline formatting,
also de-duplicate logic that uses both NUMBERS_1 & NUMPAD_1.
2025-01-31 13:08:05 +11:00
RedMser
032feaf65f Fix #133812: Strip color picker uses invalid icon enum
Regression in a9c87a15fc - missed "sequence" -> "strip" renaming.

Pull Request: https://projects.blender.org/blender/blender/pulls/133814
2025-01-30 15:45:58 +01:00
Lukas Tönne
3be9f3d599 Fix #133516: Add basic support for radial control in the primitive operator
This adds another operator mode for changing brush radius and opacity while the
modal primitive operator is running. It's based on the `wm.radial_control`
operator but only implements simple mouse control for these two properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/133675
2025-01-30 14:09:42 +01:00
Habib Gahbiche
d19fe522e4 Fix box select ignoring selection mode in node editors
Box select is broken for all node editors. It ignores selection modes and always uses the mode `Set a new selection`.

The operator `NODE_OT_select_box` works fine, but clicking anywhere in the node editor calls `NODE_OT_select` first, so we need to make sure it has no undesired side effects when it is not run.

Pull Request: https://projects.blender.org/blender/blender/pulls/133736
2025-01-30 12:45:50 +01:00
Pablo Vazquez
6ea8297477 Extensions: Quick access to add-on folder
When developing and testing add-ons it can be useful to get to the
folder containing such add-on.

When Developer Extras is enabled, show a folder icon next to the
extension's path to quickly open it using the system file browser.

Also display it in the list of duplicate add-ons, if any, so user can
access them more conveniently.

Pull Request: https://projects.blender.org/blender/blender/pulls/128474
2025-01-30 11:18:53 +01: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
Pratik Borhade
71213799b0 Fix #77799: Missing categories for gizmos in keymap hierarchy
Expose generic gizmo keymap in hierarchy.

Pull Request: https://projects.blender.org/blender/blender/pulls/132788
2025-01-29 20:18:10 +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
Philipp Oeser
a77e0ccd78 Fix: Curves "Warp" and "Randomize" dont update properly
Resolve by tagging positions as changed.

With this and !133544 (which fixes #133537) we can also expose those operators in the menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/133548
2025-01-29 10:00:05 +01:00
Harley Acheson
05151fcd60 UI: Reduce Light Theme Icon Border Opacity
Reduce the Light Theme Icon Border Intensity from 1.0 to 0.7 to better
match the result in Blender versions prior to SVG icons. The icon
border is now done within the text shader so the result is a bit
stronger than the old method.

Pull Request: https://projects.blender.org/blender/blender/pulls/131396
2025-01-28 19:39:14 +01:00
Sybren A. Stüvel
2440861afe Anim: fix 'Fix to Camera' poll function exception when camera is missing
The 'Fix to Camera' poll function was raising `NotImplementedError` when
there is no scene camera. That's now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/133710
2025-01-28 14:13:53 +01:00
Jonas Holzman
001c3b0d4b Fix #132150: macOS: Allow searching keymap using native modifiers key names
Allow searching through keybindings on macOS using native modifiers key
names "control", "option", and "command".

Pull Request: https://projects.blender.org/blender/blender/pulls/132579
2025-01-28 02:12:06 +01:00
Dangry98
e95687796d UV Editor: Add shortcut to Copy/Paste UVs
Assign Ctrl+C, Ctrl V to Copy/Paste UVs in UV Editor to the
default keymap and industry compatible keymap.

Similar to Copy/Paste splines in Mask editor.
Ref: https://projects.blender.org/blender/blender/issues/133558

Pull Request: https://projects.blender.org/blender/blender/pulls/133587
2025-01-27 19:57:28 +01:00
Falk David
1eb39a8689 Grease Pencil: Sculpt Mode Auto-Masking option
This implements all the auto masking options in sculpt mode.

* Stroke: Only affects strokes that are initially under the cursor.
* Layer: Only affect strokes in the same layer as the initial strokes under the cursor.
* Material: Only affect strokes with the same material as the initial strokes under the cursor.
* Active Layer: Only affect strokes in the active layer.
* Active Material: Only affect strokes that use the active material.

The `Active Layer` toggle in the toolbar has been moved to this panel.

Resolves #130022.

Pull Request: https://projects.blender.org/blender/blender/pulls/132986
2025-01-24 10:20:03 +01:00
Falk David
7878b3908b Grease Pencil: Don't show material preview as "disabled"
When locking a material, the preview icon would get greyed-out (as would
the rest of the properties in the row).
This issue is that this defeats the purpose of an accurate preview of
the material. Artists want to know what the material _actually_ looks
like.

This moves the icon into a separate row and property so that
it doesn't get disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/133478
2025-01-23 15:12:59 +01:00
Campbell Barton
89d51c7535 Extensions: add an error when building an add-on without an init file
- Add a check that the file list includes an `__init__.*` path.
- Normalize paths so they can can be compared with string literals.
2025-01-23 15:28:02 +11:00
Pratik Borhade
446b2a983d Fix: Variable referenced in UI code without being assigned
Mistake in d4d046a673
Right now python error is triggered with empty material slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/133287
2025-01-22 10:43:09 +01:00
Julien Duroure
16f728cfe5 glTF exporter: Missed background check in previous commit 2025-01-22 09:19:32 +01:00
Julien Duroure
71d3e32974 glTF exporter: Tweak for action filter in Collection Export
Waiting a proper solution for props declaration:

- Filter now happen even if the list is not displayed
- Avoid spaming console with error, display a label saying what to do
2025-01-22 09:09:40 +01:00
Julien Duroure
748c91ce27 glTF exporter: add fallback interpolation option
Before, any sampled properties that are not keyed was exported with LINEAR interpolation
Now, user can choose the interpolation for these not keyed values (LINEAR or CONSTANT/STEP)

Example of not keyed properties: Deformation bones when animators animated other bones
2025-01-21 21:46:25 +01:00
Nathan Vegdahl
a9d72b1a14 Anim: add Action+Slot selector for Movie Clips
This adds an Animation panel to the Footage tab of the n-panel of the Movie Clip
editor. Movie Clips have various properties that can be animated, but there was
previously no way to manage the Action and Slot that held those F-Curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/133380
2025-01-21 18:44:57 +01:00
Nika Kutsniashvili
693f8f37d0 Fix #133326: Material preview for Grease Pencil
Material preview panel for grease pencil was accidentally removed in e10b0b3449 because it had EEVEE engine listed as `COMPAT_ENGINES`, which also seemed accidental. After adding panel back I noticed that .blend file for generating previews was also faulty. It was updated 2 years ago when GPv3 was experimental feature, and file wasn't up to date to current state.

This PR also adds new .blend file for generating material previews that is mostly the same as one in Blender 4.2, except:
- I organized it, removed unnecessary stuff.
- For Flat preview it was using flat checkerboard background, for other modes 3D room, which seemed unnecessary and not useful for Grease Pencil, so now every mode uses flat background.
- "Cloth", "Liquid", and "Shaderball" modes in 4.2 didn't render at all and resulted in all white screen. Now they render default Circle, which is not correct, but at least better than nothing. In future we can add custom drawings to those modes for previewing materials on more complex objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/133372
2025-01-21 16:34:48 +01:00
Nathan Vegdahl
b2a06888c7 Anim: add Action+Slot selector for Masks
This adds an Animation panel to the Mask tab of the n-panel of the
Movie Clip and Image editors. Masks can be animated (for example, the
opacity of a Mask Layer), but there was no way to manage the Action
and Slot that held those F-Curves.

To keep things DRY, this PR also moves the code for drawing Action+Slot
selectors from the `PropertiesAnimationMixin` class to a utility
function, which is now called from both that class and the Mask UI code.

Pull Request: https://projects.blender.org/blender/blender/pulls/133153
2025-01-21 15:12:59 +01:00
YimingWu
2114620c28 Fix: Revised logic for EEVEE/Grease Pencil material slot display
The original code path could evaluate `ob.type` when `ob` was `None`.
Now fixed so this should not happen.

Continuation of:
https://projects.blender.org/blender/blender/pulls/132846
2025-01-21 21:04:31 +08:00
Campbell Barton
84c9e6e655 Cleanup: use single quotes for enums 2025-01-21 23:50:17 +11:00
Lukas Tönne
bca8fc76f9 Fix #130323: Make Grease Pencil interpolate tool retain point distribution
The interpolate tool was using a linear re-sampling of the curves, which changes
non-uniform point distributions can causes unexpected shifts in points along the
curve, even very close to an input stroke (mix factor ~0 or ~1).

This patch adds an alternative interpolation function with explicit segment
indices and fractions, which can then be computed by the interpolation tool.
The point segment factors are chosen such that each point of the input strokes
has an exact matching point in the interpolation. When the factor is close to
0 or 1 the shape of the curve thus matches the respective input exactly.

This approach is more similar to what GPv2 did, except instead of sub-dividing
each segment it simply generates a _local_ uniform sample to fit more points
into the same segment. These extra points are colinear at the extremes of the
mix factor range, so the curve matches the input curves visually.

Pull Request: https://projects.blender.org/blender/blender/pulls/130594
2025-01-21 13:36:37 +01:00
Campbell Barton
abd933d6b0 Cleanup: prefer parenthesis over line continuations in Python scripts 2025-01-21 23:30:55 +11:00
Campbell Barton
70f44c6204 Cleanup: use operator_enum to avoid inlining values 2025-01-21 23:24:31 +11:00