Blender V5.3
bmesh_walkers.cc File Reference
#include <cstdlib>
#include <cstring>
#include "BLI_listbase.hh"
#include "BLI_utildefines.hh"
#include "bmesh.hh"
#include "bmesh_walkers_private.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Functions

void * blender::BMW_begin (BMWalker *walker, void *start)
void blender::BMW_init (struct BMWalker *walker, BMesh *bm, int type, short mask_vert, short mask_edge, short mask_face, BMWFlag flag, int layer, BMWDelimitFlag delimit)
 Initialize Walker.
void blender::BMW_end (struct BMWalker *walker)
 End Walker.
void * blender::BMW_step (struct BMWalker *walker)
 Step Walker.
int blender::BMW_current_depth (BMWalker *walker)
 Walker Current Depth.
void * blender::BMW_walk (BMWalker *walker)
 Main Walking Function.
void * blender::BMW_current_state (BMWalker *walker)
 Current Walker State.
void blender::BMW_state_remove (BMWalker *walker)
 Remove Current Walker State.
void * blender::BMW_state_add (BMWalker *walker)
 Add a new Walker State.
void blender::BMW_reset (BMWalker *walker)
 Reset Walker.

Detailed Description

BMesh Walker API.

NOTE(@joeedh): Details on design.

Original design: walkers directly emulation recursive functions. functions save their state onto a #BMWalker.worklist, and also add new states to implement recursive or looping behavior. Generally only one state push per call with a specific state is desired.

basic design pattern: the walker step function goes through its list of possible choices for recursion, and recurses (by pushing a new state) using the first non-visited one. This choice is the flagged as visited using the #GHash. Each step may push multiple new states onto the #BMWalker.worklist at once.

  • Walkers use tool flags, not header flags.
  • Walkers now use #GHash for storing visited elements, rather than stealing flags. #GHash can be rewritten to be faster if necessary, in the far future :) .
  • tools should ALWAYS have necessary error handling for if walkers fail.

Definition in file bmesh_walkers.cc.