Commit Graph

120055 Commits

Author SHA1 Message Date
Jeroen Bakker
e2793ab3da Fix: SubDiv: CPP Shader compilation
Some shaders were missing and didn't
compile using CPP compilation

Pull Request: https://projects.blender.org/blender/blender/pulls/135090
2025-02-27 08:54:34 +01:00
Jeroen Bakker
667c8a914f Revert "Cleanup: GPU: Reduce compilation warnings"
This reverts commit 3ca5f6f62e.

There were some performance regressions detected.

Fixes: #135215, #134941
2025-02-27 08:23:26 +01:00
Campbell Barton
0fa74fc4af Merge branch 'blender-v4.4-release' 2025-02-27 15:54:48 +11:00
Jason C. Wenger
80a38bb1e4 Fix #120770: poor un-subdivide performance with disconnected geometry
- Refactor tagging logic into a function to remove duplicate code

  The two phases of tagging were identical logic just with the variables
  and tag values swapped. This change ensures the two loops use matching
  behavior.

- Adjust iteration to prevent restarting from the beginning of the mesh
  after each island.

- Simplify and speed iteration tests.

  testing to ensure v->e is non-null is redundant - verts with no edges
  would never have passed `bm_vert_dissolve_fan_test` in the first
  place, so can't be tagged as `VERT_INDEX_INIT`.
  Re-testing `bm_vert_dissolve_fan_test(v)` is redundant - it was
  checked above, and during tagging, the topology does not change.
  Topology only changes later, after tagging is complete.
  Therefore it's guaranteed to return the same result as the first time.

- Simplify loop logic, rename vars for clarity

  offset and nth were constants, and depth was what causes alternation.
  However none of that math is necessary - it can simply be done with
  call order.

  'seek_a' and 'seek_b' were renamed to what they actually are - lists
  of verts that are tagged for collapse and ignore, respectively.

  Further, by checking if any verts were tagged during the first
  iteration pass, the second iteration pass can be avoided entirely if
  it will perform no work.

Ref: !135212
2025-02-27 15:53:12 +11:00
Campbell Barton
51113085de Cleanup: remove disabled BMWalker logic for un-subdivide
This isn't going to be enabled and made the in-lined tagging more
difficult to follow.
2025-02-27 15:53:12 +11:00
Harley Acheson
b8a81c90d1 Merge branch 'blender-v4.4-release' 2025-02-26 20:18:18 -08:00
Harley Acheson
89e78e7065 Fix: MacOS Status Status Bar Swap Areas Spacing
For MacOS, when hovering your mouse over the area corner "action zones"
the Status Bar shows a "Swap Areas" item that has unnecessary spacing
between the Control modifier key icon and left mouse button icon. This
is because I forget different icons were shown for Mac. This PR just
uses the proper calculated spacing that knows better.

Pull Request: https://projects.blender.org/blender/blender/pulls/135208
2025-02-27 05:13:09 +01:00
Sean Kim
3fca920e72 Merge branch 'blender-v4.4-release' 2025-02-26 17:17:15 -08:00
Sean Kim
a106480b92 Fix #135130: Mask from Cavity does not work via operator
Introduced with 6b0fa709fa.

Pull Request: https://projects.blender.org/blender/blender/pulls/135139
2025-02-27 02:16:29 +01:00
Sean Kim
79df0351d4 Spreadsheet: Expose .sculpt and .hide attributes behind debug option
This commit adds five commonly used internal Sculpt Mode attributes
to the Spreadsheet editor when `--debug-value 4001` is passed in to
assist with development and debugging of issues.

The whitelisted attributes are:
* `.sculpt_mask`
* `.sculpt_face_set`
* `.hide_vert`
* `.hide_poly`
* `.hide_edge`

And are displayed after the other existing debug columns.

Pull Request: https://projects.blender.org/blender/blender/pulls/135201
2025-02-27 02:15:36 +01:00
Jesse Yurkovich
d6cdaff0c0 Cleanup: USD: remove now unneeded PXR_VERSION guards
These were primarily put in place during the library update period of
4.2 to ease the in-between time when not all platforms had updated
libraries. Also, now that we've begun depending on later version of USD
and MaterialX, there's little reason to pretend that using versions
prior to 24.03 is still supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/135202
2025-02-27 00:15:41 +01:00
John Kiril Swenson
debf747265 Fix linting error on buildbot 2025-02-26 15:34:20 -06:00
John Kiril Swenson
b79344e3a0 UI: Ensure invisible scrollbar tracks are opaque and shrink scrollbars with handles
This patch registers scrollbars with handles so that they shrink just
like their non-handle counterparts.

