Commit Graph

3520 Commits

Author SHA1 Message Date
Hans Goudey
972c52feb9 Cleanup: Use enum class for boolean operation
Similar to the recently introduced `Solver` enum. This is just friendlier
and doesn't require including `DNA_node_types.h` in the geometry
module header. There's no strong benefit to declaring these enums in
DNA in practice.
2024-03-14 17:24:27 -04:00
Howard Trickey
e3f030cce6 Geometry Nodes: Add float solver to mesh boolean node
This adds a "Solver" option to the geo boolean node, with the options
Exact and Float.
The current geo boolean node only uses the Exact solver.
This adds the ability to use the faster original floating point boolean solver.
The float solver has issues with coplanar and other coincident geometry,
but is generally much faster than the Exact solver, and users have asked
for this option (which is available in the Boolean Modifier and edit mode
boolean tool).

Like the modifier, the Float solver needs to convert the Mesh to BMesh,
do the operation, and then convert back to Mesh. It also has to do it
iteratively if more than two operands are supplied.

This is the first of a planned series of commits that will add a
new exact boolean solver, based on the Ember paper, as a solver option.
Ember will be much faster than the current exact solver, but may still not
be as fast as float, and also will not handle some non-volume-enclosing
inputs as well as Float, so it is likely that the Float solver will always remain.
We may eventually retire the old Exact Solver, however.

This commit also prepares for more sensible code in the future by
changing the internal enum names for the solvers to better reflect the
algorithms used: Fast -> Float, and Exact -> Mesh_Arr (which means
"Mesh Arrangments, the name of the paper upon which the current
exact solver is based).

Co-authored-by: Howard Trickey <trickey@google.com>
Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119294
2024-03-14 20:49:57 +01:00
Jacques Lucke
68c5e35be1 Merge branch 'blender-v4.1-release' 2024-03-12 17:33:59 +01:00
Sean Kim
1982cad490 Fix: update comparator for std::sort for NamedAttribute
This PR applies a fix for the comparator being passed into std::sort to
avoid potential Mac / libc++ issues as seen in #119189

Pull Request: https://projects.blender.org/blender/blender/pulls/119385
2024-03-12 17:31:02 +01:00
Howard Trickey
17b2ff6119 Refactor: rename files mesh_boolean_convert to mesh_boolean.
A follow-up to previous commit that moved these files to geometry.
The _convert suffix made sense at one point but is now just confusing.
2024-03-12 07:00:33 -04:00
Howard Trickey
70fa3becad Refactor: Move mesh_boolean_convert from blenkernel to geometry.
Header file is renamed to GEO_mesh_boolean_convert.cc and
files that included it are updated to use that path.
This is in preparation for bigger changes to the internal
boolean API, which make more sense as a "geometry" API
than a kernel API.

Pull Request: https://projects.blender.org/blender/blender/pulls/119336
2024-03-11 18:17:57 +01:00
Casey Bianco-Davis
af6d09b439 Fix: GPv3: Armature modifier crash when vertex groups are empty
A debug error was thrown when the armature modifier was added to a GPv3
object that did not have vertex groups.

