Commit Graph

6383 Commits

Author SHA1 Message Date
Lukas Stockner
c38b711c48 Merge branch 'blender-v4.2-release' 2024-06-05 23:18:48 +02:00
Sergey Sharybin
15b5651712 Fix/workaround linker issues of blender_test on Linux
Seems to be dependent on specific compiler/cmake version.

Is a typical mixture of missing dependencies between libraries,
object files which do not get referenced from other files in the
target, and whole-archive linking of the blender_test target.

Pull Request: https://projects.blender.org/blender/blender/pulls/122801
2024-06-05 21:46:13 +02:00
Hans Goudey
84c4ddbbb9 Cleanup: GPU: Use references for some vertex buffer functions
Pull Request: https://projects.blender.org/blender/blender/pulls/122784
2024-06-05 18:47:22 +02:00
Richard Antalik
f98b01e492 VSE: Improved handle tweaking
This commit changes how users can interact with handles:

Unselected handles are not drawn anymore by default. Handles are bit
thinner. If handle can't be selected, because strip is too small,
it is not drawn.

When hovering over strip handle a cursor is changed to represent a
handle shape. It is possible to select 2 handles at once if strips are
adjoined.

When tweak event happens on unselected handle, handle selection is lost
ater tweaking.

This behavior can be disabled in preferences:
Editing > Video Sequencer > Tweak Handles.

Moving strips with G key works same way as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/109522
2024-06-03 23:17:41 +02:00
Brecht Van Lommel
a331ebb324 Fix #122562: Auto scrolling issues with modal operators
Keep the UI and modal handlers order the same as before the priority
changes, these rely on being in a particular order.
2024-06-03 21:50:19 +02:00
Campbell Barton
cfd199b7a2 Fix passing allocated strings to guarded-alloc 2024-06-02 20:39:06 +10:00
Campbell Barton
1aa5eddab3 Correct error in last commit
Correct flipped check in 96c4be169f.
2024-06-02 19:23:06 +10:00
Campbell Barton
96c4be169f Cleanup: minor changes relating to operator macros
- Consistent naming for wmOperatorTypeMacro variables.
- Reduced right-shift.
- Use boolean types.
2024-06-02 19:20:53 +10:00
Harley Acheson
30168752cf Fix #122590: Revert "Fix #122423: Fix Gizmo Map Crash after Area Join"
This reverts commit e48eacd672.

Pull Request: https://projects.blender.org/blender/blender/pulls/122604
2024-06-01 19:19:58 +02:00
Campbell Barton
5f5d851d13 WM: add extra check for Python operator names
Check the "." separator isn't at the beginning/end of the string.
2024-06-01 16:08:53 +10:00
Campbell Barton
8c542ce15f WM: assert operator names are valid when appending
Add WM_operator_bl_idname_is_valid utility function.
2024-06-01 16:08:51 +10:00
Harley Acheson
e48eacd672 Fix #122423: Fix Gizmo Map Crash after Area Join
When joining areas, one will be removed which can cause
wm_gizmomaps_handled_modal_update to attempt operation on a region that
is deallocated. This PR just exits if there is no current region.

Pull Request: https://projects.blender.org/blender/blender/pulls/122504
2024-05-30 21:02:02 +02:00
Dalai Felinto
1d9f12ac43 Extensions: DEFINE values to use for extensions update count 2024-05-30 17:48:21 +02:00
Dalai Felinto
7ba0d35746 Extensions: wm.extensions_update property
To be tackled by future commits:

* Setting the property when checking for updates.
* Read this property for the splashscreen information (and in the future the status bar).

Ref: !122487
2024-05-30 14:41:05 +02:00
Campbell Barton
e3a6eed5c5 Cleanup: correct function name spelling 2024-05-29 12:49:07 +10:00
Sean Kim
025df21a0f Sculpt: Add Polyline Mask, Face Set, and Trim
This PR adds the *Polyline Mask*, *Polyline Face Set*, and
*Polyline Trim* tools.

## Limitations
* *Polyline Face Set* is not added to either of the *Sculpt*
or *Face Sets* menu as none of the other face set gestures are in
either.

Pull Request: https://projects.blender.org/blender/blender/pulls/122248
2024-05-28 18:33:45 +02:00
Sean Kim
7726e7f563 Sculpt: Add Line Face Set Tool
This PR adds the `Line Face Set` tool and adds it to the following
location:
* Sculpt Mode toolbar

