Commit Graph

120055 Commits

Author SHA1 Message Date
Aras Pranckevicius
983687ebfc Tests: extend OBJ test coverage for #126065 2024-08-09 14:49:17 +03:00
Scurest
86e7668b11 Fix #117367: OBJ importer does not correctly import vertex colors when not all vertices have them
Lift certain incorrect assumptions about the order of vertices in
an OBJ file when processing vertex colors, which could lead to
missing or randomly permuted colors.

Replaces the list-of-blocks representation, attuned to assumptions
that the verts in an object form a contiguous subrange, with a
flat array better suited for random-access.

Co-authored-by: scurest <scurest@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/126065
2024-08-09 08:53:49 +02:00
Clément FOUCAULT
58d04bfa7c Fix: DRW: Missing vnor attribute on edit mesh and edges
Fixes commit ae85b54ffc
2024-08-09 08:30:32 +02:00
Clément FOUCAULT
a6ec643229 Fix: DRW: Missing data upload
Only the `vert_len == 0` is invalid.

Fixes #126097
2024-08-09 08:18:51 +02:00
Clément FOUCAULT
724112d51d Fix: DRW: Missing default enabled program point size
This state should always be enabled for internal reasons.
2024-08-09 08:16:21 +02:00
Clément FOUCAULT
ae85b54ffc Fix: DRW: Missing vnor attribute on edit mesh and edges
This resulted in the lack of fresnel effect on dense meshes
in edit mode when GPU subdiv was not used.
2024-08-09 08:16:21 +02:00
Hans Goudey
0250596f5b Cleanup: Sculpt: Remove more unnecessary shape key flushing
Similar to 3acb5ae41b.
2024-08-08 15:56:38 -04:00
Hans Goudey
72b5fd677b Cleanup: Sculpt: Use C++ Array for fake neighbor indices 2024-08-08 15:56:38 -04:00
Hans Goudey
a2e3abd2d0 Refactor: Sculpt: Fake neighbor data creation
Part of #118145.
As noted in a comment, this algorithm has O(n^2) runtime which is quite
bad. Ideally we would be able to look into a better solution at some point,
but I just refactored the existing algorithm here.
2024-08-08 15:56:38 -04:00
Hans Goudey
68146fe479 Fix: Sculpt pose brush incorrectly accumulates translations
Use the same fix as the mesh filter and add a comment so it's reusable
in other places too.
2024-08-08 15:56:38 -04:00
Jesse Yurkovich
c862d40e09 Fix: USD: Ensure animated velocities are loaded correctly in rare case
If velocity attributes are the only thing being animated, we would fail
to add the cache modifier. This prevents velocity attribute data from
being updated as the timeline changes.

This is a rather rare case. Typically if velocity is changing that would
imply the positions of the mesh are also changing, and the positions
will add the modifier correctly in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/126105
2024-08-08 21:54:18 +02:00
Hans Goudey
3acb5ae41b Cleanup: Sculpt: Remove unnecessary deform flushing function
We now deform the active shape key and other original data while deforming
the evaluated/deformed positions, rather than before, when we delayed that to
afterwards and affected the entire mesh no matter the area sculpted. This is all
handled by `write_translations` now.
2024-08-08 12:29:50 -04:00
Hans Goudey
f09395c69e Refactor: Sculpt: Refactor relax mesh filter
Part of #118145.
This is an intermediate step. Next the relax functions will be shared
with the brush. For now just getting rid of the iteration macro is
worth it.

Pull Request: https://projects.blender.org/blender/blender/pulls/126099
2024-08-08 18:19:54 +02:00
Falk David
0e2ef7f6f1 Geometry Nodes: Default opacity value in "Curves to Grease Pencil" node
When a curve instance did not have a "opacity" attribute, the default would be 0.
This meant that when creating Grease Pencil layers from scratch, the user
would need to manually write a "opacity" attribute.

Now the default value is 1, so that this step is no longer necessary.
2024-08-08 17:58:26 +02:00
Hans Goudey
8c04261644 Cleanup: Sculpt: Pass vertex instead of iterator struct to relax function 2024-08-08 11:39:59 -04:00
Sean Kim
f11b650767 Refactor: Add SCULPT_vertex_attr_get overloads
* Adds overloads for different vertex types
* Cleans up original code

Pull Request: https://projects.blender.org/blender/blender/pulls/126070
2024-08-08 16:57:38 +02:00
Jacques Lucke
29edcef5c9 Fix #125670: Regression: Setting parent to triangle changes object location
This fixes two things:
* Pass the evaluated object into `BKE_object_as_kdtree` instead of the original
  one. `BKE_object_as_kdtree` uses functions on the object which are only
  expected to be executed on evaluated objects, such as
  `BKE_object_get_mesh_deform_eval`. Note that this is the only place where
  `BKE_object_as_kdtree` is used.
* Tag depsgraph at the end of setting parent. This way,
  `BKE_object_get_evaluated_mesh` will return the correct mesh instead of null.
  It was returning null because it the object is not in a fully evaluated state
  if it just has been tagged as requiring an update.

Pull Request: https://projects.blender.org/blender/blender/pulls/126086
2024-08-08 16:42:53 +02:00
Hans Goudey
d99e6f82da Cleanup: Move some sculpt mode functions to C++ namespace 2024-08-08 10:11:52 -04:00
Bastien Montagne
9106383a52 Fix #99875: Reserve 0 SDNA struct index for raw data.
This commit essentially adds a fake SDNA struct info at struct index
`0`, ensuring that no actual SDNA struct will use that identifier from
now on.

Pull Request: https://projects.blender.org/blender/blender/pulls/125730
2024-08-08 15:56:33 +02:00
Hans Goudey
006f954f5c Sculpt: Refactor area normal/center sampling
Part of #118145.
Structure the sampling code more like the brush code, processing the
distances for all vertices in a node at the same time. However, because
this is such a common code path, I compromised a bit on the code's
simplicity to improve performance, mostly by avoiding the use of more
local arrays like we often do for brushes, and also by skipping loop
iterations when the factor is zero. Avoiding the square root for filtered
vertices had a large performance impact of about 5-10% for example.

This is the last use of the sculpt brush test functions and structs which
allows removing them, completing a large part of the overall refactor.

The newly added `_sq` versions of the distance functions are deduplicated
from the non-square versions by separating the square roots to a separate
loop at the end. In my testing that had a ~1% performance cost, though
with variable timing results. I hope that smaller nodes will remove
that cost in the future.

Some rough numbers with the brush benchmark file:
Before: 0.471->0.476s
Without the filtered sqrt: ~0.5-0.53s
After: ~0.473-0.475s

Pull Request: https://projects.blender.org/blender/blender/pulls/126058
2024-08-08 15:41:59 +02:00
Omar Emara
f40cf759c7 Compositor: Add experimental option for new CPU compositor
This patch introduces a new experimental option for the new CPU
compositor under development. This is to make development easier such
that it happens directly in main, but the compositor is not expected to
work and will probably crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/125960
2024-08-08 15:40:06 +02:00
Jacques Lucke
d74d8ceb23 Cleanup: move BKE_packedFile.h to C++
Part of #103343.
2024-08-08 15:13:20 +02:00
YimingWu
3f5d380365 Fix #125897: Use cyclic when handling curves selection
Curves selection didn't take cyclic into account, so when using box/
circle/lasso selections they won't trigger if only the "closing" segment
on a cyclic curve is touched. Now the code properly handles those
situations.

Pull Request: https://projects.blender.org/blender/blender/pulls/125900
2024-08-08 14:12:09 +02:00
Omar Emara
149825bc2a Fix #125946: Crash when adding compositor node
Blender crashes when adding any Color compositor node when both the
viewport and the interactive compositors are active at the same time.
This is caused by a threading issue where both threads try to compile
the same GPU material at the same time.

To fix this, we protects GPU material pass compilation using a mutex.

