GPv3: Initial Geometry Nodes support #112535
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#112535
Loading…
Reference in New Issue
No description provided.
Delete Branch "filedescriptor/blender:gpv3-geometry-nodes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This implements the core changes for this design: https://devtalk.blender.org/t/grease-pencil-integration-into-geometry-nodes/31220
The changes include:
CustomData
for layer attributesGreasePencilComponent
to read/write layer attributes. Also introduce aLayer
domain.GreasePencilLayerFieldContext
and makeGeometryFieldContext
work with grease pencil layers.Set Position
node forGrease Pencil
.Note: These changes are only accessible/visible with the
Grease Pencil 3.0
experimental flag enabled.7d8fb1e96b
to9bff50909a
b17686a270
tofe3729bac4
fe3729bac4
to0a140c6845
@ -152,0 +167,4 @@
propagation_info,
dst_curves))
{
return;
This would make the node to skip the grease pencil part of it. It probably needs to be an if/else
WIP: GPv3: Geometry Nodesto GPv3: Initial Geometry Nodes supportI think this is ready to be reviewed.
Ideally anything shown in the UI related to Grease Pencil is hidden behind the experimental flag.
@ -565,0 +686,4 @@
if (grease_pencil == nullptr) {
return false;
}
std::atomic<bool> any_success = false;
This can be regular bool, any writing will be atomic.
is_empty()
@ -1995,1 +2211,4 @@
}
if (node.is_layer()) {
const Span<const bke::greasepencil::Layer *> layers = this->layers();
const IndexRange
GreasePencilFieldContext
should first check forGeometryFieldInput
, call that if possible, but otherwise use existingCurvesFieldInput
s. That allows changing existing curves field inputs that do field evaluations, but not changing existing field inputs that don't. Otherwise we'd basically have to completely removeCurvesFieldInput
default
case ofset_computed_position_and_offset
, since it has the "is original" optimization and the devirtualization optimization.@ -99,12 +132,24 @@ class GeometryFieldContext : public fn::FieldContext {
const void *geometry_;
const GeometryComponent::Type type_;
const eAttrDomain domain_;
/** Only used when the type is grease pencil and the domain is either points or curves
@ -123,1 +168,4 @@
int grease_pencil_layer_index() const
{
return grease_pencil_layer_index_;
Add an assert for the component type and domain
@ -686,3 +686,2 @@
* A geometry component that stores #GreasePencil data.
* This component does not implement an attribute API, because the #GreasePencil data itself does
* not store any attributes, only the individual drawings within it.
* The attributes on this component are only on the layer domain.
Nice, but this should also mention the other domains are stored inside the curves for each layer, this is only about the "direct" attributes
@ -98,0 +151,4 @@
}
};
fn.domain_supported = [](const void * /*owner*/, const eAttrDomain domain) {
return ELEM(domain, ATTR_DOMAIN_GREASE_PENCIL_LAYER);
return domain == ATTR_DOMAIN_GREASE_PENCIL_LAYER;
@ -485,2 +603,2 @@
const fn::Field<bool> &selection,
const fn::GField &field)
static bool try_capture_field_on_geometry(MutableAttributeAccessor attributes,
GeometryFieldContext field_context,
Pass by const reference
@ -565,0 +697,4 @@
return false;
}
std::atomic<bool> any_success = false;
threading::parallel_for(
Should use a much smaller grain size here, layers will usually be large enough for that
@ -1956,0 +2047,4 @@
}
}
else {
for (const int i : IndexRange(reorder_to, dist)) {
Simpler with
array_utils::fill_index_range(reorder_indices.slice(reorder_to, dist), i);
Or something like that anyway
@ -571,6 +571,13 @@ void *BLI_findlinkfrom(Link *start, int number)
link = link->next;
}
}
else {
Not sure what's going on here, but this should be committed separately
@ -119,3 +118,1 @@
Field<float> &start_field,
Field<float> &end_field,
const AnonymousAttributePropagationInfo &propagation_info)
static bool set_curve_trim(const bke::CurvesGeometry &src_curves,
"set_curve_trim" sounds weird. How about
trim_curves
?@ -130,3 +127,4 @@
return false;
}
const bke::CurvesFieldContext field_context{src_curves, ATTR_DOMAIN_CURVE};
This needs to use the GP field context for GP
@ -149,3 +145,1 @@
Curves *dst_curves_id = bke::curves_new_nomain(std::move(dst_curves));
bke::curves_copy_parameters(src_curves_id, *dst_curves_id);
geometry_set.replace_curves(dst_curves_id);
dst_curves = std::move(
The result of
geometry::trim_curves
is already an R-value, no need to move it.@ -39,3 +39,2 @@
const bke::GeometryFieldContext value_context{
context.geometry(), context.type(), value_field_domain_};
const bke::GeometryFieldContext value_context{context.geometry(),
Can't this use the simpler constructor you added?
const bke::GeometryFieldContext value_context{context, value_field_domain_};
@ -114,0 +121,4 @@
(dst_domain == ATTR_DOMAIN_GREASE_PENCIL_LAYER))
{
/* Evaluate field just for the current layer. */
if (src_domain_ == ATTR_DOMAIN_GREASE_PENCIL_LAYER) {
Pretty sure this check (or the previous one ;) is redundant
@JacquesLucke added this but I think it's right. The check before is basically "exactly one of
src_domain_
ordst_domain
is equal toATTR_DOMAIN_GREASE_PENCIL_LAYER
", sosrc_domain_
doesn't need to beATTR_DOMAIN_GREASE_PENCIL_LAYER
.It's not redundant as Falk pointed out.
Yeah, I was just reading this too quickly!
@ -114,0 +126,4 @@
ATTR_DOMAIN_GREASE_PENCIL_LAYER};
const int layer_index = context.grease_pencil_layer_index();
const IndexMask single_layer_mask = IndexRange(layer_index, 1);
I think you could avoid doing the field input manually here by using
EvaluateAtIndexInput
. You could probably just pass in the input field, the single value field for the layer index, and the layer domain. Seems sort of elegant that way-- avoiding reimplementing evaluating the field at a single index :)@HooglyBoogly and I looked at this briefly, but it makes the code more complicated in the end. We'll keep it like it is for now.
@ -352,4 +404,9 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
std::optional<eAttrDomain> try_detect_field_domain(const GeometryComponent &component,
const fn::GField &field);
const greasepencil::Drawing *get_eval_grease_pencil_layer_drawing(
These seem unrelated to "geometry fields." Maybe they should go in the GP headers?
@ -138,0 +209,4 @@
}
const greasepencil::Drawing *GeometryFieldContext::grease_pencil_layer_drawing() const
{
return this->type() == GeometryComponent::Type::GreasePencil &&
Oof, there's a lot going on here. Could this be split to multiple lines with the typical
pattern?
@blender-bot build
The
bf_blenkernel_tests
failure is probably still caused by this patch. Likely the issue that I reported some time ago already that caused by wrong initialization ofGreasePencil
in tests.@ -37,0 +54,4 @@
return field_input.get_varray_for_context(context, mask, scope);
}
}
return {};
This seems to be missing the default case which is just
field_input.get_array_for_context(*this)
.I think this could be simplified. We just have do check if the
field_input
is aCurvesFieldInput
. Then we do the conversion toCurvesFieldContext
. Otherwise, we can just do the default operation mentioned above. The conversion toGeometryFieldContext
is done inGeometryFieldInput::get_varray_for_context
already.@ -1967,1 +2117,4 @@
}
}
if (node.is_group()) {
BLI_assert_msg(0, "Reordering custom data when moving a group is not implemented");
Not-implemented means it will be implemented? Is this protected against at a higher level so that we don't run into this assert in practice?
Yes, reordering of layer groups is not implemented at a high-level yet, but technically supported by the core functions. This assert basically acts as a reminder to implement this part once we can reorder layer groups.
@blender-bot build
@ -1947,0 +2000,4 @@
const IndexRange range_before(insertion_index + 1);
const IndexRange range_after(insertion_index + 1, size - insertion_index - 1);
if (range_before.size() > 0) {
!range_before.is_empty()
There is still also few other
.size() > 0
..@blender-bot build