Object Gpencil Add
Spawn a grease pencil object for your 2D-in-3D overlays
- BPY_OBJ
- location
- rotation
- scale
- BPY_OBJ
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 theLRT_*variants (scene/collection/object references used by line-art workflows).STROKEis the one you want for drawing;MONKEYis Blender's test mesh.radius(FLOAT, default 1) - the starting size of the object.align-WORLD,VIEW, orCURSOR- 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-2Dor3D- 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.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| radiusopt | FLOAT | 1.000–999999995904 | — |
| alignopt | COMBO | 3 options: WORLD, VIEW, CURSOR | |
| locationopt | B_VECTOR3 | — | |
| rotationopt | B_VECTOR3 | — | |
| scaleopt | B_VECTOR3 | — | |
| typeopt | COMBO | 6 options: EMPTY, STROKE, MONKEY, LRT_SCENE, LRT_COLLECTION, LRT_OBJECT | |
| use_in_frontopt | BOOLEAN | true | — |
| stroke_depth_offsetopt | FLOAT | 0.050–3.402823466385289e+38 | — |
| use_lightsopt | BOOLEAN | false | — |
| stroke_depth_orderopt | COMBO | 2 options: 2D, 3D |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |