Commit Graph

4195 Commits

Author SHA1 Message Date
Lukas Tönne
367320a0f5 Merge branch 'blender-v4.0-release' 2023-10-19 11:48:54 +02:00
Lukas Tönne
dfc3f75e77 Fix #113860: Nullptr checks for node socket and panel name pointers
In 3.6 the names of node group sockets were using char arrays, but now
use allocated strings. The RNA system assigns nullptr to such strings
when assigning an empty string through python (UI assignment appears to
always generate a valid string). This creates issues with many STL
functions, in particular assigning nullptr to `std::string` will crash.

We have to check for valid pointers before using them in places that
don't handle nullptrs.

Pull Request: https://projects.blender.org/blender/blender/pulls/113924
2023-10-19 11:48:08 +02:00
Jacques Lucke
1c703eac2e Cleanup: use single declare function for all group nodes
The longer term plan is to allow using the same node groups in different
node tree types anyway. Also, the implicit field inputs is something that
shader nodes could benefit from soonish already.

This also fixes a bug where the geometry nodes specific declare function
was not used anymore since 38813a7441.
2023-10-19 11:13:52 +02:00
Sergey Sharybin
d826bcd02f Merge branch 'blender-v4.0-release' 2023-10-19 11:02:40 +02:00
Iliya Katueshenock
e6a0b4404c Fix #110415: Crash with single point curves in Interpolate Curves node
Single point curves should be handled separately, because they don't
have any curve segments.

Pull Request: https://projects.blender.org/blender/blender/pulls/110477
2023-10-19 10:41:33 +02:00
Hans Goudey
aa34e2f2aa Cleanup: Remove unnecessary namespace specification 2023-10-19 10:37:04 +02:00
Sergey Sharybin
aa8c97faeb Cleanup: Fix -Wpessimizing-move warning in curve trim
Pull Request: https://projects.blender.org/blender/blender/pulls/113923
2023-10-19 10:26:39 +02:00
Iliya Katueshenock
4a5bfb273f Geometry Nodes: Avoid corner domain for Blur Attribute viewing
Face Corner is not supported.
In case prefer domain is used, face corner shouldn't be proposed.
This will make the viewer node preview the values on the point
domain instead in the viewport.

Pull Request: https://projects.blender.org/blender/blender/pulls/113905
2023-10-18 20:11:47 +02:00
Pablo Vazquez
f0e812d3d8 UI: Use single column layout on Tangent node
The layout inside nodes is usually a column, not split rows,
since nodes are narrow and read top-down.

Pull Request: https://projects.blender.org/blender/blender/pulls/113902
2023-10-18 18:37:25 +02:00
Brecht Van Lommel
f7dfde9e73 Fix build error when not using unity build 2023-10-18 17:59:51 +02:00
Brecht Van Lommel
b867f16e27 Cleanup: compiler warnings 2023-10-18 16:57:08 +02:00
Hans Goudey
5b108ae522 Cleanup: Resolve clang compile warnings
Of the two overloaded functions clang chose the non-span version with
only a single item in the initializer list. Resolve that by not using an
intializer list in that case.
2023-10-18 14:23:57 +02:00
Pablo Vazquez
9f2d32c154 UI: Use proper icon for nodes with UV Maps picker
It was set to none, which draws as a dot instead of the already familiar
UV Map icon used in the UV Maps list and other places.

Affects:
* UV Map
* Tangent
* Normal Map

Following !113793 efforts to unify icons.
2023-10-18 12:36:25 +02:00
Falk David
a89bb7632a GPv3: Separate/Delete Geometry node
This implements deleting a selection of layers on a grease pencil geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/113828
2023-10-18 11:54:56 +02:00
Jacques Lucke
5bee6bcedc Geometry Nodes: new Split to Instances node
This node allows splitting up a geometry into groups. A group is defined as all
elements with the same group id. The output contains an instance per group.
The `Group ID` output can be used for further deterministic processing.

The node supports meshes, curves, point clouds and instances. It only works
on the top-level geometry, so it does not go into nested instances because it
also generates new instances.

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

Pull Request: https://projects.blender.org/blender/blender/pulls/113083
2023-10-18 10:26:23 +02:00
Jacques Lucke
9c56a19640 Merge branch 'blender-v4.0-release' 2023-10-18 10:18:04 +02:00
Jacques Lucke
969dd7b985 Geometry Nodes: add forward compatibility for map range socket identifiers
Also see 0ea193bdb3.
2023-10-18 10:17:43 +02:00
Dalai Felinto
9a967d26fd GPv3: Set Material node
Note: At the moment the node only supports
non-Grease Pencil materials.

But if the material socket is connected to the
modifier a Grease Pencil material can be used.

Part of #113602.

Ref !113816.
2023-10-18 08:58:02 +02:00
Hans Goudey
e84ba67c73 Fix: Material selection node test failure
The actual selection needs to be evaluated on the right domain, not
necessarily the domain from the field context. It's interpolated as
a separate step.

Also reuse the attribute accessor already assigned to a local variable.
2023-10-17 22:46:16 +02:00
Hans Goudey
60e7e89bfa Cleanup: Retrieve virtual array single value in one call 2023-10-17 22:43:38 +02:00
Hans Goudey
4c7fe8b583 Cleanup: Remove unnecessary parentheses in switch cases
Also remove unnececessary checks that can be combined with the switch,
and use `.index_range()` instead of `IndexRange(.size())`.
2023-10-17 22:28:47 +02:00
Dalai Felinto
e773cc2967 GPv3: Set Material Index node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113821
2023-10-17 20:20:40 +02:00
Dalai Felinto
42f71c9dca GPv3: Material Selection node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113827
2023-10-17 19:52:46 +02:00
Dalai Felinto
c5ed37a5c0 GPv3: Replace Material node
Note: At the moment the node only supports non-Grease Pencil materials.

But if the material socket is connected to the modifier a Grease Pencil
material can be used.

Part of #113602.

Co-authored-by: Hans Goudey <hans@blender.org>
Ref !113818.
2023-10-17 18:51:47 +02:00
Dalai Felinto
f54d5df2fc GPv3: Fillet Curve node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113850
2023-10-17 18:30:38 +02:00
Hans Goudey
30d66a4eaf Merge branch 'blender-v4.0-release' 2023-10-17 09:56:58 +02:00
Hans Goudey
bd4c310a19 Fix: Missing edge domain in node tool set selection node
This wasn't implemented in the initial commit because we didn't have
a function to flush edge selections to vertices and faces. But using the
existing domain interpolations makes that trivial, so it may as well be
added now to avoid the arbitrary limitation from the user perspective.

See https://devtalk.blender.org/t/node-tools-feedback/31388/5

Pull Request: https://projects.blender.org/blender/blender/pulls/113367
2023-10-17 09:56:24 +02:00
Campbell Barton
a89686240e Build: unbreak WITH_UNITY_BUILD=OFF 2023-10-17 16:11:04 +11:00
Dalai Felinto
dd8d3ec27b GPv3: Convex Hull node
We create one convex hull per layer, following what we do for instances.

This is covered as part of the design in #113602, and as such not
commented on the code itself.

Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113788
2023-10-16 22:16:34 +02:00
Iliya Katueshenock
fb57767f78 Cleanup: simplify extracting GField from geometry nodes parameters
Pull Request: https://projects.blender.org/blender/blender/pulls/113743
2023-10-16 19:19:53 +02:00
Iliya Katueshenock
bd6db0acea Cleanup: Nodes: unify data type conversion functions
Pull Request: https://projects.blender.org/blender/blender/pulls/113744
2023-10-16 19:09:07 +02:00
Jacques Lucke
ff4d5b6f04 Geometry Nodes: don't use CustomDataAttributes in Instances
This was the last use of `CustomDataAttributes`. It's not very useful
nowadays because we have a lower level (`CustomData`) and higher level
(`AttributeAccessor`) API.

As part of this I removed the ability to `reserve` instances which was
useful when adding instances one by one. Generally, such code should
eventually be rewritten to handle more instances at once, instead of
handling them one by one. This will lead to better performance and
is more in line with how other geometry types (like mesh) are handled.

This also adds the ability to move and assign `Instances` just like we can
move and assign `CurvesGeometry`.
2023-10-16 18:41:32 +02:00
Dalai Felinto
0dcf92f945 GPv3: Fix Curve to Mesh node replacing instances
The code is already replacing instances when needed (when there was no
instances previously created in the file). To do it regardless may lead
to remove instances from the loop.

The other related nodes did not have that issue:
* Curve to Points
* Curve Fill
2023-10-16 17:33:30 +02:00
Germano Cavalcante
47867549e8 Merge branch 'blender-v4.0-release' into main 2023-10-16 10:40:08 -03:00
Damien Picard
9c0c9789cc I18n: fix Vector Math and Mix node sockets search
When searching for a new node by dragging from a socket, some results
were untranslated. This is because they did not use a translation
context matching other occurrences, from which the strings were
extracted to the translation files.

Three nodes using operations were affected: Mix and Vector Math.
- Vector Math used the default context when it should have used
  NodeTree.
- Mix and Mix RGB used NodeTree when they should have used the default
  context.

