Commit Graph

221 Commits

Author SHA1 Message Date
Campbell Barton
99f93aa4c8 Cleanup: assign object & space variables from the context for reuse 2024-03-29 10:08:59 +11:00
Campbell Barton
a2dae7e4b4 Cleanup: consistent quotes for Python scripts 2024-03-29 10:07:28 +11:00
Campbell Barton
a6dd4f9cc7 Cleanup: simplify & de-duplicate bl_file_extensions variable 2024-03-27 15:10:51 +11:00
Campbell Barton
2a55aabbd8 Fix minor error in recent theme preset save operator
Changes to recent commit [0].

- Replace poll_message_set with report in the execute function.
- Remove f-string use which violates string formatting convention.
- Remove unnecessary string to bool.

[0]: ee38a7b723f8f12b695ae30ba300ecc93f29fe76
2024-03-27 15:04:03 +11:00
Harley Acheson
ee38a7b723 UI: Button to Save Custom Themes
Add a new "Save" to the Themes list in Preferences to save (overwrite)
custom themes. The operator has a poll function to disable for built-in
themes. Shows a confirmation when overwriting.

Pull Request: https://projects.blender.org/blender/blender/pulls/119491
2024-03-27 01:11:50 +01:00
Guillermo Venegas
8b6a21c122 IO: Use FileHandlers in the View 3d
Use File Handlers to handle file drag-n-drop in the View 3d. Drop-boxes
still remain since they handle Texture ID drag-n-drop.

This will add-ons to handle drag-n-drop for images and movies while
still providing access to Blender's native support since File Handlers
let users choose which to invoke if there's multiple configured.

Pull Request: https://projects.blender.org/blender/blender/pulls/117728
2024-03-26 20:01:08 +01:00
Campbell Barton
1a1905a639 UI: only show a single exception when enabling an add-on fails
The full stack-trace is mainly useful to developers which is printed
to the console. Only include a single exception in the error report.
2024-03-21 16:57:31 +11:00
Hans Goudey
803c783e52 Merge branch 'blender-v4.1-release' 2024-03-19 11:59:26 -04:00
cd476226d8 Fix #119402: Bone collections layers fail with pinned object or armature #119434
Don't assume armature of active object is what is displayed in the properties editor, both in C++ and Python code.

Object pointer was left out from some notifiers, as this means only that object was changed. But an armature datablock can be shared by multiple objects.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119663
2024-03-19 16:27:06 +01:00
Brecht Van Lommel
7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98c075f3dfc61faebbcb43c99a778956.

After this one more fix was committed, this one is preserved as well:
67bd678887d7f8aec9f3b23bbf1aaf29f80d0da4.
2024-03-18 15:04:12 +01:00
Campbell Barton
f347706ecd Cleanup: add "unreachable" message to "assert False" statements
Clarify that these blocks are unreachable so the intention is clear
if they're ever encountered.
2024-03-15 13:20:11 +11:00
Campbell Barton
d07d6f1c10 Cleanup: un-wrap lines that fit within 120 width for Python scripts 2024-03-15 10:04:03 +11:00
Campbell Barton
40ab79c887 Cleanup: format 2024-03-15 09:57:36 +11:00
Harley Acheson
57729aa8bb UI: Improved Operator to Delete Custom Keyconfigs
Changes to python operators that add and remove custom keyconfigs.
Removal gets poll function, separate name and description, and
confirmation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118778
2024-03-14 22:40:04 +01:00
Hans Goudey
726b18eefb Cleanup: Make format 2024-03-14 17:25:36 -04:00
Harley Acheson
a0a2e7e0dd UI: Improved Operator to Delete Custom Themes
Changes to python operators that add and remove custom themes. Removal
gets poll function, separate name and description, and confirmation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118775
2024-03-14 22:01:34 +01:00
Campbell Barton
cf1ab3ec6e Cleanup: consistent quotes in Python 2024-03-14 10:38:45 +11:00
Hans Goudey
daa1739953 Merge branch 'blender-v4.1-release' 2024-03-12 10:54:14 -04:00
Hans Goudey
91466f71f1 Fix #91256, #112646: IDProperty UI data lost when changing type
With some data-type conversions we can do a best-effort conversion of
UI data like default values and min and max to the new data type.
This can help to make Python scripts simpler and to avoid bugs like
#105965.

