Geometry Nodes: Add selection and depth options to realize instances #104832
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104832
Loading…
Reference in New Issue
No description provided.
Delete Branch "ab_stanton/blender:add-selection-realize-instances"
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?
Adds selection and depth options to realize instances.
This is working well and my tests, and the implementation seems reasonable.
I'll add a couple more reviewers though.
@ -1455,0 +1502,4 @@
GeometrySet &new_geometry_set,
const bke::AnonymousAttributePropagationInfo &propagation_info)
{
const Instances *instances = geometry_set.get_instances_for_read();
Add a null check or use a reference here with
*
@ -3,3 +2,1 @@
#include "GEO_realize_instances.hh"
#include "BKE_instances.hh"
#include "GEO_join_geometry.hh"
Missing newline in between license and includes
@ -12,6 +14,8 @@ namespace blender::nodes::node_geo_realize_instances_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
Suggest a description like
Which top-level instances to realize
@ -13,2 +15,4 @@
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("Depth")).default_value(0).supports_field();
Maybe
How many levels of nested instances to realize at each top-level instance. Beyond the depth, further instances won't be realized
Though that's probably a bit too long.
Just removed the last sentence, seems intuitive enough to me to leave it out
@ -43,0 +48,4 @@
Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
Field<int> depth_field = params.extract_input<Field<int>>("Depth");
const bke::Instances &instances = *geometry_set.get_instances_for_read();
The whitespace here doesn't really help IMO. I'd suggest putting all of these in one block:
This is subjective, but generally blank lines are only helpful when used a bit more sparingly, to separate the code into meaningful sections. Just like paragraphs of prose I guess.
This sounds like a good idea to me overall! I don't have time to properly test it this week though, but I can take a look next week.
Testing the node I'm getting a crash in the attached file, when trying to set the depth higher than 0.
Duplicate Elements
)I just noticed that I built the patch on top of the release branch. Let me know if you can replicate the crash. If you can't it might be that and I'll try again properly.
I agree re a depth of 0 seeming like it should be no realising, however doing 1 doesn't make sense to me either, as I think the user would expect all the instances to be realised by default
Right, I didn't consider this aspect, but that's absolutely correct.
Hm, the only options I see to resolve this dilemma then is to either
To be honest I'm not a fan of either of these. Is there maybe a better solution that I'm missing?
Btw: I tried my test file again with the build based on main and it still crashes.
I't currently possible to loose attributes with this node, consider the example below. The
test
attribute should be available on the vertices in the end. Note that this does work when I mute the firstRealize Instances
node.I agree that a
Depth
of 0 should just not change the geometry at all. I think a boolean node propertyRealize All
is reasonable and results in the least surprising behavior.@ -43,0 +62,4 @@
evaluator.set_selection(selection_field);
evaluator.add(depth_field);
evaluator.evaluate();
const VArray<int> depths = evaluator.get_evaluated<int>(0);
It looks like later you expect there to be a depth only per selected instance, but here you get an array that contains a depth for every instance (not only selected ones, although the unselected instances might be uninitialized).
@ -43,0 +69,4 @@
"Geometry");
geometry_set = geometry::realize_instances(
geometry_set, {legacy_behavior, !legacy_behavior, selection, depths, propagation_info});
I think it would be better to keep the explicit initialization of
RealizeInstancesOptions
.Closing this in favor of #116582.
Pull request closed