Commit Graph

106872 Commits

Author SHA1 Message Date
Campbell Barton
503d56e2c8 Cleanup: use const variables in convexhull_2d_sorted for clarity 2024-02-16 14:26:49 +11:00
Campbell Barton
37475d252f Cleanup: use "use_" prefix for RNA boolean 2024-02-16 14:26:47 +11:00
Campbell Barton
7582b15c4c Cleanup: spelling in comments 2024-02-16 14:26:46 +11:00
Campbell Barton
9992718703 Cleanup: restore macro to avoid repetition for swapping values 2024-02-16 14:26:45 +11:00
Jesse Yurkovich
551b846bcd Merge branch 'blender-v4.1-release' 2024-02-15 16:55:12 -08:00
Jesse Yurkovich
9e8bbc1129 Fix: USD hooks leak
If hooks are not unregistered Blender will report a leak on exit.

Store the hooks as unique_ptrs to remove manual memory management and
encapsulate the previous global list inside a function. These changes
ensure that everything is cleaned up on termination.

Also makes a small change to the hook documentation for a missing
`import` statement.

Pull Request: https://projects.blender.org/blender/blender/pulls/118294
2024-02-16 01:53:33 +01:00
Jacques Lucke
d803b6acca Cleanup: simplify usage of Map 2024-02-15 22:51:18 +01:00
Jacques Lucke
d9d9ff1dcd Nodes: hide shader input in node properties panel
This was missing in d27a1c47fa.
2024-02-15 21:55:53 +01:00
Jacques Lucke
75e9056cac Geometry Nodes: support group ids in Sample Nearest Surface node
This adds group ids to the `Sample Nearest Surface` node. This allows e.g. finding
the closest point on a specific mesh island.

Three new sockets are added:
* `Group ID`: Is evaluated on the face domain and splits the input mesh into  multiple
  parts, each with its own id.
* `Sample Group ID`: Determines in which group the closest nearest surface is detected.
* `Is Valid`: Outputs true if a nearest surface was found, it's false if the group is empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/118150
2024-02-15 20:35:02 +01:00
Bastien Montagne
0801fcd6b3 Cleanup: make format 2024-02-15 19:49:58 +01:00
Bastien Montagne
f8541337bb IDType: Refactor some 'conversion' helpers.
Use IDTypeInfo data as much as possible, to avoid too many functions
`switch`ing over all ID type values.

Now only `BKE_idtype_idcode_to_index` and `BKE_idtype_idfilter_to_index`
do that, all others are using one of the above to retrieve the valid
IDTypeInfo and return data from it.

Also tweaked some namings to make them more consistent.

No behavioral changes expected here.
2024-02-15 19:45:10 +01:00
Bastien Montagne
f21540f428 Cleanup: IDTypeInfo: Use std::array for the static array of ID types.
Also add a hard, direct failure in `id_type_init`, in case one ID type
is missing processing there.

No behavioral changes expected here.
2024-02-15 19:45:10 +01:00
Bastien Montagne
d083f69295 IDType: Add FILTER_ID_ for deprecated IPO ID type.
Although this type is not much encountered anymore, it's simpler and
cleaner to have a FILTER value for all known ID types.
2024-02-15 19:45:10 +01:00
Bastien Montagne
df0efda0d6 Refactor: IDTypeInfo: Add info about 'potentially used IDTypes'.
This data was 'hidden' away in a util in
`lib_query.cc`, which made it hard to discover and keep up-to-date.

However, as shown by e.g. #108407, critical low-level features in ID
management code, such as remapping, now rely on this information being
valid.

Also simplify `BKE_library_id_can_use_filter_id` and
`BKE_library_id_can_use_idtype` to make them more generic, relying on
IDTypeInfo to retrieve IDtype-specific info.

No behavioral changes expected here.
2024-02-15 19:45:10 +01:00
Bastien Montagne
f674e486e1 Merge branch 'blender-v4.1-release' 2024-02-15 18:26:31 +01:00
Bastien Montagne
401a2397db Fix mistake in fix for #108407 (crash on deleting shapekeys).
Own d38824bc02 mistakenly added the 'FILTER_ID_KE' to the list IDTypes
usable by Lights (`ID_LA`) instead of Lattices (`ID_LT`)...