## Limitations
None of the existing Face Set gesture operators exist in either the
Sculpt dropdown or the Face Set dropdown, this PR does not add the Line
Face set tool in either location as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122245
2024-05-28 17:17:10 +02:00
Julian Eisel
98c92b9033 Fix more potential crashes when refreshing certain popups
These popups had refreshing enabled, but the callback used for
refreshing would access a likely dangling operator pointer. One case can
use the operator-type pointer instead, in the other case disable
refreshing altogether. Also see 8ea79dc3a7.
2024-05-27 21:21:39 +02:00
Julian Eisel
8ea79dc3a7 Fix #122276: Crash when searching for a Collection Instance
This search menu creation/refreshing function relies on the operator
pointer which might be dangling. There are more such cases, will fix in
followup commits.
2024-05-27 20:58:12 +02:00
Brecht Van Lommel
6efd7a6a50 Operators: Add option to give a modal operator priority in event handling
This may be used by add-ons like screencast keys, to log events before a
modal operator like transform handles them.

Pull Request: https://projects.blender.org/blender/blender/pulls/122226
2024-05-27 12:06:01 +02:00
Bastien Montagne
6426de4489 Core: IDManagement: Refactor how 'never unused' IDs are defined.
A few ID types are considered as 'never unused' in Blender (UI related
ones, the Libraries and the Scenes). Local IDs of this type are always
considered as used, even if no other ID links to them.

This was previously fairly weekly defined and implemented (mainly in the
writefile code and the 'tag unused' libquery functions).

This commit formalize this characteristic of ID types by adding a new
`IDTYPE_FLAGS_NEVER_UNUSED` flag, and using this in the few places in
the code that handle unused IDs.
2024-05-24 17:43:22 +02:00
Campbell Barton
61e4d1818e Cleanup: follow operator callback & argument naming 2024-05-24 14:08:33 +10:00
Campbell Barton
b25eefbf9a Fix #122132: Crash canceling nested popups
Moving the cursor away from the extensions "Add Repository" popup
could crash because the "Repositories" popover was closed while the
popup it created remains open.

Resolve by clearing wmEventHandler_UI::context.region_popup
which match the freed region, following similar logic already used by
WM_event_modal_handler_region_replace.

Note that this bug was exposed by [0].

[0]: 38d11482f5
2024-05-23 15:22:19 +10:00
Campbell Barton
57c023d580 Preference: add option allow internet access
Add a preference to "Work Offline" system preference as well as command
line options `--offline-mode` & `--online-mode`
(which overrides the preference).
This option is displayed in the initial setup screen too.

This is currently respected by:

- Check for updates on startup
- Disables running an update when enabling extensions.

When Blender is launched with `--offline-mode` the option cannot be
enabled in the preferences. This is intended for environments
where internet access is intentionally disallowed.

Background: with Blender supporting access to online-repositories
as well as 3rd party extensions themselves potentially accessing the
internet. This setting provides a way for users to disable online
functionality.

This prevents error messages when online access fails in environments
without internet access as well as the ability for users who prefer
Blender doesn't access the internet to have one place to turn this off.

While it does not enforce limitations on add-ons, 3rd party scripts
are expected to respect this setting using `bpy.app.internet_offline`.

The details for this will be handled along with other policies scripts
are expected to follow.

Ref !121994
2024-05-23 13:50:06 +10:00
Jason Fielder
1cf8f64927 Fix #70036: Fixed animation playback scaling issue on retina displays
Authored by Apple: James McCarthy

Pull Request: https://projects.blender.org/blender/blender/pulls/122048
2024-05-21 19:25:23 +02:00
Brecht Van Lommel
5f9f3116db Libraries: Support editing linked datablocks from some libraries
For the brush assets, this mechanism makes brush, texture, node tree and
image datablocks editable even when library linked.

This commit should introduce no functional change yet, as the code to
actually tag such libraries as editable will come later.

* These libraries and their datablocks are preserved when loading a new
  blend file, much like the UI can be preserved.
* Operators that create new datablocks to be assigned to such datablocks
  will put the datablocks in the same library immediately. This was
  implemented for datablocks relevant for brush assets.
* RNA does not allow assignment of pointers from such linked datablocks
  to local datablocks.