To avoid user errors related to clicking into the handle track instead
of the underlying view, if the final alpha of the track is invisible (0)
then it will range up to 0.25 instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/135023
2025-02-26 21:57:36 +01:00
Harley Acheson
4a56715e60 Merge branch 'blender-v4.4-release' 2025-02-26 12:26:33 -08:00
Harley Acheson
f930b7a731 Fix #135097: Wrap Text Lines Without Control Chars in Glyph Cache
Our text wrapping code is written in a way that requires the Line Feed
character to be in our glyph cache. This is problematic as none of the
control characters will ever be there if not using fallback. With
fallback these glyphs could be a zero-width character from a symbol
font, or something with width if using a last resort font. So we'd have
to ignore the advance in the latter case. This came to a head recently
because we are turning off fallback in some circumstances. 12b1f8bd7a
removed the rendering of control characters so they are never in the
cache. That change requires this one, which does wrapping based on the
string's codepoint, not that of its glyph.

Pull Request: https://projects.blender.org/blender/blender/pulls/135196
2025-02-26 21:25:13 +01:00
Clément Foucault
973813f8ba Cleanup: DRW: Remove unused DRWInstanceData
Rel #134690
2025-02-26 19:43:49 +01:00
Jacques Lucke
63e6f53ba0 Modifiers: new Visual Geometry to Objects operator
This adds a new `Visual Geometry to Objects` operator which is added to the
`Apply` menu.

It creates new objects from the evaluated geometry of the active object. Other
than e.g. applying modifiers, this operator does keep all generated data and
creates new objects and collections for instances. It does have some
similarities to `Make Instances Real` with the main difference that it doesn't
actually realize instances, i.e. instanced geometry is still shared between all
objects using it.

It does intentionally not replace the original object, because the semantics of
that aren't all that obvious. It's especially tricky when the object was
referenced by other objects. Instance attributes are not preserved currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/134119
2025-02-26 17:48:54 +01:00
Aras Pranckevicius
d64aa0112f VSE: speedup RE_render_result_rect_from_ibuf by avoiding memory clear
The RE_render_result_rect_from_ibuf function (used only by VSE) was
allocating memory for the render result, clearing it to zero and
immediately overwriting it with the image pixel data. Remove the
"clear to zero" part.

Rendering a 1920x1080 resolution movie with VSE (using float
pixel data), average RE_render_result_rect_from_ibuf time goes from
6.8ms down to 3.8ms

Pull Request: https://projects.blender.org/blender/blender/pulls/135170
2025-02-26 16:17:48 +01:00
Philipp Oeser
a5d652e5c0 Merge branch 'blender-v4.4-release' 2025-02-26 15:56:25 +01:00
Philipp Oeser
a636b101d7 Fix #121609: Shrinkwrap invert vertex group (no group specified) wrong
Same was true for SimpleDeform.

Invert vertex group influence should only have an effect if there is a
group specified.
Shrinkwrap always uses a weight (gets weights via
`BKE_defvert_array_find_weight_safe` -- which gets full weight for no
group specified, rightfully so), if this gets inverted, we get no
influence at all.

Now move the inverting of the weights to `BKE_defvert_array_find_weight_safe`,
adjust the other callers accordingly (Bevel also does not need to check for a valid
vertexgroup beforehand).

Pull Request: https://projects.blender.org/blender/blender/pulls/121625
2025-02-26 15:56:08 +01:00
Philipp Oeser
a8ed137e52 Merge branch 'blender-v4.4-release' 2025-02-26 15:38:50 +01:00
Philipp Oeser
bc3c6c4e7c Fix #134895: Cancelling sculpt mode elastic transforms deforms mesh
Since the transform system uses previous positions to update to
"original" positions upon cancel, the elastic transforms are not working
well with this (due to their `TransformDisplacementMode::Incremental`
nature).

To resolve, rely on restoring positions from undo (as done elsewhere in
sculpt).

Pull Request: https://projects.blender.org/blender/blender/pulls/134919
2025-02-26 15:38:29 +01:00
Philipp Oeser
ef9742d5de Merge branch 'blender-v4.4-release' 2025-02-26 15:35:53 +01:00
Philipp Oeser
7ac3de70fd Fix #135159: Copied modifier doesn't keep the name of the modifier
`BKE_modifier_copy_ex` did it (which is called e.g. when copying the
whole stack from one object to another), but when simply duplicating a
modifier (`modifier_copy`), it was just ensuring a unique name (based on
the default name) without copyig the existing name prior.

Pull Request: https://projects.blender.org/blender/blender/pulls/135172
2025-02-26 15:35:35 +01:00
Philipp Oeser
51f0758f61 Merge branch 'blender-v4.4-release' 2025-02-26 14:14:36 +01:00
Philipp Oeser
d2ecf66492 Fix #120697: better error for BVHTree.FromObject()
When called on an object that you cannot get a mesh from (e.g. Empties),
you would run into an unhelpful "SystemError: <built-in method
FromObject of type object at ...> returned NULL without setting an
exception"

