Commit Graph

101555 Commits

Author SHA1 Message Date
Julian Eisel
088d7a0bdd UI: Activate view item on right click on nested button too
No user visible change expected.

Right-clicking a view item is supposed to activate it and display the
context menu. However, nested buttons could "swallow" the right click
event. Ensure the view item is still activated.
2023-07-28 15:31:52 +02:00
Julian Eisel
1fe45cef91 Fix broking popover refreshing
Mistake in 167c5c6b53, basically making the commit have no effect.
2023-07-28 15:25:48 +02:00
Christoph Lendenfeld
9cd60da3cb Refactor: extract code from dopesheet draw function
No functional changes

Extracting code into two new functions in the dopesheet draw code
to improve readability and reduce variable scopes.
in addition to the extraction two if checks were negated to reduce indentation.

the diff makes it look a bit convoluted, but it's just copy paste into functions

Pull Request: https://projects.blender.org/blender/blender/pulls/110290
2023-07-28 15:14:56 +02:00
Julian Eisel
3053cba6e9 Fix glitch when unhiding fixed size regions with region resizing
Some regions have a fixed size or the size is determined by the layout
somehow, and so the regions should allow hiding/unhiding via the resize
operator, but the size shouldn't be modified. When the region was just
unhidden, it would still use a size based on the mouse position for one
mouse move event. Ensure the size isn't modified, as requested.
2023-07-28 14:36:02 +02:00
Julian Eisel
4319c211dc UI: Support layout based region resizing that still allows user resizing
No user visible changes expected.

