Brushstroke Tools: Initial Version #328
@ -4,7 +4,7 @@ from mathutils import Vector
|
|||||||
from bpy.types import WorkSpaceTool
|
from bpy.types import WorkSpaceTool
|
||||||
|
|
||||||
def preserve_draw_settings(context, restore=False):
|
def preserve_draw_settings(context, restore=False):
|
||||||
props_list = ['curve_type', 'depth_mode', 'use_pressure_radius', 'use_project_only_selected', ]
|
props_list = ['curve_type', 'depth_mode', 'use_pressure_radius', 'use_project_only_selected', 'radius_max', 'surface_offset']
|
||||||
if restore:
|
if restore:
|
||||||
draw_settings_dict = context.scene['BSBST-TMP-draw_settings_dict']
|
draw_settings_dict = context.scene['BSBST-TMP-draw_settings_dict']
|
||||||
for k, v in draw_settings_dict.items():
|
for k, v in draw_settings_dict.items():
|
||||||
@ -31,6 +31,8 @@ class BSBST_tool_settings(bpy.types.PropertyGroup):
|
|||||||
soft_max=1,
|
soft_max=1,
|
||||||
update=None,
|
update=None,
|
||||||
)
|
)
|
||||||
|
radius_max: bpy.props.FloatProperty(name='Radius', default=1, min=0)
|
||||||
|
surface_offset: bpy.props.FloatProperty(name='Offset', default=0)
|
||||||
|
|
||||||
class BSBST_OT_draw(bpy.types.Macro):
|
class BSBST_OT_draw(bpy.types.Macro):
|
||||||
"""
|
"""
|
||||||
@ -49,12 +51,18 @@ class BSBST_OT_pre_process_brushstroke(bpy.types.Operator):
|
|||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
tool_settings = context.scene.BSBST_tool_settings
|
||||||
|
|
||||||
preserve_draw_settings(context)
|
preserve_draw_settings(context)
|
||||||
|
|
||||||
context.tool_settings.curve_paint_settings.curve_type = 'POLY'
|
context.tool_settings.curve_paint_settings.curve_type = 'POLY'
|
||||||
context.tool_settings.curve_paint_settings.depth_mode = 'SURFACE'
|
context.tool_settings.curve_paint_settings.depth_mode = 'SURFACE'
|
||||||
context.tool_settings.curve_paint_settings.use_pressure_radius = True
|
context.tool_settings.curve_paint_settings.use_pressure_radius = True
|
||||||
context.tool_settings.curve_paint_settings.use_project_only_selected = True
|
context.tool_settings.curve_paint_settings.use_project_only_selected = True
|
||||||
|
|
||||||
|
context.tool_settings.curve_paint_settings.radius_max = tool_settings.radius_max
|
||||||
|
context.tool_settings.curve_paint_settings.surface_offset = tool_settings.surface_offset
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class BSBST_OT_post_process_brushstroke(bpy.types.Operator):
|
class BSBST_OT_post_process_brushstroke(bpy.types.Operator):
|
||||||
@ -122,8 +130,8 @@ class BrushstrokesCurves(WorkSpaceTool):
|
|||||||
def draw_settings(context, layout, tool):
|
def draw_settings(context, layout, tool):
|
||||||
props = tool.operator_properties("brushstroke_tools.draw")
|
props = tool.operator_properties("brushstroke_tools.draw")
|
||||||
tool_settings = context.scene.BSBST_tool_settings
|
tool_settings = context.scene.BSBST_tool_settings
|
||||||
layout.prop(context.tool_settings.curve_paint_settings , "radius_max")
|
layout.prop(tool_settings , "radius_max")
|
||||||
layout.prop(context.tool_settings.curve_paint_settings , "surface_offset")
|
layout.prop(tool_settings , "surface_offset")
|
||||||
layout.prop(tool_settings, "brush_color")
|
layout.prop(tool_settings, "brush_color")
|
||||||
|
|
||||||
classes = [
|
classes = [
|
||||||
|
Loading…
Reference in New Issue
Block a user