Nodes/Avatar Graph/Object Gpencil Add
ComfyUI Node

Object Gpencil Add

Spawn a grease pencil object for your 2D-in-3D overlays

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Gpencil Add
  • BPY_OBJ
  • location
  • rotation
  • scale
  • BPY_OBJ
radius1.00
align
type
use_in_fronttrue
stroke_depth_offset0.05
use_lightsfalse
stroke_depth_order

Object_GpencilAdd creates a new grease pencil object in the headless Blender scene. Grease pencil is Blender's 2D-drawing-inside-3D system: strokes that live in 3D space, which makes it perfect for cartoon outlines, hand-drawn flourishes, and cel-style overlays sitting on top of your avatar. This node is bpy.ops.object.gpencil_add wrapped for ComfyUI, and it's the entry point for any grease-pencil work in this pack.

When you'd use it

Think of it as the "give me a canvas" step. Once a grease pencil object exists you can draw strokes into it, and its modifiers (see Object_GpencilModifierAdd) do everything from generating line art from mesh edges to making strokes draw themselves in over time. So if your avatar needs a hand-drawn outline, a comic-style effect, or an animated sketch that unfolds frame by frame, this node is where that whole branch of the graph starts. The stock templates skip it - but the moment you want flavor, this is the door.

How it works

A plain auto-generated wrapper over the gpencil_add operator, built from the object_api list in blender/ops_mesh.py. The wrapper makes your BPY_OBJ the active object, runs the operator with your parameters, and hands the newly created grease pencil object back as the output - which is a slightly different behavior than most nodes here, because the output is the new object, not the input one. Inputs worth knowing:

  • type - what sort of grease pencil object to add: EMPTY, STROKE, MONKEY, or the LRT_* variants (scene/collection/object references used by line-art workflows). STROKE is the one you want for drawing; MONKEY is Blender's test mesh.
  • radius (FLOAT, default 1) - the starting size of the object.
  • align - WORLD, VIEW, or CURSOR - how the new object's orientation is chosen.
  • location, rotation, scale - the usual placement vectors (B_VECTOR3).
  • use_in_front (BOOLEAN, default true) - keep strokes visible in front of other objects in the viewport.
  • stroke_depth_offset (FLOAT, default 0.05) - how far strokes sit off the surface they're drawn on.
  • stroke_depth_order - 2D or 3D - whether depth is decided by drawing order or actual 3D position.
  • use_lights (BOOLEAN, default false) - let lighting affect stroke color.

The practical bits

For a beginner, the defaults are actually reasonable: STROKE + use_in_front on gets you a usable drawing canvas immediately. The LRT_* types are for the line-art pipeline where you generate strokes from mesh geometry - powerful, but you'll know when you need them.

Output: the new BPY_OBJ (the grease pencil object), ready to feed modifier or drawing nodes.

Install and gotchas

Same pack, same install:

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

or ComfyUI Manager → "Avatar Graph". The usual house rules: Python 3.10 for bpy==3.6.0; ~2.5GB SAM checkpoint + mediapipe models on first load; scene resets to factory settings every run, so your grease pencil object is recreated from scratch each execution; live preview needs --enable-cors-header.

One trap: because the output is the newly created object, don't wire the output back into a chain that was expecting your original mesh - you'll silently start operating on the grease pencil layer instead.

Categoryblender

Inputs (11)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
radiusoptFLOAT1.000–999999995904
alignoptCOMBO3 options: WORLD, VIEW, CURSOR
locationoptB_VECTOR3
rotationoptB_VECTOR3
scaleoptB_VECTOR3
typeoptCOMBO6 options: EMPTY, STROKE, MONKEY, LRT_SCENE, LRT_COLLECTION, LRT_OBJECT
use_in_frontoptBOOLEANtrue
stroke_depth_offsetoptFLOAT0.050–3.402823466385289e+38
use_lightsoptBOOLEANfalse
stroke_depth_orderoptCOMBO2 options: 2D, 3D

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