Commit Graph

183 Commits

Author SHA1 Message Date
Jesse Yurkovich
0240a1f32f Cleanup: CMake: Modernize bf_intern_openvdb dependencies
This follows the other CMake "modernization" commits, this time for
`bf_intern_openvdb` and the OpenVDB dependency itself.

The difference with this one is that `intern/openvdb` becomes an
"optional" dependency itself. This is because downstream consumers often
want to include this dependency rather than openvdb directly, so this
target must also be optional. Optional, in this case, means the target
always exists but may be entirely empty.

Summary
- If you are using BKE APIs to access openvdb features, then use the
  `bf::blenkernel` target
- If you are only using `intern/openvdb` APIs then use the
  `bf::intern::optional::openvdb` target (rare)
- For all other cases, use the `bf::dependencies::optional::openvdb`
  target (rare)

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/137071
2025-08-12 21:26:38 +02:00
Hans Goudey
4f372d64d4 Geometry Nodes: Initial very basic list support
This includes a new list structure type and socket shape, a node
to create lists, a node to retrieve values from lists, and a node to
retrieve the length of lists. It also implements multi-function support
so that function nodes work on lists.

There are three nodes included in this PR.
- **List** Creates a list of elements with a given size. The values
  are computed with a field that can use the index as an input.
- **Get List Item** A field node that retrieves an element from a
  a list at a given index. The index input is dynamic, so if the input
  is a list, the output will be a list too.
- **List Length** Just gives the length of a list.

When a function node is used with multiple list inputs, the shorter
lists are repeated to extend it to the length of the longest.

The list nodes and structure type are hidden behind an experimental
feature until we can be sure they're useful for an actual use case.

Pull Request: https://projects.blender.org/blender/blender/pulls/140679
2025-07-24 16:16:40 +02:00
Omar Emara
a565e96f6c Compositor: Support Menu socket and Menu Switch node
This patch adds support for menu socket in the compositor as well as
the Menu Switch node from Geometry Nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/141792
2025-07-18 11:08:30 +02:00
quackarooni
ad90cceb1e Geometry Nodes: Add "Set Grease Pencil Softness" node
How solid/faded the edges of a Grease Pencil stroke is
controlled by the `softness` attribute. This change adds a
node that exposes that attribute, allowing the user to
control it via Geometry Nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138939
2025-05-23 07:30:23 +02:00
Jacques Lucke
1816a2665e Tests: Geometry Nodes: add initial Import CSV node tests
Previously, the test files still had absolute instead of relative paths in them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139020
2025-05-18 07:34:57 +02:00
Lukas Tönne
11ceddb9df New Grid Info node for reading grid transforms and background value
These are generic properties of grids (not stored in voxels) which are
useful to know in geometry nodes. The transform in particular defines
the voxel size. Background value is used outside of active voxels.

Pull Request: https://projects.blender.org/blender/blender/pulls/138592
2025-05-12 13:46:40 +02:00
Jacques Lucke
1363319844 Geometry Nodes: add Import VDB node
This adds an Import VDB node. It loads all the grids from a .vdb file and hence
outputs a Volume geometry instead of an individual grid.

The grids are cached through the existing volume grid file cache, so they are
automatically deduplicated when volume grids are loaded from files in other
ways.

Pull Request: https://projects.blender.org/blender/blender/pulls/138380
2025-05-06 04:13:11 +02:00
Cartesian Caramel
3d1b6f53f3 Geometry Nodes: new Instance Bounds Node
This adds a new Instance Bounds nodes which provides an easy and
efficient way to get the bounding box of each instance.

Nested instances or not taken into account to compute the bounding
box. That would result in a major performance degredation because
one would have to basically realize all instances to do that.

Also see #135933 for some examples.

Pull Request: https://projects.blender.org/blender/blender/pulls/135933
2025-04-17 13:34:26 +02:00
Campbell Barton
12f0164eb0 CMake: match defines & CMake variable names
Avoid mistakes with these variables getting mixed up
(see: bf03a2684b).

Ref !137183
2025-04-09 08:44:36 +00:00
quackarooni
17b5ab6965 Geometry Nodes: Field Statistic Nodes
Adds field versions of the operations from Attribute Statistic, can
support grouping via Group IDs. These operations are added as separate
nodes: `Field Average`, `Field Min & Max`, & `Field Variance` which
group the different statistic operations according to their use.

Supported Data Types:
- Field Average - (Float, Vector)
- Field Min & Max - (Float, Integer, Vector)
- Field Variance - (Float, Vector)

Pull Request: https://projects.blender.org/blender/blender/pulls/134640
2025-04-08 17:12:08 +02:00
Falk David
20ce477ea0 Geometry Nodes: Add node to set the Grease Pencil depth order
Adds a new node to set the Grease Pencil depth ordering.

Here are the options:
* 2D Layers: Uses the Layer order + Stroke order to calculate the depth ordering.
* 3D Location: Uses the 3D position of the points as the depth.

This reflects the same setting that is available in the Grease Pencil
object-data properties.

The node is added to the `Grease Pencil` > `Write` menu.

Resolves #129458.

Pull Request: https://projects.blender.org/blender/blender/pulls/135914
2025-04-08 15:24:51 +02:00
Falk David
8a01c9b8ec Geometry Nodes: Add Set Grease Pencil Color node
Adds a new `Set Grease Pencil Color` node.
It was already possible to write to the color and opacity attributes using the
`Store Named Attribute` node, but this required the user to know the names
of the "built in" attributes.

Similar to how we can set other built-in attributes (e.g. the curve radius) this
adds a node to write to the following Grease Pencil attributes:
* `vertex_color` (point domain): The color of a point (the alpha value is used
    as a mix factor with the base material color).
* `opacity` (point domain): The opacity of a point.
* `fill_color` (curve domain): The fill color of a stroke (the alpha value is used
    as a mix factor with the base material color).
* `fill_opacity` (curve domain): The fill opacity of a stroke.

For consistency with other nodes, there is a mode to switch between writing
to the points (`Stroke` mode) and the fills (`Fill` mode).

Pull Request: https://projects.blender.org/blender/blender/pulls/136260
2025-04-05 12:11:26 +02:00
Hans Goudey
d3f84449ad Mesh: Add "free" custom normals
Add a "dumb vector" storage option for custom normals, with the
"custom_normal" attribute. Adjust the mesh normals caching to
provide this attribute if it's available, and add a geometry node to
store custom normals.

## Free Normals
They're called "free" in the sense that they're just direction vectors
in the object's local space, rather than the existing "smooth corner
fan space" storage. They're also "free" in that they make further
normals calculation very inexpensive, since we just use the custom
normals instead. That's a big improvement from the existing custom
normals storage, which usually significantly decreases
viewport performance. For example, in a simple test file just storing
the vertex normals on a UV sphere, using free normals gives 25 times
better playback performance and 10% lower memory usage.

Free normals are adjusted when applying a transformation to the entire
mesh or when realizing instances, but in general they're not updated for
vertex deformations.

## Set Mesh Normal Node
The new geometry node allows storing free custom normals as well as
the existing corner fan space normals. When free normals are chosen,
free normals can be stored on vertices, faces, or face corners. Using
the face corner domain is necessary to bake existing mixed sharp and
smooth edges into the custom normal vectors.

The node also has a mode for storing edge and mesh sharpness, meant
as a "soft" replacement to the "Set Shade Smooth" node that's a bit
more convenient.

## Normal Input Node
The normal node outputs free custom normals mixed to whatever domain is
requested. A "true normal" output that ignores custom normals and
sharpness is added as well.

Across Blender, custom normals are generally accessed via face and
vertex normals, when "true normals" are not requested explicitly.
In many cases that means they are mixed from the face corner domain.

## Future Work
1. There are many places where propagation of free normals could be
   improved. They should probably be normalized after mixing, and it
   may be useful to not just use 0 vectors for new elements. To keep
   the scope of this change smaller, that sort of thing generally isn't
   handled here. Searching `CD_NORMAL` gives a hint of where better
   propagation could be useful.
2. Free normals are displayed properly in edit mode, but the existing
   custom normal editing operators don't work with free normals yet.
   This will hopefully be fairly straightforward since custom normals
   are usually converted to `float3` for editing anyway. Edit mode
   changes aren't included here because they're unnecessary for the
   procedural custom normals use cases.
3. Most importers can probably switch to using free normals instead,
   or at least provide an option for it. That will give a significant
   import performance improvement, and an improvement of Blender's
   FPS for imported scenes too.

Pull Request: https://projects.blender.org/blender/blender/pulls/132583
2025-04-04 19:16:51 +02:00
Jacques Lucke
8ec9c62d3e Geometry Nodes: add Closures and Bundles behind experimental feature flag
This implements bundles and closures which are described in more detail in this
blog post: https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/

tl;dr:
* Bundles are containers that allow storing multiple socket values in a single
  value. Each value in the bundle is identified by a name. Bundles can be
  nested.
* Closures are functions that are created with the Closure Zone and can be
  evaluated with the Evaluate Closure node.

To use the patch, the `Bundle and Closure Nodes` experimental feature has to be
enabled. This is necessary, because these features are not fully done yet and
still need iterations to improve the workflow before they can be officially
released. These iterations are easier to do in `main` than in a separate branch
though. That's because this patch is quite large and somewhat prone to merge
conflicts. Also other work we want to do, depends on this.

This adds the following new nodes:
* Combine Bundle: can pack multiple values into one.
* Separate Bundle: extracts values from a bundle.
* Closure Zone: outputs a closure zone for use in the `Evaluate Closure` node.
* Evaluate Closure: evaluates the passed in closure.

Things that will be added soon after this lands:
* Fields in bundles and closures. The way this is done changes with #134811, so
  I rather implement this once both are in `main`.
* UI features for keeping sockets in sync (right now there are warnings only).

One bigger issue is the limited support for lazyness. For example, all inputs of
a Combine Bundle node will be evaluated, even if they are not all needed. The
same is true for all captured values of a closure. This is a deeper limitation
that needs to be resolved at some point. This will likely be done after an
initial version of this patch is done.

Pull Request: https://projects.blender.org/blender/blender/pulls/128340
2025-04-03 15:44:06 +02:00
Cartesian Caramel
ade8576bf7 Geometry Nodes: new Camera Info Node
This adds a new Camera Info node to Geometry Nodes. It provides information
about the passed in camera like its projection matrix and focus distance.

This can be used for camera culling which was must more complex before.
It also allows building other view-dependent effects.

Pull Request: https://projects.blender.org/blender/blender/pulls/135311
2025-03-28 22:54:13 +01:00
Hans Goudey
9287bb759b Geometry Nodes: Import Text node
As a small addition to the import node features for 4.5,
this simple node imports a text file as a string. Potential
use cases include retrieving text for motion graphics.

Currently this just allows .txt files. More extensions could
be allowed in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/135459
2025-03-06 18:47:30 +01:00
Campbell Barton
5087246f39 Cleanup: strip trailing space, sort file lists 2025-02-16 20:42:16 +11:00
Devashish Lal
1a62fdc82a Geometry Nodes: CSV import node
This commit implements a node to import CSV files as a point cloud.
The interface is minimal, with just a file path input. The type of each
column is chosen by whether the first value is an integer or a float
(those are currently the only supported types).

The goal of the node is to make it easier to get arbitrary data into
geometry nodes for visualization purposes, for example.

https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482

Pull Request: https://projects.blender.org/blender/blender/pulls/126308
2025-02-10 16:56:52 +01:00
Ray Molenkamp
5783950ac5 Revert: 0dc484f9cc bf_rna modernisation
This caused build errors on the docs builder, I can't seem to reproduce
locally, so revert for now and have another look at some point in the
future.

Sadly as these changes usually go, this took 5c515e26bb and
2f0fc7fc9f with it as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/132559
2025-01-02 19:56:24 +01:00
Campbell Barton
5c515e26bb Cleanup: remove trailing space, ensure a newline at EOF 2025-01-02 15:11:18 +11:00
Ray Molenkamp
0dc484f9cc Cleanup: CMake: Modernize bf_rna dependencies
Pretty straightforward

