Cleanup: Geometry: Some unification in working with attributes in realize instances #108821

Closed
Iliya Katushenock wants to merge 2 commits from mod_moder:cleanup_realize_instance into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Split loops to separate them by their conceptual meaning.
Separate the copying of attributes into a new function.

Split loops to separate them by their conceptual meaning. Separate the copying of attributes into a new function.
Iliya Katushenock added the
Interest
Geometry Nodes
label 2023-06-09 20:12:43 +02:00
Iliya Katushenock added 1 commit 2023-06-09 20:12:55 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-06-09 20:13:00 +02:00
Iliya Katushenock added 1 commit 2023-06-09 20:14:52 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-06-09 20:15:58 +02:00
Member

Could you explain how this is better in the PR description? Right now it just looks like a bunch of code getting shuffled around.

Could you explain how this is better in the PR description? Right now it just looks like a bunch of code getting shuffled around.
Author
Member

Basically, it's just a shuffled around code.
I was doing support for a new type of component and noticed that the code has a lot of duplication, so I decided to at least make it simpler. As an example: separate a component-specific loop from a nested loop.
One could say that this allows you to take the check out of the loop, but I don’t think that this would be a good improvement as a main advantage.
I also introduced a new function, which gave unification.

Basically, it's just a shuffled around code. I was doing support for a new type of component and noticed that the code has a lot of duplication, so I decided to at least make it simpler. As an example: separate a component-specific loop from a nested loop. One could say that this allows you to take the check out of the loop, but I don’t think that this would be a good improvement as a main advantage. I also introduced a new function, which gave unification.
Hans Goudey requested changes 2023-06-09 20:43:10 +02:00
@ -716,0 +730,4 @@
}
if (info.create_radius_attribute) {
for (const int pointcloud_index : info.realize_info.index_range()) {
Member

Don't add three separate loops over all the point clouds, that adds code duplication for no real purpose.

Same for the other geometry components.

Don't add three separate loops over all the point clouds, that adds code duplication for no real purpose. Same for the other geometry components.
Author
Member

When I said nesting, I meant...

  ...
  if (info.create_radius_attribute) {
    pointcloud_info.radii = *attributes.lookup_or_default("radius", ATTR_DOMAIN_POINT, 0.01f);
  }
}

And

if (info.create_radius_attribute) {
  for (const int pointcloud_index : info.realize_info.index_range()) {
    pointcloud_info.radii = *attributes.lookup_or_default("radius", ATTR_DOMAIN_POINT, 0.01f);
  }
}

Although I see some code duplication, does it still seem easier to separate this into a separate processing step?

When I said nesting, I meant... ```Cpp ... if (info.create_radius_attribute) { pointcloud_info.radii = *attributes.lookup_or_default("radius", ATTR_DOMAIN_POINT, 0.01f); } } ``` And ```Cpp if (info.create_radius_attribute) { for (const int pointcloud_index : info.realize_info.index_range()) { pointcloud_info.radii = *attributes.lookup_or_default("radius", ATTR_DOMAIN_POINT, 0.01f); } } ``` Although I see some code duplication, does it still seem easier to separate this into a separate processing step?
Member

does it still seem easier to separate this into a separate processing step?

I guess I don't see the benefit of this

>does it still seem easier to separate this into a separate processing step? I guess I don't see the benefit of this
Iliya Katushenock deleted branch cleanup_realize_instance 2023-06-09 20:47:56 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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 Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108821
No description provided.