Pull Request: https://projects.blender.org/blender/blender/pulls/106161
2024-03-12 15:49:20 +01:00
Campbell Barton
24f7074c6c Merge branch 'blender-v4.1-release' 2024-03-12 21:21:09 +11:00
Campbell Barton
d4610e70db Fix #115185: Batch Rename Action Clips error
Account for actions themselves being selected in the outliner as well
as ID-types that don't have any animation data.
2024-03-12 21:17:55 +11:00
c7e4365d7a Merge remote-tracking branch 'origin/blender-v4.1-release' 2024-03-11 17:16:32 +01:00
5531a191e8 Fix #117798: "Nothing to Bake" when pose object is not selected
Use `context.pose_object` when baking a pose, on on top of the objects
in `context.selected_editable_objects`. When in pose mode, it's expected
that the pose of the active will be baked, regardless of whether the
pose object is selected itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/119317
2024-03-11 17:11:14 +01:00
Sebastian Parborg
013cd3d1ba Fix: Remove duplicate image_add operators in the 3D view port
As part of #118623, we discovered that the operator used for adding images in the 3D viewport was not the same when drag and dropping as when adding it from the add menu. This lead to different and potentially confusing behaviour for the user when they use both.

This patch removes the python operator and unifies the functionality into one operator. It also renames the operator to be in line with the other "Add X" object operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/118973
2024-03-11 16:18:25 +01:00
Pratik Borhade
7e3abdf503 Merge branch 'blender-v4.1-release' 2024-03-08 16:56:20 +05:30
Jacques Lucke
f9abbeca09 Fix: exception in poll function of some node operators 2024-03-08 11:58:47 +01:00
Campbell Barton
b099108178 Merge branch 'blender-v4.1-release' 2024-02-29 14:02:58 +11:00
Campbell Barton
d5598838a2 Fixes for operator preset cleanup utility
Various fixes to operator preset cleanup:

- Only remove properties that match exactly the properties to exclude
  exactly (taking word boundaries into account).
- When the preset path doesn't exist, don't construct paths relative
  to the working directory.
- Enforce UTF8 encoded text.

Other minor changes:

- Rename "properties" to "properties_exclude" for clarity.
- Use single underscore for private methods.
- Match each line against a single regex instead of constructing a
  string and checking startswith(..) for every property to exclude.
- Use os instead of pathlib, as us used in blender's built in operators
  that handle paths.
- Prefer doc-string over bl_description.
- Double quote strings.
- Use single indentation for lists to reduce right-shift.
2024-02-29 14:00:05 +11:00
Dalai Felinto
1860110fa8 Extensions: Update addon_enable/disable name and tooltip
Ideally the operator itself should be renamed, but I went the conservative approach
since themes are not supported yet. Once they are supported I suppose the operators
could be unified.
2024-02-21 15:42:59 +01:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564ad2.
2024-02-19 15:59:59 +01:00
Campbell Barton
2119d271e0 Cleanup: remove "-noaudio" argument in background mode
This is no longer needed as background mode implies -noaudio.
2024-02-14 00:13:38 +11:00
Guillermo Venegas
0d7282e69b Fix: Presets overriding drag-n-drop data
Currently, internal I/O operators can be invoked with drag-n-drop path
data, and when this happens a quick popup menu is shown to customize
import settings.

If these operators support operator presets, using a preset can
override path data given by drag-n-drop, and that can be unwanted
behavior.

While this can be fixed by setting path properties to SKIP_SAVE, doing
this would make these properties also to stop using ghost values. These
ghost values are used by the file select window to open operator last
import directory, and using this flag makes the file select windows
always open the home directory.

