Nodes/Avatar Graph/Object Editmode Toggle
ComfyUI Node

Object Editmode Toggle

Tab, but as a node

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Editmode Toggle
  • BPY_OBJ
  • BPY_OBJ

Small node, and it matters more than its size suggests. Object Editmode Toggle switches an object between Blender's Object Mode and Edit Mode - the same thing Tab does in Blender's own UI. A handful of other nodes in this pack only make sense in one of those two modes, and this is how you get into (or back out of) the one you need.

How it works

It wraps bpy.ops.object.editmode_toggle(), no parameters beyond the target object. Object Mode is where you move, duplicate, and parent whole objects. Edit Mode is where you work on a mesh's actual geometry - vertices, edges, faces - and it's the mode this pack's face-map nodes (Object_FaceMapAssign, Object_FaceMapSelect, Object_FaceMapDeselect, Object_FaceMapRemoveFrom) need to be in, since they all act on whatever faces are currently selected in Edit Mode. Run one of those outside Edit Mode and there's no live face selection for it to work with.

Since it's a toggle, not a "set to X mode" operator, calling it flips whichever state the object is currently in - it doesn't force a specific mode.

The inputs and outputs that matter

There's exactly one input:

  • BPY_OBJ - the object to toggle.

Output is the same BPY_OBJ, now in the other mode.

How to install it

ComfyUI Manager: search "Avatar Graph", install, restart - or manually:

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

bpy is hard-pinned to Python 3.10.x. Windows can use Avatech's prebuilt Python-3.10 ComfyUI zip; macOS/Linux should build a dedicated conda create --name comfyui python=3.10 rather than layering it onto an existing newer-Python install. Restart with --enable-cors-header (plus --force-fp16 on Mac) if you want the live avatar preview reaching editor.avatech.ai; otherwise everything still works, you just export .glb/.gltf instead.

Common issues & troubleshooting

If nodes aren't loading, it's the Python-version pin - check for a bpy import error in ComfyUI's startup console before looking elsewhere.

Face-map nodes downstream aren't picking up the selection you expect - because this node toggles rather than sets, an extra (or missing) call anywhere earlier in the graph flips the parity: an even number of toggle calls before a face-map node leaves you in Object Mode, an odd number leaves you in Edit Mode. If a face-map operation isn't finding a selection, trace back through the graph and count how many times this node has actually run before it, rather than assuming the graph structure alone guarantees the mode you expect.

Nothing looks different after this node runs - that's often correct. Switching modes doesn't change geometry or transforms by itself; it changes what kind of editing the next node is allowed to do. If you were expecting a visible change, the actual work probably belongs in whatever node comes after this one, not in this one itself.

Categoryblender

Inputs (1)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