Geometry Nodes: Index switch node #115250
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#115250
Loading…
Reference in New Issue
No description provided.
Delete Branch "HooglyBoogly/blender:geometry-nodes-index-switch"
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?
Add an "Index Switch" node which is meant as a simpler version of
the "Menu Switch" from #113445 that doesn't allow naming items
or displaying them in a dropdown, but still allows choosing between
an arbitrary number of items, unlike the regular "Switch" node.
Even when the Menu Switch is included (which should be in the
same release as this), it may still be helpful to have explicit mapping
of indices, and a fair amount of the internals can be shared anyway.
Generally looks good and how I'd expect it to work. Got some inline comments.
@ -4,3 +4,3 @@
import bpy
from bpy.types import Operator
from bpy.types import Operator, IntProperty
Don't include
IntProperty
frombpy.types
.@ -459,6 +460,55 @@ class RepeatZoneItemMoveOperator(RepeatZoneOperator, ZoneMoveItemOperator, Opera
bl_options = {'REGISTER', 'UNDO'}
def _editable_tree_with_active_node_type(context, node_type):
node_type
is unused@ -1148,0 +1167,4 @@
node = context.active_node
layout.operator("node.index_switch_item_add", icon='ADD', text="Add Item")
for i, item in enumerate(node.index_switch_items):
row = layout.row()
I'd expect all these row to be in a column.
@ -39,10 +39,18 @@ struct SimulationItemsAccessor {
}
static void blend_write(BlendWriter *writer, const bNode &node);
static void blend_read_data(BlendDataReader *reader, bNode &node);
static constexpr bool has_type()
This can also be a
constexpr
static member, instead of a function.@ -0,0 +120,4 @@
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const
{
const int inputs_num = signature_.params.size() - 2;
const VArray<int> indices = params.readonly_single_input<int>(0, "Index");
Optimize for the case when this is a single value. This can still happen, even if it was a field before.
Ah, I didn't realize that, but it makes sense.
@ -0,0 +126,4 @@
const int invalid_index = inputs_num;
IndexMaskMemory memory;
Array<IndexMask> masks(inputs_num + 1);
IndexMask::from_groups<int64_t>(
Feels like something that is very optimizable in the future by using spans etc. directly instead of using higher level abstractions. Could be fine for now though.
Yeah, probably. The implementation of
IndexMask::from_groups
isn't optimal right now, that's somewhere to start. I've been trying to useIndexMask::from_groups
everywhere we're solving this problem though, so that we can optimize things with all of that in mind. I also usedIndexMask
here thinking about branching multi-function evaluation. Evaluating each input on a smaller mask would be nice.In case if such method is even needed at all: https://projects.blender.org/blender/blender/pulls/111081/files#diff-90d4677ddd507912e8848534ef60d6dfef4f3154
@ -0,0 +141,4 @@
for (const int i : IndexRange(inputs_num)) {
if (!masks[i].is_empty()) {
const GVArray inputs = params.readonly_single_input(value_inputs_start + i);
array_utils::copy(inputs, masks[i], output);
output
points to uninitialized memory, therefor usingarray_utils::copy
is semantically wrong.node_zone_socket_items.cc
should be renamed to reflect that it's not just "zones" now. Fine for now.Thanks for the review. I've found a memory leak I need to fix too, not sure where it's coming from yet though.
Can you add a regression file with some decent code coverage afterwards?
Yeah, will do!