Commit Graph

101526 Commits

Author SHA1 Message Date
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
Sergey Sharybin
76995feea0 Refactor: Move tile highlight logic outside of Render
Allows to generalize the API a bit more, getting closer to
a situation when RenderEngine::re points to a baseclass of
the Render.
2023-07-27 12:37:06 +02:00
Sergey Sharybin
032bcd50f8 DNA: Add C++ comparison operator to rcti 2023-07-27 12:37:06 +02:00
Sergey Sharybin
1c6c05ea7e Refactor: Make highlighted tiles constant in the API 2023-07-27 12:37:06 +02:00
Sergey Sharybin
45f58a5b5f Cleanup: Remove extern "C" from C++ only header 2023-07-27 12:37:06 +02:00
Pratik Borhade
6f0477bd1d Fix #107918: Weight Gradient tool paints over locked vertex groups
Exit the operator code if `DG_LOCK_WEIGHT` flag is set
for active vertex group to avoid painting over locked vertex
group. New function `BKE_object_defgroup_active_is_locked`
created to handle this.
2023-07-27 16:06:07 +05:30
Sybren A. Stüvel
3a89ffc99c Refactor: anim, make ArmatureDrawContext *ctx parameters const
In the Armature drawing code, make `ArmatureDrawContext *ctx` parameters
`const` wherever possible.

No functional changes.
2023-07-27 12:29:36 +02:00
Falk David
610834540a GPv3: Return correct mode in BKE_paintmode_get_active_from_context
Previously this function would return `PAINT_MODE_TEXTURE_2D`.
This would result `paint_space_stroke_enabled` to return true, when it
shouldn't for Grease Pencil .
2023-07-27 12:22:47 +02:00
Sybren A. Stüvel
4aef0204ac Refactor: anim, drawing code, split up get_pchan_color into three funcs
In the Armature drawing code, split up `get_pchan_color()` into three
separate functions. It was basically one big `switch` with three
`case`s, and there were three calls of the function, each with its own
hard-coded parameter value, one for each `case`.

This now also makes it clear that two of those functions always write to
their return parameter, and thus copying a default color 'just in case'
is no longer necessary, reducing the parameter counts even more.

No functional changes.
2023-07-27 12:14:00 +02:00
Sybren A. Stüvel
725542cf42 Refactor: anim, avoid passing constflag everywhere
Add a `UnifiedBonePtr::constflag()` function to grab the `constflag` from
the bone, so that it doesn't have to be passed as a separate parameter
to every drawing-related function.

No functional changes.
2023-07-27 12:14:00 +02:00
Pratik Borhade
4c12801532 GPv3: Send notifiers and undo push when changing the active layer
Use RNA to update the active layer and also do an undo
push in `on_activate` function of tree-view. This is now
possible after recent refactor: 741c684bf6, 2e9bc6373c

Part of: https://projects.blender.org/blender/blender/pulls/110133

Pull Request: https://projects.blender.org/blender/blender/pulls/110378
2023-07-27 11:37:45 +02:00
Sybren A. Stüvel
69150a35ba Refactor: anim, small refactor of armature drawing code
- Introduce `UnifiedBonePtr` to avoid having to pass `(EditBone *eBone,
  pPoseChannel *pchan)` everywhere.
- Introduce `eArmatureDrawMode` and store that on the
  `ArmatureDrawContext`, to avoid having to pass `bArmature *arm` and
  then doing `arm->flag & ARM_POSEMODE` everywhere.
- Use the `eBone_Flag` type instead of `int`.
- Deprecate the `ARM_POSEMODE` armature flag. It is no longer necessary,
  and also it was changing DNA data from the draw functions. The flag
  was basically purely runtime-only, to pass some information to
  lower-level drawing code, yet it was stored in DNA. It has been
  replaced by the `eArmatureDrawMode`  on the context.

Note that some comparisons `eBone != nullptr` (often using the implicit
conversion of pointer to boolean) have been replaced by a comparison to
`ctx->draw_mode`. This is used in cases where the pointer comparison was
actually indicative of the draw mode, and to help get the `else if
(draw_mode == ARM_DRAW_MODE_POSE)` symmetrical.

Disclaimer: this `UnifiedBonePtr` can probably be used in many other
places in Blender as well. We might move it somewhere else in the
future, but to keep things simple I just want to see how it behaves
locally first.

Pull Request: https://projects.blender.org/blender/blender/pulls/110424
2023-07-27 11:32:11 +02:00
Amelie Fondevilla
b195f9a3da GPv3: Cleanup: Looping over frames in a layer
Use structured binding declaration to unwrap the item into `frame_number` and `frame`.
Makes the code more readable.

Pull Request: https://projects.blender.org/blender/blender/pulls/110525
2023-07-27 11:29:13 +02:00
Christoph Lendenfeld
f7570c5ef4 Animation: Disable NLA mapping if no NLA tracks are present
The drawing code executed NLA mapping code
even though there were no tracks to be mapped.

Disabling this takes the `draw_fcurve` function
from ~1130μs to ~985μs (heavy example scene with dense data)
~13% faster
Of course this only applies when not using the NLA.
And the performance benefit is larger, the more curves are on screen

Pull Request: https://projects.blender.org/blender/blender/pulls/110306
2023-07-27 09:31:43 +02:00
Campbell Barton
c14a43acce Fix paint stroke "mode" property being reused when weight painting
Binding a key to weight-paint with mode set (invert/smooth for e.g.)
caused regular weight painting to reuse this setting.

Don't reuse paint "mode" between strokes.
This also allows the default to be removed from the key-map.
2023-07-27 15:58:50 +10:00
Campbell Barton
c7595272eb RNA: fail with an error when unused callbacks are assigned
Exit and fail when set callbacks are assigned to read-only properties
as well as array callbacks for non-array properties.
2023-07-27 15:07:39 +10:00
Campbell Barton
2f39d8df59 Cleanup: remove unused rna_Main_filepath_set callback 2023-07-27 15:07:20 +10:00
Campbell Barton
3da47a6084 Cleanup: remove unused set callbacks from readonly RNA properties
Oversight in 8d9422cfe3.
2023-07-27 14:32:40 +10:00
Harley Acheson
8d9422cfe3 Fix #110508: Text Object Select Attributes in Object Mode
Status of selected bold, italics, underline, and small caps requires
that the curve have an editfont object. Not checking for this works
interactively but can cause errors in Python. This PR adds explicit
getters and setters that check for editfont.

Pull Request: https://projects.blender.org/blender/blender/pulls/110513
2023-07-27 05:31:08 +02:00