Commit Graph

363 Commits

Author SHA1 Message Date
Campbell Barton
9bd2e3554a Merge branch 'blender-v4.3-release' 2024-10-16 15:07:33 +11:00
Campbell Barton
c3b067dc80 Cleanup: single/double quote use in scripts 2024-10-16 14:45:08 +11:00
Damien Picard
5715693a97 UI: Use title case for Grease Pencil, Freestyle, Line Art
This was already the case for the vast majority of occurrences, and is
recommended by the human interface guideline's writing style.

Pull Request: https://projects.blender.org/blender/blender/pulls/129000
2024-10-15 13:00:47 +02:00
Clément Foucault
5b70445460 Merge branch 'blender-v4.3-release'
# Conflicts:
#	scripts/addons_core/bl_pkg/bl_extension_ops.py
2024-10-10 16:21:51 +02:00
Sybren A. Stüvel
a564e678f0 Fix #128797: Custom property Data-Block Type only has Object ID Type
In the WindowManager code, use `bpy.types.ID.id_type` enum property to
get all valid ID types, instead of using a property on the `Action`
type.

Pull Request: https://projects.blender.org/blender/blender/pulls/128834
2024-10-10 14:33:31 +02:00
Bastien Montagne
2b72cccc85 Merge branch 'blender-v4.3-release' 2024-10-09 15:59:01 +02:00
Bastien Montagne
e2705a432a Fix #128767: Regression: Batch Rename failed to rename bones.
Regression from 8c3a3bb9a3, did not realize all items were not
necessarily actual IDs.
2024-10-09 15:57:19 +02:00
Sybren A. Stüvel
411f399a7f Anim: disable 'New Slot' operator on linked Actions
The 'New Slot' operator now checks for editability of the Action.

Pull Request: https://projects.blender.org/blender/blender/pulls/128708
2024-10-08 15:20:55 +02:00
Sybren A. Stüvel
dba78ebb66 Cleanup: clarify 'disabled' message in anim.slot_new_for_id poll function
The old text seemed to suggest that an Action Slot can only be created at
the moment of assigning the Action to something. That is not the case.
The operator just works on the assigned Action, and if none is assigned,
there is nothing it can do.
2024-10-07 18:29:50 +02:00
Campbell Barton
dadb9ba5dc Cleanup: script formatting 2024-10-02 15:42:46 +10:00
Harley Acheson
8d0fc95fb6 Cleanup: Make format
Just the result of running Make Format
2024-10-01 12:17:43 -07:00
Julian Eisel
33b670a65d Sculpt/Paint: Automatically switch tools when activating brushes
As discussed in #128066, we want that activating a brush makes sure the
most appropriate tool is activated. For example activating an eraser
brush should activate an eraser tool, if available. This makes the
tool and brush binding two ways, which is more clear. Plus it means that
users don't have to care about tools at all if they don't want to, they
can just keep switching brushes and Blender takes care of the tool.

Implementation wise, this works by letting a Python operator lookup a
tool for a given brush type name, when activating a brush.

Design Task: https://projects.blender.org/blender/blender/issues/128066
2024-10-01 18:21:15 +02:00
Campbell Barton
a7ab81d927 PyAPI: remove use of BaseException
BaseException was used as a catch-all in situations where it
didn't make sense and where "Exception" is more appropriate
based on Python's documentation & error checking tools,
`pylint` warns `broad-exception-caught` for e.g.

BaseException includes SystemExit, KeyboardInterrupt & GeneratorExit,
so unless the intention is to catch calls to `sys.exit(..)`,
breaking a out of a loop using Ctrl-C or generator-exit,
then it shouldn't be used.

Even then, it's preferable to catch those exceptions explicitly.
2024-10-01 13:18:46 +10:00
Campbell Barton
4c36f9a566 Cleanup: simplify attribute access
Avoid getattr(..) when values are know to exist.
2024-10-01 10:23:04 +10:00
Campbell Barton
0afce08c20 Cleanup: use Python format specifiers 2024-10-01 10:14:48 +10:00
Campbell Barton
6cbdf0223b Cleanup: defer imports on startup 2024-10-01 10:01:16 +10:00
Campbell Barton
a9dee36974 Cleanup: remove unused variables, imports 2024-09-27 23:37:18 +10:00
Jacques Lucke
6e5e01e630 Geometry Nodes: new For Each Geometry Element zone
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
2024-09-24 11:52:02 +02:00
Bastien Montagne
8c3a3bb9a3 Fix #128006: Liboverride objects can be renamed using batch rename.
Do not allow renaming liboverride IDs from batch-rename either.