- Remove any bf_rna paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132413
2024-12-31 18:23:25 +01:00
Ray Molenkamp
95c1a5e4fe Cleanup: CMake: Modernize bf_imbuf_movie dependencies
Not entirely straightforward, some manual edits were done since when
this library was created, some of the work was already done.

- Remove any bf_imbuf_movie paths from INC
- Add a dependency though LIB when missing
- Add public dependency to bf_imbuf in bf_imbuf_movie since it uses the
  imbuf headers in its public headers.
- Fix namespace not to have underscores

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132407
2024-12-28 20:53:18 +01:00
Ray molenkamp
10c5493746 Cleanup: CMake: Modernize bf_geometry dependencies
Pretty straightforward

- Remove any bf_geometry paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132375
2024-12-28 19:58:14 +01:00
Ray Molenkamp
16eb4430f5 Cleanup: CMake: Modernize bf_render dependencies
Pretty straightforward

- Remove any bf_render paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132355
2024-12-26 18:50:53 +01:00
Ray Molenkamp
a0d9826b3c Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132336
2024-12-25 23:32:15 +01:00
Ray Molenkamp
4dcef4421c Cleanup: CMake: Modernize bf_functions dependencies
Pretty straightforward

- Remove any bf_functions paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132335
2024-12-25 19:46:31 +01:00
Ray Molenkamp
a23aab3ddc Cleanup: CMake: Modernize bf_blenloader dependencies
Pretty straightforward

- Remove any bf_blenloader paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132334
2024-12-25 18:40:41 +01:00
Ray Molenkamp
c331c6b50e Cleanup: CMake: Modernize bf_blentranslation dependencies
Pretty straightforward

- Remove any bf_blentranslation paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132311
2024-12-25 17:40:25 +01:00
Ray Molenkamp
54604efdfd Cleanup: CMake: Modernize bf_windowmanager dependencies
Pretty straightforward

- Remove any bf_windowmanager paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132310
2024-12-24 22:40:38 +01:00
Ray Molenkamp
b7407aabb5 Cleanup: CMake: Modernize bf_gpu dependencies
Pretty straightforward

- Remove any bf_gpu paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132286
2024-12-23 21:38:19 +01:00
Ray Molenkamp
a7c39896c6 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any bf_blenkernel paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132282
2024-12-23 20:08:37 +01:00
Ray Molenkamp
2992c63bc3 Cleanup: CMake: Modernize bf_bmesh dependencies
Pretty straightforward

- Remove any bf_bmesh paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132203
2024-12-23 17:47:25 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
quackarooni
65b1ab43bf Geometry Nodes: Add "Collection" and "Object" input nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/131075
2024-12-04 15:01:44 +01:00
Falk David
53b9594ee2 Geometry Nodes: Add "Merge Layers" node
This patch improves working with grease pencil layers in geometry nodes.
* Allow layers to have duplicate names in geometry nodes. In original data, unique names are enforced.
  * This allows e.g. duplicating layers and then merging them by name in the end.
  * It also resolves a big serial bottleneck when working with many grease pencil layers in geometry nodes. Enforcing unique names is inefficient.
* New `Merge Layers` node that can merge multiple layers by name or by a custom group id.
* Applying a grease pencil modifier now first merges all layers with the same name to ensure all names are unique.

Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/127873
2024-09-27 13:17:18 +02:00
Campbell Barton
0e08e8bf2d Cleanup: add missing CMake headers, update "check_cmake" config 2024-09-25 19:24:21 +10:00
Jacques Lucke
6e5e01e630 Geometry Nodes: new For Each Geometry Element zone
This adds a new type of zone to Geometry Nodes that allows executing some nodes
for each element in a geometry.

## Features

* The `Selection` input allows iterating over a subset of elements on the set
  domain.
* Fields passed into the input node are available as single values inside of the
  zone.
* The input geometry can be split up into separate (completely independent)
  geometries for each element (on all domains except face corner).
* New attributes can be created on the input geometry by outputting a single
  value from each iteration.
* New geometries can be generated in each iteration.
    * All of these geometries are joined to form the final output.
    * Attributes from the input geometry are propagated to the output
      geometries.

## Evaluation

