Operator Inventory (Release 5.0)¶
This page lists operators provided by The Violence Layer Manager. Each operator is mapped to its function. For the specific native Blender operations executed by these macros, see the Technical Appendix: Native Blender Operations at the bottom of this page.
Note
Limitations: Some operators are marked as Non-functional or Buggy. These are documented for transparency but should not be used.
Warning
All operators require a Grease Pencil object to be selected and active. If no object is selected, the operator will report a warning.
Layer Switching (Drawing & Filling)¶
These operators unlock the specific layer, set it as active, switch the brush tool (Draw or Fill), and assign the correct material.
Operator ID |
Description |
|---|---|
|
Switch to Body line art layer. Material: |
|
Switch to Head line art layer. Material: |
|
Switch to Eyes line art layer. Material: |
|
Switch to Mouth line art layer. Material: |
|
Switch to Extra (Arms/Tail) line art layer. Material: |
|
Switch to Foreground (Hands) line art layer. Material: |
|
Switch to Background (Layer 7) line art layer. Material: |
|
Switch to Misc. 8 line art layer. Material: |
|
Switch to Misc. 9 line art layer. Material: |
|
Switch to Holdout/Mask (Layer 10) line art layer.
Material: |
Operator ID |
Description |
|---|---|
|
Switch to Body fill layer. Opens material selection menu. |
|
Switch to Head fill layer. Opens material selection menu. |
|
Switch to Eyes fill layer. Opens material selection menu. |
|
Switch to Mouth Mask layer. Material: |
|
Switch to Extra fill layer. Opens material selection menu. |
|
Switch to Foreground fill layer. Opens material selection menu. |
|
Switch to Background (Layer 7) fill layer. Opens material selection menu. |
|
Switch to Misc. 8 fill layer. Opens material selection menu. |
|
Switch to Misc. 9 fill layer. Opens material selection menu. |
|
Switch to Layer 10 fill layer. Opens material selection menu. |
Specialized Drawing & Animation¶
Operators for specific character parts, effects, and animation workflows.
Mouth & Teeth Control¶
Operator ID |
Description |
|---|---|
|
Mouth Lines: Unlock and switch to mouth outline. |
|
Mouth Mask: Unlock and switch to mouth mask (for teeth/tongue visibility). |
|
Upper Teeth: Unlock and switch to upper jaw/teeth layer. Material: |
|
Lower Teeth: Unlock and switch to lower jaw/teeth layer. Material: |
Effects¶
Operator ID |
Description |
|---|---|
|
Switch to Shadows layer. Brush size: 70px. Material: |
|
Switch to Highlights layer. Material: |
|
Switch to Highlights layer. Material: |
|
Switch to Highlights layer. Material: |
Keyframe Operators¶
Operator ID |
Description |
|---|---|
|
Unlock Mouth and Mask layers for keyframing (Front View). |
|
Unlock Mouth, Mask, and Lower Jaw layers for keyframing. |
|
Duplicate the current frame for all unlocked layers (Insert Keyframe). |
Sculpting & Editing¶
These operators isolate specific body parts for sculpting or editing. They unlock both the Line and Fill layers for the selected part, switch to Sculpt Mode briefly to prepare the brush, then return to Paint Mode.
Operator ID |
Description |
|---|---|
|
Isolate Body (Lines + Fills) for Sculpt/Edit. |
|
Isolate Head (Lines + Fills) for Sculpt/Edit. |
|
Isolate Eyes (Lines + Fills) for Sculpt/Edit. |
|
Isolate Mouth (Lines + Mask) for Sculpt/Edit. |
|
Isolate Extra (Lines + Fills) for Sculpt/Edit. |
|
Isolate Foreground (Lines + Fills) for Sculpt/Edit. |
|
Isolate Background (Layer 7) for Sculpt/Edit. |
|
Isolate Misc. 8 for Sculpt/Edit. |
|
Isolate Misc. 9 for Sculpt/Edit. |
|
Isolate Misc. 10 for Sculpt/Edit. |
Custom Tools & Utilities¶
New in v5.0: These operators provide advanced functionality for retopology, compositing, and bulk actions.
New 5.0 Operators¶
Operator ID |
Description |
|---|---|
|
NEW: Apply randomized noise to unlocked strokes. Dialog Options: Strength, Size, Repeat. (Replaces the old static noise operator). |
|
NEW: Unlock Mouth, Mask, Upper/Lower Teeth, AND Head layers. Useful for complex jaw/head animations. |
|
Retopo Helper: Flattens Y-axis, smooths vertices, snaps to nearest face. (Designed for mesh retopology workflows). |
|
Affect Selected GP: Disables lights on all layers of the selected GP object. |
|
Affect All GP: Placeholder for bulk actions across all GP objects in the scene. |
|
Toggle Compositor: Switches viewport compositor between |
|
Toggle Layer Hide: Toggles the visibility of the currently active GP layer. |
Legacy Operators¶
Operator ID |
Description |
|---|---|
|
Set Stroke Strength to 0% or 100%. |
|
Join selected strokes and smooth them. |
|
Jump to Previous/Next Keyframe. |
|
Jump to Previous/Next Marker. |
|
Switch to Eraser Point or Eraser Stroke. |
|
Create a new blank Grease Pencil object (Fox template). |
|
Randomize selected vertices (Legacy). |
|
Lock all non-character layers. |
|
Unlock all mouth layers (Legacy). |
|
Enable/Disable Auto-Merge Strokes. |
|
Toggle “Fade Inactive Layers” overlay. |
|
Toggle Onion Skins overlay. |
|
Remove all vertex paints from all layers/frames. |
|
Enable/Disable “Draw Behind” mode. |
|
Large Pass Randomize (Legacy). |
|
Smooth selected strokes. |
|
Create GP Object (Fox McCloud): Generates the full Fox template with materials. |
|
Various legacy material, brush, and modifier toggles. |
Advanced Configuration¶
Note
The fred.applynoise operator (dialog box) remains available but is distinct
from the new fred.op8 (Jiggle). fred.applynoise uses the older
implementation with fixed randomness ranges.
Warnings & Known Bugs¶
fred.op15
Marked as Non-functional in the code. It currently only pushes an undo message.
Intended: Unlock and clear Mouth/Head frames via hotkey (Ctrl+Alt+Shift+4).
Bug: The code fails to make invisible layers visible before unlocking them. (V1.0)
Workaround: Manually ensure layers are visible and unlocked in the Outliner.
fred.op30
Marked as Crash Risk. The code contains a syntax error. But there’s no way for the user to get to it anyway.
fred.applynoise
This is a Dialog Box operator. It will open the dialog window rather than perform the operation. (This is fine, but a hotkey assigned to it won’t technically perform an operation, is all.)
Technical Appendix: Native Blender Operations¶
This section details the specific native Blender operations used by the operators above. Click the Ref Key in the tables to jump to the relevant section here.
Note
API Links: Links prefixed with Blender API: point to the Blender API Reference.
If a link targets a class, navigate to the specific attribute mentioned in parentheses (e.g., see active).
Blender Manual Links: Links prefixed with Blender Manual: point to the User Manual for Blender’s explanation of its use.
Unlock & Activate Layer¶
Used by: All Layer Switching, Mouth, Jaw, Effects, Keyframe operators
Unlock Layer
bpy.ops.wm.context_toggle(data_path="object.data.layers['" + layer_name + "'].lock")
Blender API: Layer Unlock
Applies a toggle to the lock state of a specific layer.
Blender Manual: Layers (see #Layers List - Lock)
Set Active Layer¶
bpy.context.active_object.data.layers.active = bpy.context.active_object.data.layers[layer_name]
Blender API: GreasePencil (see layers.active)
When the code runs bpy.context.active_object.data.layers.active = …, it is doing three specific things simultaneously:
Blender Manual: Set Active Layer (see #Active Layer)
‘Setting’ the “Target” for drawing: In Blender, you can have 18 layers, but you can only draw on one at a time.
Chages the visual (UI) focus:
Outliner: The layer name in the Outliner (the list on the right) becomes highlighted.
Properties Panel: The “Layer” tab in the sidebar updates to show the settings (opacity, lock status, color) for that specific layer.
Context for Other Operations:
Many other Blender operations (like “Delete,” “Duplicate,” or “Lock”) operate on the enitre active layer by default if no specific selection is made.
Fred’s use case: “I want to lock all layers except the one I’m working on.” The tool does this by unlocking the active one and locking the rest.
Set Brush Tool¶
bpy.ops.wm.tool_set_by_id(name='builtin_brush.Draw') and name='builtin_brush.Fill'
Blender API: Set Tool by ID (see name)
Switches the active brush tool to either Fill or Brush, depending on the layer selected.
Blender Manual: Brush Settings (see #Selecting-a-brush-and-material)
Set Brush Size¶
bpy.context.tool_settings.gpencil_paint.brush.size = 13
Blender API: In 4.1 Brush (see gpencil_settings.pen_size)
Sets the brush radius to one specified by the layer materials.
Blender Manual: Brush Settings
Set Brush Strength¶
bpy.context.tool_settings.gpencil_paint.brush.gpencil_settings.pen_strength = 1
Blender API: Brush (see gpencil_settings.pen_strength)
Sets the stroke opacity/strength to the one specified by the layer materials.
Blender Manual: Brush Settings
Set Material Active¶
bpy.ops.gpencil.material_set(slot=m.name)
Blender API: Set Material
Assigns the layer’s material to the active stroke/layer. (I think?)
Blender Manual: Materials
Sculpt Mode & Push Brush¶
Used by: All Sculpt Isolation operators
Enter Sculpt Mode¶
bpy.ops.object.mode_set(mode='SCULPT_GPENCIL')
Blender API: Mode Set
Switches to Sculpt Mode.
Blender Manual: Sculpt Mode
Set Push Brush¶
bpy.ops.wm.tool_set_by_id(name='builtin_brush.Push')
Blender API: Set Tool by ID
Sets the active brush to “Push” (used for “butterknifing”).
Blender Manual: Sculpt Mode
Return to Draw Mode¶
bpy.ops.object.mode_set(mode='PAINT_GPENCIL')
Blender API: Mode Set
Returns to Draw Mode.
Blender Manual: Draw Mode
Select Random & Apply Noise¶
Used by: fred.applynoise, fred.op8, fred.op12, fred.op23
Select All¶
bpy.ops.gpencil.select_all(action='SELECT')
Blender API: Select All
Selects all vertices on unlocked layers.
Blender Manual: Selecting Strokes
Deselect Random¶
bpy.ops.gpencil.select_random(ratio=0.995, action='DESELECT', ...)
Blender API: Select Random
Selects everything, then randomly deselects 99.5%, leaving 0.5% selected.
Blender Manual: Random Selection
Apply Noise (Translate)¶
bpy.ops.transform.translate(value=(mynoisex, mynoisey, 0), ...)
Blender API: Translate
Moves selected vertices randomly.
Blender Manual: Array Modifier
Apply Thickness (via Shrinkfatten)¶
bpy.ops.transform.transform(mode='GPENCIL_SHRINKFATTEN', ...)
Blender API: Transform
Changes stroke thickness.
Blender Manual: Build Modifier
Duplicate Frame¶
Used by: fred.addkeyframes
Duplicate Frame¶
bpy.ops.gpencil.frame_duplicate(mode='ALL')
Blender API: Duplicate Frame
Duplicates the current frame on all unlocked layers.
Blender Manual: Duplicating Frames (see #Duplicate Active Keyframe (All Layers))
Set Brush Strength¶
Set Brush Strength¶
bpy.context.tool_settings.gpencil_paint.brush.gpencil_settings.pen_strength = 0 (or 1)
Blender API: Blender 4.1 Brush (see gpencil_settings.pen_strength)
Sets the stroke opacity/strength to 0% or 100%.
Blender Manual: Brush Strength (see #Strength)
Join & Smooth Strokes¶
Join Strokes¶
bpy.ops.gpencil.stroke_join(type='JOIN')
Blender API: Join Strokes
Joins two selected strokes into one.
Blender Manual: Joining Strokes (see #join)
Smooth Strokes¶
bpy.ops.gpencil.stroke_smooth(
repeat=10,
factor=0.5, ...
)
Blender API: Smooth Strokes
Smooths the position and thickness of selected strokes.
Blender Manual: Smoothing Strokes (see #smooth)
Jump Keyframe/Marker¶
Used by: fred.op4, fred.op5, fred.op6, fred.op7
Jump Keyframe¶
bpy.ops.screen.keyframe_jump(
next=False)
# or ``True``
Blender API: Keyframe Jump
Jumps the playhead to the previous or next keyframe.
Blender Manual: Markers (see #selecting keyframes)
Jump Marker¶
bpy.ops.screen.marker_jump(next=False) (or True)
Blender API: Marker Jump (see #Jump to next/previous marker)
Jumps the playhead to the previous or next marker.
Blender Manual: Markers
Set Eraser Brush¶
bpy.context.scene.tool_settings.gpencil_paint.brush = bpy.data.brushes["Eraser Point"]
Blender API: Brush
Sets the active brush to “Eraser Point” or “Eraser Stroke”.
Blender Manual: Eraser Brushes (see #Point Erasing, #Stroke Erasing)
Create GP Object¶
Create Data¶
bpy.data.grease_pencils.new("ANIM_FOX")
Blender API: GreasePencil
Creates a new Grease Pencil data-block.
Blender Manual: Creating Grease Pencil Objects (see #Data Block)
Create Object¶
bpy.data.objects.new("GP_FOX", gp_data)
Blender API: Object
Creates a new object using the GP data-block.
Blender Manual: Creating Grease Pencil Objects (see #Sroke)
Create Material¶
bpy.data.materials.new("1 I LINE")
Blender API: Material
Creates a new material with Grease Pencil properties.
Blender Manual: Materials (see #Setting Up Materials)
Lock All Layers¶
Used by: fred.op13
Lock All¶
bpy.ops.gpencil.lock_all()
Blender API: Lock All
Locks all Grease Pencil layers at once.
Blender Manual: Layers (see #Layer Specials - Lock All)
Toggle Automerge¶
Set Automerge¶
bpy.ops.wm.context_set_value(data_path='scene.tool_settings.use_gpencil_automerge_strokes', value='True')
Blender API: ToolSettings
Enables or disables automerge toggle for stroke endpoints.
Blender Manual: Automerge (see #Drawing Options, Automerge)
Toggle Overlay¶
Toggle Fade Layers¶
bpy.ops.wm.context_toggle(data_path="space_data.overlay.use_gpencil_fade_layers")
Blender API: SpaceView3D
Fades layers that are not currently active.
Blender Manual: Fading Layers (See Visibililty)
Toggle Onion Skins¶
bpy.ops.wm.context_toggle(data_path="space_data.overlay.use_gpencil_onion_skin")
Blender API: SpaceView3D
Toggles onion skin visibility for adjacent frames.
Blender Manual: Onion Skinning (See #Display - Fade)
Clear Vertex Colors¶
Used by: fred.op20
Iterate GP Objects¶
for gp in bpy.data.grease_pencils:
Blender API: GreasePencil
Iterates through all Grease Pencil data-blocks in the file.
Blender Manual: Selecting First/Last
Clear Vertex Color¶
point.vertex_color = [0.0, 0.0, 0.0, 0.0]
Blender API: GPencilStrokePoint
Resets vertex color data to transparent black on all strokes and points.
Blender Manual: Vertex Colors (see #Reset Vertex Color)
Toggle Draw on Back¶
Set Draw on Back¶
bpy.ops.wm.context_set_value(data_path='scene.tool_settings.use_gpencil_draw_onback', value='True')
Blender API: ToolSettings
Enables or disables drawing strokes behind existing geometry.
Blender Manual: Draw on Back (see #Drawing Options, Draw-on-back)
Smooth Stroke¶
Used by: fred.op24
Smooth¶
bpy.ops.gpencil.stroke_smooth(repeat=2, factor=0.5, ...)
Blender API: Smooth Strokes
Smooths the position, thickness, and strength of selected strokes.
Blender Manual: Smoothing Strokes (see #Smooth)
Set Material¶
Used by: fred.op26
Set Material¶
bpy.ops.gpencil.material_set(mat)
Blender API: Set Material
Assigns the active material to selected strokes.
Blender Manual: Materials
View Frame¶
Used by: fred.op27
bpy.ops.action.view_selected()
Blender API: View Selected
Zooms the Dope Sheet to show selected keyframes.
Blender Manual: View Frame (see #Frame Selected, Numpad .)
View Frame¶
bpy.ops.action.view_frame()
Blender API: View Frame
Centers the Dope Sheet on the current frame.
Blender Manual: View Frame (see #Go to Current Frame, Numpad 0)
Set Brush¶
Set Brush¶
bpy.context.scene.tool_settings.gpencil_paint.brush = bpy.data.brushes["01 PEN"]
Blender API: Brush
Sets the active brush to a named brush preset.
Blender Manual: Data Block Menu
Toggle Material Visibility¶
Used by: fred.op31
Toggle Visibility¶
obj.hide = True (or False)
Blender Manual: Materials (see Common Settings, Viewport/Render Visibility)
Toggles the visibility of the active Grease Pencil material.
Blender API: MaterialGPencilStyle
Reveal Material¶
Used by: fred.op32
Reveal¶
bpy.ops.gpencil.material_reveal()
Blender Manual: Materials
Makes all Grease Pencil materials visible.
Blender API: Reveal Material
Hide All Fills¶
Used by: fred.op33
Toggle Modifier¶
bpy.ops.wm.context_toggle(data_path="object.grease_pencil_modifiers['HIDE ALL FILLS'].show_viewport")
Blender Manual: Viewport Visibility
Toggles the viewport visibility of the “HIDE ALL FILLS” modifier.
Blender API: Modifier (see show_viewport)
Set Fill Draw Mode¶
Set Mode¶
bpy.data.brushes["Fill Area"].gpencil_settings.fill_draw_mode = 'CONTROL' (or 'BOTH')
Blender Manual: Fill Draw Mode (See #Fill Brushes)
Sets the fill brush to react to control lines only, or both control lines and strokes.
Blender API: Brush (see gpencil_settings.fill_draw_mode)
Native Blender Operations (v5.0 Additions)¶
Used by: OP36, OP37, OP38, OP39, OP40, and the rewritten OP8.
Toggle Layer Visibility (Hide)¶
layer.hide = not layer.hide
Toggles whether a layer is visible in the viewport.
Used by: fred.op40
Blender API: bpy.types.GPencilLayer.hide
Set Layer Lighting¶
layer.use_lights = False
Disables scene lighting on a Grease Pencil layer, causing it to render with flat/unlit colors regardless of scene lights.
Used by: fred.op37
Blender API: bpy.types.GPencilLayer.use_lights
Iterate All Objects by Type¶
for obj in bpy.data.objects:if obj.type == 'GPENCIL':
Loops through every object in the blend file and filters by type.
obj.type returns a string enum such as 'GPENCIL', 'MESH', etc.
Used by: fred.op38
Blender API: bpy.types.BlendData.objects, bpy.types.Object.type
Iterate Screen Areas and Spaces¶
for area in context.window.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == 'VIEW_3D':
Walks through all editor areas in the current window, then accesses their space data. Used to modify viewport settings that aren’t exposed through a simpler API path.
Used by: fred.op39
Blender API: bpy.types.Screen.areas, bpy.types.Area.type, bpy.types.SpaceView3D
Toggle Viewport Compositor¶
space.shading.use_compositor =
'DISABLED'
# or 'ALWAYS'
Switches the viewport compositor mode. Valid values are
'DISABLED', 'CAMERA', and 'ALWAYS'.
Used by: fred.op39
Blender API: bpy.types.View3DShading.use_compositor
Resize (Scale) Transform with Axis Constraint¶
bpy.ops.transform.resize(
value=(1, 0, 1),
orient_type='GLOBAL',
constraint_axis=(False, True, False)
)
Scales the selection. Setting a component of value to 0
flattens that axis. constraint_axis limits the operation to
specific axes.
Used by: fred.op36
Blender Manual: Resize
Translate with Snap to Nearest Face¶
bpy.ops.transform.translate(
value=(0, 0, 0),
snap=True,
snap_elements={'FACE_NEAREST'},
snap_target='CLOSEST')
Moves the selection. With snap=True and
snap_elements={'FACE_NEAREST'}, vertices are projected onto
the nearest surface of the target mesh. A zero-value translate
with snapping effectively “conforms” geometry to the surface.
Used by: fred.op36
Blender Manual: Translate
Smooth Mesh Vertices¶
bpy.ops.mesh.vertices_smooth(
factor=0.5,
repeat=3
)
Averages vertex positions with their neighbors. factor
controls the strength (0.0–1.0), repeat controls iterations.
Warning
This operator only works in Mesh Edit Mode. It will fail on Grease Pencil objects.
Used by: fred.op36
Blender Manual: Smooth Vertices
Integer Property for Dialog Input¶
arg1: bpy.props.IntProperty(
name="Strength",
default=1,
min=1,
max=1000
)
Defines an integer property on an operator class. When used
with invoke_props_dialog(), the property appears as a
slider/input field in a popup dialog before execution.
Used by: fred.op8 (Jiggle)
Blender API: bpy.props.IntProperty
Invoke Properties Dialog¶
def invoke(self, context, event):return context.window_manager.invoke_props_dialog(self)
Opens a popup dialog showing the operator’s properties before
running execute(). The user can adjust values, then click
OK to proceed. Must be defined alongside execute().
Used by: fred.op8 (Jiggle), fred.applynoise
Blender API: bpy.types.WindowManager.invoke_props_dialog()