bpy.ops.gpencil.layer_annotation_add 是 Blender 中的一个操作,用于在 Grease Pencil 中添加新的注释层。
name (string, default: "") – 新注释层的名称。
remove_existing (boolean, default: False) – 是否要删除现有的注释层。
操作执行成功时,该函数将返回一个执行结果的字典。
import bpy
# Add new annotation layer
bpy.ops.gpencil.layer_annotation_add(name="My Annotation Layer")
当 remove_existing 设置为 True 时,该函数将删除现有的注释层并替换为新注释层。
如果指定的注释层名称已经存在,则将自动在名称后面添加数字以创建唯一名称。
在执行此操作之前,请确保您已经切换到 Grease Pencil 模式。