Co-authored-by: Bastien Montagne <bastien@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/121920
2024-05-21 18:16:36 +02:00
Campbell Barton
096eed9d7f Cleanup: spelling in comments 2024-05-20 10:23:54 +10:00
Brecht Van Lommel
a926f5b67d Refactor: Replace ID_IS_LINKED by !ID_IS_EDITABLE
Add new ID_IS_EDITABLE macro that checks if the ID can be edited in the
user interface. Replace usage of ID_IS_LINKED where it is used with this
meaning.

Also add a corresponding ID.is_editable property for Python.

This prepares for the ability to edit some linked datablocks for brush
assets.

Pull Request: https://projects.blender.org/blender/blender/pulls/121838
2024-05-16 14:53:09 +02:00
Sean Kim
1cf0d7ca6a Sculpt: Add customizable increment for line tool snapping
Sculpt: Add customizable increment for line tool snapping

This PR exposes the snap increments introduced in #118760 to the base
`WM_gesture_straightline` operators and exposes the increment menu to
allow users to change this value in both Sculpt and Weight Paint mode.

## Details
The full list of operators this affects:
* IMAGE_OT_sample_line
* PAINT_OT_weight_gradient
* MESH_OT_bisect
* PAINT_OT_mask_line_gesture
* SCULPT_OT_trim_line_gesture
* SCULPT_OT_project_line_gesture
* PAINT_OT_hide_show_line_gesture

## Compatibility
Previously, the hardcoded value for this snap increment was 15 degrees,
by using the toolsetting value, this changes the default to 5 degrees.

Pull Request: https://projects.blender.org/blender/blender/pulls/121547
2024-05-14 19:00:58 +02:00
Campbell Barton
566a77f605 UI: restore assert in CTX_wm_region_popup_set
This just hid that freed memory was being passed to
CTX_wm_region_popup_set.

The change from [0] exposed this issue, however the problem has
existed for a long time (likely since the inclusion of popups in the
context) it's just that setting the context member when popups
are first displayed made problems more likely to show up.

[0]: 38d11482f5
2024-05-14 19:34:21 +10:00
Pratik Borhade
9b5f0cb8a2 GPv3: Drag & drop for layer groups
New drag type `WM_DRAG_GREASE_PENCIL_GROUP` introduced for layer group nodes.
Replaced layer struct with `GreasePencilLayerTreeNode` in `wmDragGreasePencilLayer`
so group node can be stored while dragging in `wmdrag->poin`.

Using `can_drop()`, drop operation of layer group node returns `false`
if the target node is its child.

Part of #121390.

Pull Request: https://projects.blender.org/blender/blender/pulls/121654
2024-05-10 18:18:03 +02:00
Campbell Barton
bc5b77b390 Cleanup: rename Context::wm::menu to popup_region
The term "menu" was misleading as this is used for all temporary popups.
2024-05-10 11:27:03 +10:00
Campbell Barton
9e481b484e Cleanup: don't use boolean literals to set flag members
This could be renamed as it reads like a boolean but is a flag.
2024-05-09 12:11:46 +10:00
Jacques Lucke
89a1a2cd7e Fix #121458: crash when using layout panels in operator ui
The same fix is used in e.g. `wm_block_dialog_create`.
2024-05-07 12:01:11 +02:00
Campbell Barton
e153758318 Cleanup: remove optional draw flipping argument
Always use take a boolean array instead of checking for null.
2024-05-06 11:28:47 +10:00
Harley Acheson
8735a8a6be UI: Different Warning for Revert if Unsaved Images
Change to the confirmation when reverting the current blend file to
include a specific warning if there are unsaved images.

Pull Request: https://projects.blender.org/blender/blender/pulls/121288
2024-05-05 19:31:20 +02:00
Campbell Barton
4f5f0040c0 Cleanup: back-tick quote file extensions in code-comments 2024-05-04 15:06:46 +10:00
Hans Goudey
09c0dec2a3 UI: Adjust gesture operator descriptions to avoid second person
Use the imperative tense as described by the HIG.

