Commit Graph

2588 Commits

Author SHA1 Message Date
Lukas Tönne
3d6a142162 GPv3: Remove unused GPv2 operators
Removes many of the operators, panels, and menus used exclusively by Grease Pencil v2 that are no longer needed in v3.
No functional changes are expected.

Some operators are still used by the annotations system and have to be kept around. These may be renamed in future.

Pull Request: https://projects.blender.org/blender/blender/pulls/128521
2024-10-04 13:05:09 +02:00
Julian Eisel
7191608a98 Sculpt/Paint: Hide asset shelf by default in a few modes
Hides the brush asset shelf by default in weight paint, grease pencil
weight paint and grease pencil vertex paint mode. These only have one
bundled brush per tool available.

After bringing back some tools for brushes in certain modes
(3798852071), we want to hide the asset shelf in modes where there's
only one brush bundled per tool. While having these tools support
brushes can be useful, we don't expect to bundle more brushes soon. So
avoid a mostly empty asset shelf for a single brush by hiding it by
default and keeping it hidden until the user expands it (bf52f6f723 made
it possible to remember the visibility per mode).

Part of #128066 and #116337.
2024-10-04 12:27:04 +02:00
Pratik Borhade
bd4f7acce5 GPv3: Display layers when properties tab is pinned
Layer panel (also mask/ transform etc.) and other operators are gone
when properties tab is pinned and gpv3 object is non-active.
To fix this, get grease pencil pointer from `button_context()`
(done in `grease_pencil_context()`).

Continuation of cd476226d8

Pull Request: https://projects.blender.org/blender/blender/pulls/128475
2024-10-04 11:58:12 +02:00
Falk David
effa8fbb7a GPv3: Material Isolate Operator
This ports the `gpencil.material_isolate` operator to GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/128549
2024-10-04 10:38:04 +02:00
Jesse Yurkovich
cd74a279cc Cleanup: make format 2024-10-03 22:09:02 +02:00
Julian Eisel
71dee64743 Sculpt/Paint: Asset shelf option to filter brushes by the active tool
Part of: https://projects.blender.org/blender/blender/issues/128066

Adds a "Filter by Active Tool" option for the brush asset shelves,
enabled by default. If enabled, the asset shelf only shows brushes
matching the brush type of the current tool. If the general "Brush" tool
is active, only brushes that are not covered by another tool are
displayed. The popup brush selector always shows all assets.

The option is stored in the Preferences, toggled in the "Display
Settings" popover of the asset shelf.

Note: This is committed to the 4.3 release branch, which was discussed
in advance.

Pull Request: https://projects.blender.org/blender/blender/pulls/128450
2024-10-03 18:56:40 +02:00
Chris Clyne
5a27280916 EEVEE: Light & Shadow linking
This adds feature parity with Cycles regarding light and shadow liking.

Technically, this extends the GBuffer header to 32 bits, and uses
the top bits to store the object's light set membership index.
The same index is also added to `ObjectInfo` in place of padding bytes.

For shadow linking, the shadow blocker sets bitmask is stored per
tilemap. It is then used during the GPU culling phase to cull objects
that do not belong to the shadow's sets.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/127514
2024-10-03 18:41:06 +02:00
Sean
47c9520bcc Fix #128430: GPv3: Crash using "Shrink/Fatten" operator
The operator was called with the legacy `mode` setting for Grease Pencil.
New mode should be `CURVE_SHRINKFATTEN`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128532
2024-10-03 18:14:58 +02:00
Falk David
6b78894740 Fix: GPv3: Radial controls not working in some modes
The radial controls to set the brush size were not working in sculpt and
vertex paint mode.
This was because of a collision with the  `cyclical_set` operator in edit mode.
The issue was that the poll function for the edit mode keymaps also
passed in sculpt and vertex paint mode.

To solve this, add a keymap for these common selection operators and
separate them from the general edit mode keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/128542
2024-10-03 17:45:04 +02:00
Lukas Tönne
7cb0e8a558 Cleanup: GPv3: Separate weight paint context menu class
The paint, sculpt, and vertex-paint modes already have separate context
menu classes from GPv2. The GPv2 classes will be removed, this is just
a small refactor to prevent this change from getting lost in a big
cleanup PR. No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/128530
2024-10-03 13:42:54 +02:00
Lukas Tönne
c986aa03b9 GPv3: Remove unused GPv2 keymap entries
This should free up references to GPv2 types and operators and should
in turn make their removal easier.

- Remove keymaps for GPv2 operators from `blender_default.py` and
  `industry_compatible_data.py`
- Remove keymap poll callback assignment from `gpencil_ops.cc`
- Remove keymap handler registration from `area.cc:ed_default_handlers`

Pull Request: https://projects.blender.org/blender/blender/pulls/128480
2024-10-03 11:18:31 +02:00
Campbell Barton
1563ba7e6c Fix #128175: Updating extension can remove the extension on WIN32
On Windows an entire directory may be locked when any files inside it
are opened by another process. This can cause operations that
recursively remove a directory (uninstalling & updating) to fail
with a partially removed extension.

The case of uninstalling was already handled, where failure to remove
a directory would stage the extension for later removal.
In the case of updating however, the user could be left with a broken
(partially removed) extension where some files were removed, as the
directory was locked, the update would fail to extract new files.

Address this issue by renaming the directory before recursive removal.

The following logic has been implemented:

- If any files in the directory are locked, renaming will fail.
  So even though the operation fails the extension is left intact.

- If renaming succeeds, it's possible to apply the update.

  While it's possible (albeit unlikely) recursive removal fails,
  which could be caused by file-system permissions issues corruption or
  a process could open a file between rename & removal.

  In this case the renamed directory is staged for later removal.

Other changes:

- Resolve a related problem where the user could install an
  extension previously staged for removal, now installing an extension
  ensured it's not removed later.

  This would occur if uninstalling failed, the user resolves
  directory-lock, uninstalls again, then re-installs the extension.

- When an extension fails to be removed, don't attempt to remove
  user configuration for that extension.

  Prefer to keep the extension & it's settings in their "current state"
  if it can't be removed.
2024-10-03 12:15:27 +10:00
John Kiril Swenson
d2a802d3c6 VSE: Remove timeline box select
Remove the box select tool from the timeline to simplify selection
logic, avoid confusion for users, and make maintaining the code
easier in the future. It also brings the selection system  closer
to other industry-standard NLEs.

It also fixes an issue caused by d2091b4b1.

More details in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/128051
2024-10-03 00:37:00 +02:00
Pablo Vazquez
177e2ac837 Grease Pencil: Tool settings layout adjustments
Small adjustments to improve consistency in tool settings
between different tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/128491
2024-10-03 00:28:50 +02:00
Falk David
1829982d3b GPv3: Merge Layers Operator
This adds a function to merge layers in original Grease Pencil geometry.
It also adds an operator to merge layers as well as some tests for the `merge_layers` function.

The operator has 3 modes:
* `Merge Down`: Combine the active layer with the layer just below (if there is one).
* `Merge Group`: Combine all the layers in a group into one single layer and remove
  the group. Can be accessed in the right-click menu of groups.
* `Merge All`: Combine all the layers of the object into one single layer.

All of these can be accessed in the `Extras` menu next to the layer tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/128201
2024-10-02 18:28:30 +02:00
Lukas Tönne
dfc8a782f5 GPv3: Attribute panel to configure layer attributes on original data
This follows the same pattern as attribute panels for Mesh, Curves, and
Point Cloud. Only the layer domain is supported. The _add_ operator now
has to validate the domain setting on invoke, because layer attributes
don't support the default `Point` domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/128471
2024-10-02 13:58:13 +02:00
Falk David
a25456eaf1 Fix: GP: UI errors when no layer tree node is active
The UI code assumed that either a layer or a group is always
active which is not always the case. It can happen that nothing
is active.
The fix makes sure the this case is handled correctly.
2024-10-02 12:41:11 +02:00
Julian Eisel
78e330923d UI: Tree-view scrolling and resizing support
Implements scrolling support for tree-views, as well as changing the size of the
scroll-able tree-view. This is important to be able to place them in many places
in the UI, where a compact layout is preferred over an every expanding one
(causing following contents to be scrolled out of view). UI-lists would use
scrolling and resizing to ensure this, now tree-views are on par.

Enables scrolling and resizing for:
- Bone collection UI (`UILayout.template_bone_collection_tree()`)
- Grease Pencil layer UI (`UILayout.template_grease_pencil_layer_tree()`)
- Light link collection UI (`UILayout.template_light_linking_collection()`)
- UI to define a node tree interface (`UILayout.template_node_tree_interface()`)

These are all cases where compact UIs make more sense than expanding ones.

Internally this is enabled by calling the `set_default_rows()` method of the
tree-view, although the API might change still. It shouldn't be quite simple to
implement this for grid-views too if necessary, or other potential view types.

Although I'd like to do some smaller code quality improvements still, this
feature is important for some other modules (e.g. grease pencil module for the
layers UI in grease pencil v3), so I decided to prioritize merging this.

Pull Request: https://projects.blender.org/blender/blender/pulls/119668
2024-10-02 11:19:49 +02:00
Campbell Barton
0b69e1d6f5 Cleanup: double quotes for strings, replace f-string with str.format 2024-10-02 15:46:11 +10: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
Casey Bianco-Davis
b4881f6b0a GPv3: Layer Tint Color, Radius Offset and Adjustments panel.
This adds the layer adjustments back.
There is a the `Adjustment` panel under the layer properties with
the tint color, the tint factor, and the radius offset (now in meters).

The tint and radius offsets are stored as layer attributes.

For compatibility and the sake of not making the conversion code more complicated,
legacy layer adjustments are always converted to modifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/126777
2024-10-01 19:04:32 +02:00
Pablo Vazquez
7b91f71ebf Grease Pencil: Move Layer selector and tool settings
Move the Layer selector to the header, centered, with icons and
without labels, to match other modes that display the source
there (such as Vertex Groups, Color Attributes, etc).

Additionally, move the tool settings from the header  to the right
hand side of the toolbar. Matching mesh and other modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/128439
2024-10-01 18:36:29 +02:00
Jonas Holzman
92d00678ac macOS: Add Image Clipboard Copy/Paste Support
This Pull Request adds support for image clipboard copy-pasting to the Image Viewer on macOS, accepting sources from both raw image data and image files.

Tracking Issue: #111404

Pull Request: https://projects.blender.org/blender/blender/pulls/126574
2024-10-01 18:32:32 +02: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
Julian Eisel
3798852071 Sculpt/Paint: Bring back some brush tools for paint modes
Since brush assets were merged, all sculpt and paint modes have a unified
"Brush" tool that is used for all brushes. Based on feedback, this mixes brush
types a bit too much, so some specific tools that use brushes should be brought
back. These brush types just behave very different from the main brush types,
and users expect them to be easily accessible from the toolbar. This also makes
them more discoverable and having tools that remember their last used brush can
be useful too (e.g. assigning shortcut to eraser tool to switch back to last
used eraser, rather than a specific eraser brush).

Note that further changes are planned, to get a true "best of both worlds"
design, where people can use a global brush library without having to worry
about tools, but brushes can also be accessed via tool categorization.
The new design works well with both mental models without being a compromise
in-between.

a79f9100a6 already brought back some tool for grease pencil draw mode, with this
commit the design is now applied to all sculpt & paint modes.

See PR for a list of tools that were brought back.

Design Task: https://projects.blender.org/blender/blender/issues/128066
Pull Request: https://projects.blender.org/blender/blender/pulls/128038
2024-10-01 18:03:33 +02:00
Nika Kutsniashvili
d70b10dcd4 UI: Add missing items & reorganize grease pencil menus
Some important operators & menus (like gesture select & animation)
were missing from grease pencil menus, and some of them had
inconsistent labels/placements.

Pull Request: https://projects.blender.org/blender/blender/pulls/128427
2024-10-01 17:04:50 +02:00
Pablo Vazquez
e9bce13bfb UI: Fix case in Grease Pencil Auto-Masking
Every word should be capitalized, as established in the guidelines.

Matches mesh sculpt Auto-Masking.
2024-10-01 16:37:20 +02:00
Campbell Barton
729004390d Cleanup: quiet pylint warnings for extensions 2024-10-01 16:07:05 +10:00
Campbell Barton
38c30c5c43 Extensions: resolve test failing
Enable the extensions add-on by default, without this, it's enabled
on startup, causing the preferences to be tagged as modified.
2024-10-01 15:36:54 +10: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
22cdf8da1e Extensions: only apply SSL workaround for Python older than 3.12.6
Skip the workaround for versions of Python that contain the fix.
2024-10-01 13:06:05 +10:00
Campbell Barton
9f072ecefb Cleanup: remove unused exception values 2024-10-01 10:30:04 +10:00
Campbell Barton
58fe7c9b22 Cleanup: remove unused imports, exception values 2024-10-01 10:24:22 +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
Colin Basnett
22d78c5a8e Geometry Nodes: add Matrix Determinant node
Pull Request: https://projects.blender.org/blender/blender/pulls/128212
2024-09-30 21:30:10 +02:00
Jacques Lucke
b22a1499a4 Geometry Nodes: remove "Zone" from menu entries
This was accepted in #128384. The term "zone" is known well enough now
that it's not really necessary to show it in the menu anymore.
2024-09-30 17:09:00 +02:00
Jacques Lucke
70cdfabf79 Geometry Nodes: shorten foreach zone menu entry
This changes the name from `For Each Geometry Element` to just `For Each
Element`. While we might have more foreach zones in the future, it's not clear
yet whether the longer name will be necessary to differentiate the zones. So
better just use the better looking name for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/128384
2024-09-30 17:04:36 +02:00
Dalai Felinto
dc7645ff95 Extensions: Manifest polishing
* Match name with the extension ID.
* More strict double comment for optional parameters.
* Comment out tag since it is optional.
* More complete explanation for the paths_exclude_pattern.
2024-09-30 16:15:43 +02:00
priera
ce7667f3b1 GPv3: Join Operator
Adds the `Join` operator in edit mode to connect the selected strokes
by their endpoints.

Resolves #113582 and #113570.

Pull Request: https://projects.blender.org/blender/blender/pulls/117916
2024-09-30 12:16:40 +02:00
Pablo Vazquez
05a398cf45 UI: Preferences: Align new Editor properties
Place all Editor properties in an aligned column on top of other
more general widget properties.
2024-09-27 18:03:47 +02:00
Falk David
19465bec19 GPv3: Add canvas options to the overlay settings
This adds the color, subdivisions, scale, and offset options to the canvas overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/128259
2024-09-27 16:58:38 +02:00
Falk David
954f723421 Cleanup: GPv3: Remove duplicated "Add Extra" menu
This got duplicated by mistake during a merge.
2024-09-27 16:53:31 +02:00
Lorenzo-Carpaneto
29c6e6c5b2 GPv3: "Select Similar" operator
Implements the "Select Similar" operator for Grease Pencil v3.

Several modes are available. Each mode has a dedicated "distance" metric:
- layer, material: compared by index
- radius, opacity: simple value difference
- vertex color: euclidian float4 distance metric

The implementation uses a `Set` to find selected values first, then compare each point attribute value to each value in the set until a distance below the threshold is found. This could be optimized by using a KD-Tree in the future. Layer comparison is a special case because points are already separated into drawings by layer, so any drawing in a "selected" layer is becomes fully selected.

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/111410
2024-09-27 16:51:19 +02:00
casey bianco-davis
a75259fa14 GPv3: Make the Remove button work with groups.
This makes the `remove` delete groups when active.
The items inside of the group will not be deleted (i.e. `ungroup`)

Pull Request: https://projects.blender.org/blender/blender/pulls/128002
2024-09-27 16:39:59 +02:00
Christoph Lendenfeld
85e4bd19f6 Anim: Separate Slots operator
This adds an operator that splits all slots of the action on the active object,
into separate actions.

The newly created actions will be named `slot_name+Action`.
All users of those slots will be reassigned to this new action.

The exploded action will not be deleted, but will end up with 0 users
unless a fake user is set.

------

For the review, does that operator name make sense?

Pull Request: https://projects.blender.org/blender/blender/pulls/128251
2024-09-27 16:39:29 +02:00
Sybren A. Stüvel
ad2207243a Anim: invisible UI tweak for Action and Slot selectors in Properties Editor
Set `use_property_decorate = False` in the Animation panels in the
Properties editor. This has no visual effect right now, but if we ever
decide to add labels to the selectors, this will ensure that the layout
remains correct.

Context: `layout.template_action()` and `layout.template_search()` respond
differently to the default of `use_property_decorate = True`.
2024-09-27 16:33:27 +02:00
casey bianco-davis
04a3916a3a GPv3: Add Add Group button under the Add Layer button
This adds a button for creating a new group/folder.
Having this as an exposed button makes it faster to create groups.

This also removes the entry for adding a group in the extra menu
since it's no longer needed there.

Pull Request: https://projects.blender.org/blender/blender/pulls/128000
2024-09-27 16:23:11 +02:00