Commit Graph

101544 Commits

Author SHA1 Message Date
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
Jacques Lucke
1327befc94 DRW/GPU: move .c files to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110509
2023-07-27 14:16:58 +02:00
Campbell Barton
4cf728c3dd Cleanup: use boolean for GpencilModifierTypeInfo::is_disabled
Also rename user_render_params to use_render_params
(matching object modifiers).
2023-07-27 22:10:16 +10:00
Campbell Barton
df530d4fd4 Cleanup: various C++ cleanups
- Use C++ headers.
- Use function style cast.
- Use boolean literals.
- Remove redundant struct, void.
- Correct struct comment ID's.
2023-07-27 21:54:00 +10:00
Campbell Barton
7b7af7d1d5 Fix vertex paint color sample on some GPU's under Wayland
Support sampling vertex colors when WM_CAPABILITY_GPU_FRONT_BUFFER_READ
isn't supported (see #106264).
2023-07-27 21:35:32 +10:00
Pratik Borhade
6f5873de5f Fix #110497: Quick favorites can be duplicated
Mistake in adb370e6ba
Skip "add to quick favorites" button from context menu when button is
found in user_menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/110517
2023-07-27 13:34:52 +02:00
Jacques Lucke
3e6025c1b1 Cleanup: move some files to c++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110529
2023-07-27 13:10:42 +02:00
Jacques Lucke
4c1d66edab Fix: avoid appending graph inputs multiple times
This didn't lead to problems in practice, because the sockets
were deduplicated later on in `GraphExecutor` by putting
them into a `VectorSet`.
2023-07-27 13:06:32 +02:00
Campbell Barton
a5215fda33 Fix image projection paint with "mode" set to "Smooth"
Setting the paint.image_paint mode to smooth did nothing,
now it uses the soften tool as expected.
2023-07-27 21:03:04 +10:00
Pratik Borhade
d2fb16baeb Merge branch 'main' of projects.blender.org:blender/blender 2023-07-27 16:22:27 +05:30
Amelie Fondevilla
18de91f960 GPv3: Option to use tablet pressure for the eraser
The eraser tool now calibrates its radius according to the pressure only if the Use Pressure option is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/110460
2023-07-27 12:48:04 +02:00
Sergey Sharybin
2a5e0ff212 Cleanup: Remove unused argument from the tile highlight API
The Render is always an owner of the highlighted tiles, and freeing
is never needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/110294
2023-07-27 12:37:20 +02:00