Object Gpencil Modifier Apply
Bake those grease pencil modifiers into the strokes
- BPY_OBJ
- BPY_OBJ
Object_GpencilModifierApply is the "commit" button for grease pencil modifiers. Once you've stacked modifiers on a grease pencil object - line art, build, noise, whatever - applying bakes their effect into the actual stroke data, so the result stops depending on the modifier stack and becomes plain, editable geometry. It wraps Blender's bpy.ops.object.gpencil_modifier_apply, and in the avatar pipeline it's how you freeze a nice effect before handing the object further down the graph.
Why you'd reach for it
Modifiers are live and re-evaluated constantly, which is great while you're experimenting and a liability once you're done. An applied modifier no longer recomputes, so it's faster to render, stable across runs, and - crucially in this pack, where the scene resets every run - the baked result is what you export. If you're producing line art around your avatar or a draw-on build effect for a final output, you typically want the modifier applied so the strokes are real data rather than a live calculation.
How it works
Standard wrapper over the Blender operator. The node makes your BPY_OBJ active and applies the modifier you name. The inputs:
modifier(STRING, default empty) - the name of the modifier to apply. This matters: you're not picking from a dropdown, you're typing the exact name the modifier was created with. Get it wrong and the operator fails silently or complains.apply_as-DATAorSHAPE.DATAbakes the modifier into the object's actual geometry.SHAPEbakes it into a shape key instead, which is the route you'd take if you want the result to stay deformable - useful when the modified strokes need to keep animating.report(BOOLEAN, default false) - surface Blender's feedback as a message in the ComfyUI console.
Output: BPY_OBJ, the same grease pencil object, with the modifier removed from the stack and its effect folded into the strokes.
The catch: naming
Everything in the Object_GpencilModifier* family addresses modifiers by name, and the apply/copy/remove/move nodes all take a modifier STRING. There's no "get me the list of modifier names" node in the pack, so the practical workflow is: know your names, or keep a naming convention. If you create modifiers with a Create Shape Flow-style pipeline or script, you control the names; if you don't, check the names in a Blender session or a debug output.
Install and gotchas
Standard pack 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". Python 3.10 for bpy==3.6.0, ~2.5GB SAM checkpoint + mediapipe models on first load, scene resets each run, live preview needs --enable-cors-header.
Two honest warnings. Applying is destructive - you can't un-apply a modifier without an undo, and the scene reset means undo won't save you across runs. And SHAPE as an apply_as only makes sense for modifiers that can fold into a shape key; for something like a noise jitter, DATA is usually what you want. When in doubt, apply as DATA and keep a copy of the pre-baked object upstream.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| apply_asopt | COMBO | 2 options: DATA, SHAPE | |
| modifieropt | STRING | — | |
| reportopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |