Commit Graph

120055 Commits

Author SHA1 Message Date
Jason Fielder
5753a27624 Metal: Disable usage attachment for atomic buffer textures
Removes the implicit USAGE_ATTACHMENT flag from
atomic fallback textures which are buffer-backed.
This usage flag results in a validation failure, and is
not required by these textures as they are cleared
via the backing buffer.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119785
2024-04-11 10:46:20 +02:00
Aras Pranckevicius
1ea014112b Fix #120253: Batch export of STL files incorrectly handles .stl suffix
It was mostly correct, except for the case where a user sets an
empty string as the export filename. What was happening is:
- STL exporter invocation adds ".stl" extension, so the path becomes
  foo/.stl
- Code tries to replace extension with "ObjectName.stl", but
  BLI_path_extension_replace sees that the filename part starts with
  a dot and thinks the ".stl" part is the whole filename, not the
  extension
- Resulting path thus becomes "foo/.stlObjectName.stl"
2024-04-11 11:07:55 +03:00
Campbell Barton
793b99ca7c Theme: ensure unique theme names, increase name size to 64
Ensure unique names when setting the name and with versioning.
2024-04-11 17:44:27 +10:00
Campbell Barton
adbec9eea9 Theme: reset the default theme fails & fix invalid ListBase links
If the theme's name was changed, resetting the default theme did
nothing from a user perspective.

Internally it would add the Default theme to the end of the list where
it was ignored, then the default theme overwrote the data including the
next/prev links causing the ListBase to be invalid.

Resolve by ensuring the default theme is always first and use the
MEMCPY_STRUCT_AFTER macro to prevent links being overwritten.
2024-04-11 17:44:27 +10:00
Campbell Barton
962d2ca6a6 Cleanup: use a const ListBase argument to BLI_uniquename
The list-base isn't manipulated, only the link argument.
2024-04-11 17:44:27 +10:00
Campbell Barton
28381e6c93 Cleanup: remove unused RenderProfile DNA struct 2024-04-11 17:44:27 +10:00
Campbell Barton
a70f667f8b Cleanup: pass args by reference instead of value in mesh_boolean.cc 2024-04-11 17:44:27 +10:00
Campbell Barton
09ee8d97e6 Cleanup: use C-style comments for descriptive text 2024-04-11 17:44:27 +10:00
Lukas Tönne
658a9ac3a9 GPv3: Initial sculpt mode
Adds an (empty) sculpt mode for Grease Pencil v3 objects.

The object `SCULPT_GPENCIL` mode is re-used for Grease Pencil object
types. A `SCULPT_GREASE_PENCIL` context mode has been added, which is
specific to grease pencil objects. This is necessary for polling tools
and keymaps.

Pull Request: https://projects.blender.org/blender/blender/pulls/119338
2024-04-11 09:39:48 +02:00
Jesse Yurkovich
88526ab5f4 Collection Export: Don't draw ignored properties for OBJ and USD
When using Collection export skip drawing certain operator properties
which shouldn't apply for this style of export.

These suppressed properties were mentioned a few times while gathering
feedback for the feature and they are ignored internally when using
collection export anyhow.
2024-04-11 07:01:45 +02:00
Hans Goudey
0f46e02310 Mesh: Draw triangle index buffer creation improvements
This PR is another step in the refactor described by #116901.
This change applies to the triangle index buffer. The main improvement
is the ability to recognize when the mesh corner triangles index array
can be uploaded directly (when there is a single material and no hidden
faces). In that case the index data should be copied directly to the
GPU rather than to a temporary array owned by the IBO first. Though
that isn't implemented yet since it will be handled by the GPU module
later, the code is now structured to make that change simple from the
data extraction perspective.

Other than that, the main change is to not use the extractor iterator
framework anymore, and to set index data directly instead of using GPU
API functions. Though we're mainly bottlenecked by memory-bandwidth
anyway, it's nice to avoid function call overhead.