Users who really want to rename liboverrides should use python/RNA API
instead, this should not be exposed to standard UI tools (as renaming
liboverride IDs can lead to quite some confusing setups).
2024-09-23 15:45:02 +02:00
Sybren A. Stüvel
615cb46412 Anim: add Action Slot selector to Action Constraint
Add slotted Actions support to Action constraints.

The user interface can be improved once #127751 lands.

Ref: #120406
Pull Request: https://projects.blender.org/blender/blender/pulls/127749
2024-09-20 08:07:15 +02:00
Red-Andringa
8345ebc704 Fix batch renaming object data from the outliner
Correct typo is_editabe > is_editable.

Ref: !127675
2024-09-16 19:20:18 +10:00
Campbell Barton
81e2ccbf2b Cleanup: spelling in comments 2024-09-13 10:56:26 +10:00
Sybren A. Stüvel
3417934eff Anim: add Action Slot assignment to NLA strip
For an NLA strip to use a slotted Action, it needs to specify which slot
to use in that action. This is now handled by two new properties on the
strip in DNA & RNA: `action_slot_handle` and `action_slot_name`.

These serve the same purpose as their counterparts on the `AnimData`
struct.

Note that this commit does NOT add NLA evaluation support for slotted
Actions. It merely allows assigning them. Evaluation, tweak mode
support, etc. will be implemented in future commits.

Pull Request: https://projects.blender.org/blender/blender/pulls/127359
2024-09-12 14:08:16 +02:00
Jacques Lucke
1a52f2bbab Fix #126924: instable fire simulation by default
The cfl_condition default was changed in 9a0a75eff0 with the intention
of making liquids behave better. However, that degraded the simulations of fire.

Now the property will be set to its old value if the quick smoke operator is used.
Can't think of a great way always use the old value for smoke simulations for now.
2024-09-11 17:48:20 +02:00
Campbell Barton
97179b10fb Refactor: make "sys_info" an internal module, rename for clarity
- Move sys_info into an internal module to avoid having so many
  top level modules for Blender's internal functionality.
- Rename system_info sub-modules that pre-fill URL's for clarity.
- Move top-level exception handling into the operator.
- Report an error if an unexpected exception occurs.
- Use `Exception` instead of `BaseException` as there is no reason to
  catch the additional exceptions.
- Remove use of sys_info from the command line example,
  replace with in-lined system info.
2024-09-06 11:11:26 +10:00
Campbell Barton
e34d9eeac7 Cleanup: use C-style comments, double quote Python text 2024-09-03 21:22:34 +10:00
Alaska
3196ef1636 Add a script to collect system information when Blender isn't opening
This commit adds a python script that can collect some of the
information necessary to fill out a bug report.

The primary use case is to help users collect system information for
a bug report in the case that Blender can't open.

CMD and sh files are included to help users use the Python script.

Ref !122191
2024-09-03 13:26:54 +10:00
Sybren A. Stüvel
a6d7e12e22 Anim: New/Un-assign Slot operators
Add two new operators, `anim.slot_new_for_id` and
`anim.slot_unassign_from_id`. These are used in the Action editor and
the Animation panels in the Properties editor, to respectively create a
new Action Slot for an ID and to unassign whatever slot is currently
assigned to that ID.

The latter operator also replaces the C++ operator
`anim.slot_unassign_object`, which was specifically made for the
Dopesheet header. The Python ones are generic enough to be used there
too.

Pull Request: https://projects.blender.org/blender/blender/pulls/126943
2024-09-02 14:10:49 +02:00
Campbell Barton
780686f885 Cleanup: correct code-comment 2024-08-26 11:50:14 +10:00
Lukas Tönne
400c738db9 GPv3: Import and export for SVG and PDF
Implements the SVG import/export and PDF export operators for GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/123996
2024-08-20 11:41:37 +02:00
Campbell Barton
8a7ff41a85 Cleanup: wrap long lines in Python scripts 2024-08-19 10:48:07 +10:00
YimingWu
4f4add5406 Fix #125426: Update paths in animation when renaming IDProperty
Previously when renaming an IDProperty the existing paths in the
animation/driver system isn't updated, this leads to missing animation
after renaming the property. Now `BKE_animdata_fix_paths_rename_all`
will be called so the animation system records the updated name.

