We had a short discussion on this change. "Grease Pencil Layer" is
just a bit too long, especially in the UI. Even though "Layer" might be
ambiguous, it shouldn't be in the context of geometry nodes. There are
currently no other "Layers" and if there were, using the same domain
name could be fine (just like we reuse the point domain for e.g. vertices
in meshes and control points in curves).
This also renames the internal enum to `ATTR_DOMAIN_LAYER`
Pull Request: https://projects.blender.org/blender/blender/pulls/113589
Update to the new naming convention for `Light Probes`:
`Reflection Cubemap` -> `Sphere`
`Reflection Plane` -> `Plane`
`Irradiance Grid` -> `Volume`
Note that this breaks the Python API (`bpy.types.LightProbe.type`).
Pull Request: https://projects.blender.org/blender/blender/pulls/113452
The issue was that custom data layers were modified without checking
that the data was not shared. Now the data is unshared first.
I also added an assert to catches this kind of issue more directly.
Pass the mesh to the drawing functions so it doesn't have to be
retrieved from the PBVH. It's nice to rely less on the PBVH `me`
pointer, since it's a fairly ugly "back pointer" which isn't necessarily
good design.
Making some liboverride local will break/corrupt liboverride hierarchies
in many cases. So that function (or its caller, in some cases) need to
call #BKE_lib_override_library_main_hierarchy_root_ensure to re-validate
(and re-generate if needed) the liboverride hierarchy roots.
The code ensuring a valid liboverride hierarchy root ID pointer for all
liboverrides in a given Main would fail in some cases, and crash on
asserts (in Debug builds) or due to corrupted data later in code
(release builds).
The main issue fixed here is re-entry in case of dependency loops (a
same ID being checked more than once within the same chain of recursive
calls to ensure its hierarchy root is valid). Solved the usual way now,
using the intermediate 'PROCESSING' flag instead of setting immediately
the 'PROCESSED' one, when recursively processing the chain of
dependencies.
A second issue fixed in that code was that in some cases, it could leave
the invalid existing hierarchy root pointer unchanged, because it could
not find a 'valid enough' alternative.
NOTE: This data corruption is presumably caused by 'make local'
operations on liboverride hierarchy root IDs. This will be addressed as
a second commit.
For reference, issue is reproducible when opening
`/promo/splash/040_0010.lighting.splash.blend` from Pets SVN repo r3106.
This implements the core changes for this design: https://devtalk.blender.org/t/grease-pencil-integration-into-geometry-nodes/31220
The changes include:
* Add `CustomData` for layer attributes
* Add attribute support for the `GreasePencilComponent` to read/write layer attributes. Also introduces a `Layer` domain.
* Implement a `GreasePencilLayerFieldContext` and make `GeometryFieldContext` work with grease pencil layers.
* Implement `Set Position` node for `Grease Pencil`.
Note: These changes are only accessible/visible with the `Grease Pencil 3.0` experimental flag enabled.
Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/112535
Currently nodes are reordered so that the "on top" nodes are last in
the list. Node order changing for simple operations like selection
means we either have to reevaluate the node tree data-block on
selections or accept that the evaluated order can be different from the
original. Currently we do the latter (see d76a0e98ba), but
makes it complex to access nodes by index, and is hard to reason about.
Instead of reordering nodes, store the ui order in the node itself
and sort the nodes before drawing them or doing any processing
that depends on the "depth."
The "selected_nodes" list in the context is no longer ordered by the
recent selection.
Pull Request: https://projects.blender.org/blender/blender/pulls/113419
Accessing the file size returns -1 on error, for file packing this
was passed directly to an allocation which would wrap around to
SIZE_T_MAX and fail to allocate. In other cases zero was treated
as an error value but -1 wasn't.
Add checks for the error return value, also warn that packing files over
2gb isn't supported.
Use the typical combination of an "array utils" function used by an
attribute interpolation function. This helps moves us towards having
a more centralized implementaiton of attribute propagation that can
be changed and optimized more easily.
A copy has to compare equal to itself and have the same hash
when it is supposed to be used as a reference in a hash table
like `VectorSet`.
Just making the hash not change during a copy by hashing the
geometry component pointers instead of the geometry-set pointer
does not work because of `geometry_set_from_reference` which
assumed that changing the geometry set does not change the
hash of the reference.
For now the solution is to just not use a hash table as this
makes it easier to get corretness right. Instead, just use a
regular `Vector` to store all the references which avoids
the need for a hash function.
This can now lead to some O(n^2) behavior when adding many
references. Fortunately, this is not too common yet, as usually
one has few references but many instances that use those.
It's still something that has to be solved at some point. It's
not clear yet what approach would work best:
* Reintroduce `VectorSet` for the references and properly update
the reference positions in the hash table after the references
have changed.
* Add a separate `Map<Object*/Collection*, int>` for the
deduplication.
* Do deduplication on the call-site of `add_reference` by building
a temporary map there.
`iota` is name that has no meaning, it's not an acronym or initialism.
It's usually very cryptic when I come across it. Replacing it with a
specialized function makes the code more readible.
The assert was assuming that the attribute request is properly
initialized and that was not the case: the "special" data layers
like coordinates, normals, masks, and face sets did not initialize
domain in the attribute request.
The domain is now properly initialized. As well as there is an
assert added in other PBVH types for the face sets. It is possible
to add asserts in more places, but it is not directly related to
this CL.
Pull Request: https://projects.blender.org/blender/blender/pulls/113354
The outlines of volume grids in the viewport are noticeable "wobbly"
when they should simply represent grid boxes. This is especially
noticeable on simple regular grids such as the "Volume Cube" geometry
node output.
The reason is that the outlines generated by taking a triangulated mesh
of the grid boxes and then growing it by successively scaling each
triangle. The offset for each vertex grows proportional to its degree
(number of connected edges). The fix is to divide each vertex's offset
by its degree.
The resulting mesh is much more regular and closer to to 1% desired
growth factor.
Old: 
New: 
Pull Request: https://projects.blender.org/blender/blender/pulls/111657
This change makes it so the newly added vertices have properly
interpolated attributes. This includes things like vertex colors.
New vertices are created by splitting edges, so the interpolation
mixes between the edge's two vertices equally.
Co-Authored-By: Hans Goudey <hans@blender.org>
This assert triggers whenever dyntopo is used, even when all the
objects and environment is pristine. The semantic of the assert
is not very clear either.
Avoid having a false-positive trigger which gets in the way of any
development in the area.
This PR implements an initial drawing tool that can already be used for testing.
While this is not fully feature complete (compared to the current grease pencil draw tool) the following is already implemented:
* Pressure support for radius and opacity.
* Material color and vertex color support.
* New active smoothing algorithm based on curve fitting.
* Simplify algorithm as a post-process step.
Some deliberate limitations include:
* The drawing plane is always the front plane. Drawing on surfaces is also not supported.
*
The current approach has not been optimized for performance yet. The goal was to have a straightforward implementation
first and then focus on performance later.
There are numerous parameters in the code that are hard-coded for now. These should be exposed at some point, potentially as user settings.
Pull Request: https://projects.blender.org/blender/blender/pulls/110093
When units were initially defined having each on their own line was
compact, since them more fields have been added, making the lines
overly long and the difference between each field non-obvious.
Further, the conversion from C to C++ [0], wrapped definitions onto the
same line (for some reason), resulting in lines over 700 wide.
Use clang-format & add struct ID's for clarity.
[0]: 129f78eee7