We also now avoid creating the array of sorted triangle indices when
there is a single material and no hidden faces. And we don't use
restart indices for the single-material case anymore. For Metal that's
nice because we can avoid `strip_restart_indices`.

I didn't notice significant performance improvements in my test files
beyond a few percent here and there. With a hacked implementation of
the copy-directly-to-the-gpu optimization, I did see more consistent
improvements though.

Pull Request: https://projects.blender.org/blender/blender/pulls/119130
2024-04-11 04:49:27 +02:00
Iliya Katueshenock
6bafe65d28 Mesh: Calculate edges with VectorSet instead of Map
Due to legacy reasons (`MEdge`), edge calculation was being done with
idea that edges cannot be temporarily copied. But today, edges are just
`int2`, so using `edge *` instead of `edge` actually made things worse.
And since `OrderedEdge` itself is the same thing as `int2`, it does not
make sense to use `Map` for edges. So, now edges are in a hash set.
To be able to take index of edges, `VectorSet` is used.

The only functional change now is that original edges will be reordered
as well. This should be okay just like an unintentional but stable
indices change.

For 2'000 x 2'000 x 2'000 cube edges calculation, change is around
`3703.47` -> `2911.18` ms.

In order to reduce memory usage, a template parameter is added to
`VectorSet` slots, so they can use a 32 instead of 64 bit index type.
Without that, the performance change is not consistent and might not be
better on a computer with more memory bandwidth.

Co-authored-by: Hans Goudey <hans@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/120224
2024-04-11 04:33:25 +02:00
Harley Acheson
7642a5452a UI: Consistent Cursor Color
Change Console and text editor cursor color to match that of
widget_text_cursor. Console cursor is currently red which we normally
use for error conditions.

Pull Request: https://projects.blender.org/blender/blender/pulls/120491
2024-04-11 04:00:14 +02:00
Harley Acheson
4e8cc76c2d Cleanup: Make Format
Just changes resulting from running make format.
2024-04-10 18:34:52 -07:00
YimingWu
5fcbbb5b42 FCurve: Separate fcu->bezt check in deduplicate
This is to avoid uncessary assertion exception when `fcu->totvert < 2`.

Also fixes #120155

Pull Request: https://projects.blender.org/blender/blender/pulls/120158
2024-04-11 03:05:35 +02:00
Hans Goudey
19e94bf9d2 Fix: Crazyspace memory leak with curve modifier
This free was missing compared to BKE_sculpt_get_first_deform_matrices
2024-04-10 18:36:50 -04:00
Iliya Katueshenock
de6834e5c2 Cleanup: Unused argument
`ntree` is unused after 3357658c13

Pull Request: https://projects.blender.org/blender/blender/pulls/120495
2024-04-11 00:36:31 +02:00
Jesse Yurkovich
df4ccf2eed Collection Exporters: Add Alembic support
Enable Alembic support for collection exporters.

Pull Request: https://projects.blender.org/blender/blender/pulls/120493
2024-04-11 00:24:06 +02:00
Iliya Katueshenock
3357658c13 Cleanup: Nodes: Remove unnecessary socket tooltip check
There is no context in which socket can't have data to display in tooltip.
The most basic info is the name of the socket. Such tooltip can be even
for output Shader socket. If is there, socket tooltip can be built from
data of socket declaration. Description, constraints and so. Such as supported
components. At point socket was used in evaluation on CPU, there is value
to display. Any trivial types or statistic about them value. Fields can
have dependencies, which is also can be known from evaluated value.

Pull Request: https://projects.blender.org/blender/blender/pulls/120492
2024-04-11 00:21:34 +02:00
Hans Goudey
563bb7e1da Cleanup: Grammar in mesh creation comments 2024-04-10 16:06:34 -04:00
Hans Goudey
48f77b6c24 Fix #120313: Paint mode vertex selection overlay skips vertices
Before bace4c9a29, the selection was uploaded twice: both face
and vertex selection. Afterwards only the face selection was uploaded,
but the vertex selection is necessary for the paint mode vertex overlay.
Now choose between uploading the vertex or face attribute based on the
paint overlay flags.
2024-04-10 14:22:42 -04:00
Lukas Tönne
efd07d8207 Fix #118509: GPv3: fix broken drawing array compression function
The `remove_drawings_with_no_users` did not work properly when removing
more than one drawing at a time. It created incorrect drawing indices
that were larger than the drawings array, causing crashes down the line.

The new implementation should be both cleaner and more efficient,
avoiding a loop over all frames for every drawing removed.

This complements #119337 which fixes disappearing keyframes during
transform.

Pull Request: https://projects.blender.org/blender/blender/pulls/120433
2024-04-10 18:23:33 +02:00
Sergey Sharybin
70b3b018c1 Fix #113182: Crash when animating Viewport visibility of Curves / GPv3 object
This is actually a deeper issue, which roots to the fact that updating
relations of the dependency graph does not properly handle cases when an
operation was previously skipped from evaluation (i.e. as a visibility
optimization).

The fix is to preserve needs-update flag throughout relations update of
a dependency graph, similar to the entry tags.

Pull Request: https://projects.blender.org/blender/blender/pulls/120477
2024-04-10 16:26:31 +02:00
Clément Foucault
99ebc1f7d3 BLI: Fix inverted 0 determinant for infinite orthographic projection
This was creating issues with triangle winding order since
the resulting matrix was degenerate (0 determinant). Which
caused the Draw manager to wrongly invert the winding.

This fixes a bug in EEVEE-Next mesh voxelization for volume
rendering (with accurate method).
2024-04-10 15:53:51 +02:00
Philipp Oeser
1fdd7cd098 Fix #120417: VSE crash rendering a scene strip with missing Editing data
In case a scene strips `Input` was set to `Sequencer`, but the scene did
not actually have `Editing` data (e.g. when just adding a `New` scene as
scene strip), blender would crash trying to render.

Now simply check if the required `Editing` data is present before
proceeding.

Pull Request: https://projects.blender.org/blender/blender/pulls/120418
2024-04-10 14:21:21 +02:00
Jacques Lucke
55cbb9f271 Fix #120402: memory leak in volume grid handling
The openvdb tree was not freed correctly because the destuctor
of the `shared_ptr` was not run.
2024-04-10 14:10:56 +02:00
Jacques Lucke
01ee34ebd1 Curves: add operator to set bezier handle types
This adds an operator to set the handle types of bezier curves. It also
adds the same shortcut that is available in the legacy curve edit mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/120426
2024-04-10 13:08:50 +02:00
Falk David
554b064214 Fix #120459: GPv3: Issue in conversion for layer parents
The layer parenting did not account for storing an
initial parent inverse matrix (to "keep transform").

This adds this matrix, stores it in DNA, and uses it
when we compute the parent matrices on demand.

Note: This PR does not set the parent inverse matrix
outside of conversion from GPv2. Support for
"keep transform" parenting will have to be added
in another PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/120462
2024-04-10 12:41:28 +02:00
Pratik Borhade
c8f275b777 GPv3: Deselect everything from all visible drawings when pasting strokes
To match with gpv2 behavior, fill selection attribute of all the visible
drawings with "false" value to deselect them so only the pasted stroke
from the clipboard is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/120363
2024-04-10 12:31:51 +02:00
Philipp Oeser
605de2f094 Fix #120421: Animated "Burn metadata into image" ignored during render
Seems like scene `RenderData` only gets synched once from `Scene` to
`BaseRender` in `RE_InitState` .
Animation on it is only evaluating on the scene, so the the `BaseRender`
`RenderData` is not properly updated here.

However `R_STAMP_DRAW` is part of that and it is the `BaseRender`
`RenderData` that is checked in `do_render_full_pipeline` (not the
`Scene` one) to determine if we want to stamp.

Later calls to `BKE_render_result_stamp_info` / `renderresult_stampinfo`
/ `stampdata` always get passed the scene, so individual animation stamp
details (such as Render Time) work properly.

So to resolve, use the `Scene` `RenderData` (rather than the
`BaseRender` one) for proper animation update.

NOTE: this (not updating animation of members of `RenderData`) might
actually be a problem elsewhere, too -- havent checked on this in detail
though

Pull Request: https://projects.blender.org/blender/blender/pulls/120429
2024-04-10 11:19:02 +02:00
Pratik Borhade
d049cd1dbf Fix: GPv3: Clear copy strokes buffer if nothing is selected during copy
If `clipboard.curves` has some curve and the copy operation is called
again when nothing is selected, the buffer is expected to be cleared.
Otherwise the paste operations will paste the previous copied curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/120454
2024-04-10 11:15:47 +02:00
Campbell Barton
74a65d77cc Cleanup: spelling in comments 2024-04-10 12:28:33 +10:00
Campbell Barton
d3ae39571e Fix crash using "--command" on Windows
Use after free error accessing command line arguments on windows.
Resolve by duplicating the arguments when a "--command" is passed in.
2024-04-10 11:52:54 +10:00
Hans Goudey
256dbce9fa Cleanup: Make format 2024-04-09 21:23:18 -04:00
Sean Kim
ea1cfdbf83 Fix #120400: Remove cyclic dependency of pbvh type when building bmesh pbvh
This PR fixes a crash when enabling Dyntopo.

When the PBVH generation code for BMesh was changed in b3aca5b28f, a
bug was introduced where dependent code to generate necessary layers
for BMesh could no longer access the PBVH type, as it was not generated
yet. As the type is known in the code at time of construction, I opted
to add parameters specifying the PBVHType to necessary methods when
accessing attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120445
2024-04-10 02:57:34 +02:00
Hans Goudey
193789f036 Cleanup: Use utility function to sample triangle bary coord
Also move the declaration of the BVH tree closer to its use.
2024-04-09 20:45:55 -04:00
Iliya Katueshenock
ebd04b5660 Fix: Crash calculating edges of empty mesh
At some point (Fill Curve node in my case) it is possible to have
empty task of edges. Simplest fix - ignore such tasks. In future
this might be improved (see: #120224).

Pull Request: https://projects.blender.org/blender/blender/pulls/120330
2024-04-10 02:36:26 +02:00
Iliya Katueshenock
a419152589 Fix: Matrix socket is always visible
Fix of typo in weakly typed API.

Pull Request: https://projects.blender.org/blender/blender/pulls/120337
2024-04-10 02:30:11 +02:00
Germano Cavalcante
c9fa73a379 Fix #120443: Knife tool loses precision on edges with high clip distance range
The previous algorithm for interpolating the vertices of an edge using
a lambda in screen space was heavily dependent on the resolution of the
projection matrix, leading to precision loss when the clip distance
range was high.

The updated algorithm now adjusts the lambda according to the
perspective before performing the interpolation, which improves
precision regardless of the clip distance range.
2024-04-09 20:56:02 -03:00
Harley Acheson
7226b52728 UI: Removal of GRAPH_OT_keys_to_samples Confirmation
Removal of the dialog that pops up to confirm this operator. The
Animation & Rigging module feels this isn't needed since this action
is quite visual and hard to miss. This operator is also not often
used and might get removed in future as unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/120074
2024-04-10 00:45:44 +02:00
Clément Foucault
c3088d6558 EEVEE-Next: Add back volume reprojection
This is done almost the same as legacy EEVEE.

The main difference is that we now take into
account the change in volume Z bounds during
reprojection.

The viewport smoothing experience as also be
improved with less blurring when moving
objects.

We also still do the reprojection during
final rendering between samples. This improves
the convergence as the input to the film TAA
is less noisy.

Pull Request: https://projects.blender.org/blender/blender/pulls/120320
2024-04-09 19:36:45 +02:00
Clément Foucault
20bc1cbb57 Fix: EEVEE-Next: Volume: Wrong voxelization from accurate method 2024-04-09 19:06:34 +02:00
Falk David
eec9c50580 Fix #120436: "Show Fill Color" setting not working
The flag was completly unused in the code.
Now this flag does what it says: While drawing,
the fill color is (almost) not visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/120438
2024-04-09 17:59:20 +02:00
Nathan Vegdahl
05226881f7 Anim: make CombinedKeyingResult plain old data
The data in CombinedKeyingResult was using BLI's Array type, which
heap allocates.  However, we know the array size at compile time,
and therefore can use std::array instead, as suggested in Array's
documentation.  This makes CombinedKeyingResult a
plain-old-data class.

Pull Request: https://projects.blender.org/blender/blender/pulls/120425
2024-04-09 17:27:20 +02:00
Amelie Fondevilla
d0d4bf2068 Fix #118509: GPv3: frames disappear during transform in the timeline
While selecting and transforming multiple grease pencil frames in the
timeline, frames would sometimes disappear. This happened when the
transformation overlapped, meaning when a frame replaced another moving
one in the timeline. The frames transformation was happening in place
and in series, and thus leaded to the initial position of the frame to
be removed, even if it was occupied by a freshly transformed framed.

This commit fixes the issue by storing two separate maps in the
transform data structure instead of one, one map to store the static
data, meaning the frames that are not affected by the transform, and
another one for the moving data, meaning the frames that are affected by
the transform.

Some changes were made to account for the potential duplication of the
frames (move + duplicate):
* the map of the duplicated frames was renamed to a more explicit name,
* when a duplication occurs, the original frame is stored in the static
  frames map, and the duplicate is stored in the moving frames map,
* thus the check for the duplicate flag of the operator is now done at
  the init step of the transform, instead of the update step, so that
  the maps are initialized accordingly.

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119337
2024-04-09 16:44:34 +02:00
Sybren A. Stüvel
bc764072f5 Anim: Avoid loading alpha channel from theme for keyframe drawing
The theme has a color for each keyframe type. This is exposed in RNA and
the preferences UI as an RGB color, so without alpha channel. The code
that loads the color from the theme, however, does include that
unsettable alpha channel, though.

In practice this doesn't cause issues, as the versioning code ensures
that the default colors are stored with `alpha=uint8_t(255)`. While
developing, however, this caused me considerable headscratching, as I
was missing that little bit of versioning code, which means that the
default color was set to all-zeroes, and thus had a zero alpha.

This is now resolved by altering the drawing code to only load the RGB
component from the theme. This way only the user-settable bytes are
loaded, while the alpha component is handled a different way (setting it
to an absolute value, instead of multiplying the theme value).

No user-perceivable changes, just some developer comfort.

Pull Request: https://projects.blender.org/blender/blender/pulls/120311
2024-04-09 16:34:35 +02:00
Omar Emara
26f059ae55 Realtime Compositor: Support variable scaling
This patch adds support for variable scaling in the Scale node for the
Realtime Compositor. This is supported for the CPU compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/120314
2024-04-09 16:02:47 +02:00
Jacques Lucke
d3c98e6753 Fix #119702: Set Position node behaves incorrectly on instances with selection
The selection was not taken into account properly and uninitialized data was used.

Pull Request: https://projects.blender.org/blender/blender/pulls/120409
2024-04-09 13:11:19 +02:00
Pratik Borhade
1a37017244 Fix #120144: Invert Visible doesn't invert Face Sets properly
Caused by 53418fc3a1.
corner vertices of hidden face sets are not `1/true/hidden` (which
is expected). So inverting then hides these corner verts, hence the
small region of face sets is visible afterwards.
This could be avoided if `.hide_poly` attribute is used for changing the
visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/120160
2024-04-09 12:50:49 +02:00
Falk David
7ce0b625cb BLI: IndexMask: Add binary set operations
The `IndexMask` class already had a static function `from_union`.
This adds two new functions `from_difference` and `from_intersection`
as well as tests for each of them.

It also uses `from_intersection` in two grease pencil utility functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/120419
2024-04-09 12:08:14 +02:00