Pull Request: https://projects.blender.org/blender/blender/pulls/119301
2024-03-11 10:54:23 +01:00
Hans Goudey
01941e2b50 Geometry Nodes: Use boolean type for "use attribute" inputs
When the "use_attribute" properties were added, boolean IDProperties
didn't exist. Then we didn't change it for a while because of forward
compatibility concerns. But currently we always convert boolean
properties to integer properties when saving anyway (since
2ea47e0def, so there is no issue with compatibility.
Using booleans makes working with the properties in the Python API
a bit friendlier.

Pull Request: https://projects.blender.org/blender/blender/pulls/119129
2024-03-08 17:49:09 +01:00
YimingWu
6ed4282771 GPencil: Remove subdiv modifier unused vgroup UI
The UI was erroneously added initially for the stroke filter, now
removed.
2024-03-08 20:19:46 +08:00
Campbell Barton
f3e0e39df5 Cleanup: use const pointers where camera data isn't modified 2024-03-08 17:15:08 +11:00
Campbell Barton
cb4351665a Cleanup: format, trailing space 2024-03-08 11:31:01 +11:00
Hans Goudey
744f3b2823 Cleanup: Grammar in comments: Fix uses of "own"
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own",  "her own", or "the object's own".
It also isn't used separately to mean something like "separate".

Also, "its own" is correct instead of "it's own" which is a misues of the verb.
2024-03-07 16:23:35 -05:00
Anthony Roberts
445fd42c61 Windows: Add ARM64 support
* Only works on machines with a Qualcomm Snapdragon 8cx Gen3 or above.
  Older generation devices are not and will not be supported due to
  some driver issues
* Requires VS2022 for building.
* Uses new MSVC preprocessor for sse2neon compatibility.
* SIMD is not enabled, waiting on conversion of blenlib to C++.

Ref #119126

Pull Request: https://projects.blender.org/blender/blender/pulls/117036
2024-03-06 16:14:34 +01:00
Lukas Tönne
e3c0f64154 GPv3: Fix outline modifier unstable end cap direction
The angle of the outline modifier caps was computed in a [-pi, +pi)
interval, but this creates an unstable situation for angles close to
180. Small variation can lead the angle to flip from +180 to -180 and
change the direction of the semi-circle. Instead generate arcs always
in counter-clockwise direction and use angles in the [0, 2pi) intverval.
This creates stable directions for end caps and also allows larger
arcs where necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/119122
2024-03-06 12:40:46 +01:00
Lukas Tönne
f51e93bec7 GPv3: Shrinkwrap modifier
Port of shrinkwrap modifier from GPv2.

Adds a new API function in `BKE_shrinkwrap.hh` for the modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/119118
2024-03-06 12:05:00 +01:00
Lukas Tönne
01f794a7d5 GPv3: Fix outline modifier edge cases
Fixes behavior of the outline modifier in some edge case:

- When the outline radius gets larger than the input stroke radius it
  caused a negative offset, inverting the outline in thin areas like the
  tips of the default stroke. The offset should always remain positive
  or zero (collapses onto the input curve).
- When the outline collapses the modifier was skipping points on outside
  corners, where at least one point should be added in all cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/119084
2024-03-05 11:57:36 +01:00
Pratik Borhade
690679e3ce GPv3: Length modifier end property not working
When `random_(end/start)_factor` is non-zero, the `end segment` property
won't have any effect on the curves end. This is accidently controlled by `start_fac`.

Resolves #119059

Pull Request: https://projects.blender.org/blender/blender/pulls/119074
2024-03-05 11:51:29 +01:00
Lukas Tönne
3f43f83b8a GPv3: Fix jittery miter points by the outline modifier
With the default GPv3 "Stroke" object the outline modifier generates
jittery strokes. It also generates full circles at various points along
the input stroke.

The outline modifier chooses a normal from the camera view. In the
default GPv3 stroke test the camera views the stroke from an angle.
In that case the curve has a significant Z component out of the plane,
which breaks normalization of the 2D component and causes excessive
miter scaling.

The full circles are caused by bad angles, the range should be `(-pi,pi)`
rather than `(0,2*pi)`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119067
2024-03-05 11:07:45 +01:00
Lukas Tönne
d6aadd6692 GPv3: Outline modifier
Port of GPv2 outline modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/118911
2024-03-04 16:54:07 +01:00
YimingWu
4f70190a01 Fix #119026: GPv3: Stack use after scope
The arrays `modified_starts` and `modified_ends` was freed early
due to wrong variable scope, this leads to incorrect randomize length
effect in length modifier. Now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/119054
2024-03-04 15:30:08 +01:00
Hans Goudey
2fe717df58 Cleanup: Make format 2024-03-04 09:22:32 -05:00
YimingWu
d0c9246fcc Fix #119022: GPv3: Noise modifier seed per stroke
Use seed per stroke for grease pencil v3 noise modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/119024
2024-03-04 10:58:34 +01:00
Lukas Tönne
64bb63dcb0 Fix #118962: Skip setting not taken into account looping over points
The GPv3 envelope modifier was computing the correct number of strokes
to generate, but then not actually skipping over points. Result is that
all envelope strokes got added at the beginning instead of the whole
point range.

Pull Request: https://projects.blender.org/blender/blender/pulls/119023
2024-03-04 10:57:17 +01:00
Lukas Tönne
68c12fe0ec GPv3: Envelope Modifier
Ports the Envelope modifier from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118272
2024-03-01 10:42:41 +01:00
Hans Goudey
121ded625f Cleanup: Remove unnecessary a1 and a2 arguments for some UI functions 2024-02-29 22:39:37 -05:00
Hans Goudey
d338261c55 Cleanup: Pass Span by value
Also pass Span instead of `const Array &`
and use parantheses for BLI includes.
2024-02-27 23:09:54 -05:00
Kévin Dietrich
ea256346a8 Alembic/USD: Use GeometrySets to import data
This rewrites the Alembic and USD data importers to work with and
output GeometrySets instead of Meshes.

The main motivation for this change is to be able to import properly
point clouds, which are currently imported as Meshes, and curves
data, which suffer from a lot of issues due to limitations of
legacy curves structures (fixed by the new curves data-block) and are
also converted to Meshes. Further, for Curves, it will allow importing
arbitrary attributes.

This patch was primarily meant for Alembic, but changes to USD import
were necessary as they share the same modifier.

For Alembic:
There should be no behavioral changes for Meshes
Curves are imported as the new Curves object type
Points are imported as PointClouds

For USD:
There should be no behavioral changes for Meshes
Curves are imported as the new Curves object type
Note that the current USD importer does not support loading PointClouds,
so this patch does not add support for it.

For both Alembic and USD, knots arrays are not read anymore, as the new
Curves object does not expose the ability to set them. Improvements can
be made in the future if and when example assets are provided.

This fixes at least the following:
#58704: Animated Alembic curves don't update on render
#112308: Curves have offset animations (alembic / USD)
#118261: wrong motion blur from usd in cycles and reverting to the first
frame when disabeling motion blur

Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115623
2024-02-28 03:02:38 +01:00
Campbell Barton
7db790c4b7 Cleanup: spelling in comments 2024-02-28 12:13:20 +11:00
Jacques Lucke
086b808671 Merge branch 'blender-v4.1-release' 2024-02-27 20:40:29 +01:00
Jacques Lucke
64febcf155 Fix #116820: make sure that simulation runs when it contains an active viewer
Previously, the viewer node would work, but since the simulation output node
was never evaluated, the new simulation state was never stored. Now make
sure that the simulation output node is executed when there is an active viewer
inside the simulation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118804
2024-02-27 20:37:52 +01:00
Lukas Tönne
c6e5e62f45 GPv3: Time offset modifier
Port of the Time Offset modifier from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118371
2024-02-27 14:17:22 +01:00
Campbell Barton
9795c432e1 Cleanup: avoid redundant copy-by-value for 4x4 matrices & float3 2024-02-27 17:57:50 +11:00
YimingWu
9e143968d3 LineArt: Fix back transformation issue for v3
Line art v3 strokes should not move along with the grease pencil object
to keep the same behaviour as the old line art. Now fixed.
2024-02-27 13:07:47 +08:00
Hans Goudey
9d349896a7 Cleanup: Remove BKE_mesh.hh include from mesh_to_volume.cc
Avoid rebuilding this file when changing BKE_mesh.hh, since it's very slow.
Instead pass the necessary data directly as spans.
2024-02-26 15:04:28 -05:00
Lukas Tönne
5599172499 GPv3: Armature Modifier
Armature deformation modifier for Grease Pencil v3.

Changes compared to GPv2:
- `multi` DNA field was unused and was removed.
- `vert_coords_prev` array is unused and was removed (gets passed to
  armature functions but never gets allocated).
- GPv3 modifier uses the common `influence` struct to store the vertex
  group name, for consistency. The
  `GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP` flag is copied to
  `deformflag` as `ARM_DEF_INVERT_VGROUP` before evaluation, which is
  used internally by armature functions.
- `BKE_armature_deform_coords_with_curves` is added as another variant
  of the deform function, but uses C++ parameter types (spans instead
  of raw pointers). It gets a `Span<MDeformVert>` directly instead of
  deducing it internally from the object type. This is because we want
  to do this curve-by-curve and already use arbitrary vector spans for
  positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118752
2024-02-26 19:36:10 +01:00
YimingWu
3d1cdfe2ca GPv3: Line Art Modifier
This is a migration of the current Line Art modifier to GPv3.

Note:
- The modifier is using the exact same DNA structure as the old one, it's re-defined in a different name. At the moment all the variable names and placement after the `ModifierData` part should stay exactly the same until we do proper versioning of the modifier data and completely remove the GPv2 support.
- Vertex weight transfer feature no longer supports name initial matching ("group" used to match "group1","group2" etc). Now it will only transfer vertex weight from source vertex groups that has the exact same name as specified.

Pull Request: https://projects.blender.org/blender/blender/pulls/117028
2024-02-26 15:28:15 +01:00
Lukas Tönne
690cc6e3cb GPv3: Minor modifier fixes
A couple of small fixes for new Grease Pencil v3 modifiers: typos,
unused properties, draw code for undefined RNA properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/118675
2024-02-23 18:18:23 +01:00
Pratik Borhade
0209928647 GPv3: General panel in offset modifier
Same as legacy gp offset modifier

Resolves #118608

Pull Request: https://projects.blender.org/blender/blender/pulls/118647
2024-02-23 10:56:47 +01:00
Bastien Montagne
f15f57c5ea GPv3: Add layer 'pass_index' attribute.
Add this data as a layer attribute. It's usage was already implemented
by the modifier filtering generic code, but data itself did not yet
exist in GPv3 data.

Also add RNA accessors and handle it in conversion code.

Pull Request: https://projects.blender.org/blender/blender/pulls/118495
2024-02-22 14:53:48 +01:00
Philipp Oeser
6b8a7a17d7 Fix #118600: GPv3: hook modifier looses its object upon file reload
foreach_ID_link was missing treatment of GreasePencilHookModifierData
object.

Pull Request: https://projects.blender.org/blender/blender/pulls/118601
2024-02-22 10:16:56 +01:00
YimingWu
0dc617aac7 Fix #118492: GPv3: Noise modifier weight influence
The vertex weight influence was missing for grease pencil v3 noise
modifier due to missing API at first. Now added back.

Pull Request: https://projects.blender.org/blender/blender/pulls/118545
2024-02-21 14:59:06 +01:00
YimingWu
2225ce8202 GPv3: Hook modifier
Migrates the Hook modifier to Grease Pencil v3.

Pull Request: https://projects.blender.org/blender/blender/pulls/118452
2024-02-21 14:20:47 +01:00
bonj
fcc8a11370 Fix #118395: use copy instead of new for geometry nodes in modifiers list
Now it behaves the same as the materials list UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/118420
2024-02-20 18:43:40 +01:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Hans Goudey
81a63153d0 Despgraph: Rename "copy-on-write" to "copy-on-evaluation"
The depsgraph CoW mechanism is a bit of a misnomer. It creates an
evaluated copy for data-blocks regardless of whether the copy will
actually be written to. The point is to have physical separation between
original and evaluated data. This is in contrast to the commonly used
performance improvement of keeping a user count and copying data
implicitly when it needs to be changed. In Blender code we call this
"implicit sharing" instead. Importantly, the dependency graph has no
idea about the _actual_ CoW behavior in Blender.

Renaming this functionality in the despgraph removes some of the
confusion that comes up when talking about this, and will hopefully
make the depsgraph less confusing to understand initially too. Wording
like "the evaluated copy" (as opposed to the original data-block) has
also become common anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/118338
2024-02-19 15:54:08 +01:00
YimingWu
ae20873250 GPv3: Weight proximity modifier
This migrates the Weight proximity modifier to GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/118363
2024-02-19 11:16:38 +01:00
Campbell Barton
e51f954f39 Cleanup: spelling in comments, RNA description warning 2024-02-19 09:23:48 +11:00
YimingWu
975c226282 GPv3: Array Modifier
This migrates the Array modifier to Grease Pencil v3.

Pull Request: https://projects.blender.org/blender/blender/pulls/117836
2024-02-16 14:04:01 +01:00
YimingWu
ace5c9af2a GPv3: Vertex Weight Angle modifier
This ports the Vertex Weight Angle modifier to Grease Pencil v3.

Pull Request: https://projects.blender.org/blender/blender/pulls/117846
2024-02-16 12:30:43 +01:00
Campbell Barton
7582b15c4c Cleanup: spelling in comments 2024-02-16 14:26:46 +11:00