The evaluation strategy is similar to the one used for repeat zones. Namely, it
dynamically builds a `lazy_function::Graph` once it knows how many iterations
are necessary. It contains a separate node for each iteration. The inputs for
each iteration are hardcoded into the graph. The outputs of each iteration a
passed to a separate lazy-function that reduces all the values down to the final
outputs. This final output can have a huge number of inputs and that is not
ideal for multi-threading yet, but that can still be improved in the future.

## Performance

There is a non-neglilible amount of overhead for each iteration. The overhead is
way larger than the per-element overhead when just doing field evaluation.
Therefore, normal field evaluation should be preferred when possible. That can
partially still be optimized if there is only some number crunching going on in
the zone but that optimization is not implemented yet.

However, processing many small geometries (e.g. each hair of a character
separately) will likely **always be slower** than working on fewer larger
geoemtries. The additional flexibility you get by processing each element
separately comes at the cost that Blender can't optimize the operation as well.
For node groups that need to handle lots of geometry elements, we recommend
trying to design the node setup so that iteration over tiny sub-geometries is
not required.

An opposite point is true as well though. It can be faster to process more
medium sized geometries in parallel than fewer very large geometries because of
more multi-threading opportunities. The exact threshold between tiny, medium and
large geometries depends on a lot of factors though.

Overall, this initial version of the new zone does not implement all
optimization opportunities yet, but the points mentioned above will still hold
true later.

Pull Request: https://projects.blender.org/blender/blender/pulls/127331
2024-09-24 11:52:02 +02:00
Campbell Barton
0fc27c8d81 Cleanup: spelling in comments 2024-09-20 13:14:57 +10:00
Jacques Lucke
b279a6d703 Refactor: Geometry Nodes: remove AnonymousAttributeID in favor of just strings
This removes `AnonymousAttributeID` which was "attached" to every anonymous
attribute before. It adds more complexity than is justified for its
functionality.

It was originally introduced to keep the reference count of the anonymous
attribute so that it can be deleted automatically when the attribute is not
referenced anymore. For quite some time we have had deterministic attribute
life-times though which don't rely on the reference count anymore.

Anonymous attributes are sometimes shown in the UI as "friendly looking" string
like `"UV Map" from Cube`. Some information necessary for this was also stored
in `AnonymousAttributeID`. However, this can also be solved differently.
Specifically, this functionality has now been added directly to
`AttributeFieldInput`.

This refactor also allows removing `AttributeIDRef` which was mainly introduced
because we had to keep the `AnonymousAttributeID` attached with the attribute
name. Just using simple string types to identify attributes can reduce the
mental overhead quite significantly. This will be done as a separate refactor
though.

Pull Request: https://projects.blender.org/blender/blender/pulls/127081
2024-09-03 15:38:51 +02:00
Jacques Lucke
e8b81065bc Geometry Nodes: support custom warnings in node groups
This implements the `Warning` node that allows node groups to communicate
expectations about input values to the user.

By default, the `Warning` node is only evaluated if the node group that contains
it is evaluated in any way. This is better than always evaluating it, because
that could trigger lots of unnecessary evaluation in parts of the potentially
large node tree which should be ignored. In this basic mode, the output of the
node should not be connected to anything and it must not be in a zone.

For more fine-grained control for when the `Warning` node should be evaluated,
one can use the boolean output which is just a pass-through of the `Show` input.
If this output is used, the `Warning` node will only be evaluated if its output
is used. A simple way to use it is to control a Switch node with it that e.g.
"disables" a specific output when the inputs are invalid. In this case, the
`Warning` node may also be in a zone.

The node allows the user to choose between 3 severity levels: Error, Warning and
Info. Those are the same levels that we use internally. Currently, the error and
warning mode are pretty much the same, but that may change in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/125544
2024-08-29 16:03:25 +02:00
Campbell Barton
07b11206eb Cleanup: sort cmake file lists 2024-08-23 10:19:53 +10:00
Devashish Lal
f6e6f2b2d2 Geometry Nodes: PLY import node
This commit adds a PLY format import node, part of the current Google
Summer of Code Project [0]. The importer is refactored to output a mesh,
and a node is added to wrap around the importer. The node supports error
messages from the importer. The node is hidden behind an experimental
option for now, like the others.