Pull Request: https://projects.blender.org/blender/blender/pulls/125474
2024-08-15 13:56:17 +02:00
Campbell Barton
74fae7f943 Presets: remove poll functions that scan the file-system
The poll functions for theme & key-map preset operators used functions
documented not to be used on redraw draw and could make the interface
slow when extensions (for example) are stored on a network file-system.

While the file-system lookups are typically cached, it can still cause
occasional stuttering or hanging. In general scanning the file-system
on poll should be avoided.
2024-08-15 16:06:17 +10:00
Campbell Barton
9e09351b5b Fix active theme behavior when adding/removing themes
Regression in [0] which displays the filename for the active
theme but still used the label internally.

This meant actions such as removing the theme would not always apply
to the name being displayed.

- Adding a new theme was not setting it active.
- Detecting if a theme was built-in used the run-time label as a lookup.
- Theme removal first require it to be re-selected.

[0]: 0bb6317035
2024-08-15 16:06:13 +10:00
Campbell Barton
9f931ee3d2 Presets: consider presets within the extensions repo to be "built-in"
It was possible to remove a preset defined within an extension,
the only way to restore it was to uninstall & re-install the extension.
2024-08-15 16:06:11 +10:00
Campbell Barton
5110833ff1 Extensions: use wait cursor when toggling add-ons
Add-ons with large wheels can take a while to extract,
set the wait cursor so it's clear Blender is busy.
2024-08-06 12:48:08 +10:00
Campbell Barton
fc6a99e0d2 Fix #77837: Error removing addons/extension/wheels on WIN32
When deleting files on WIN32, open files cannot be removed.
This is especially a problem for compiled Python modules which
remain open once imported.

Previously it was not as common for add-ons to include compiled Python
modules however with extensions supporting Python-wheels,
it's increasingly likely users run into this.

Workaround the problem by:
- Scheduling the files for removal next time Blender starts.
- Rename paths that cannot be removed to avoid collisions when
  the paths is reused (re-installing for example).

This is supported for:
- Extensions.
- Python wheels.
- Legacy user add-ons.
- App-templates.

Details:
- On startup, a file exists that indicates cleanup is needed.
  In the common case the file doesn't exist.
  Otherwise module paths are scanned for files to remove.
- Since errors resolving paths to remove could result in user data loss,
  ensure the paths are always within the (extension/addon/app-template)
  directory.
- File locking isn't used, if multiple Blender instances start at the
  same time and try to remove the same files, this won't cause errors.
  Even so, remove the checking file immediately avoid unnecessary
  file-system access overhead for other Blender instances.

Also resolves #125049.
2024-08-05 09:49:14 +10:00
Campbell Barton
afa44b16a6 Fix error installing app-templates & legacy add-ons overwriting symlinks
Resolve error when overwriting existing Python modules would attempt
to recursively remove a symlink which raised an error.

Related to #123827, same error but for extensions.
2024-08-04 20:58:48 +10:00
Julian Eisel
0baeca8f9e Fix #123735: Tooltip missing from open URL preset operator
Necessary because the "type" property is no longer the default
`bl_property` since 7bc34283ea.
2024-07-25 12:28:50 +02:00
Campbell Barton
4cf9f53946 Cleanup: remove unused BUG_ADDON URL preset 2024-07-24 13:35:41 +10:00
Guillermo Venegas
6e152df547 Fix #125319: Can't drop images in uv editor
Caused in b97ac126f8

Pull Request: https://projects.blender.org/blender/blender/pulls/125322
2024-07-23 19:02:12 +02:00
Campbell Barton
dc74a98b9e Cleanup: remove unused imports 2024-07-23 15:58:21 +10:00
Thomas Dinges
8aedcd5143 Merge branch 'blender-v4.2-release' 2024-07-15 16:41:40 +02:00
Jeroen Bakker
b761d3435f Image Plane: Add support for EEVEE
- Fixes incorrect handling of incompatible engines. There is a global list of compatible
  engines, but `create_cycles_material` didn't use it, displaying an incorrect warning
  when using the operator.