This is needed for the asset shelf (#104831), so that the user can
resize the asset shelf region, but it's ensured to always be snapped to
a multiple of the row height (which can change over redraws).

Before this, `RGN_FLAG_DYNAMIC_SIZE` would have to be set so that
regions can control their own size in the `ARegionType::layout()`
callback. But this would also disable resizing the region by the user.
Tagging regions as being dynamically sized and disabling user resizing
are now two separate options/flags.

Included changes:
- Rename `RGN_FLAG_PREFSIZE_OR_HIDDEN` to `RGN_FLAG_NO_USER_RESIZE` and
  make that generally disable user resizing like `RGN_FLAG_DYNAMIC_SIZE`
  used to, so that it can be used for more than just the properties
  editor tabs region.
- Ensure regions that relied on the previous `RGN_FLAG_DYNAMIC_SIZE`
  behavior that disallowed user resizing have the
  `RGN_FLAG_NO_USER_RESIZE` flag set too now.
- Versioning to ensure the previous point for old files.
- Update comments.
2023-07-28 14:36:02 +02:00
Falk David
20b1077097 GPv3: Initial modifier support
This commit adds modifier support for Grease Pencil 3.
The `BKE_grease_pencil_data_update` function evaluates the modifiers by
first creating a `GeometrySet` from the grease pencil data,
then evaluating the modifiers, and finally reading the
resulting `GreasePencilComponent` component and assigning
the evaluated object data.

Pull Request: https://projects.blender.org/blender/blender/pulls/110500
2023-07-28 14:25:38 +02:00
Jacques Lucke
38294bcbe7 Fix #110543: black faces on mesh extrude
That was a mistake in 932332ad6e.
2023-07-28 13:50:02 +02:00
Hans Goudey
a632f1ddfd Sculpt: Remove dynamic topology "Smooth Shading" option
Dynamic topology drawing can now use the smooth status saved in each
edge. Because of that, the "Smooth Shading" draw option is unnecessary
and just adds confusion because of inconsistency between dynamic
topology drawing and other modes.

Fixes #109191

Pull Request: https://projects.blender.org/blender/blender/pulls/110548
2023-07-28 13:44:01 +02:00
Andras-Borsanyi
f418e4f648 Walk Navigation: Controls to adjust jump height interactively
In Walk Navigation mode with gravity enabled, the jump height is
often inappropriate for the scene that you are viewing. This is a small
feature that lets you change the jump height in modal walk navigation
as you go, i.e. if there are varying elevation changes across the scene.

Pressing '.' increases and ',' decreases the jump height (because these keys
are the same for most layouts).

Pull Request: https://projects.blender.org/blender/blender/pulls/109827
2023-07-28 13:43:35 +02:00
Sergey Sharybin
f839c31f6c Fix Blender crash on startup on macOS
The issue was caused by recent C++ transition: the header file is
shared between CPU and GPU. The Metal defines __cplusplus so it is
not enough to check for it to use C linking as it is not a valid
syntax for shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/110570
2023-07-28 12:42:15 +02:00
Julian Eisel
44c54eda6f Cleanup: Apply clang-format for recent Outliner changes 2023-07-28 12:36:32 +02:00
Julian Eisel
d1e590eafa Refactor: Avoid evil context storage in drag data for asset import
Context is needed to import and instantiate assets correctly. Previously
the context was stored as "evil" pointer in the drag data. Since
77794b1a7b, context is passed to the dragging callbacks doing the asset
import, so the context doesn't need to be stored that way anymore and
can simply be passed to the import function.
2023-07-28 12:20:27 +02:00
Almaz-Shinbay
1f722a6d01 Outliner: Port grease pencil effect elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds new classes for grease pencil effect elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110551
2023-07-28 11:26:09 +02:00
Guillermo
82c178a574 Fix #110556, #110546: wrong variable initialization
Fixes attempt to access an overridden variable value.

Pull Request: https://projects.blender.org/blender/blender/pulls/110557
2023-07-28 09:15:31 +02:00
Campbell Barton
88902a273e UI: add menu items for sample weight/color
These were only available as shortcuts without any menu item.
2023-07-28 16:27:24 +10:00
Campbell Barton
09c66631a6 Refactor: use object.vertex_group_set_active for group sample operator
This change is needed for PAINT_OT_weight_sample_group to be accessed
from a menu.

Otherwise using the OPTYPE_DEPENDS_ON_CURSOR flag causes both the
initial activation and the selected vertex group to prompt the user
to select a region.
2023-07-28 16:09:29 +10:00
Hans Goudey
795ca93de5 Cleanup: Format
Somehow this snuck through, sorry for the noise.
2023-07-27 23:47:26 -04:00
Hans Goudey
bed79d9ad1 Sculpt: Parallelize grid bounds calculations for creating PBVH
Similar to 79115c5c56, but for multires sculpting. Improves
the PBVH build time for a 16 million vert multires sculpt by about 100ms
(from 470ms to 370ms). That itself is just a small portion of the time
spent entering sculpt mode though.
2023-07-27 23:38:28 -04:00
Hans Goudey
25917f0165 Sculpt: Reduce overhead of PBVH draw with blender::FunctionRef
At least on GCC on Linux, it appears std::function has noticeable
overhead compared to blender::FunctionRef. That makes some
sense, as the latter generally handles less, and the performance
difference is mentioned in the function ref header as well.

To test performance, I measured the timing of the first data
upload (`BKE_pbvh_draw_cb`) after entering sculpt mode. For
meshes, I observed a 30% improvement, from 1.7s to 1.3s.
For multires, I observed a change from 290ms to 263ms.
The change should apply to regular draw updates while sculpting,
but that's harder to measure.

This is also cleaner semantically, since the callbacks aren't meant
to own any data, they are just lambdas that capture by reference.
2023-07-27 23:38:28 -04:00
Hans Goudey
1c9e32cab1 Cleanup: Sculpt: Use r_ prefix for return argument 2023-07-27 23:38:28 -04:00
Hans Goudey
82f67a1b58 Cleanup: Use const reference for PBVH draw arguments 2023-07-27 23:38:28 -04:00
Campbell Barton
a478a4cd92 Fix crash drawing armatures in edit-mode
ArmatureDrawContext::bcolor wasn't initialized causing a crash.
Resolve by initialing the whole struct to zero.
2023-07-28 11:36:46 +10:00
Campbell Barton
9a37a206cf Cleanup: remove duplicate struct member comments 2023-07-28 10:04:26 +10:00
Campbell Barton
7768c1cc96 Fix crash loading corrupt blend file
Missing NULL check in [0] meant failing to load a blend file crashed
instead of reporting a warning.

[0]: a1d7ec7139.
2023-07-28 09:43:51 +10:00
Campbell Barton
ea8d985db8 Cleanup: various C++ cleanups
- Use C++ headers.
- Use function style cast.
- Use boolean literals.
- Remove redundant struct, void.
- Remove redundant parenthesis.
2023-07-28 09:38:07 +10:00
Campbell Barton
257cf12439 Cleanup: quiet compiler warnings 2023-07-28 09:38:05 +10:00
Campbell Barton
e4437f15f3 Cleanup: format 2023-07-28 09:33:42 +10:00
Hans Goudey
69cf65732a Sculpt: Replace GHash with Map when building PBVH
Reduces the average runtime of building mesh PBVH nodes from 4.2 to
3.3 seconds in a basic test with a 16 million face grid on my hardware.
This is probably mainly because of improved inlining with C++
templates. It also makes the code easier to understand.
2023-07-27 17:47:34 -04:00
Hans Goudey
79115c5c56 Sculpt: Multithread PBVH mesh triangle bounds calculation
When entering sculpt mode (or another mode that uses PBVH), the
bounds of each triangle are calculated serially. Doing this in parallel
is simple, and about 10x faster (568 to 56 ms) on a Ryzen 7950x.
2023-07-27 17:47:34 -04:00
Hans Goudey
1be70f22cc Cleanup: Use C++ containers and spans for some PBVH data
One thing to point out is that `PBVH::nodes` is now stored in a `Vector`
which replaces the manual amortized growth. That requires explicitly
setting the defaults of PBVHNode fields for default initialization.

Similar to f0b53777c8
2023-07-27 17:47:34 -04:00
Hans Goudey
81e687b49d Cleanup: Use const for PBVH node grid indices 2023-07-27 17:47:34 -04:00
Harley Acheson
1f4e59a96f Cleanup: Make format
Small format changes in various files (not just mine).
2023-07-27 13:12:52 -07:00
Harley Acheson
38d90f1f47 BLF: Conversion of blf_font_w32_compat to c++
Simple conversion of blf_font_win32_compat.c to .cc

Pull Request: https://projects.blender.org/blender/blender/pulls/110552
2023-07-27 21:57:37 +02:00
Germano Cavalcante
89e0f82e86 Cleanup: Remove the 'tc_' prefix in transform convert functions
This prefix is not as descriptive, nor is it helpful.

Also this convention is not followed in others transform conversion
types.
2023-07-27 16:06:13 -03:00
Julian Eisel
3d6f02493e Revert 790cbeda2c
revert Outliner: Port grease pencil effect elements to new tree-element code design

This is causing compile errors which I can’t fix right now. Reverting until resolved.
2023-07-27 19:10:56 +02:00
Almaz-Shinbay
790cbeda2c Outliner: Port grease pencil effect elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds new classes for grease pencil effect elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110371
2023-07-27 18:42:09 +02:00
Nate Rupsis
8183f21258 Animation: Default NLA duplucation hot keys to duplicate linked
## Overview

Much like node groups, or a VSE clip, when we duplicate we actually want a _linked_ duplicate. This PR updates the NLA key board for Duplicate linked to `Shift + D`, and Duplicate to `Alt + D`.

Additionally, update Tool tips to reflect duplicate vs linked duplicate.

Pull Request: https://projects.blender.org/blender/blender/pulls/110316
2023-07-27 18:14:05 +02:00
Almaz-Shinbay
8214109778 Outliner: Port deform group elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds new classes for deform group elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110003
2023-07-27 17:36:41 +02:00
Jacques Lucke
ca1066faf3 Cleanup: move avi io to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110537
2023-07-27 17:13:07 +02:00
Julian Eisel
382683db62 Fix build errors after ee7ba1955c 2023-07-27 17:04:42 +02:00
Almaz-Shinbay
ee7ba1955c Outliner: Port particle system elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a new class for particle system elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110245
2023-07-27 16:29:19 +02:00
Bastien Montagne
aecf6dd1db File Browser: Add proper warning when trying to list content of invalid library.
In case a blend file opening fails (in the context of library content
listing, e.g. for linking or appending), the File Browser would just
show an emtpy window.

With the new comnpatibility policy, this will now become a fairly common
situation, which requires giving proper explanations to the user.

This commit re-uses and extends the system used to display errors
messages from the Asset browser.

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Bastien Montagne
05243a4206 BKE_file: Add util to check if a given blend file is readable.
`BKE_blendfile_is_readable` attempts to open the given file path, and
return `true` on success, `false` on failure.

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Bastien Montagne
a1d7ec7139 Core: Implement new blendfile compatibility handling.
This implements the main aspects of changes to blendfile compatibility
as designed in #109151:
* Blender files which file minversion is newer than current Blender
  executable won't be loaded at all.
* Blender files which file version is newer than current Blender will
  triger systematic warning to user:
  * In the status info bar (lower right corner in default UI).
  * When attempting to save (overwrite) them.

This means that the file minversion becomes a hard limit, and not a
soft, warning-only as it used to be. Further more, forward compatibility
warning is now systematic (instead of depending on file minversion),
and more visible for users.

See also https://wiki.blender.org/wiki/Process/Compatibility_Handling
for details over the new policy.

Technically:
* Opening any file with a minversion newer than current Blender file one
  now triggers an early abort, with an error message reported to the user.
  This is handled by a new utils called from `blo_decode_and_check`.
* Any file newer than current Blender version sets a new
  `has_forward_compatibility_issues` flag in Main struct at read time.
* Status bar info area is turned into a template, which uses this flag
  to display special warning UI and tooltip when set.
* A new confirmation popup appears when user tries to save (overwrite)
  such a 'newer' blendfile, stating potential loos of data, and
  proposing by default to 'save as' instead.
* The 'quit unsaved' popup has also been updated to 'save as' instead of
  'save' when the edited file is has potential forward compitibility
  issues.

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Bastien Montagne
830730e2cc Reduce file minversion to 3.6 (sub 11) for Blender 4.0.
Required to make 4.0 files readable by 3.6 once the compatibility
changes are backported to the LTS releases.

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Bastien Montagne
0896cae97c BKE version: Add utils to get string out of numbers for blendfile version.
Since in rare cases there may be needs to expose file subversion here,
the following format was defined:

  <major>.<minor> (sub <subversion>)

Part of #109151 (PR !110109).
2023-07-27 16:21:38 +02:00
Falk David
8acd3dfb8e Anim: Cleanup: Move CfraElem struct to editors
This struct was defined in `BKE_fcurve.h` but only used in editor files.
The only function that used this struct in BKE was marked unused.

This commit removes the unused BKE function and moves the struct
to `ED_keyframes_edit.h`.

Pull Request: https://projects.blender.org/blender/blender/pulls/110527
2023-07-27 15:11:30 +02:00
Sybren A. Stüvel
e604f3db91 Refactor: Anim, abstractions for armature layers
Add an API for armature layer access. Instead of accessing `arm->layer`
and friends directly, the code now uses this API. This will make things
easier to replace by bone collections in the future.

The functions are named "bonecoll" (short for "bone collection"), as
that's the soon-to-be-introduced replacement for armature layers. This
API is the first step towards that replacement, and should help to
reduce the changes necessary when functional changes are committed.

This also creates a new module `source/blender/animrig` for Animation &
Rigging code. This will, for example, house the bone collection system
in the near future.

There is a bunch of code currently spread across blenkernel and editors
in a rather ad-hoc way; it is intended that at some point that code gets
moved into `animrig` as well (or at least the subset of that code where
such a move makes sense; brain still required).

Ref: #108941

No functional changes.
2023-07-27 14:57:01 +02:00
Iliya Katueshenock
6a03f3a575 Fix #110210: Hide Value option doesn't work on color sockets
Regression caused by 7026096099.
Original error introduced in 46fff97604.
Name hadling isn't problem of a declaration matching functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/110225
2023-07-27 14:55:15 +02:00
Sergey Sharybin
6b9da41221 Fix doc builder using C version of bmesh_opdefines
The file bmesh_opdefines.c was recently converted to bmesh_opdefines.cc,
but the manual builder was not updated accordingly.

Also, update some comments in the code which were still mentioning the C
version of this file.

Pull Request: https://projects.blender.org/blender/blender/pulls/110532
2023-07-27 14:49:00 +02:00