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
2 changed files with 31 additions and 0 deletions
Showing only changes of commit 9ce0eba774 - Show all commits

View File

@ -1128,6 +1128,27 @@ class BSBST_OT_render_setup(bpy.types.Operator):
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
class BSBST_OT_view_all(bpy.types.Operator):
"""
Enable/disable all brushstrokes for the viewport.
"""
bl_idname = "brushstroke_tools.view_all"
bl_label = "Enable/Disable All"
bl_description = "Enable/disable all brushstrokes for the viewport"
bl_options = {"REGISTER", "UNDO"}
disable: bpy.props.BoolProperty(default=False)
def execute(self, context):
for ob in bpy.data.objects:
if not utils.is_brushstrokes_object(ob):
continue
if ob.hide_viewport == self.disable:
continue
else:
ob.hide_viewport = self.disable
return {"FINISHED"}
class BSBST_OT_new_material(bpy.types.Operator):
"""
"""
@ -1163,6 +1184,7 @@ classes = [
BSBST_OT_preset_remove_mod,
BSBST_OT_preset_toggle_attribute,
BSBST_OT_brushstrokes_toggle_attribute,
BSBST_OT_view_all,
BSBST_OT_render_setup,
BSBST_OT_new_material,
]

View File

@ -427,6 +427,15 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
bl_label = "Brushstroke Tools"
bl_category = "Brushstroke Tools"
def draw_header_preset(self,context):
layout = self.layout
row = layout.row(align=True)
op = row.operator('brushstroke_tools.view_all', icon='RESTRICT_VIEW_OFF', text='')
op.disable = False
op = row.operator('brushstroke_tools.view_all', icon='RESTRICT_VIEW_ON', text='')
op.disable = True
def draw(self, context):
layout = self.layout