Commit Graph

3276 Commits

Author SHA1 Message Date
Lukas Tönne
2459247f9f GPv3: Enable selection operators and overlays in vertex paint mode
Vertex paint mode also supports masking based on selection, so the
selection overlay and relevant operators should also be enabled in that
mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128114
2024-09-25 12:40:46 +02:00
Casey Bianco-Davis
9b0160ffb6 Cleanup: GPv3: Share layer menu drawing code
Share layer menu drawing code to reduce duplication
and guaranty they are the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/128005
2024-09-25 10:30:14 +02:00
Harley Acheson
8450aa275f UI: Area Docking as Regular Feature, Not Experimental
This PR makes "Interactive Editor Docking" a regular feature, available
by default, and removes the option from Experimental Preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/127810
2024-09-24 23:23:48 +02:00
Sean Kim
591f4c0e59 Sculpt: Add Mask from Boundary Operator
This commit adds the Mask from Boundary operator, which creates or
otherwise modifies a mask based on the the mesh boundary or the face
set boundaries of the mesh.

Conceptually, it behaves similarly to the corresponding automasking
options and the existing Mask from Cavity operator. When applying this
setting, it either uses the global scene value, the brush specific
value, or the operator-defined values. As such, it is exposed in the
existing automasking menus and inside the main Mask menu in Sculpt mode.

Based on this [1] RCS request.

[1] https://blender.community/c/rightclickselect/DYKy/

Pull Request: https://projects.blender.org/blender/blender/pulls/127787
2024-09-24 18:02:30 +02:00
Lukas Tönne
23cd299ba7 GPv3: Selection support in Sculpt mode
Supporting selection operators and overlays in sculpt mode is necessary
to support masking operations.
This enables selection drawing in the overlay in sculpt mode,
and ensures all the necessary operators (pick, lasso, circle, box)
handle the differences in modes correctly.

The selection code so far was expecting object mode, so the `vc->obedit`
object was used without further checks. Now the selection code can be
called outside of edit mode, in which case the `vc->obact` object must
be used instead. Similarly edit mode and sculpt mode have separate
`selectmode` flags, so the correct mode property must be used from the
tool settings depending on the object mode. These changes require some
refactoring of unrelated selection code.

Pull Request: https://projects.blender.org/blender/blender/pulls/128040
2024-09-24 16:27:06 +02:00
casey bianco-davis
a0021ed862 GPv3: Move layer operator.
Add `move layer` operator and move UI to match the legacy Grease Pencil's UI.
This will also move groups when selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/127999
2024-09-24 14:59:11 +02:00
Falk David
c496ad20c8 GPv3: Draw Mode: Reorder tools in toolbar
These changes were discussed in the previous [module meeting](https://devtalk.blender.org/t/2024-09-23-grease-pencil-module-meeting/36748).
* The primitive tools are grouped together, the default is the box primitive.
* The order of draw tools now is 1) Draw 2) Erase 3) Fill 4) Primitives

Pull Request: https://projects.blender.org/blender/blender/pulls/128062
2024-09-24 13:41:05 +02: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
casey bianco-davis
1b6220a4ba GPv3: Fill gradient tool
This adds a gradient tool allowing the user to specify a gradient by dragging from a start to a end point.
This behaves the same as most gradient tool in other softwares.

Pull Request: https://projects.blender.org/blender/blender/pulls/120121
2024-09-24 11:25:28 +02:00
Jeroen Bakker
5c8ce24d40 Preferences: Don't show preferred device in OpenGL
When overriding the GPU backend to OpenGL from the command line the
vulkan device was still visible in the preferences. This is fixed by
testing both the active backend and the backend in the preferences to be
vulkan.
2024-09-24 09:46:40 +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
Charlie Jolly
bf04513dec Geometry Nodes: new Integer Math node
Provide building block support for integer operations.

Manipulation of integer based data should not be limited to using float math nodes.
Using float math comes with accuracy issues for larger integers and requires unnecessary
type conversions.

The node also adds some integer specific operations like GCM and LCD.

Pull Request: https://projects.blender.org/blender/blender/pulls/110735
2024-09-23 15:01:31 +02:00
dupoxy
c07b89b329 Fix #127968: Add label to the grease pencil overlays Panel
Pull Request: https://projects.blender.org/blender/blender/pulls/127972
2024-09-23 13:11:22 +02:00
Jeroen Bakker
ddb2179e37 Vulkan: GPU device selection
Allows users to override the auto detection for GPU
selection. Normally the GPU selection is done by looping
over the order Vulkan provides and finding the highest
performing device based on its type (discrete, integrated,
software).

However users might have multiple discrete cards and want
to switch between them. Or developers want to validate other
GPUs without rebooting.

This PR adds the ability to override the auto detection
for the vulkan backend.

![image](/attachments/5d9198a8-af08-4eee-aa73-363edea11cd9)

**Future improvements**:
- This PR does not include a command line option. This can be added
  later for render farms.

Pull Request: https://projects.blender.org/blender/blender/pulls/127860
2024-09-23 11:18:24 +02:00
Casey Bianco-Davis
fb2fc0759b Fix: GPv3: UnboundLocalError when no layer or group is active.
This fixes `UnboundLocalError` when in draw mode with no layer or group active.

Pull Request: https://projects.blender.org/blender/blender/pulls/128001
2024-09-23 09:58:27 +02:00
casey bianco-davis
849d8bc3d6 GPv3: Missing stroke panel in tool properties tab
Stroke panel was missing due to wrong `bl_parent_id`

Pull Request: https://projects.blender.org/blender/blender/pulls/119857
2024-09-21 12:57:41 +02:00
Lukasz Czyz
788bc5158e UV: add support for the SLIM unwrapping algorithm
Integrate an existing implementation of the SLIM unwrapping algorithm
into Blender. More info about SLIM here:
https://igl.ethz.ch/projects/slim/

This commit is based on the integration code written by Aurel Gruber
for Blender 2.7x (unfinished and never merged with the main branch).

This commit is based on Aurel's code, rebased and further improved.

Details:

- Unwrap has been moved into a sub-menu,
  slim unwrapping is exposed as: "Minimum Stretch".
- Live unwrap with SLIM refines the solutions using a timer.
- When using SLIM there are options to:
  - Set the number of iterations.
  - Weight the influence using vertex weights.
- SLIM can be disabled using the `WITH_UV_SLIM` build option.

Co-authored-by: Aurel Gruber <aurel.gruber@infix.ch>

Ref !114545
2024-09-21 16:48:53 +10:00
Campbell Barton
f030e6f0b2 Cleanup: spelling in comments 2024-09-21 16:22:52 +10:00
Julian Eisel
a79f9100a6 Grease Pencil: Bring back eraser and fill tools (now using brush assets)
Followup to a38c96b92c, which implemented the necessary sculpt, paint and
tool-system changes. All this commit has to do is bring back the tool
definitions.

The brush assets project merged all brush based tools into a single, "Brush"
tool. After feedback, we want to bring back some of the previous brush based
tools. For example in grease pencil draw mode, not having an eraser or fill tool
available, and having to go through all the brush assets instead made the
workflow more cumbersome, and features less discoverable (an eraser tool in the
toolbar is quite easy to find, a brush deep down in the asset library may not
be).

Pull Request: https://projects.blender.org/blender/blender/pulls/125449/files
2024-09-20 18:13:19 +02:00
Julian Eisel
a38c96b92c Sculpt/Paint: Bring back support for multiple brush based tools
Design: https://projects.blender.org/blender/blender/issues/126032

The brush assets project merged all brush based tools into a single, "Brush"
tool. After feedback, we want to bring back some of the previous brush based
tools. For example in grease pencil draw mode, not having an eraser or fill tool
available, and having to go through all the brush assets instead made the
workflow more cumbersome, and features less discoverable (an eraser tool in the
toolbar is quite easy to find, a brush deep down in the asset library may not
be).

With this commit we can add back some tools for specific brush types in sculpt &
paint modes. The follow up commit will start with the eraser and fill tools for
grease pencil draw mode, but more tools in other modes are expected to follow.

For every brush type that has a tool in the toolbar, the last used brush is
remembered. This is the biggest part of the changes here.

Brush asset popups will only show the brushes supported by the active tool for
now. The permanent asset shelf region displays all brushes. Activating a brush
that isn't compatible with the current tool will also activate the general
"Brush" tool, but while the brush tool is active we never switch to another one
(e.g. activating an eraser brush will keep the "Brush" tool active). All this
might change after further feedback.

Pull Request: https://projects.blender.org/blender/blender/pulls/125449
2024-09-20 18:09:31 +02:00
Philipp Oeser
52be15071f UI: dim the hide_select property whenever the bone is hidden
suggestion by @dr.sybren in !127340
2024-09-20 18:00:05 +02:00
Philipp Oeser
b58f61a91a Fix: inconsistent bone selection after hiding or changing selectability
In blender, hidden items should not be selected.
Also, making an item unselectable should deselect it.

- in armature editmode (unlike posemode), hiding a bone through RNA
(unlike though the Outliner) would not deselect the bone
- in armature editmode (unlike posemode), hiding a bone through RNA
would not update the Outliner
- in armature posemode (unlike editmode), making a bone unselectable did
not deselect it (at least it did not update properly)

To resolve, add deselection to the RNA update functions and add needed
depsgraph tagging
Also add Bone selectability checkbox to Properties Editor (could be
split in a separate commit) -- came up in #127180.

Pull Request: https://projects.blender.org/blender/blender/pulls/127340
2024-09-20 17:42:41 +02:00
Sybren A. Stüvel
26379c2b01 Anim: Update Action Slot selectors in the UI
Now that #127751 has landed, `layout.template_slot(...)` calls can pass a
text to use as label. This produces a nicer layout than possible before.

Pull Request: https://projects.blender.org/blender/blender/pulls/127905
2024-09-20 14:33:24 +02:00
Sean Kim
bd7c6208b7 GPv3: Add Bake Grease Pencil Animation operator
This commit ports over the legacy Grease Pencil "Bake Object Transform
to Grease Pencil" (`GPENCIL_OT_bake_grease_pencil_animation`) to GPv3.

It is accessed in the same location as the old operator, via the menu
path Object > Animation > Bake Object Transform to Grease Pencil

Pull Request: https://projects.blender.org/blender/blender/pulls/126581
2024-09-20 10:53:31 +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
notrudyyy
1939eb03a7 Refactor: Mesh: Normalize input normals in set custom normals
To reduce code duplication in importers, modifies the C++
set_custom_normals API functions to normalize the input normals.

Reverts !124336, !124267, and !124261 as the normalization now
occurs in the API call.

Resolves #124358.

Pull Request: https://projects.blender.org/blender/blender/pulls/127814
2024-09-19 20:12:40 +02:00
Casey Bianco-Davis
929f17ab2b GPv3: Add reset_uvsoperator
This implements `GPENCIL_OT_reset_transform_fill` for GPv3 and
renames it to `GREASE_PENCIL_OT_reset_uvs`

Pull Request: https://projects.blender.org/blender/blender/pulls/126217
2024-09-19 14:19:34 +02:00
Sean Kim
4291ab855c GPv3: Add Reproject operator
This commit adds the `Reproject Strokes` operator in the
`Grease Pencil` > `Cleanup` menu in edit mode.

All similar operator settings have been ported over from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/127735
2024-09-19 14:06:10 +02:00
Pratik Borhade
8badadd52f GPv3: Topbar layers panel in vertex paint mode
Expose topbar layer panel in vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/127851
2024-09-19 14:02:05 +02:00
Lukas Tönne
6b63fa8f85 GPv3: Interpolate Sequence operator
This is a variation of the modal "Interpolate" operator, where a series
of keyframes is generated according in stead of a single keyframe.
The behavior should be the same as the GPv2 operator.

Much of the code is shared between the "Interpolate" and "Interpolate
Sequence" operators now (utility functions section at the top).

Pull Request: https://projects.blender.org/blender/blender/pulls/127709
2024-09-17 20:20:18 +02:00
Julian Eisel
8c98fcc1f1 Fix: Grease pencil vertex paint brush tool not showing
b64bf66257 changed how brush based tools are defined. It was authored
before the vertex paint tools got added back for grease pencil v3, so
this additional change was missing.
2024-09-16 20:19:59 +02:00
Julian Eisel
d28956ab99 Tools: Add BPY tool definition option for brush type
Adds a new `brush_type` argument to pass when defining a tool.
Previously the `data_block` argument would be used for this, but its
name was unclear and misleading, it never ended up being used for
anything but brushes. `brush_type` is much more clear. Note that this
isn't used yet until !125449 is merged.

Part of https://projects.blender.org/blender/blender/issues/126032.

Reviewed as part of
https://projects.blender.org/blender/blender/pulls/125449.
2024-09-16 20:07:37 +02:00
Julian Eisel
a5d7684539 Fix: Small layout jumps of tool settings header in some paint modes
When switching between tools, layouts starting with the brush asset
selector would jump back and forth for a few pixels. Make sure they use
the same padding to avoid the jumps.
2024-09-16 15:44:31 +02:00
Pratik Borhade
9311a4c89c GPv3: Layers menu in topbar
Add layers panel in topbar which consists list of layers
and operators such as add, hide, isolate, etc.

Resolves #123397.

Pull Request: https://projects.blender.org/blender/blender/pulls/127612
2024-09-16 14:12:31 +02:00
Jeroen Bakker
b6da18172b Cleanup: Make format 2024-09-16 13:30:21 +02:00
Julian Eisel
7180df49dd Fix: Incorrect tool brush check for grease pencil vertex paint mode
This vertex paint code was just recently added in 942499382d, so the
property wasn't renamed correctly after b64bf66257 (which was created
earlier, just committed later).
2024-09-16 13:11:37 +02:00
Julian Eisel
65fdb3fa30 Grease Pencil: Properly support brushes with draw mode primitive tools
Part of blender/blender!125449.

Since brush assets were merged, the brush asset selector and some other brush
UIs wouldn't show up for the primitive tools. This is addressed now. The
primitive tools use the same brush as the brush tool, although only the draw
brushes will work properly. !125449 addresses this so the primitive tools
remember their own draw brush, separate from the brush tool.

Turns out that these primitive tools were never tagged as using brushes by
setting the `data_block` member (or setting the `'USE_BRUSHES'` option since
b64bf66257). The UI was just hardcoded to display things like the brush selector
for primitive tools. So as far as the tool system knew, these tools did not use
brushes.

Tagging the tools properly exposed some issues that are addressed here (see PR
for details).

Pull Request: https://projects.blender.org/blender/blender/pulls/127204
2024-09-16 13:04:08 +02:00
Bastien Montagne
d52d70324d Fix (chat-reported) Py-defined operators id being added to translation files.
Yet another consequence/fix from fixing the type value of
`bpy.types.*.bl_rna` in our BPY code (21b820cd33).
2024-09-16 12:56:35 +02:00
Bastien Montagne
81cdcf8326 Fix (unreported) I18N tool failing to process RTL languages on Linux. 2024-09-16 12:41:11 +02:00
Bastien Montagne
902693a6a5 Add Urdu language entry. 2024-09-16 12:41:11 +02:00
Julian Eisel
b64bf66257 Refactor: Tools: Change how tools are marked as using brushes
The previous way of considering tools with the `data_block` member set
as using brushes was rather unclear/confusing, but also a bit outdated
with the brush assets changes. Since then most sculpt/paint modes use a
unified brush tool, there was no tool for every brush type (aka brush
tool) anymore. So now the `data_block` member was just set dynamically to
match the active brush type which is otherwise irrelevant to the tool
system now.

