Commit Graph

5145 Commits

Author SHA1 Message Date
Richard Antalik
afa828ffca VSE: Various refactorings
These changes are not very useful on their own, but committed in order
to make PR #109522 easier to review
2024-05-07 13:37:16 +02:00
Richard Antalik
b062980318 Cleanup: Refactor VSE handle drawing code
Split handle rectangle and handle position text drawing to separate
functions.
2024-05-07 13:37:16 +02:00
Hans Goudey
88b4498b32 Cleanup: Miscellaneous cleanups to workspace status items
- Remove meaningless const for by-value arguments in declarations
- Use std::move for strings (otherwise StringRef should be used)
- Move struct to C++ namespace
- Avoid unnecessary namespace specification
- Use static constexpr instead of macros
- Add const for other arguments in function definitions
- Avoid copying struct in for loop
- Remove redundnat "private" in class
2024-05-06 18:20:43 -04:00
Harley Acheson
c4e5a70e07 UI: Optional Complex Layout for Workspace Status
Optionally allow complex layout instead of just plain text when using
ED_workspace_status_text.

Pull Request: https://projects.blender.org/blender/blender/pulls/120595
2024-05-06 23:52:37 +02:00
Campbell Barton
948dc29dd8 Cleanup: order return arguments last 2024-05-06 09:20:06 +10:00
Campbell Barton
c5ad937f53 Cleanup: match argument names in function & declaration 2024-05-06 09:20:05 +10:00
Campbell Barton
bb172dae61 Cleanup: use const variables & arguments 2024-05-06 09:20:03 +10:00
Campbell Barton
98f319ce02 Cleanup: spelling in comments 2024-05-04 15:24:46 +10:00
Julian Eisel
a700c90ec3 Asset Shelf: Add callback to get active asset
Add a function for asset shelves, `get_active_asset` in RNA, that
can be used to sync the active item of an asset shelf with an asset
reference elsewhere in Blender. In the brush asset system this is
used to retrieve the asset reference from the active `Paint` struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/121405
2024-05-03 15:27:35 -04:00
Hans Goudey
798219225d Asset Shelf: Add optional operator to activate assets
The operator stored when registering the asset shelf will be called
with properties that reference the asset (a weak reference, split into
three properties already used in other asset-related operators). The
operator is called whenever a grid view item is activated, and is
meant to do things like import and activate a brush asset.

Previously Reviewed: https://projects.blender.org/blender/blender/pulls/117861

Pull Request: https://projects.blender.org/blender/blender/pulls/121402
2024-05-03 19:24:00 +02:00
Campbell Barton
1b788f3a84 Fix #120778: Depth navigation no longer works for non-geometry objects
Regression in [0] that changed behavior of depth drawing to exclude
overlays which are needed so users can box-zoom to an armature or camera
for example. Add `V3D_DEPTH_NO_OVERLAY` when no overlays are desired.

[0]: 5fea1eda36
2024-05-02 22:36:05 +10:00
Christoph Lendenfeld
5b7a0ed1b5 Refactor: move keyingset enums to animrig
No functional changes expected.

This PR moves the enums
`eModifyKey_Modes` and `eModifyKey_Returns` to animrig
as enum classes.

Functions that take or return that value were also modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/121132
2024-05-02 12:00:37 +02:00
Hans Goudey
fb8f0311bd Assets: Expose function to find asset from a weak reference
Unused for now, will be used by brush assets operators.
2024-05-01 13:11:55 -04:00
Hans Goudey
02f2d73b78 Refactor: Deduplicate modifier copy to selected functions
There were two functions copying modifiers. The modifier operator
exposed in the property editor reported for various failures. Outliner
drag and drop did not. This commit refactors code a bit to unify the
two. Outliner drag and drop should now report why it fails too.
2024-04-30 16:02:08 -04:00
Hans Goudey
5b6c776ef4 Cleanup: Rename modifier_clear function to add plural
Make it more obvious that the function removes all modifiers.
2024-04-30 16:02:08 -04:00
Christoph Lendenfeld
33c6e9f92c Refactor: move FCurve baking code to animrig
No functional changes.