Now be more specific in the error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/135162
2025-02-26 14:14:14 +01:00
Clément Foucault
f3736aa7af Fix #135018: EEVEE: Plane lightprobe renders incorrectly in ortho view
Caused by wrong view vector which is used to check which way
to point the clipping plane at.

To be backported to 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/135166
2025-02-26 14:13:33 +01:00
Pratik Borhade
3a1e7ffebe Fix #134737: Node: Panel deleted when Parented with children
Skip `move_to_parent()` operation when new_parent is already
children of "item" to avoid running into this situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135148
2025-02-26 14:13:33 +01:00
Clément Foucault
e9dfe79054 Fix #135018: EEVEE: Plane lightprobe renders incorrectly in ortho view
Caused by wrong view vector which is used to check which way
to point the clipping plane at.

To be backported to 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/135166
2025-02-26 14:01:30 +01:00
Omar Emara
6365110312 Cleanup: GPU: Remove common_math.glsl includes
This patch refactors GPU shaders to remove includes to the utility
gpu_shader_common_math.glsl file. This is done because it has duplicate
functions that exist in other files, and it was really created for use
in GPU material nodes.

The safe_divide and hypot functions were removed since they exist in
gpu_shader_math_base_lib.glsl.

The compatible_[mod|pow] and wrap functions were moved into
gpu_shader_math_base_lib.glsl.

The floor_to_int function was inlined since it was trivial and only used
in one place.

The quick_floor was removed because it was unused.

The euler_to_mat3 function was replaced with the from_rotation function
from gpu_shader_math_matrix_lib.glsl.

Now the file only contains some GPU material node utility functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/135160
2025-02-26 13:37:20 +01:00
Aras Pranckevicius
844c6e1280 Cleanup: rename IMB divers.cc -> conversion.cc
Looks like "divers" comes from ancient times, Dutch word meaning "misc".
But by now, everything in that file is about conversion between different
pixel data types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135165
2025-02-26 12:44:33 +01:00
Aras Pranckevicius
148aa54398 ImBuf: unify color space transform threaded/non-threaded functions
There's no point in having non-threaded image color space conversion functions.
So merge the threaded and non-threaded functions and clarify names while at it:

- IMB_colormanagement_transform & IMB_colormanagement_transform_threaded
    -> IMB_colormanagement_transform_float
- IMB_colormanagement_transform_byte & IMB_colormanagement_transform_byte_threaded
    -> IMB_colormanagement_transform_byte
- IMB_colormanagement_transform_from_byte & IMB_colormanagement_transform_from_byte_threaded
    -> IMB_colormanagement_transform_byte_to_float

These places were doing single-threaded colorspace conversion previously, and
thus now are potentially faster:
- IMB_rect_from_float (used in many places)
- EXR image "save as render" saving (image_exr_from_scene_linear_to_output)
- Object baking (write_internal_bake_pixels, write_external_bake_pixels)
- General image saving, clipboard copy, movie preparation
  (IMB_colormanagement_imbuf_for_write)
- Linear conversion when reading HDR images/movies
  (colormanage_imbuf_make_linear)
- EXR multi-layer conversion (render_result_new_from_exr)

For one case I benchmarked, which is to render out a 2D stabilized 10 bit input
movie clip out of VSE, the total render time went from 49sec down to 44sec
(Ryzen 5950X), one of the single-threaded parts was the colorspace conversion
in the movieclip code.

Pull Request: https://projects.blender.org/blender/blender/pulls/135155
2025-02-26 12:11:47 +01:00
Clément Foucault
b3e20616d0 Fix #135116: DRW: Leaks while using generated metarig rigs
In this case, the evaluator cache was never referenced and
the subdiv free queue empty. So the freeing of the cache
never happened.

This function is called once per frame and is unlikely
to generate overhead by doing one lock.
2025-02-26 12:11:23 +01:00
Aras Pranckevicius
525ece8465 ImBuf: faster orthogonal image rotation
Speedup IMB_rotate_orthogonal (used for example in auto-rotating
videos that were shot sideways on a phone) by: 1) not copying previous
pixel values into new result, only for them to be immediately
overwritten by rotated pixels, and 2) using multi-threading.

Performing rotation of 1920x1080 resolution HDR (float) video frame
goes from 20ms down to 5ms (Ryzen 5950X, Windows)