0: https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482)

Pull Request: https://projects.blender.org/blender/blender/pulls/125587
2024-08-05 14:54:54 +02:00
Campbell Barton
8418ec4952 CMake: include headers in source lists 2024-07-25 11:24:11 +10:00
Jacques Lucke
3c81984178 Geometry Nodes: add conversion nodes for Grease Pencil and Curves
This adds two new nodes:
* `Grease Pencil to Curves`: Converts each grease pencil layer into an instance
  that contains curves.
* `Curves to Grease Pencil`: Converts top-level curve instances into grease
  pencil layers.

This opens up many new opportunities:
* Use grease pencil as input to other procedural systems that don't necessarily
  output grease pencil.
* Generate grease pencil from scratch using geometry nodes.
* Temporarily convert grease pencil data to curves to use more powerful features
  for curves processing.

Some data on layers are not attributes yet unfortunately, so there is some
special case handling for the `opacity` attribute. This was previously discussed
at the geometry nodes workshop:
https://devtalk.blender.org/t/2024-05-13-geometry-nodes-workshop-notes/34760#grease-pencil-14

Pull Request: https://projects.blender.org/blender/blender/pulls/124279
2024-07-22 12:29:26 +02:00
Jesse Yurkovich
ec4fc2d34a CMake: Modernize the optional TBB dependency
This continues the cmake modernization effort and introduces support for
allowing our optional dependencies to integrate properly. TBB is added
here as it's proven troublesome to maintain correctly.

Currently the only Blender project which uses the TBB headers directly
is `blenlib`.  However, all downstream projects which require blenlib as
their dependency, and wish to properly make use of its threading
facilities, needed to define various TBB items in their CMake files. Not
only is this unnecessary and arcane, but several projects didn't do this
and ended up not using threading as well as producing ODR violations
along the way[1].

This PR makes TBB a modern dependency and exposes it PUBLIC'ly from
`blenlib`.  All downstream projects which depend on blenlib will now
receive everything they require from TBB automatically. This includes
the `WITH_TBB` define, the headers, and the library itself.

[1] blender/blender@05241f47f5

Pull Request: https://projects.blender.org/blender/blender/pulls/124916
2024-07-19 23:30:56 +02:00
Bastien Montagne
c607ead4b7 Refactor: Makesrna: move generated code further in C++.
This commit moves generated `RNA_blender.h`, `RNA_prototype.h` and
`RNA_blender_cpp.h` headers to become C++ header files.

It also removes the now useless `RNA_EXTERN_C` defines, and just
directly use the `extern` keyword. We do not need anymore `extern "C"`
declarations here.

Pull Request: https://projects.blender.org/blender/blender/pulls/124469
2024-07-15 16:39:45 +02:00
Jacques Lucke
24dc9a21b1 Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.

We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.

The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.

The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.

If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.

Backpropagation does not work for all nodes, although more nodes can be
supported over time.

This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
  a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
  rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.

In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.

All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.

The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.

Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.

The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
  clicking the gizmo icon next to the value.

Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
Jacques Lucke
dc8e9678e1 Geometry Nodes: allow naming geometry sets
This adds a new `name` member to the `GeometrySet` class. This name can be set
with the new `Set Geometry Name` node. Currently, the name is only used in the
spreadsheet when displaying instances.

The main purpose of this name is to help debugging in instance trees. However, in the
future it may also be used when exporting instance trees or when creating separate
objects from them.

Note, the name is not expected to be unique, it is fully in user control.

Naming geometries is necessary to make the spreadsheet more useful for instances,
because currently the user has no information for which geometry is used by each instance.

We also want to use this name to improve the integration with grease pencil where
sometimes layers become instances with the same name.

Pull Request: https://projects.blender.org/blender/blender/pulls/114910
2024-07-09 17:03:54 +02:00
Hans Goudey
61db25b78e Fix: Linker error in lite build with OBJ import node 2024-07-08 19:05:36 -04:00
Hans Goudey
977e961067 Fix: OBJ import node build error in lite build
Similar to 3a31fcebcf
2024-07-08 17:05:06 -04:00