- Add `BLENDER_EEVEE_NEXT` to compatible engines.
- Remove `BLENDER_EEVEE` from compatible engines.
- Add render method option. This replaces the material `blend_method`
- Remove material blend method option (replaced by `render_method`)
- Remove material shadow option. Not needed anymore as shadows use
  the node tree for evaluation.

**TODO**
- Manual should still be updated. Will be done after this patch lands.
- I did some basic tests. I am not familiar with this operator, but think it
  should handle all the different cases. Would be nice to have some
  render tests for this to detect regressions.

Implements: #122315
Pull Request: https://projects.blender.org/blender/blender/pulls/124094
2024-07-15 15:35:57 +02:00
Campbell Barton
b8fc441fdd Merge branch 'blender-v4.2-release' 2024-07-09 13:47:10 +10:00
Campbell Barton
5d379b9887 Cleanup: remove type hints, follow code style for core scripts 2024-07-09 13:32:30 +10:00
Jesse Yurkovich
5bb5cfd97a Merge branch 'blender-v4.2-release' 2024-07-08 09:07:07 -07:00
Julian Eisel
56387f5be5 Assets: Disable "Open Blend File" operator for assets from asset system files
Asset system files (using the `.asset.blend` extension) are special and cannot
be edited like normal files. Opening them showes warnings about this. So better
not "encourage" editing these files that much.

Note that this check will result in false positives, since users may create
files with this extension. Asset system files have an extra flag stored
identifying them. Accessing that from the asset representation is a bit more
involved, probably requires changes in the asset indexer. For now keeping it
simple, the false positives are not a big deal for this convenience operator.

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

Part of the brush assets project, see:
- https://projects.blender.org/blender/blender/issues/116337
- https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 17:50:24 +02:00
Sybren A. Stüvel
9d3dc77e05 Anim: move Bone Selection Sets add-on into Blender
The functionality of the Bone Selection Sets add-on is now integrated
into Blender itself. Rigify has been updated to no longer check for the
add-on, but just assume that the functionality is available.

The keymap is still the same, and so are all the class names. This
ensures that there are no conflicts when people still have the old
add-on enabled somehow. And there is versioning code to remove the
'add-on enabled' state so that Blender won't complain it cannot find it
any more.

Compared to the add-on, the following changes are made:

- The 'bone' icon has been removed from the list of available selection
  sets. It was the same for each entry anyway, and thus didn't provide
  any information.
- The code has been split up into multiple files, with the UI elements
  in `scripts/startup/bl_ui/properties_data_armature.py` and the
  operators in `scripts/startup/bl_operators/bone_selection_sets.py`.
- Helper functions and classes are prefixed with `_` to indicate that
  they are not part of any public API.
- The `Operator` helper subclasses have been transformed to mix-in
  classes. This way the only subclasses of `Operator` are the actual
  operators.
- Comments & descriptions have been updated for clarity & consistency.

This commit contains code by the following authors, ordered by number of
commits in the original add-on repository, highest first:

Co-Authored By: Ines Almeida <britalmeida@gmail.com>
Co-Authored By: Sybren A. Stüvel <sybren@stuvel.eu>
Co-Authored By: Campbell Barton <ideasman42@gmail.com>
Co-Authored By: meta-androcto <meta.androcto1@gmail.com>
Co-Authored By: Demeter Dzadik <Mets>
Co-Authored By: lijenstina <lijenstina@gmail.com>
Co-Authored By: Brecht Van Lommel <brechtvanlommel@gmail.com>
Co-Authored By: Aaron Carlisle <carlisle.b3d@gmail.com>

For the full history see the original add-on at:
https://projects.blender.org/blender/blender-addons/commits/branch/main/bone_selection_sets.py

Reviewed On: https://projects.blender.org/blender/blender/pulls/124343
2024-07-08 16:28:42 +02:00
Bastien Montagne
b42f2b7634 Merge branch 'blender-v4.2-release' 2024-07-04 11:08:56 +02:00