Pull Request: https://projects.blender.org/blender/blender/pulls/113485
2023-10-16 14:45:47 +02:00
Dalai Felinto
9c22af32a9 Cleanup: Remove unecesary includes 2023-10-16 11:30:22 +02:00
Dalai Felinto
47cfeb45d8 GPv3: Delete Geometry node
Incorporated the cleanup and tweaks from Hans Goudey to return CurvesGeometry directly.

Part of #113602.

Co-authored-by: Hans Goudey <hans@blender.org>
Ref !113721
2023-10-16 11:29:07 +02:00
Omar Emara
9f1538b586 Cleanup: Move compositor headers to c++
Pull Request: https://projects.blender.org/blender/blender/pulls/113758
2023-10-16 10:45:54 +02:00
Campbell Barton
ed2e42d62c Merge branch 'blender-v4.0-release' 2023-10-16 10:35:39 +11:00
Iliya Katueshenock
4d91c50b62 Fix #113429: Dirty evaluated curve
Tag curve topology as dirty after changing of types of handles.

Pull Request: https://projects.blender.org/blender/blender/pulls/113717
2023-10-15 20:59:21 +02:00
Jacques Lucke
d76263de96 Merge branch 'blender-v4.0-release' 2023-10-15 20:50:12 +02:00
Jacques Lucke
c584b6434f Fix #113691: crash when Interpolate Curves input has zero curves
The crash happened only when there was a `Curves` geometry, but
it was empty.
2023-10-15 20:49:48 +02:00
Jacques Lucke
38813a7441 Nodes: unify static and dynamic declarations
This helps solving the problem encountered in #113553. The problem is that we
currently can't support link-drag-search for nodes which have a dynamic declaration.

With this patch, there is only a single `declare` function per node type, instead of
the separate `declare` and `declare_dynamic` functions. The new `declare` function
has access to the node and tree. However, both are allowed to be null. The final
node declaration has a flag for whether it depends on the node context or not.

Nodes that previously had a dynamic declaration should now create as much of
the declaration as possible that does not depend on the node. This allows code
like for link-drag-search to take those sockets into account even if the other
sockets are dynamic.

For node declarations that have dynamic types (e.g. Switch node), we can also
add extra information to the static node declaration, like the identifier of the socket
with the dynamic type. This is not part of this patch though.

I can think of two main alternatives to the approach implemented here:
* Define two separate functions for dynamic nodes. One that creates the "static
  declaration" without node context, and on that creates the actual declaration with
  node context.
* Have a single declare function that generates "build instructions" for the actual
  node declaration. So instead of building the final declaration directly, one can for
  example add a socket whose type depends on a specific rna path in the node.
  The actual node declaration is then automatically generated based on the build
  instructions. This becomes quite a bit more tricky with dynamic amounts of sockets
  and introduces another indirection between declarations and what sockets the node
  actually has.

I found the approach implemented in this patch to lead to the least amount of
boilerplate (doesn't require a seperate "build instructions" data structure) and code
duplication (socket properties are still only defined in one place). At the same time,
it offers more flexibility to how nodes can be dynamic.

Pull Request: https://projects.blender.org/blender/blender/pulls/113742
2023-10-15 20:28:23 +02:00
Jacques Lucke
14fa963910 Cleanup: move node declaration code out of header 2023-10-15 12:43:02 +02:00
Harley Acheson
13de143ba8 Merge branch 'blender-v4.0-release' 2023-10-14 12:00:08 -07:00
Dalai Felinto
a93238a922 GPv3: Reverse Curve node
Part of #113602.
Ref !113702.
2023-10-14 12:50:02 +02:00
Iliya Katueshenock
690deeda18 Fix: Geometry Nodes: Create instance attribute of the right type
`attributes_to_propagate` is map of all attributes to propagate from different
components. For attribute propagation three different components is taken.
Each one can have named attribute with specific type. Current implementation
of propagation: Try to make implicit share attribute. Or create/copy.
This doesn't takes into account `attributes_to_propagate`' data type info.
So, this cause crash for case, there multiple component have same name attribute
with different type.
Fix: Try to make implicit share attribute with correct type. Or create, copy typed version.

Pull Request: https://projects.blender.org/blender/blender/pulls/110146
2023-10-14 10:54:32 +02:00
Dalai Felinto
16b7977bb5 GPv3: Set Curve Normal
Part of #113602.
Ref !113704.
2023-10-14 00:58:02 +02:00
Dalai Felinto
a92cfc2754 GPv3: Set Spline Resolution
Part of #113602.
2023-10-13 19:55:10 +02:00
Dalai Felinto
d3fea733a1 GPv3: Set Spline Cyclic
Part of #113602.
2023-10-13 19:48:22 +02:00