API Read/Write Vertex Group with one command #71390
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#71390
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Dear developers,
as suggested by one of you I'm reporting this as bug, even if it is actually a request of improvement.
I'm the developer of Tissue, and during the Reaction-Diffusion simulation based on vertex groups, I'm realising that the slowest part is not the simulation itself, but Reading and Writing the vertex group each frame. This is a short example of the computing time for each frame using 50 iterations (read and write occurs only once) in the simulation on a geometry with 55298 vertices:
This is what I do in "RD - Read Vertex Group":
I'm using a "try" in case that some vertices are not in the group
while this is what I do in "RD - Closing Time":
It would be great to have an easy and fast method for having a specific vertex group as list of values for each vertex, maybe with a null or just zero for vertices that are not in the group. The same thing for writing back the vertex group.
Is it possible?
Thank you for your work,
Alessandro
Added subscriber: @AlessandroZomparelli
Added subscriber: @JacquesLucke
Changed status from 'Needs Triage' to: 'Archived'
I think this can be closed because we still have the patch open. Generally I think features like this are good, something similar was actually my first patch for Blender.
You say these loops are a major bottleneck in your code. Then you should try to optimize them more. Even just moving
ob.vertex_groups['A'].add
out of the loop might result in a noticeable performance improvement.Hi @JacquesLucke is the patch covering both read and write operations?
Regarding your suggestion, the loop is actually needed for adding the weight value to ALL the vertices, starting from two liists of values "a" and "b". Or there is another way?
Thanks
Alessandro
Hm, no, I think it it's only for one of the two. In any case, it is a bit weird to have this as a bug report... The situation is similar to when image pixels have to be accessed, I think we closed the related reports as well.
One inefficiency in this loop is that you are doing many lookups much more often than necessary. You lookup
ob.vertex_groups
in every iteration. You lookupvertex_groups["name"]
in every iteration. You lookupvertex_group.add
/vertex_group.weight
in every iteration. These lookups should be done before the loop in cases like this one.A hot loop should contain as little code as possible.
Thank you @JacquesLucke , I will definetly try to minimize the amount of code in the loop. I didn't know that those call would had affect the performances.
I wasn't actually sure to report that as a bug, I just followed the suggestion gave by a developer met during the Blender Conference. She told me that this would be considered as a bug, even if it's not technically a bug.
Also see this: https://github.com/JacquesLucke/animation_nodes/blob/master/animation_nodes/nodes/mesh/vertex_group_input.py#L88-L90
There I'm doing something similar. It's probably not the fastest approach, but it looks like I put some effort into it back in the day. Not sure if I'd do it the same nowadays. Let me know when you can measure any speedup.