← All ideas
  • Published 11 Jul 2020

Expose Blender's internal mid-level walker functions to the Python API

This is a technical request to help add-on developers. Selection is an essential part of all modeling workflows, not just individual components but also (complete or partial) loops and rings of components. Currently add-ons devs who want to get their own selection or list of components to operate on must write their own functions from scratch to step (or 'walk') from one component (like a face) to that component's neighbor using granular low-level properties of bmesh types that Blender provides for each component; think of these properties like 1x1 LEGO bricks. However, in order to get from one component to its neighbor you need a 1x2 LEGO "brick" which is why add-on devs who want to get their own selections need to string those 1x1 bricks together into 1x2 "bricks." Blender does not provide a way to get these 1x2 "bricks" by inputting one component and receiving its neighbor as an output.

But Blender already has internal walker functions to handle stepping from one component to its neighbor, that's how it builds its own loop selections, for example. So when an add-on dev has to write their own walker that add-on is unnecessarily duplicating functions that already exist in Blender that could be exposed for them to use. Not only that but writing your own walker function is open to 1) error 2) poor performance and 3) time wasted that could be spent on core add-on functionality. For certain types of walker (like loops that work regardless of face normal vector ) a developer needs an advanced understanding of the low-level bmesh loop cycle and radial cycle .

https://i.imgur.com/Xi7jMCH.png

Exposing the mid-level walkers that Blender already has would increase accessibility for new add-on devs who do not have a low-level understanding of bmesh structures. This would allow add-on devs to write more compact add-ons with fewer lines of code, and they would have the reassurance that their add-on is backed by the stability, high speed, and reliability of Blender's internal walking code.

TL;DR: Blender has low-level, mid-level, and high-level functions for working with mesh data but when it comes to mesh component selection Python developers only have access to the low-level and high-level functions, not the mid-level walkers. Please expose the mid-level walkers to the Python API.

walker.png

96.3%

Development Status: Open

Upvote 26 Downvote 1
ckohl_art
11 Jul 2020

3 Comments

I wish this would be implemented. I'm having really hard time checking edge and face rings. Bmesh face loops, link loop next, link loop radial next and such concepts and manual book keeping is not fun.

1
peter.boos

You seam to be verry deep into the code, why not fix it contribute to Blender git development.

ckohl_art Author

* @peter.boos * Alas, I only know a smattering of Python. Blender's guts are written in C and C++ and I'm no real developer. Maybe in a few years I'll have the technical skills to contribute directly but right now I don't.