Pull Request: https://projects.blender.org/blender/blender/pulls/126084
2024-08-08 13:54:22 +02:00
Falk David
1b2b47d6d7 Fix: GPv3: Python API: Wrong argument type in remove function
The `bpy.data.grease_pencils_v3.remove()` function expected the wrong
`ID` type as an input.
2024-08-08 13:03:21 +02:00
Lukas Tönne
f172b570dd Fix #125922: Interpolation tool should use active material
This was just copying the existing material, should use the active
brush.

Pull Request: https://projects.blender.org/blender/blender/pulls/126046
2024-08-08 11:29:52 +02:00
Lukas Tönne
477d520376 Fix #125895: Brush invert setting was not taken into account for fill
Both the operator and the brush have an "invert" setting for the fill
tool. The operator property is toggled by both editor keymap and modal
keymap, while the brush setting is toggled from UI. Both settings are
combined (i.e. inverting both works like regular fill again).

Pull Request: https://projects.blender.org/blender/blender/pulls/126042
2024-08-08 11:29:05 +02:00
Christoph Lendenfeld
a451971026 Fix #124691: Custom bone wire rendering broken on Mac
This issue occurred only on Mac which has to circumvent
geometry shaders lacking support for them.

This patch reverts the vertex shader for Mac devices to
how it was before f9ea64b0ba. (and uses the frag shader from before that commit)
In order to communicate that to the user I added a label
in the GUI when the platform is Mac.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/125967
2024-08-08 11:19:12 +02:00
Falk David
1899ea25d5 GPv3: Python API: Rename drawing API functions
These functions used the term `curves` when we try to use the
term `strokes` at the user level. Renaming the functions and
the descriptions to be more consistent.
2024-08-08 11:10:33 +02:00
Christoph Lendenfeld
77f75353b0 Anim: Remove empty FCurves from layered Actions
This changes the behavior when deleting the last key of an FCurve on layered actions.
Previously the FCurve would continue to exist, whereas now it is deleted.
This makes it consistent with legacy actions.

I modified the "Clear Keyframes" operator in this PR as well to make it work with layered actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/125327
2024-08-08 11:06:49 +02:00
Anish Bharadwaj
8edae047e8 UV: add "shared vertex" option to "Merge UVs by Distance"
Support merging by distanced for UV's with shared underlying geometry.

This can be useful for welding seams & cleaning up holes without
merging nearby UV's from disconnected vertices.

Ref !124221
2024-08-08 18:05:11 +10:00
Philipp Oeser
5de3de9bf7 Fix: View3D shading RNA paths incomplete/wrong
Somewhat similar to !125365 and !125963 (but more specialized for
View3DShading), this PR adds the missing "areas[x].spaces[x]" subpath to
a 3D Viewport Shading and its properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/126035
2024-08-08 08:41:00 +02:00
Hans Goudey
7f7d85036f Cleanup: Sculpt: Remove unused functions 2024-08-07 22:34:22 -04:00
Hans Goudey
2582858e08 Refactor: Sculpt: Specialize grab active vertex preview
The preview is only supported with deform modifiers which are
only supported for Mesh sculpting, so just write that implementation.
Also remove SculptSession::vert_positions which is now unnecessary.
2024-08-07 22:13:18 -04:00
Hans Goudey
1b29b52f2d Cleanup: Sculpt: Move paint cursor code to C++ namespace 2024-08-07 21:49:23 -04:00
Hans Goudey
5946af3556 Cleanup: Sculpt: Reduce usage of sculpt session positions array
Part of #118145.
Remove some uses of the `SculptSession` array in favor of retrieving
positions as necessary. Because of implicit sharing, avoiding unnecessary
mutable references to data can avoid copies and increased memory usage.
There are still more places to change before sculpt mode recieves that
benefit though.
2024-08-07 21:18:37 -04:00
Hans Goudey
65f97245dc Cleanup: Sculpt: Unify deformed position access
SCULPT_mesh_deformed_positions_get was equivalent to
BKE_pbvh_get_vert_positions which already contains the result
of any deform modifiers. Use the same function to access both
to make it easier to remove both `SculptSession::vert_positions`
and `pbvh::Tree::vert_positions_` in the future.
2024-08-07 21:18:37 -04:00
Hans Goudey
79d6125660 Sculpt: Process all undo nodes at once in position undo/redo
Previously some work for applying shape key positions was
repeated once per undo node which probably made undo/redo
in that case much slower than it should be.
2024-08-07 21:18:37 -04:00
Hans Goudey
4d41be1371 Cleanup: Sculpt: Remove unused active vertex functions 2024-08-07 21:18:37 -04:00
Sean Kim
915be63b01 Cleanup: Simplify topology automasking code
* Removes struct and callback method
* Removes double initialization of custom data layer

Pull Request: https://projects.blender.org/blender/blender/pulls/126067
2024-08-08 00:58:10 +02:00
Sean Kim
034550cc4b Cleanup: Sculpt: Remove unused function
Pull Request: https://projects.blender.org/blender/blender/pulls/126066
2024-08-08 00:53:32 +02:00
Harley Acheson
b63d691570 UI: Allow Changing Alpha for Multicolor Icons
When we use icons that are multi-color, like for Tool icons, we'll
still need the ability to change their alpha at runtime. We do this
for hover effects, and as a theme setting.

Pull Request: https://projects.blender.org/blender/blender/pulls/126063
2024-08-07 23:28:17 +02:00
Jonas Holzman
6bb2e5a691 WM API: Improve naming of WM_window_pixels_* functions
The WM API has WM_window_pixels_{x,y,coords}` functions that returns the
window size/point coordinate in the host native pixel size.

As "pixels" in itself doesn't really mean anything the intent of
these functions wasn't really clear. To clarify this, this commit
renames their prefix from `WM_window_pixels_` to
`WM_window_native_pixel_`.

Pull Request: https://projects.blender.org/blender/blender/pulls/125994
2024-08-07 22:30:31 +02:00
Hans Goudey
ecc3d1db4e Refactor: Sculpt: Refactor surface smooth mesh filter
Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/126061
2024-08-07 22:17:06 +02:00
Hans Goudey
ebcdfeb77e Refactor: Sculpt: Refactor sharpen mesh filter
Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/126059
2024-08-07 21:39:05 +02:00
Sean Kim
e16e07b2da Refactor: Introduce typed version of SculptSession#active_vertex
Part of #118145.

Uses std::variant (and std::monostate to represent no value) to hold the
current active vertex type among the three different concrete types.

Pull Request: https://projects.blender.org/blender/blender/pulls/126000
2024-08-07 21:17:42 +02:00
Hans Goudey
51152cec30 Refactor: Sculpt: Inline cube brush tip distance test
Part of #118145.
2024-08-07 14:09:02 -04:00
Sean Kim
34d71b8088 Refactor: Sculpt: Remove flood_fill add_active methods
This single extra layer of abstraction for these elements doesn't add
much to the API as accessing the current active vertex is a single call.

Pull Request: https://projects.blender.org/blender/blender/pulls/126011
2024-08-07 19:45:40 +02:00
Sean Kim
50b5b4678b Refactor: Sculpt: Extract pose brush preview data
Removes the SculptPoseIKChain and SculptPoseIKChainSegment structs from
BKE_paint.hh, substituting them for the bare minimum vertex data needed
to draw the overlay using the pose brush.

Moves the needed structs into sculpt_intern.hh, ideally they should be
local to sculpt_pose.cc, but the chain is needed in StrokeCache, so
further refactoring is needed before it can be reduced in scope.

Pull Request: https://projects.blender.org/blender/blender/pulls/126009
2024-08-07 19:21:35 +02:00
Hans Goudey
a9d318d2f3 Fix #124292: GPU subdivision loose edges crash
There were two issues. One was that the normals VBO wasn't created
with the correct size. The other was that there were empty VBOs created
which can apparently also cause crashes.

Pull Request: https://projects.blender.org/blender/blender/pulls/126041
2024-08-07 19:11:23 +02:00