Pull Request: https://projects.blender.org/blender/blender/pulls/135158
2025-02-26 11:31:52 +01:00
Pratik Borhade
66a3500324 Fix #134737: Node: Panel deleted when Parented with children
Skip `move_to_parent()` operation when new_parent is already
children of "item" to avoid running into this situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135148
2025-02-26 11:10:40 +01:00
Omar Emara
e224e437da Cleanup: Compositor: Remove common_math_utils includes
This patches removes common_math_utils includes from compositor shaders
and replaces them with math lib includes. This involves moving some
functions from that file to to the math lib files.

Pull Request: https://projects.blender.org/blender/blender/pulls/135157
2025-02-26 10:47:39 +01:00
Philipp Oeser
7faee6b33b Merge branch 'blender-v4.4-release' 2025-02-26 09:13:03 +01:00
Philipp Oeser
462d887114 Fix #122152: Mask Points select API wrong
Only a single `select` prop was exposed, and this was set to "bezt.f1"
(so it affected the left handle only).

Now we add properties for `left`, `right` and the `single` handle, the
selection prop for the control point is renamed to
`select_control_point` [which is now in line with the API for a bezier
curve].

NOTE: setting/getting a `single` handle uses the existing functions for
this -- handle is selected if any of the right/left handle is selected,
setting the handle results in both handles getting selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/135114
2025-02-26 09:12:46 +01:00
Philipp Oeser
ea40fef958 Merge branch 'blender-v4.4-release' 2025-02-26 09:11:15 +01:00
Jesse Yurkovich
1254cb7e03 Cleanup: USD: Use newly enabled BKE_fcurve_bezt_resize API
Pull Request: https://projects.blender.org/blender/blender/pulls/135147
2025-02-26 07:31:59 +01:00
YimingWu
78b54dd6d5 Fix #134489: Grease Pencil: Simplify operator should follow selection
Previously Grease Pencil simplify operator didn't take stroke selection
into account when it's running in Adaptive or Merge modes. Now filters
points with selected stroke to make all modes have consistent behaviour.

Note that the behaviour of simplify is to operate on the entire
stroke if there's anything selected on the stroke. This is consistent
with what we have prior to switching to Grease Pencil v3 (4.2 and prior)
Arguably some modes can be further improved by only work on selected
segments, but it's beyond the scope of this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/134497
2025-02-26 02:33:31 +01:00
Harley Acheson
ac549dcfde UI: Show ANIM_OT_change_frame as "Set Frame (Solo Preview)" in VSE
Operator ANIM_OT_change_frame currently has a hidden feature when used
within the Sequencer, called "Solo Preview". But this feature is not
advertised anywhere in the interface. This PR adds a new property to
the operator called "seq_preview" that enables this feature and then
shows the name as "Set Frame (Solo Preview)".
2025-02-26 01:54:26 +01:00
Sean Kim
956a0fad80 Sculpt: Expose location parameter for sculpt.mask_by_color
Currently, there is no way to call the sculpt.mask_by_color operator
from the python API without simulating mouse events. This makes writing
python tests harder than it needs to be.

This commit does the following:
* Adds an exec callback for the mask_by_color operator.
* Adds new `location` property, an int array defined in region space
  coordinates to represent the mouse location.
* Extracts logic into a helper function so that the `invoke` and `exec`
  paths are functionally equivalent.

Pull Request: https://projects.blender.org/blender/blender/pulls/134964
2025-02-26 01:28:24 +01:00
Harley Acheson
6035447ce5 UI: Select Operator Name Improvements
Different object selection modes show custom names like "Select
(Extend)", but this does not happen for "Enumerate" modes. This PR
shows these modes (on the status bar) with specific names and alters
the title of the resulting menu from "Select Menu" to "Select Object",
"Deselect Object", etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/134371
2025-02-26 01:19:46 +01:00
Harley Acheson
2514ca8bd6 Merge branch 'blender-v4.4-release' 2025-02-25 15:40:25 -08:00
Harley Acheson
199c046449 UI: Do Not Show Editor Border for Single Area Separated Windows
With recent changes to the matching of OS title bar to Blender colors
on MacOS and Windows, it looks far nicer to not show the editor border
for windows that only have a single area and also do not have any
global areas. This PR removes them in this case.

Pull Request: https://projects.blender.org/blender/blender/pulls/134961
2025-02-26 00:38:50 +01:00
Jacques Lucke
33d052b84e Merge branch 'blender-v4.4-release' 2025-02-26 00:27:34 +01:00
Yahia
132af79a82 Fix #135047: missing arrow to collapse/expand in properties
It used to be  `depth + 1` in 4.3 instead of `depth`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135082
2025-02-26 00:27:03 +01:00
Clément Foucault
f47f990594 Cleanup: DRW: Remove uniforms declaration and dangerous defines 2025-02-25 23:46:27 +01:00
Clément Foucault
b2ed7eb45c Cleanup: DRW: Remove unused legacy shader libraries 2025-02-25 23:10:19 +01:00