Note that this did not cause any additional issue, but only missed part
of the expected fix.
2024-02-15 18:25:50 +01:00
Sebastian Parborg
91100fc6d4 Merge branch 'blender-v4.1-release' 2024-02-15 18:08:35 +01:00
Sebastian Parborg
86522d9ab1 Fix #118276: IDs were remapped by mistake when copying in the VSE
All IDs in the current bmain were remapped while it should have only
been done for IDs in the dummy scene created for the copy operation.
2024-02-15 18:06:54 +01:00
Miguel Pozo
50a3a0253d Revert "EEVEE: Remove Thickness output"
This reverts commit 91b727028a.
The change was only meant for 4.1.
Thickness output is required for EEVEE-Next.
2024-02-15 18:04:30 +01:00
Miguel Pozo
5eac9e6095 Merge branch 'blender-v4.1-release' 2024-02-15 17:59:44 +01:00
Miguel Pozo
91b727028a EEVEE: Remove Thickness output 2024-02-15 17:57:20 +01:00
Hans Goudey
ca49998049 Cleanup: Make format 2024-02-15 11:36:28 -05:00
Hans Goudey
af9709089e Cleanup: Remove unnecessary set curve type optimization
Now that attributes use implicit sharing, copying CurvesGeometry
is relatively cheap, and the complexity of this function isn't worth
the remaining optimization of avoiding user count updates.
2024-02-15 11:35:33 -05:00
Christoph Lendenfeld
0c560fb7ef Fix #112395: Proportional editing indicator in Graph Editor and Dope Sheet
When using proportional editing in the Graph Editor or the Dope Sheet,
the GUI displays a circle suggesting that the influence is limited in x and y.

In reality those editors only look at the x-axis to determine which keys to influence.

This PR fixes that by adding a new drawing function for those editors that
draws 2 lines to indicate a range.

In theory this can be a feature in other 2D editors in the future.
I assume the VSE would benefit from this as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/118196
2024-02-15 16:50:34 +01:00
Hans Goudey
1bf6d8b0b9 WM: Move report list to runtime struct
These reports were embedded in the window manager DNA,
but they were always cleared when reading it from files. It's clearer
to just not store the reports in files at all. I also moved the reports
initialization and freeing to the constructor and destructor of the
runtime class.

This is the only place `ReportList` was embedded in DNA, so
after this we can move that to use C++ features if we want.

Pull Request: https://projects.blender.org/blender/blender/pulls/118329
2024-02-15 16:42:35 +01:00
YimingWu
b661b368c4 GPv3: Length modifier
This ports the length modifier to Grease Pencil v3.

Pull Request: https://projects.blender.org/blender/blender/pulls/117124
2024-02-15 16:37:54 +01:00
Sebastian Parborg
8a388a39ea Fix #118276: IDs were remapped by mistake when copying in the VSE
All IDs in the current bmain were remapped while it should have only
been done for IDs in the dummy scene created for the copy operation.
2024-02-15 16:31:30 +01:00
Sean Kim
a2f49b05f8 Sculpt: Disable set pivot and select color for invisible objects
This PR disables the `SCULPT_OT_sample_color` and `SCULPT_OT_set_pivot_position` operators and the following actions that correspond to them when attempting to operate on invisible objects:
* Set Pivot
* Sample Color

| Set Pivot | Sample Color |
| --- | --- |
| ![invisible_set_pivot.gif](/attachments/0dd23857-abdf-4214-a08d-ce986f15e16f) | ![invisible_set_color.gif](/attachments/84950810-1c3d-4f02-8e84-67425d80754d) |

### Limitations
* All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience.

Addresses part of #112371

Pull Request: https://projects.blender.org/blender/blender/pulls/118306
2024-02-15 16:30:31 +01:00
Sean Kim
1e3e5c5ac2 Sculpt: Disable face set operators on invisible objects
This PR disables the `SCULPT_OT_face_sets_init`, `SCULPT_OT_face_sets_create`, `SCULPT_OT_face_sets_edit`, `SCULPT_OT_face_sets_randomize_colors`, `SCULPT_OT_face_set_change_visibility`, `SCULPT_OT_face_set_box_gesture`, and `SCULPT_OT_face_set_lasso_gesture` operators and the following actions that correspond to them when attempting to operate on invisible objects:
* Face Set From Masked
* Face Set from Visible
* Face Set from Edit Mode Selection
* Initialize Face Sets
* Grow Face Set
* Shrink Face Set
* Randomize Colors
* Toggle Visibility
* Hide Active Face SEt
* Box Face Set
* Lasso Face Set

| Init | Create | Edit |
| --- | --- | --- |
| ![fs_init.gif](/attachments/f44e96ab-e1c9-4279-9f69-80ea9503c830) | ![fs_create.gif](/attachments/3992b8fc-bd59-4aee-a2f6-6d7aa507f0b9) | ![fs_edit.gif](/attachments/78a7c447-8fd8-41dc-846a-5617751e5594) |

| Randomize Colors | Visibility | Gestures |
| --- | --- | --- |
| ![fs_color.gif](/attachments/43230f6b-4a39-4417-ac90-b94e3f33e724) | ![fs_hide.gif](/attachments/fe6fcdac-eda9-4f55-b013-f132f373fe65) | ![fs_gesture.gif](/attachments/5f36d7ed-c5bf-4154-af9e-0f19fb24249c) |
### Limitations
* All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience.

Addresses part of #112371

Pull Request: https://projects.blender.org/blender/blender/pulls/118228
2024-02-15 16:29:08 +01:00
Sean Kim
fca979e237 Sculpt: Disable modal filter operators on invisible objects
This PR disables the `SCULPT_OT_mesh_filter`,  `SCULPT_OT_cloth_filter`, and `SCULPT_OT_color_filter` operators and the following actions that correspond to them when attempting to operate on invisible objects:
* Mesh Filter
* Color FIlter
* Cloth Filter
| Mesh & Cloth | Color |
| ---- | --- |
| ![invisible_filter_mesh.gif](/attachments/87d2dfe2-be27-40bf-bb58-e9aa761a3f0a) | ![invisible_filter_color.gif](/attachments/ac51584e-bd87-4392-9bda-6ad5191cf38f) |

Addresses part of #112371

Pull Request: https://projects.blender.org/blender/blender/pulls/118172
2024-02-15 16:26:38 +01:00
Sean Kim
d76c1e30e7 Sculpt: Disable mask operators on invisible objects
This PR disables the `SCULPT_OT_mask_init`, `SCULPT_OT_mask_filter`, `SCULPT_OT_mask_by_color`,  and `SCULPT_OT_mask_from_cavity` operators and the following actions that correspond to them when attempting to operate on invisible objects:
* Random Mesh
  * Per Vertex
  * Per Face Set
  * Per Loose Part
* Smooth Mask
* Sharpen Mask
* Grow Mask
* Shrink Mask
* Increase Contrast
* Decrease Contrast
* Mask By Color
* Mask From Cavity

| Init | Filter | By Color | From Cavity |
| ---- | --- | --- | --- |
| ![](/attachments/fc2ea68e-0af9-4887-b1a3-b2aa2eacaf21) | ![](attachments/3e94f48c-b463-417c-9ad9-bdc74e24bd70) | ![](/attachments/16029e7c-d973-483e-8c4a-164133d0fe11) | ![](/attachments/b356a248-354b-4c68-bf5b-c49907edcaff)

### Limitations
* All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience.

Addresses part of #112371

Pull Request: https://projects.blender.org/blender/blender/pulls/118173
2024-02-15 16:24:39 +01:00
Omar Emara
49faea5f36 Fix #111345: Compositor uses entire viewport in camera view
The compositor assumes the entire viewport as its compositing space even
in camera view. The current design decision was to limit the compositing
space by the camera region only if the camera passepartout is opaque,
that is, areas outside of the camera are not visible.

This patch changes that behavior to always limit the compositing space
by the camera region. The downside is that areas outside of the camera
will be left uncomposited.

This is useful to match viewport compositing to final render compositing
in terms of maintaining the same space, but not necessarily the same
resolution. However, this still has the limitation that space will be
different when the camera region intersects the viewport, since we only
composite their intersection in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/118241
2024-02-15 15:46:34 +01:00
Raul Fernandez
ed6f8c5b86 Fix #81948: Sculpt mode Annotation tool cursor conflict
This fix checks if the annotation tool is active in `bool SCULPT_mode_poll_view3d(bContext *C)` to hide the sculpt cursor .

Pull Request: https://projects.blender.org/blender/blender/pulls/118255
2024-02-15 15:28:16 +01:00
Aras Pranckevicius
b4c6c69632 ImBuf: do not clear newly allocated image pixels when not needed
In some/many cases, an `ImBuf` is allocated, and all the pixels are
immediately filled by some code. Doing the memory clear within allocation
is just memory traffic for no good reason.

Add a flag to skip initialization of ImBuf pixels (IB_uninitialized_pixels)
and use that in some parts of VSE effects/rendering/cache/scopes, as well
as image loading code.

Rendering out VSE movie, on Windows/VS2022/Ryzen5950X:
- Sprite Fright: 443sec -> 414sec (takes 93% of previous time)
- Gold previs: 367sec -> 325sec (takes 88% of prev time)

Pull Request: https://projects.blender.org/blender/blender/pulls/118321
2024-02-15 14:54:57 +01:00
YimingWu
76b0976500 GPv3: Multiple Strokes Modifier
This migrates the multiple strokes modifier to Grease Pencil v3.

Pull Request: https://projects.blender.org/blender/blender/pulls/117796
2024-02-15 14:19:50 +01:00
Pratik Borhade
43996a54cf GPv3: Lock/Unlock All Layers
Port the legacy lock/unlock all layers operator from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118259
2024-02-15 12:14:17 +01:00
Omar Emara
4780cd3368 Fix: GPU compositor ignores border region
The GPU compositor does not take the border region into consideration,
which means it reads more than it should, leading to corruption. Fix
this by taking the border region into account when computing render
width and height.
2024-02-15 12:56:16 +02:00
Campbell Barton
7e66026fa0 Cleanup: odd doc-string formatting, match argument names in headers
Quiet argument name mis-match warning.
Assert that WM_event_timer_add takes a timer event type.
2024-02-15 21:31:08 +11:00
Jacques Lucke
c1c3a4e45d Merge branch 'blender-v4.1-release' 2024-02-15 11:29:31 +01:00
Campbell Barton
55adfdc7af Merge branch 'blender-v4.1-release' 2024-02-15 21:22:52 +11:00
Jacques Lucke
590e4652b6 Fix #118211: clarify use cases of layout panels in api docs
We could support layout panels in sublayouts like boxes eventually,
but for now this is out of scope.
2024-02-15 11:21:11 +01:00
Sergey Sharybin
20145ea51f Cleanup: Unused variable in release builds
Pull Request: https://projects.blender.org/blender/blender/pulls/118312
2024-02-15 10:41:17 +01:00
Aras Pranckevicius
ffbc90874b ffmpeg: cache swscale contexts instead of re-creating them
ffmpeg's libswscale is used to do RGB<->YUV conversions on movie reading
and writing. The "context" for the scale operation was being created
and destroyed for each movie clip / animation. Now, maintain a cache
of the scale contexts instead.

E.g. in Gold edit, it only ever needs two contexts (one for reading
source movie clips since they are all exactly the same resolution
and format; and one for rendering the resulting movie).

During playback, on some of the "slow" frames (camera cuts) this
saves 10-20ms (Windows, Ryzen 5950X). Rendering whole movie goes
from 390sec to 376sec.

Pull Request: https://projects.blender.org/blender/blender/pulls/118130
2024-02-15 10:35:02 +01:00
Bastien Montagne
59d59006c4 GPv3: Implement EditMode Undo.
Relatively basic and straightforward implementation.

Further optimizations are possible (and needed), especially regarding
the handling of caches.