To fix that, add an explicit flag PROP_SKIP_PRESET that skips properties
writing to presets. Also clarify that PROP_HIDDEN and PROP_SKIP_SAVE
also avoid writing to presets.

Added a operator that can clean operator's specific property presets.
Importing presets from previous versions runs an automatic cleanup.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/117673
2024-02-06 20:02:27 +01:00
Damien Picard
5b9c176b68 I18n: extract and disambiguate a few messages
Extract:
- Operators' poll messages, including Python-defined ones.
- Use default translation context for the region toggle pie menu.
- Newly created F-Curve modifiers.
- Newly created video tracker track.
- Grease Pencil UV area status message
- Status messages in the graph slider operators.
- Status message "Text <text.py>" when opening .blend with
  auto-executing Python file.

Disambiguate:
- Track: can mean NLA track, video tracking, a tracking marker, or
  a track constraint.
- Tracking: can mean video tracking, or a track constraint.

Issue reported by Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/117855
2024-02-06 17:06:30 +01:00
Damien Picard
fa77e9142d UI: fix and improve a few messages
- "can not" -> "cannot" in many places (ambiguous, also see
  Writing Style guide).
- "Bezier" -> "Bézier": proper spelling of the eponym.
- Tool keymaps: make "Uv" all caps.
- "FFMPEG" -> "FFmpeg" (official spelling)
- Use MULTIPLICATION SIGN U+00D7 instead of MULTIPLICATION X U+2715.
- "LClick" -> "LMB", "RClick" -> "RMB": this convention is used
  everywhere else.
- "Save rendered the image..." -> "Save the rendered image...": typo.
- "Preserve Current retiming": title case for property.
- Bend status message: punctuation.
- "... class used to define the panel" -> "header": copy-paste error.
- "... class used to define the menu" -> "asset": copy-paste error.
- "Lights user to display objects..." -> "Lights used...": typo.
- "-setaudio require one argument" -> "requires": typo.

Some issues reported by Joan Pujolar and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/117856
2024-02-05 17:08:17 +01:00
Campbell Barton
a8e73616b9 Cleanup: rename add-on related variables for clarity
- Rename info to bl_info, to avoid confusion with extensions manifest,
  which should eventually be accessible in a similar way.
- Rename module_name to addon_module_name to avoid confusion with
  extension repositories name-spaced modules.
- Clarify naming for TOML manifest.
2024-02-01 17:03:40 +11:00
Scurest
f87cc8ca8f Addon: catch certain ZIP packaging errors in addon_install
One error that occurs when packaging a multi-file addon into a ZIP is
zipping the contents of the addon, instead of the addon directory.
When installing the ZIP using addon_install, the files that should be
inside a directory instead get extracted into the top-level of the
script directory. There was also no user feedback about what went wrong.

Detect this case and fail with an error.

Ref: !117664
2024-01-31 10:01:50 +11:00
Philipp Oeser
5a6034654c Fix #117547: RBD Bake to Keyframes no longer working
Since a99e419b6e, we now have to use `keyframe_insert_by_name` when
inserting keyframes with a specified keying set.