Pull Request: https://projects.blender.org/blender/blender/pulls/121309
2024-05-01 19:01:28 +02:00
Hans Goudey
d4981e0de3 Cleanup: Tweak naming in file forwardcompat dialog
Make the function naming more generic so extending it in the future
(with asset blend file information for example) won't have to adjust
the function names to correct the semantics itself.
2024-05-01 12:26:58 -04:00
Hans Goudey
a3f87ceb35 Cleanup: Correct comment in keymap operator name guessing
PAINT_OT operators are not skipped here.
2024-05-01 12:26:58 -04:00
Hans Goudey
c549c1b29c Brush: Add Main argument to BKE_paint_ensure
This is used by the brush assets branch. Though it is unused currently, the
argument is added now to reduce the trivial boilerplate changes in the diff.
2024-05-01 11:49:48 -04:00
Harley Acheson
529b8786f8 UI: Custom Text and Confirmation Button Text for Props Confirm
For operators that use WM_operator_props_popup_confirm allow custom
title and confirmation button text.

Pull Request: https://projects.blender.org/blender/blender/pulls/121287
2024-05-01 16:29:19 +02:00
Sean Kim
d4a61647bf Sculpt: Add Line Trim tool
This PR adds the *Line Trim* tool to Sculpt mode. It is exposed via
the toolbar along with the other *Trim* tools and as an entry in the
*Sculpt* menu.

## Technical Approach
Line gestures are represented as two points in screen space: the `start`
and `end` of the gesture. Trim tools work by taking a set of screen
points as the top face of a volume, projecting a copy of the face into
the scene, then using that as the operand shape for boolean operations.
To behave as users would expect, the *Line Trim* tool does the following
steps to make the initial face:
1. Take the sculpted object's bounding box.
2. Project the bounding box into screen space
3. Take the magnitude of the diagonal line made from the bounding box
4. Use the magnitude multiplied by an arbitrary factor to ensure the
   initial line is long enough to fully divide the object.
5. Create two points by moving in a perpendicular direction from start
   and end points.
6. Use the resulting four points as vertices of the quad in screen space.

## Differences with Other Trim Tools
* Line Trim **only** supports the **Difference** mode. As such, the
corresponding tool options have been disabled in the header.

## Alternatives
* Instead of using a boolean operation, this could be achieved by using
a bisect operation when using the *Fixed* projection mode. While this
may result in a better performing tool, it is not guaranteed and
requires extra work to integrate this approach.

Pull Request: https://projects.blender.org/blender/blender/pulls/120845
2024-05-01 14:10:26 +02:00
Sean Kim
55fc1066ac Sculpt: Polyline hide operator
This PR adds a polyline hide operator for sculpt mode as well as the
necessary generic callback code to allow using this gesture in other
selection tools.

Added features include:
* *Polyline Hide* operator
* `WM_gesture_polyline_*` callback functions for other operators
* Status bar text while using the polyline modal
* Common *Gesture Polyline* keymap for usage with the modal

Unlike the *Box Hide* and *Lasso Hide* operators, the *Polyline Hide*
operator does not provide a simple shortcut to click and show all
hidden elements in a mesh. This is because the existing operators
operate on a click-drag action while the new operator is invoked by
just a click.

Design Task: #119353

Pull Request: https://projects.blender.org/blender/blender/pulls/119483
2024-04-29 14:04:16 +02:00
Jacques Lucke
71ba360ddc Cleanup: use Map for operator types
This simplifies the code, makes it more type safe and also makes it
easier to use the construct-on-first-use-idiom.

Pull Request: https://projects.blender.org/blender/blender/pulls/121170
2024-04-27 21:44:55 +02:00
Campbell Barton
d644873252 Preferences: add option to set the trackpad direction for Wayland
When using a version of Wayland that doesn't support trackpad direction
show an option to set the direction manually.

While this is a stop-gap measure until compositors support seat
version 9, the latest GNOME doesn't yet support this, so there will
be users for some years without this functionality.

Addresses issue raised in #107676.
2024-04-26 21:26:49 +10:00
Campbell Barton
c444f128d3 WM: add a capability flag for physical trackpad direction
Support detecting if the trackpad direction flag is propertly set
(currently unused).

Needed so Wayland compositors that don't support seat-version 9 or
newer (GNOME-46 & KDE5 for e.g) can have a working trackpad.

Eventually this option will be removed when the functionality is
widely supported.
2024-04-26 21:26:49 +10:00
Campbell Barton
954dc21581 WM: correct the last flag of ENUM_OPERATORS for eWM_CapabilitiesFlag 2024-04-26 21:26:49 +10: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
Campbell Barton
6d1ffc519f Cleanup: remove unused GizmoGroup reports 2024-04-25 23:24:47 +10:00