Notes:
* All drawings are stored in each undo step. This is needed (also for
  Reference drawings), in case some drawings are added, removed or
  re-ordered between undo steps.
* The whole tree of layers is copied as-is, using the C++ classes copy
  constructors, so they only handle what these constructors copy
  (noticeably, the `Layer` copy constructor does not currently handles
   masks?).
* The active layer pointer is stored and restored by its name.
* The layer customdata is also duplicated using standard `BKE_customdata`
  API.

Pull Request: https://projects.blender.org/blender/blender/pulls/117072
2024-02-15 10:19:52 +01:00
Bastien Montagne
9be522d480 GPv3: Add low-level resize_drawings function. 2024-02-15 10:19:50 +01:00
Bastien Montagne
13887fc427 GPv3: Add assignement operator to LayerGroup class. 2024-02-15 10:19:50 +01:00
Bastien Montagne
f2e481a519 Core: Refactor id_delete.
This commit essentially:
* Remove the 'delete single ID' code path.
  The multi-deletion code has now be around for a long while, so we
  should be able to assume it is mature enough. It is also several times
  faster when deleting a lot of IDs at once.
* Move away from using `LIB_TAG_DOIT` ID tag in internal code, using a
  Set instead to store the IDs to be deleted.

Potential side-effects:
* The 'delete single ID' codepath (removed by this commit) was making
  some dangerous assumptions regarding order of IDs in Main and 'strong'
  dependencies between them. While these assumptions where presumably
  correct in current code/data model context, they were logically wrong
  and could have randomly cause bugs in the future.
* The sanitiing check on usercount performed in the case of the single
  ID deletion cannot be done anymore. Should not be that usefull
  anymore, as there are other places where IDs usercounts are validated.
* Performances:
  * The batch-deletion did not show any significant difference in speed.
  * Massively deleting IDs one by one however, showed a surprising 10%
    speedup.

Pull Request: https://projects.blender.org/blender/blender/pulls/118283
2024-02-15 10:16:32 +01:00
Bastien Montagne
a3bf395a10 Core: IDRemapper: Refactor handling of 'never null' ID usages.
Existing code would allow tagging on request IDs which had a 'never
null' usage potentially cleared by the remapping operation (e.g. if an
Object obdata would have been set to `nullptr`).

While this worked for the current extremely restricted usecase (ID
deletion), this was not the best design, as it forced the ID remapping
user code to be very careful about its own usages of the `LIB_TAG_DOIT`
tag.

This commit replaces internal tagging by adding such IDs to a Set in
`IDRemapper` class, which user code can then use to find which IDs
(would have) had a 'never null' ID pointer cleared.

There are two additional changes induced by this commit:
* `BKE_libblock_unlink` `do_flag_never_null` parameter is removed.
  As it is not used in current codebase, simpler to remove than update
  the code to support it.
* `ID_REMAP_FLAG_NEVER_NULL_USAGE` option is renamed to
  `ID_REMAP_STORE_NEVER_NULL_USAGE`.
  In addition, its behavior is slightly modified:
  * Before, the owner ID would systematically be tagged if it had such
    'never null' ID usages, regardless of whether said ID usages (would)
    have actually been remapped to `nullptr`.
  * Now, the owner ID is only added to the `never_null_users` set if its
    'never null' usages (would) have been cleared.
2024-02-15 10:16:30 +01:00
Jeroen Bakker
f72fdcf4ae GPU: Validate All Statically Defined Shaders As Argument
This PR adds a new command line argument to validate all statically
defined shaders. It is useful for platform support to understand
what isn't working.

It only checks statically defined shaders. Dynamic shaders (EEVEE/Compositor)
can still be fail.

The report is printed to console. After checking with windows platform and
triaging we could also add it to gpu debug script. There is a risk of adding it there
as it might crash and don't store any output.

Pull Request: https://projects.blender.org/blender/blender/pulls/117326
2024-02-15 08:13:44 +01:00
Campbell Barton
5c87dfd269 Cleanup: use BLI_time_ prefix for time functions
Also use the term "now" instead of "check" for clarity.
2024-02-15 13:15:56 +11:00