Pull Request: https://projects.blender.org/blender/blender/pulls/117624
2024-01-30 10:54:05 +01:00
Lukas Tönne
5ad49f4142 Geometry Nodes: Menu Switch Node
This patch adds support for _Menu Switch_ nodes and enum definitions in
node trees more generally. The design is based on the outcome of the
[2022 Nodes Workshop](https://code.blender.org/2022/11/geometry-nodes-workshop-2022/#menu-switch).

The _Menu Switch_ node is an advanced version of the _Switch_ node which
has a customizable **menu input socket** instead of a simple boolean.
The _items_ of this menu are owned by the node itself. Each item has a
name and description and unique identifier that is used internally. A
menu _socket_ represents a concrete value out of the list of items.

To enable selection of an enum value for unconnected sockets the menu is
presented as a dropdown list like built-in enums. When the socket is
connected a shared pointer to the enum definition is propagated along
links and stored in socket default values. This allows node groups to
expose a menu from an internal menu switch as a parameter. The enum
definition is a runtime copy of the enum items in DNA that allows
sharing.

A menu socket can have multiple connections, which can lead to
ambiguity. If two or more different menu source nodes are connected to a
socket it gets marked as _undefined_. Any connection to an undefined
menu socket is invalid as a hint to users that there is a problem. A
warning/error is also shown on nodes with undefined menu sockets.

At runtime the value of a menu socket is the simple integer identifier.
This can also be a field in geometry nodes. The identifier is unique
within each enum definition, and it is persistent even when items are
added, removed, or changed. Changing the name of an item does not affect
the internal identifier, so users can rename enum items without breaking
existing input values. This also persists if, for example, a linked node
group is temporarily unavailable.

Pull Request: https://projects.blender.org/blender/blender/pulls/113445
2024-01-26 12:40:01 +01:00
848f83e210 Anim: bone collections, add 'un-solo all' operator
Add an operator that clears the 'solo' flag from all bone collections.
2024-01-26 11:09:06 +01:00
f623c8f7bc Anim: remove 'Solo Visibility' bone collections operator
Remove the 'Solo Visibility' operator that singles out a bone collection.
It was a workaround for not having a true 'solo' flag, which is there
now.
2024-01-26 11:05:00 +01:00
Campbell Barton
0ea0573349 PyDoc: remove unnecessary newlines which caused invalid syntax
Resolves all warnings building Python docs.
2024-01-25 10:22:15 +11:00
Campbell Barton
1fa896bb9a Cleanup: move bl_description to doc-strings
This is already done almost everywhere, prefer doc-strings unless
there is a reason for the tool-tip and Python doc-string to differ.
2024-01-23 13:59:15 +11:00
9e5cdf52f6 Cleanup: fix indent in anim.py 2024-01-22 16:45:29 +01:00
a7354fb2af Anim: add operator to remove unused bone collections
Add an operator to remove all unused bone collections. This is added to
the bone collections "specials" menu and the tree view context menu.

A bone collection is considered "unused" when it has no bones assigned,
and also no child collection that has bones assigned.
2024-01-22 13:34:25 +01:00
Campbell Barton
3fe1097d24 Cleanup: lazily import bpy_extras.object_utils where possible 2024-01-19 11:52:08 +11:00
Thomas Dinges
61d0f7e118 UI: Update whats new link and check version rather than hardcoding it 2024-01-18 16:49:38 +01:00
Alexander Gavrilov
b350d7a4c3 Shape Keys: support locking to protect from accidental editing.
It is very common for graphical editors with layers to support
locking individual layers to protect them from accidental edits due
to misclicks. Blender itself already supports locking vertex groups.
This adds lock toggles for shape keys, with lock/unlock all operators.

The flags are checked by sculpt brushes, edit mode transform tools,
and Smooth, Propagate and Blend From Shape operators. This selection
aims to cover operations that only deform the mesh, where the shape
key selection matters.

Topology changing operations always apply to all keys, and thus
incorrect shape key selection is less impactful. Excluding them
from the new feature greatly reduces the patch size.

Pull Request: https://projects.blender.org/blender/blender/pulls/104463
2024-01-18 13:17:24 +01:00
acbb91b192 Fix: Anim, replace last arm.collections.all with arm.collections_all
Replace the last occurrences of `arm.collections.all` to
`arm.collections_all`. This has been the API since
015555b07a0aa8fa5e0ca8692eafd2c44dca429e.
2024-01-15 11:36:48 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
SebastianWitt
406a2fde91 UV: improve performance for lightmap unwrap
Replaces this search by representing the 3 edge lengths of each triangle
as 3d points and searching with a KD-tree.

On a mesh with ~20k Tris the old method runs in 40s while the new method
takes 0.23s with a difference of <0.001%.

Ref !113720
2024-01-11 10:32:07 +11:00