This PR moves the following public functions to animrig:
* sample_fcurve_segment
* bake_fcurve
* bake_fcurve_segments

The `bake_fcurve_segments` also gets a docstring and its comments have been
updated to follow the style guide.

Pull Request: https://projects.blender.org/blender/blender/pulls/120984
2024-04-30 12:22:47 +02:00
Falk David
c87e8790bb Fix: GPv3: Redraw editors showing grease pencil keys when new on is added
When e.g. using auto-key to draw on a new frame, the dopesheet
(and other editors) would not redraw to show the newly added keyframe.

This fix makes sure we send notifiers to those editors when a
keyframe is added.
2024-04-26 15:43:51 +02:00
Christoph Lendenfeld
0dd0583a75 Refactor: move get_keyframing_flags function to animrig
No functional changes.

This PR moves the `ANIM_get_keyframing_flags` function to
animrig as `get_keyframing_flags`.
The docstring has been fixed since it was out of date.

Pull Request: https://projects.blender.org/blender/blender/pulls/121120
2024-04-26 13:21:55 +02:00
Lukas Tönne
91f1f3fc06 GPv3: Implementation of sculpt mode tools
This implements all the sculpt tools in Grease Pencil 3.

UI changes in the 3D view header and keymap entries for sculpt mode are
still minimal, more entries should be added once the relevant operators
are supported.

A set of utility functions and a shared base class
`GreasePencilStrokeOperationCommon` for sculpt operations has been added
to make individual operations less verbose.
The `GreasePencilStrokeParams` struct bundles common arguments to reduce
the amount of boilerplate code. The `foreach_editable_drawing` utility
function takes care of setting up the parameters and finding the right
drawings, so the tool only has to modify the data. Common features like
tracking mouse movement and inverting brush influence are handled by the
common base class.

Most operations are then relatively simple, with the exception of the
Grab and Clone operations.
- __Grab__ stores a stroke mask and weights on initialization of the
  stroke, rather than working with the usual selection mask.
- __Clone__ needs access to the clipboard, which requires exposing the
  clipboard in the editor API.

Pull Request: https://projects.blender.org/blender/blender/pulls/120508
2024-04-25 20:20:27 +02:00
Christoph Lendenfeld
78583bf22e Anim: Add option to show modified property on slider
This PR adds the feature of displaying which property is modified
to the slider GUI.

This is useful in cases like #117287
where the slider can modify different properties during the modal operation.

The string is optional and will be empty by default.

This label is placed to the left of the slider where the percentage was usually located.
The percentage has now been moved to the right.

Pull Request: https://projects.blender.org/blender/blender/pulls/119920
2024-04-25 15:48:17 +02:00
Sietse Brouwer
5220caeabb GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight)
This PR implements the Weight Paint tools for GPv3.

Tools:
- Draw, for assigning weight to stroke points
- Blur, smooths out weight using adjacent stroke point weights
- Average, smooths weight using the average weight under the brush
- Smear, like finger painting, drags weights in the direction of the brush
- Sample weight, sets the brush weight to the weight under the cursor

The weights are assigned to the active vertex group. When there is no
active vertex group, a group is automatically created.

When the Auto Normalize option is enabled, it is ensured that all
bone-deforming vertex groups add up to the weight of 1.0.
When a vertex group is locked, it's weights will not be altered by
Auto Normalize.

The PR already supports multi frame editing, including the use of a
falloff (defined by a curve).

The implementation is in accordance with the Weight Paint tools in GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118347
2024-04-25 15:21:14 +02:00
Guillermo Venegas
5c2d412a29 Fix image sequence detection to account for the number of digits
Previously when opening 2 images like `['img1.png' ,'img002.png']` the
sequence detection will open this images as a single image sequence.
However internally this is not a supported sequence.
To fix that this changes will also differentiate sequences
by their digit count, so if a group of images like:
`['img1.png','img2.png' ,'img002.png','img003.png']`
are open now it will create 2 images sequences instead of just one.

Ref: !120185
2024-04-25 13:04:23 +10:00
Hans Goudey
ab3f05d3ec Cleanup: Move sculpt_transform.cc to C++ namespace 2024-04-24 08:19:57 -04:00
Aras Pranckevicius
c64050ecd2 VSE: Timeline strip visual design updates
Design updates as per #118288:
- Tweak text labels (colors, drop shadows)
- Strip border colors, inset outlines
- Muted strips are mostly gray, and their thumbnails are faded
- Overlapping strips are not semitransparent anymore
- Locked stripes only in content area
- Missing data blocks
- Updates to meta strips w/ missing data blocks

Pull Request: https://projects.blender.org/blender/blender/pulls/118581
2024-04-24 12:37:38 +02:00
Campbell Barton
1865776767 Cleanup: doxygen syntax, use colons after "param" arguments, not "note" 2024-04-24 10:55:44 +10:00
Harley Acheson
49bd285529 UI: Collapse XYZ Operations in Status Bar
Reduce the number of duplicated modal operator keymap entries by just
showing "XYZ Axis" rather than "X X Axis", "Y Y Azis", etc. This allows
more items to be shown on the status bar. Note this only does so if the
keymap contains all of X, Y, & Z.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/120148
2024-04-22 20:03:11 +02:00
Sietse Brouwer
4fbef3dc6b GPv3: Cutter tool
This PR implements the Cutter Tool for GPv3. The Cutter tool deletes
points in between intersecting strokes. New points are created at the
exact intersection points, so as a result the cutted strokes will fit
perfectly.

For feature parity, the tool follows the GPv2 behavior:

- The cutter tool works on all editable layers.
- Intersections are only detected for curves on the same layer,
so intersection of curves on _seperate_ layers are not handled.

Technical notes
The implementation uses the `compute_topology_change` function
created for the Hard Eraser. So at intersection points, point
attributes will be interpolated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113953
2024-04-22 14:05:22 +02:00
Chao Li
74b9c6a8a0 GPv3: Copy/Paste Keyframes
This commit implements Copy and Past Keyframes for GPv3.
The copy operator copies the selected GPv3 keyframes and the paste
operator paste the keyframes from the clipboard.
See #113110.

Pull Request: https://projects.blender.org/blender/blender/pulls/117388
2024-04-22 12:06:21 +02:00
casey bianco-davis
2df13ce4a3 GPv3: Primitive Tools: Line, Polyline, Arc, Curve, Box and Circle Tool
Adds the primitive tools in draw mode to GPv3.

This also adds rotation and scale sub-operators with `r` and `s` keybinds.
Also all control points are editable after extruding.

Pull Request: https://projects.blender.org/blender/blender/pulls/119039
2024-04-22 10:48:03 +02:00
Sybren A. Stüvel
933f74ca02 Anim: Baklava, add Animation data-block to anim filtering code
Add minimal support for the `Animation` data-block to the anim filtering
code. This means:

- F-Curves in the `Animation` data-block are shown in the Dope Sheet and
  Graph Editor.
- The `Animation` is shown underneath each animated data-block, just
  like an `Action` would be.
- Contrary to Actions, the expanded/collapsed state is stored on
  `id->adt` and not on `Animation`. Because an `Animation` is intended
  to be used by multiple data-blocks, they each should have their own
  flag for this.
- In the filtering code, this PR adds the 'fillanim' channel type. This
  is simply mimicking the name from the Action's 'fillact' type.

Limitations:

- Deleting of F-Curves is explicitly blocked, as that'll be introduced
  in a later PR. The block prevents Blender from crashing.
- The Dope Sheet doesn't have an Animation mode yet, that'll be for a
  later PR too.

Pull Request: https://projects.blender.org/blender/blender/pulls/120654
2024-04-20 12:19:16 +02:00
Harley Acheson
d8f6ae7919 UI: Outliner "File Mode" Manage User Count
In Outliner "Blender File Mode" view, show user counts, and allow
removing and adding fake user, requested in #118655.

Pull Request: https://projects.blender.org/blender/blender/pulls/118691
2024-04-20 02:50:12 +02:00
Campbell Barton
01101dcaf9 Cleanup: use const references instead of copy-by-value 2024-04-17 11:36:44 +10:00
Brecht Van Lommel
07922a99e9 UI: Tweaks to collection export
* Remove embossing from preset / export / delete buttons.
   For example modifiers also don't have emboss for X, and presets
   never do. So it seems consistent.
* Remove duplicated preset buttons, only have the one in the header
  like other panels in properties editor.
* Use property separate layout without boxes for file path.
* Show info message when exporting a single or all collections,
  otherwise it's not obvious that something happened when clicking
  the button.

Pull Request: https://projects.blender.org/blender/blender/pulls/120667
2024-04-16 15:02:33 +02:00
Jacques Lucke
d1634b2a4a UI: support adding a search weight to menu entries for menu-search
The goal is to support better search experience in the cases where we want to
explicitly influence the ordering instead of relying only on general heuristics.
We used to support this already at some point I think, but not anymore since we
started using menu-search.

The implementation is fairly straight forward. It mainly just forwards the
search weight from the menu definition to the search code through various
required steps. The main annoying thing is that changing the signature of e.g.
`uiItemFullO_ptr` is fairly involved. Even using default parameters for these
functions is a bit annoying and becomes fairly unreadable and error-prone on the
call-site. For now, I worked around this by storing the search weight on the
`uiLayout` and to copy it to the `uiBut` from there. That seems preferable until
we have a better solution for adding parameters to all the `uiItem*` functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/120572
2024-04-16 12:18:45 +02:00
Campbell Barton
20b0805213 Cleanup: use const pointers where possible 2024-04-16 12:27:47 +10:00
Sybren A. Stüvel
51e1f29a68 Anim: Add new keyframe type 'GENERATED'
Add a new keyframe type named 'generated', which is meant to indicate
that the key was set by some automated tool (like an add-on), rather
than manually by an animator.

This is meant for tooling that needs to create keys in a repeatable way.
With this new key type, the tool can know which keys it generated
before, and thus those can be removed and re-generated.

Pull Request: https://projects.blender.org/blender/blender/pulls/120564
2024-04-15 10:42:54 +02:00
Hans Goudey
740d1fbc4b Geometry Nodes: Log socket values for node tools
To ease the process of debugging a node group while creating
a node tool, while the group is visible in a node editor, log the socket
values from its last execution. The values are only logged for the
active object is nothing selected. The Viewer node is still not supported
because visualization would probably be very tricky.

Pull Request: https://projects.blender.org/blender/blender/pulls/120596
2024-04-14 16:47:46 +02:00
Germano Cavalcante
f38c4d42bd Fix #120244: Snap cursor does not work in some Quad-View regions
The xy coordinates depend on the region, so we need to make sure we
pass the correct region.
2024-04-12 15:01:38 -03:00
Lukas Tönne
658a9ac3a9 GPv3: Initial sculpt mode
Adds an (empty) sculpt mode for Grease Pencil v3 objects.

The object `SCULPT_GPENCIL` mode is re-used for Grease Pencil object
types. A `SCULPT_GREASE_PENCIL` context mode has been added, which is
specific to grease pencil objects. This is necessary for polling tools
and keymaps.

Pull Request: https://projects.blender.org/blender/blender/pulls/119338
2024-04-11 09:39:48 +02:00
Jesse Yurkovich
509a7870c3 Collection Exporters: Enable file exporters to be specified on Collections
This implements the ability to have file exporters added and configured on Collections.

