Nodes/Avatar Graph/Object Mode Set With Submode
ComfyUI Node

Object Mode Set With Submode

Set the mode and the vertex/edge/face submode in one go

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Mode Set With Submode
  • BPY_OBJ
  • BPY_OBJ
mode
togglefalse
mesh_select_mode

If Object_ModeSet switches a Blender object into edit mode, Object_ModeSetWithSubmode also tells edit mode which kind of element you're about to work with - vertices, edges, or faces. It wraps bpy.ops.object.mode_set_with_submode(), which bundles two Blender concepts into one operator: the mode, and the mesh selection submode that edit mode displays.

Why bother with the submode part? In Blender, edit mode has a three-way toggle for vertex/edge/face selection, and it silently determines what a lot of mesh operators actually act on. If you're about to run a face-oriented operation (an inset, a bevel by face, a material assignment) but the submode is stuck on vertices, the operator behaves differently or does nothing. This node removes that ambiguity: you declare up front, "edit mode, and I mean faces," and the next node runs in exactly that context. In the Avatar Graph rigging flow - where you're building character mesh layers and shape keys - that determinism saves real head-scratching.

The mechanism. Like every Object_ node, it sets your BPY_OBJ as the active object and invokes the operator with your settings. The mode enum is the same 14-item list as Object_ModeSet. The extra control, mesh_select_mode, accepts VERT, EDGE, or FACE. toggle behaves as in ModeSet.

Inputs.

  • BPY_OBJ - the object to switch.
  • mode - the target mode (EDIT and friends).
  • mesh_select_mode - VERT, EDGE, or FACE: the submode for mesh editing.
  • toggle - flip between the mode and object mode when enabled.

Output. BPY_OBJ, passed through unchanged - mode and submode are context, not data.

Installing it. Ships in Avatar Graph. ComfyUI Manager → "Avatar Graph", or:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui
python -m pip install -r requirements.txt

Restart with --enable-cors-header; the pack requires Python 3.10.x (bpy==3.6.0).

Troubleshooting. The most common mistake is setting mesh_select_mode and then running a node that expects a different element type - the submode doesn't filter anything for you, it just sets the context. If you chain this into an edit-mode node from the pack, remember those nodes exit edit mode when they finish, so the submode you set won't persist across the whole graph. If you only need the mode and not the submode, the simpler Object_ModeSet does the same job with fewer moving parts.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
modeoptCOMBO14 options: OBJECT, EDIT, POSE, SCULPT, VERTEX_PAINT, WEIGHT_PAINT, +8
toggleoptBOOLEANfalse
mesh_select_modeoptCOMBO3 options: VERT, EDGE, FACE

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