Set Brush operator

2.1.2

- added: `gp.brush_set` operator to manually assign a brush by name to a shortcut
  - preferably add shortcut to `Grease Pencil > Grease Pencil Stroke Paint Mode`
gpv2
pullusb 2022-11-23 15:25:28 +01:00
parent bf30254871
commit b2a6e6a899
3 changed files with 33 additions and 1 deletions

View File

@ -1,5 +1,16 @@
# Changelog
2.1.2
- added: `gp.brush_set` operator to manually assign a brush by name to a shortcut
- preferably add shortcut to `Grease Pencil > Grease Pencil Stroke Paint Mode`
2.1.1
- added: follow curve show offset property in UI
- added: follow curve show clickable warning if object has non-zero location to reset location
- changed: created follow curve use `fixed offset`
2.1.1
- added: follow curve show offset property in UI

View File

@ -48,6 +48,26 @@ class GPTB_OT_load_brushes(bpy.types.Operator, ImportHelper):
return {"FINISHED"}
class GPTB_OT_brush_set(bpy.types.Operator):
bl_idname = "gp.brush_set"
bl_label = "Set Brush"
bl_description = "Set Gpencil brush"
bl_options = {"REGISTER", "UNDO"}
brush_name : bpy.props.StringProperty(name='Brush', description='Name of the brush to use')
@classmethod
def poll(cls, context):
return context.object and context.mode == 'PAINT_GPENCIL'
def execute(self, context):
brush = bpy.data.brushes.get(self.brush_name)
if not brush:
self.report({'ERROR'}, f'Brush "{self.brush_name}" not found')
return {"CANCELLED"}
context.scene.tool_settings.gpencil_paint.brush = brush
return {"FINISHED"}
### -- MENU ENTRY --
def load_brush_ui(self, context):
@ -62,6 +82,7 @@ def load_brush_top_bar_ui(self, context):
classes = (
GPTB_OT_load_brushes,
GPTB_OT_brush_set,
)
def register():

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux",
"version": (2, 1, 1),
"version": (2, 1, 2),
"blender": (3, 0, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "",