How would one code a custom sculpt brush?

By custom i mean has special behavior as in not just something you can do without coding, specifically i have some ideas for directly manipulating the curvature of meshes. After many hours of looking through docs and reading code on github, i have nothing but a bunch of guesses to show for it. Would be nice to get some kind of template or something.

In general all i really need is to get the location of all the vertices within the brush radius and a way to write there locations back. From what i can tell you get the data with this thing " PBVHVertexIter vd; " (even though this vd variable never got initialized with anything, it just magically got filled with data) and then use “BKE_pbvh_vertex_iter_begin” to iterate through the verts and simply set vd.mvert to anything you want. Of course even if i am right about all of this there’s still a million different things you have to do first to setup everything none of which i know how to do. Would really appreciate some help here. Thanks!!

1 Like