[Bf-committers] Vertex Pinning

patrick boelens p_boelens at msn.com
Sun Mar 23 05:20:27 CET 2014


Hello everyone!

Something I've missed in Blender for a very long time is the ability to pin or anchor vertices so that they can't be moved. The most typical use-cases I've found are where you want to (temporarily) exclude part of a model when performing an action using proportional editing, or where you just want to make sure a certain detailed part never accidentally changes (think accidentally selecting a "hidden" back-face vertex and moving it e.g.)

To that end I have begun work on a Vertex Pin operator. So far, I have the following working (though not too thoroughly tested):

- Ability to pin and unpin vertices from any selection mode (Vertex, Edge, Face).
- Pinned vertices are excluded from all transforms from the following actions:
    - Grab/ Rotate/ Scale.
    - Vertex/ Edge Slide.
    - Shrink/ Fatten.
    - Scale along normals.
    - Proportional editing influence.
- In case of multi-select, only pinned vertices are excluded; all others follow their paths as per usual when possible.
- Display pinned vertices in a different color and size.
    - When a pinned vertex is selected or active, the regular size and color is used on top of the pinned vertex display.

Some things that I couldn't get to work:

- Proper undo/ redo. No matter how many steps have passed since pinning a vertex, ctrl+z undoes the operation and can not be redone.
- No Python access/ direct RNA. Honestly, this is a giant mystery for me. When I found out that MVert flags are not being shared with BMVert flags and there doesn't seem to be a direct link between them I kind of gave up on this. I tried to follow ME_HIDE and BM_ELEM_HIDDEN as a guideline, but it kind of baffled me.

Something that needs work:
- Currently it's impossible to tell if a vertex is pinned or not when in Edge or Face select mode. I'm not sure what the cleanest solution for this would be.

In its current state the patch is good enough for me, but I have no idea how it would hold up in a code review, or if anyone's even interested in this functionality. If there is an interest for it though, please feel free to take a look at the code and give me some feedback. Here are the two diffs:

- http://www.pasteall.org/50415/diff - The meat of it; a direct git diff against Master 12ce5ae.
- http://www.pasteall.org/50416/diff - The diff for space_view3d.py that adds the Pin and Unpin operators to the Mesh menu.

Apologies for the ugly formatting on the second one.

Hope someone will find this patch useful and the code not horrible. ;) Please let me know if you have any feedback.

Cheers!
Patrick

PS: Ha, in making an example screenshot I discovered pinned vertices disappear after exiting edit mode.. Oops. Bug #1 I guess! Here's the screenshot regardless: http://www.pasteall.org/pic/68723
 		 	   		  


More information about the Bf-committers mailing list