Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
3 changed files with 28 additions and 0 deletions
Showing only changes of commit 7f006cd45c - Show all commits

View File

@ -200,6 +200,27 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
bpy.ops.wm.tool_set_by_id(name="brushstroke_tools.draw") bpy.ops.wm.tool_set_by_id(name="brushstroke_tools.draw")
return {"FINISHED"} return {"FINISHED"}
class BSBST_OT_edit_brushstrokes(bpy.types.Operator):
"""
SimonThommes marked this conversation as resolved Outdated

It's not really necessary to have empty return statements.

It's not really necessary to have empty return statements.
Enter the editing context for the active context brushstrokes.
"""
bl_idname = "brushstroke_tools.edit_brushstrokes"
bl_label = "Edit Active Brushstrokes"
bl_description = " Enter the editing context for the active context brushstrokes"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
settings = context.scene.BSBST_settings
return bool(settings.context_brushstrokes)
def execute(self, context):
settings = context.scene.BSBST_settings
# TODO: refactor entering edit
return {"FINISHED"}
class BSBST_OT_init_preset(bpy.types.Operator): class BSBST_OT_init_preset(bpy.types.Operator):
""" """
@ -445,6 +466,7 @@ class BSBST_OT_preset_toggle_attribute(bpy.types.Operator):
classes = [ classes = [
BSBST_OT_new_brushstrokes, BSBST_OT_new_brushstrokes,
BSBST_OT_edit_brushstrokes,
BSBST_OT_init_preset, BSBST_OT_init_preset,
BSBST_OT_make_preset, BSBST_OT_make_preset,
BSBST_OT_preset_add_mod, BSBST_OT_preset_add_mod,

View File

@ -178,6 +178,9 @@ class BSBST_Settings(bpy.types.PropertyGroup):
reuse_flow: bpy.props.BoolProperty(default=False, reuse_flow: bpy.props.BoolProperty(default=False,
name='Re-use Flow Object', name='Re-use Flow Object',
description="Re-use flow object from active brushstrokes if applicable") description="Re-use flow object from active brushstrokes if applicable")
edit_toggle: bpy.props.BoolProperty(default=True,
name='Edit Active Brushstrokes',
description="Jump into the corresponding edit mode when selecting/creating a brushstrokes layer")
classes = [ classes = [
BSBST_socket_info, BSBST_socket_info,

View File

@ -193,6 +193,9 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
style_panel.label(text='No Brushstroke Context Found', icon='ERROR') style_panel.label(text='No Brushstroke Context Found', icon='ERROR')
return return
if not is_preset and len(settings.context_brushstrokes)>0: if not is_preset and len(settings.context_brushstrokes)>0:
row = style_panel.row(align=True)
row.operator('brushstroke_tools.edit_brushstrokes', icon='GREASEPENCIL')
row.prop(settings, 'edit_toggle', icon='RESTRICT_SELECT_OFF' if settings.edit_toggle else 'RESTRICT_SELECT_ON', icon_only=True)
style_panel.template_list("BSBST_UL_brushstroke_objects", "", settings, "context_brushstrokes", style_panel.template_list("BSBST_UL_brushstroke_objects", "", settings, "context_brushstrokes",
settings, "active_context_brushstrokes_index", rows=1, maxrows=5, sort_lock=True) settings, "active_context_brushstrokes_index", rows=1, maxrows=5, sort_lock=True)
style_panel.prop(settings, 'preset_material', icon='MATERIAL') style_panel.prop(settings, 'preset_material', icon='MATERIAL')