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
4 changed files with 39 additions and 13 deletions
Showing only changes of commit 473c53f211 - Show all commits

View File

@ -17,8 +17,21 @@ class BSBST_OT_draw(bpy.types.Operator):
bl_label = "Custom Draw"
bl_options = {'REGISTER', 'UNDO'}
brush_color: bpy.props.FloatVectorProperty(name='Brush Color', size=3, subtype='COLOR', default=(.0,.0,.0), soft_min=0, soft_max=1, update=None)
brush_smear: bpy.props.FloatProperty(name='Smear', subtype='FACTOR', default=0, min=0, max=1, update=None)
brush_color: bpy.props.FloatVectorProperty(name='Brush Color',
size=3,
subtype='COLOR',
default=(.0,.0,.0),
soft_min=0,
soft_max=1,
update=None,
)
brush_smear: bpy.props.FloatProperty(name='Smear',
subtype='FACTOR',
default=0,
min=0,
max=1,
update=None,
)
ng_process = None

View File

@ -351,7 +351,8 @@ class BSBST_OT_preset_remove_mod(bpy.types.Operator):
class BSBST_OT_preset_toggle_attribute(bpy.types.Operator):
"""
Toggle use_attribute property for a socket on a specific object's modifier. (Workaround due to how these are actually stored as integer in Blender)
Toggle use_attribute property for a socket on a specific object's modifier.
(Workaround due to how these are actually stored as integer in Blender)
"""
bl_idname = "brushstroke_tools.preset_toggle_attribute"
bl_label = "Toggle Attribute"
@ -371,7 +372,8 @@ class BSBST_OT_preset_toggle_attribute(bpy.types.Operator):
override = context.copy()
override['object'] = settings.preset_object
with context.temp_override(**override):
bpy.ops.object.geometry_nodes_input_attribute_toggle(input_name=self.input_name, modifier_name=self.modifier_name)
bpy.ops.object.geometry_nodes_input_attribute_toggle(input_name=self.input_name,
modifier_name=self.modifier_name)
return {"FINISHED"}
classes = [

View File

@ -37,9 +37,15 @@ def draw_panel_ui_recursive(panel, panel_name, mod, items):
else:
input_row.prop(mod, f'["{v.identifier}"]', text=k)
if is_preset:
toggle = input_row.operator('brushstroke_tools.preset_toggle_attribute', text='', depress=mod[f'{v.identifier}_use_attribute'], icon='SPREADSHEET')
toggle = input_row.operator('brushstroke_tools.preset_toggle_attribute',
text='',
depress=mod[f'{v.identifier}_use_attribute'],
icon='SPREADSHEET')
else:
toggle = input_row.operator('object.geometry_nodes_input_attribute_toggle', text='', depress=mod[f'{v.identifier}_use_attribute'], icon='SPREADSHEET')
toggle = input_row.operator('object.geometry_nodes_input_attribute_toggle',
text='',
depress=mod[f'{v.identifier}_use_attribute'],
icon='SPREADSHEET')
toggle.modifier_name = mod.name
toggle.input_name = v.identifier
else:

View File

@ -2,14 +2,19 @@ import os
import bpy
from bpy.app.handlers import persistent
ng_list = [ ".brushstroke_tools.processing",
ng_list = [
".brushstroke_tools.processing",
".brushstroke_tools.deformation",
".brushstroke_tools.surface_fill",
".brushstroke_tools.surface_draw",
".brushstroke_tools.geometry_input",
]
linkable_sockets = [bpy.types.NodeTreeInterfaceSocketObject, bpy.types.NodeTreeInterfaceSocketMaterial, bpy.types.NodeTreeInterfaceSocketVector]
linkable_sockets = [
bpy.types.NodeTreeInterfaceSocketObject,
bpy.types.NodeTreeInterfaceSocketMaterial,
bpy.types.NodeTreeInterfaceSocketVector
]
@persistent
def refresh_preset(dummy):