Further, this will become important to bring back some of the tools that
use brushes in grease pencil draw mode, see #116337. For that we want to
keep the unified brush tool, but still allow other tools that only use a
specific brush type. So marking a tool as using brushes should be done
separately from indicating a specific brush type.

Removing/replacing the `data_block` member should happen separately
still, pending further developments (e.g. see #125449).

Pull Request: https://projects.blender.org/blender/blender/pulls/125911
2024-09-16 12:20:25 +02:00
Andres Stephens
7cff7998ad Fix: #127522: Preferences: GPv3: Show GP3 categories in the keymap editor
Shows the GPv3 keymap categories in the list for editing, adding and discoverability.

Fix for #127522.

Pull Request: https://projects.blender.org/blender/blender/pulls/127533
2024-09-16 12:05:41 +02:00
Pratik Borhade
c2a317a6d5 GPv3: Vertex paint context menu
Add right click context menu in vertex paint mode.

Resolves #127567.

Pull Request: https://projects.blender.org/blender/blender/pulls/127608
2024-09-16 12:02:30 +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
Jesse Yurkovich
b8f236510d Fix: error in node wrangler format string 2024-09-16 04:50:18 +02:00
Jacques Lucke
92febd5fb2 Fix: error in node wrangler format string 2024-09-14 13:29:45 +02:00
Sietse Brouwer
eaad744c7f GPv3: Operators for Normalize active and Normalize all vertex groups
This PR implements the Normalize operators in Weight Paint mode for
GPv3:
- Normalize weights of the active vertex group. This operator normalizes
all the vertex weights in the active vertex group to a value between 0.0
and 1.0.
- Normalize All. This operator normalizes the weights of all vertex
groups, so that for each vertex, the sum of the weights is 1.0. Weights
of locked vertex groups are not changed. By default, the active vertex
group also stays unchanged, unless it's necessary to reach a normalized
state.

The operators are added to the 'Weight' menu in Weight Paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/126302
2024-09-13 16:59:20 +02:00
casey bianco-davis
3c67ae7785 GPv3: Rename Cutter tool to Trim
This rename the `Cutter` tool's name, code and icon to `Trim`.
The legacy Grease Pencil code is unchanged.

This was discussed in the 2024-07-30 Grease Pencil Module Meeting.

Reasons for the change:
 - Match the `Trim Stroke Ends` setting on brushes.
 - Match the `stroke_trim` operator.
 - Name is more clear and more commonly used.
 - Frees the name for a future boolean cutting tool.

Pull Request: https://projects.blender.org/blender/blender/pulls/126452
2024-09-13 16:56:51 +02:00
Sybren A. Stüvel
8ba5c50f5c Anim: disallow switching action slots when using NLA Tweak Mode
When an NLA strip is in tweak mode, the Action editor no longer allows
switching the assigned slot. This is now consistent with it also not
allowing switching of the Action.

The slot used by the NLA strip can be changed in the NLA strip
properties panel of the NLA editor, in the same way that the Action
itself can be changed there.
2024-09-13 15:54:24 +02:00
Falk David
8cbdbf5634 GPv3: Vertex Paint operators
This adds the following operators:
* Set Vertex Color
* Reset Vertex Colors
* Invert
* Brightness/Contrast
* HSV
* Levels

Also populates the `Paint` menu with them in vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/127572
2024-09-13 15:42:21 +02:00