Exporting is reachable from several locations:
- Individually on each exporter configuration: The `Export` button in each panel header
- For all exporters on the collection: The `Export All` button in the main panel interface
- For all exporters on all collections in the scene: The `File`->`Export All Collections` button

Visibility of which collections currently have exporters configured is done by ways of an icon added to the Collection row in the Outliner.

Adding multiple exporters for the same file type is permitted. The user is free to setup several exports of the same format but with different file locations or settings etc.

Notes:
Only USD and Wavefront OBJ are enabled for the initial commit. Additional formats, including those implemented in Python will be added as separate commits after this.

Ref #115690
Pull Request: https://projects.blender.org/blender/blender/pulls/116646
2024-04-08 22:10:39 +02:00
Campbell Barton
bce2cf5f92 Cleanup: use const EnumPropertyItem pointers 2024-04-08 12:03:03 +10:00
Sybren A. Stüvel
85d77b79a6 Refactor: Anim, use eBezTriple_KeyframeType in more code
Instead of using `short key_type`, use `eBezTriple_KeyframeType key_type`,
so that it's clear which type it is, and so that a `switch()` can cause
compiler warnings when it's incomplete.

This also adds missing `case`s to `switch`es where necessary, in a way
that doesn't affect the outcome. There is one change that looks like it
is a functional change, but it should provide the same result:

```diff
- size -= 0.8f * key_type;
+ size *= 0.8f;
```

Since `size = 12` and in this case `key_type = 3`, the numerical values
are the same, but now the code is consistently multiplying and thus should
scale properly.

Furthermore some overly obvious comments are removed and some missing
`const` keywords have been added.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120178
2024-04-05 11:53:57 +02:00
Campbell Barton
7e9f7320e4 Cleanup: spelling in comments & comment blocks 2024-04-04 11:26:28 +11:00
Campbell Barton
c1a0804794 Cleanup: remove redundant null check, declare arguments non-null
Checking if `ob` was null in ED_armature_pose_select_pick_bone
implied later access should check too. Remove the null check
as this isn't needed.
2024-04-04 10:55:19 +11:00
Laurynas Duburas
4889aed8ac Curves: Bezier handle selection support
Adds ".selection_handle_left" and ".selection_handle_right" attributes to
`CurvesGeometry` and their support in curve's select all, pick, box, circle
and lasso select tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/119712
2024-04-03 16:40:36 +02:00
Falk David
8512a608a4 GPv3: Onion Skinning
Implements the GPv2 onion skinning functionality.

There are no functional changes exept for the `use_ghosts_always`
option, which has been removed. This was used to show onion
skinning in the final render.

Pull Request: https://projects.blender.org/blender/blender/pulls/119792
2024-04-03 15:34:40 +02:00
Harley Acheson
d1b6621903 UI: Complete Event Icon Coverage
This PR completes coverage of the event icons used to represent keymap
entries on the status bar. This adds 0-9, non-alpha keys, tablet, F13-
F24, NDOF buttons, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/120117
2024-04-02 21:52:57 +02:00
Brecht Van Lommel
d99f2e8eb7 Refactor: Add ability for UI block to own operator
Instead of only referencing an existing one. This will be used for
collection exporter and presets, to make sure the operator instance
stays alive long enough for the preset to be able to be applied.

Pull Request: https://projects.blender.org/blender/blender/pulls/120034
2024-03-29 14:52:35 +01:00
Campbell Barton
3d2593b229 Cleanup: replace "derived mesh" with "evaluated mesh" in code comments
References to the evaluated mesh were referring to "derived mesh"
when DerivedMesh wasn't used.
2024-03-29 13:29:30 +11:00
Hans Goudey
82b88f130a Cleanup: Use const for evaluated cage meshes and related data
Also access the evaluated deform mesh with a function rather than
directly from object runtime data. The goal is to make it easier to use
implicit sharing for these meshes and to improve overall const
correctness.
2024-03-28 18:57:57 -04:00