Nodes/Avatar Graph/Object Set Mode
ComfyUI Node

Object Set Mode

Which Blender mode is this object in?

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Set Mode
  • BPY_OBJ
  • BPY_OBJ
valueOBJECT

Blender objects exist in one of several modes - Object mode, Edit mode, Sculpt mode, weight painting, and so on - and which mode you're in changes what your tools can do. ObjectSet Mode is the node that sets that mode directly on the object passing through the graph. It's the blunt instrument version of a switch the pack mostly handles for you elsewhere.

Here's the context that matters. The Avatar Graph pack has a whole set of edit-mode operations (Mesh_* nodes that sculpt vertices, assign vertex groups, modify shape keys) and they handle mode switching themselves: the pack's edit-mode machinery selects the object, enters edit mode, runs the operation, and drops back to object mode. So you rarely need to set mode by hand. The default here is OBJECT, which is where you want things to be when the chain finishes and hands off to Avatar Main Output for export. If a mesh is left sitting in an edit-like mode when it's exported, that's the kind of state you don't want shipping.

The value is a string, default OBJECT. The practical set you'd ever type: OBJECT, EDIT, SCULPT, VERTEX_PAINT, WEIGHT_PAINT, TEXTURE_PAINT. If you're doing a sculpt pass on a character mesh before export, setting SCULPT here is the honest way to express it in the graph - though the pack's sculpt workflows mostly come in as op nodes.

How it works

Standard ObjectSet_* mechanics: auto-generated from a dump of Blender's bpy.types.Object properties, one setattr on the BPY_OBJ passing through, same object out the other side for the next node.

Inputs that matter:

  • BPY_OBJ - the object whose mode you're setting
  • value - string, default OBJECT; valid values are Blender's object mode names

Installing Avatar Graph

This node ships with the whole pack:

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

Or ComfyUI Manager → Install Custom Nodes → search Avatar Graph → restart. Pack requirements: bpy==3.6.0 pins you to Python 3.10 (Windows gets a bundled 3.10 environment from the README; macOS/Linux use conda), and first launch auto-downloads the SAM ViT-H model plus the mediapipe face/pose landmarkers.

Common issues

Setting a mode directly is a blunt tool - Blender normally expects mode changes to go through bpy.ops.object.mode_set, and leaving an object in edit mode mid-chain can make downstream operations behave oddly if they assume object mode. If you're just moving meshes through the standard pipeline, keep the default OBJECT and let the pack's own op nodes do their mode juggling. And as always: the scene resets every run, so the mode is whatever the graph set it to last - no persistence, no surprises.

Categoryblender

Inputs (2)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
valueoptSTRINGOBJECT

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