Commit Graph

144706 Commits

Author SHA1 Message Date
Omar Emara
2a53debc73 Cleanup: Rename COMPOSITOR_REALTIME to GPU_COMPOSITOR
Pull Request: https://projects.blender.org/blender/blender/pulls/132118
2024-12-19 14:39:55 +01:00
Pratik Borhade
5c07d52240 Fix #131745: Grease Pencil: Removing vertex group hits assert
Caused by 5585d29d30.
Return `false` from `BKE_object_defgroup_remove` when called
with `GreasePencil` ID.

Pull Request: https://projects.blender.org/blender/blender/pulls/131776
2024-12-19 14:17:45 +01:00
Omar Emara
ae6ee3398d Cleanup: Make format 2024-12-19 15:12:38 +02:00
Sybren A. Stüvel
898beab1ee Refactor: Anim, make generic_slot_for_autoassign() a public function
This function will be used by other code in the future, and thus needs to
be publicly available.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/132114
2024-12-19 14:12:25 +01:00
Sybren A. Stüvel
9f4a0d230f Core: when swapping IDs, invalidate action slot user caches
Action Slots point to the IDs they animate, and after swapping IDs they
also need some swappage (as the Action that first animated `id_a` will
now animate `id_b`, and vice versa).

Instead of doing this in the `id_swap()` function (and requiring
knowledge of how that's supposed to be done), just mark these pointers
as dirty so that they're rebuilt at first use.

This commit contains a little more code than strictly necessary, to add
a function in BKE for this cache invalidation. This avoids having to
have a dependency on the animrig module just for this purpose.

Fixes: #130136

Pull Request: https://projects.blender.org/blender/blender/pulls/131809
2024-12-19 14:10:48 +01:00
Omar Emara
33f758dcd1 Cleanup: Remove mention of realtime compositor 2024-12-19 14:43:02 +02:00
Omar Emara
b4230d84dc Compositor: Unify references between CPU and GPU tests
This patch removes the references for the GPU tests and uses the CPU
references for both CPU and GPU, since they are expected to match. This
also unifies the tests scripts into a single script with an argument
for execution device.
2024-12-19 14:35:20 +02:00
Sybren A. Stüvel
de6c65b347 Anim: change how action_foreach_id() reports action slot user pointers
Change how `action_foreach_id()` reports action slot users. This contains
two changes:

- Report the correct pointer reference, so that the ID remapping code
  can actually change the pointers in the cache (necessary, for example,
  to nil pointers to deleted IDs).
- Never report anything when it's known the slot user cache is dirty.

Pull Request: https://projects.blender.org/blender/blender/pulls/131808
2024-12-19 13:07:25 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
Pratik Borhade
307f50f3f0 Fix #131889: Grease Pencil: Select stroke by material fails with points
When in point mode, select stroke by material fails. This seems to
happen due to ignored case of point selection attribute in exec function
written in 7ae8e1dc07.

Pull Request: https://projects.blender.org/blender/blender/pulls/131961
2024-12-19 12:11:23 +01:00
Bastien Montagne
e5b299cda5 Fix LibOverride bug when clearing invalid liboverride data.
Do not try to check liboverride properties on a freed liboverride
data.

Found while investigating #132075.
2024-12-19 12:02:35 +01:00
Omar Emara
0a6b43c827 Compositor: Make transformed realized domains symmetric
This patch changes how transformations are realized by adjusting the
computed size of the new domain after transformation. Previously, this
was computed with the lower left corner of the domain as the origin of
transformation, while now, the center of the domain is used as the
origin. Consequently, domains shrinks/grows around their center, which
results in a more stable output as transforms are animated.

A consequence of this change is that we can no longer scale odd sized
domains to even sized domains or vice versa, since it grows/shrinks by
the same amount on both sides. Supporting this case requires further
investigation and will probably require passing down information to the
realization functions themselves.
2024-12-19 12:48:44 +02:00
Julian Eisel
4b23a7d74b Refactor: Tools: Avoid passing context to functions
Better to make sure that these functions operate on the passed in data,
and do not access the current context in some way. Generally that's more
predictable, but also makes sure these functions can be called on
inactive spaces (e.g. to update the active tool in the image editor on
changes in the 3D View, see #131062).
2024-12-19 11:37:28 +01:00
Julian Eisel
9fe7923e1a Fix: Crash when displaying asset shelf with 1000s of assets
Partial fix for #130861.

Once again the issue is entries from the file list cache that get freed once the
cache exceeds its maximum size. Although we already minimized use of these
entries, we'd still keep a reference to all assets to be displayed in the shelf
for the active catalog.

Instead, only request entries from cache for the few assets that are visible and
scrolled into view. This way we only use the cached entry briefly and don't have
to store it in any way.

Note that the entries from the file list cache are only needed for loading the
previews. #122439 would change this, so it's finally independent of the cache.

This basically reverts 0f8e4b3516 which mitigated the issue quite a bit, but
here we take it further.

Pull Request: https://projects.blender.org/blender/blender/pulls/131750
2024-12-19 11:04:38 +01:00
Bastien Montagne
8bba1e919a Fix #132042: Wrong IDname handling when moving a local ID into a library.
Mistake in 5f9f3116db, ID name needs to be removed from the runtime ID
name cache data _before_ its library pointer is modified.

Library is an important part of an ID 'namesapce', so trying to remove
it after its library has been changed is trying to remove it from the
wrong namespace, leaving it in the original one.

Pull Request: https://projects.blender.org/blender/blender/pulls/132080
2024-12-19 10:43:28 +01:00
Pratik Borhade
f98a6d1a20 Fix #131067: Stencil remains in view with tools that don't use it
This is more associated with brush assets. When non-brush tool is
selected, active brush in that context is not changed (see:
`toolsystem_ref_link`).
Stencil is drawn if brush has active texture on
it (`paint_draw_tex_overlay`), since the `Brush` is still referenced to
old value, stencil is still drawn. To fix this, make sure active tool is brush
before drawing the stencil.

Also note that, trim and filter tools are not brushes but
they intetionally draws brush cursor e140f263d0.

Pull Request: https://projects.blender.org/blender/blender/pulls/131086
2024-12-19 10:33:41 +01:00
Christoph Lendenfeld
c960d2b3f7 Fix #131987: Crash when inserting keys to shader nodes with NLA tweak mode
The crash happened because `bNodeSocket.runtime` was a nullptr.
That was because the struct pointer was passed instead of the
resolved pointer. Passing the resolved pointer into `BKE_animsys_nla_remap_keyframe_values`
fixes the issue

Pull Request: https://projects.blender.org/blender/blender/pulls/132012
2024-12-19 10:23:52 +01:00
Thomas Dinges
1be75e86aa Cleanup: replace floatX_to_floatY() with make_floatY()
Now that function overloads are usable on all GPUs, replace the former explicit functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/132067
2024-12-19 09:41:55 +01:00
Omar Emara
7359b5c319 BLI: Add 2D variants of transform_point function 2024-12-19 09:40:19 +02:00
Hans Goudey
a67b5f6f63 Fix #131316: Edit overlays rendered for geometry instances
Geometry instances shouldn't be drawn with cage overlays or other
edit mode overlays since they don't necessarily correspond to original
data. In this case the draw manager thought they were in edit mode
because the object data is copied from the instance parent-- we need
_some_ object for rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/132081
2024-12-19 02:42:14 +01:00
Hans Goudey
85ee7b9f24 Cleanup: Nodes: Use utility function to retrieve selected nodes 2024-12-18 19:45:16 -05:00
Hans Goudey
cf33fa6df7 Cleanup: Avoid .c_str() calls when copying strings in node.cc
Avoid measuring the length of the string again, just copy it directly
into the buffer instead using `.copy()`
2024-12-18 19:45:16 -05:00
Hans Goudey
5f86cafcf6 Cleanup: Avoid specializing allocation names
The function name is perfectly fine for this purpose.
Avoid introducing new strings unnecessarily.
2024-12-18 19:45:16 -05:00
Hans Goudey
ca6538b596 Fix: Incorrect use of StringRef::data()
The returned pointer shouldn't be passed to a function expecting
a null terminated C string. Use the StringRef::copy function instead
which is more efficient anyway since it doesn't have to measure the
size of the string again.
2024-12-18 19:45:16 -05:00
Sean Kim
a9f127975f Sculpt: Remove undo push for SCULPT_OT_optimize
Having this operator in the undo history is unnecessary and misleading;
we do not store the previous BVH state during this operator & the data
is all stored at runtime, so memfile undo has no effect here. Undoing
the operator will have no actual effect, and redoing the operator will
waste user time to rebuild the associated data.

Pull Request: https://projects.blender.org/blender/blender/pulls/132087
2024-12-19 01:36:34 +01:00
Sean Kim
3e71e6c216 Cleanup: Suppress python console warning after previous commit
Introduced in ee2f2f00bd

Without the `register` function we get the following error in the
console when running blender:

Warning! '<path_to_blender>/scripts/startup/nodeitems_builtins.py'
has no register function, this is now a requirement for registerable
scripts

Pull Request: https://projects.blender.org/blender/blender/pulls/132091
2024-12-19 00:51:45 +01:00
Sean Kim
5743fba60e Refactor: Allow checking sculpt color support without BVH
Certain color-related operators and brushes are only relevant for certain
modes. Historically, we have performed this check by inspecting the BVH
tree type. To avoid this as a hard requirement and avoid needing to
ensure that the tree is built in these scenarios, this commit changes
the `color_supported_check` to inspect the source of truth for dyntopo
(`SculptSession.bm`) and multires (`BKE_sculpt_multires_active`).

Pull Request: https://projects.blender.org/blender/blender/pulls/132086
2024-12-18 22:17:14 +01:00
Julian Eisel
9e1f02dd4d Refactor: File Browser: Extract folder/file "special icon" drawing
As mentioned in cd13f52e75, e072853e63, fb6ac24514 and 9a6beb915d,
`file_draw_preview()` is a rather overloaded and confusing function. I'm
trying to make it more readable.

With the previous changes and all the other logic extracted, it's pretty clear
that the "special icon" drwaing (for the larger folder/file icon with the
folder/file type icon overlayed) also should be split off. Most remaining logic
in `file_draw_preview()` was either for the special icons or normal previews,
but not much code was shared within the function.

Tried to not cause user visible changes. There's a few pixel change in the
horizontal icon placement, but that's because it's centered properly now.
Previously it was just eyeballed I guess.
2024-12-18 21:51:07 +01:00
Sean Kim
0c1ee9eba2 Texture Paint: Add keybind for "merged" option when sampling colors
The removal of the UNDO flag to prevent adding undo steps when using the
`paint.sample_color` operator results in the "Sample Merged" option
being inaccessible to users without them adding a keymap of their own.

This commit makes the following changes:
* For Texture Paint using the default blender keymap, the Shift-Ctrl-X
  keybind is assigned to this operator with the merged option set to True
* For Texture Paint, using the industry compatible keymap, the Shift-I
  keybind is assigned to this operator with the merged option set to
  True

This parameter is only relevant for 3D Texture Painting so it is not
added to the other modes.

For all other `paint.sample_color` entries in both the keymap and in
some menus, the `merge` option is explicitly set to False.

Ref: #101144

Pull Request: https://projects.blender.org/blender/blender/pulls/132047
2024-12-18 20:30:10 +01:00
Hans Goudey
91e1031c42 Fix #132079: Python error when adding modifier on Surface object
It looks like the Mesh Sequence Cache modifier isn't supported
for this object type.
2024-12-18 13:17:27 -05:00
dupoxy
dc0032cc2a Fix #124937: Grease Pencil: Change Shear tool icon to match Blender 4.2
Update the icon of the shear tool in edit mode to match the
Grease Pencil shear icon in Blender 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/131993
2024-12-18 19:15:30 +01:00
Miguel Pozo
e4989ff391 Workbench: Update reference images
Pull Request: https://projects.blender.org/blender/blender/pulls/132068
2024-12-18 17:11:46 +01:00
Julian Eisel
58a81b5a6a Fix: File Browser: Preview loading icon not centered and too large
Until cd13f52e75, the loading icon drawing used to share most of the code for
drawing the "special image", so changes to those unintentionally changed to
loading icon too, e.g. in 1d47e3276b.

Make the loading icon centered where the preview would be, and reduce the size
back to what it was before 1d47e3276b.

This removes the hardcoded values that were temporarily added in cd13f52e75 to
avoid user visible changes.
2024-12-18 16:40:27 +01:00
Pratik Borhade
6f86ebd2b7 Fix #132027: Grease Pencil: Skip locked layers in frame operation
For duplicate and delete key operation, skip keyframes of locked
layers.

Pull Request: https://projects.blender.org/blender/blender/pulls/132059
2024-12-18 16:18:36 +01:00
Philipp Oeser
c2909c81c8 Fix #106849: Sculpt Edit Voxel Size text too big (applies UI scale)
Followup/correction to a0c0eefd5d.

Since the aim ist to have the text displayed in "constant viewport
size", it should actually not increase with Resoltion scale at all.

So as mentioned in a0c0eefd5d, the scale should be accounted for in
`VoxelSizeEditCustomData` > `text_mat`, and to fix the remaining (false)
influence of Resolution Scale on the size of displayed text, use
`ED_view3d_pixel_size_no_ui_scale`
instead of `ED_view3d_pixel_size` when getting the pixel size.

Pull Request: https://projects.blender.org/blender/blender/pulls/131488
2024-12-18 15:41:06 +01:00
YimingWu
6191bc4f22 Object: Conversion of Font/Legacy curves to Curves and Grease Pencil
This patch implements Font to Curves, Legacy curves to Grease Pencil and
Font to Grease Pencil conversions.

Note that Font to Grease Pencil is done by converting Font to Curves
then converting Curves to Grease Pencil. Currently we do not have
direct conversion APIs.

Part of #131595 and #130518

Pull Request: https://projects.blender.org/blender/blender/pulls/131612
2024-12-18 15:38:55 +01:00
Andrej730
149ab6a7c4 PyDoc: bpy.props typing fixes and clarification note to PointerProperty.poll
1) Typing fixes for vector properties (similar to !131855)
2) More specific type for PointerProperty.poll since it's only called if type is ID.
3) Added a note to PointerProperty.poll that it's only checked when property is assigned from the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/131925
2024-12-18 10:38:29 +01:00
Omar Emara
cc07067174 Fix #132015: Image node outputs are missing meta-data
The outputs of the Image node are missing relevant meta-data like
Cryptomatte and vector components, this causes exports through the File
Output node to also miss those meta-data. To fix this, we populate the
metadata of cached images just like we do for render results.
2024-12-18 10:26:15 +02:00
Philipp Oeser
ca17ffe30e Fix #93289: Paint Mode stencil disappears when panning viewport
Code for drawing the cursor [this includes drawing the stencil] used to
early out when navigating.

This made it difficult to line up stencil projection with the 3D
geometry, so now still draw it while navigating.

Pull Request: https://projects.blender.org/blender/blender/pulls/131851
2024-12-18 09:21:37 +01:00
Jesse Yurkovich
1a01275aa9 Hydra: Update tests to allow bots to pass
Contains the following changes:
- Uses new `render_layer` images in test repo
- Excludes known broken tests with Hydra Storm from USD 24.05
  - packed float and packed half images show corruption
  - USD export doesn't support the current light-tree .blend
- Bump the `image_colorspace` and `image_mapping` thresholds to
  account for image filtering differences from OS/drivers

Pull Request: https://projects.blender.org/blender/blender/pulls/132044
2024-12-18 05:22:01 +01:00
Jesse Yurkovich
a9fc9d533a USD: Optimize FCurve keyframe insertion
Building the FCurve keyframes one at a time leads to quadratic runtime
behavior due to how the underlying BezTriple array is resized in
`animrig::insert_bezt_fcurve`. Instead, pre-allocate the entire array
upfront and assign the keyframes directly since we are already iterating
our time samples in-order.

In the event that fewer keyframes are ultimately assigned, rare since
this indicates some form of bad data which we skip during iteration, we
will reallocate to the appropriate size right before recalculating the
fcurve handles.

Total import time for the 3000 frame Elephant test asset [1] drops from
~4650 ms to 120 ms, a 38x speedup. A more typical 250 frame armature
animation shows a more modest 1.5-2x reduction in overall import time.

[1] https://github.com/usd-wg/assets/tree/main/full_assets/ElephantWithMonochord

Pull Request: https://projects.blender.org/blender/blender/pulls/131921
2024-12-18 02:49:16 +01:00
Hans Goudey
2d09305490 Fix #131977: BVH tree memory leak in some cases
Caused by 024d7d12e2.

I forgot that the BVH cache value isn't reset to default if it isn't
shared, which can happen after remeshing in some cases. To fix this,
switch to unique_ptr which handles ownership properly on assignment,
removing this class of bug from this code.

Pull Request: https://projects.blender.org/blender/blender/pulls/132040
2024-12-18 00:20:22 +01:00
Hans Goudey
ee7f30a371 Fix #131989: Mesh paint mode selection does not work
Caused by 839108f623.

The edit mapping was invalid so we just created a dummy GPU
batch for the selection edit data. But it was invalid because we
weren't in edit mode. The fix just requires tweaking the checks
for this data that's also used outside of edit mode.
2024-12-17 17:16:20 -05:00
Hans Goudey
31964ef5ca Cleanup: Move BLI_kdopbvh to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/132031
2024-12-17 21:04:55 +01:00
Bastien Montagne
e83d87f588 Move several py scripts from build_files to tools.
Preliminary step towards adding 'system python' validation for some
build-essential py scripts (!130746).

Pull Request: https://projects.blender.org/blender/blender/pulls/132025
2024-12-17 19:02:45 +01:00
Bastien Montagne
ef0fcab8b7 Add command-line option to not do liboverride autoresync on fileload.
The new --disable-liboverride-auto-resync commandline option will prevent
running liboverride auto-resync immediately after loading a blendfile.

This is an alternative way to setting the User Preferences Debug option
`No Override Auto Resync`.

-------

Some quick performances tests:
Loading a Gold production file goes from 26.5s to 25.9s.

Combined with the recent `--disable-depsgraph-on-file-load` option, it
goes from 3.5s to 2.9s, so another nice extra 15% speedup when only
bare-metal blendfile loading is needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132017
2024-12-17 18:59:49 +01:00
Falk David
94120967e7 Curves: Realize Instances: Use attribute fallback values
The realize instances code didn't have a way to use the existing
`#BuiltinAttributeProvider::default_value()`s to initialize attributes that
have to be created.

Now this writes default values of builtin attributes to the curve `attribute_fallbacks`.
Removes the need for the code to explicitly write the `resolution` and
`nurbs_weight`.

The other attributes that are written explicitly (like `radius`) don't have
builtin default values unfortunately. Ideally those would also just be provided
by the respective `BuiltinAttributeProvider`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131799
2024-12-17 18:54:10 +01:00
Falk David
5beff80118 Fix: Grease Pencil: Undefined truncation behavior in legacy conversion
The `double inittime` attribute on strokes is truncated to a `uint32_t`
range. This wasn't done explicitly and the code only did a cast.

The `double` should be clamped to a legal `uint32_t` value before
casting it.

Pull Request: https://projects.blender.org/blender/blender/pulls/131625
2024-12-17 18:45:47 +01:00
Jacques Lucke
bd3e6b30f8 Cleanup: use Map instead of GHash 2024-12-17 18:13:42 +01:00
Sean Kim
a8f1b4c462 Fix #49740: Reset Stencil Transform occasionally doesn't work
Prior to this commit, if the "Texture Mask" stencil was reset, this
would call the `brush.stencil_reset_transform` operator with the `mask`
parameter set to `True`. Subsequent clicks, even on the "Texture"
stencil "Reset Transform" button would still pass `True` to the
underlying C++ API, even though the `mask` property was left
uninitialized.

This commit sets the parameter to False explicitly to fix this bug.

Pull Request: https://projects.blender.org/blender/blender/pulls/132001
2024-12-17 17:51:08 +01:00