[Bf-blender-cvs] [65bc541f5df] greasepencil-object: Implement Presets for Brush options
Antonioya
noreply at git.blender.org
Fri Jul 27 16:05:08 CEST 2018
Commit: 65bc541f5dfbfd3cbda34e8eb49a8fb5bf723533
Author: Antonioya
Date: Fri Jul 27 16:04:57 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB65bc541f5dfbfd3cbda34e8eb49a8fb5bf723533
Implement Presets for Brush options
This is the first step to create a set of predefined settings.
===================================================================
M release/scripts/startup/bl_operators/presets.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index fe09fada297..0fe45f8fee3 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -670,6 +670,42 @@ class AddPresetUnitsLength(AddPresetBase, Operator):
preset_subdir = "units_length"
+class AddPresetGpencilBrush(AddPresetBase, Operator):
+ """Add or remove grease pencil brush preset"""
+ bl_idname = "scene.gpencil_brush_preset_add"
+ bl_label = "Add Grease Pencil Brush Preset"
+ preset_menu = "VIEW3D_PT_gpencil_brush_presets"
+
+ preset_defines = [
+ "brush = bpy.context.active_gpencil_brush",
+ "settings = brush.gpencil_settings"
+ ]
+
+ preset_values = [
+ "settings.input_samples",
+ "settings.active_smooth_factor",
+ "settings.angle",
+ "settings.angle_factor",
+ "settings.use_stabilizer",
+ "brush.smooth_stroke_radius",
+ "brush.smooth_stroke_factor",
+ "settings.pen_smooth_factor",
+ "settings.pen_smooth_steps",
+ "settings.pen_thick_smooth_factor",
+ "settings.pen_thick_smooth_steps",
+ "settings.pen_subdivision_steps",
+ "settings.random_subdiv",
+ "settings.enable_random",
+ "settings.random_pressure",
+ "settings.random_strength",
+ "settings.uv_random",
+ "settings.pen_jitter",
+ "settings.use_jitter_pressure",
+ ]
+
+ preset_subdir = "gpencil_brush"
+
+
classes = (
AddPresetCamera,
AddPresetCloth,
@@ -686,6 +722,7 @@ classes = (
AddPresetTrackingSettings,
AddPresetTrackingTrackColor,
AddPresetUnitsLength,
+ AddPresetGpencilBrush,
ExecutePreset,
WM_MT_operator_presets,
)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index fc81b25db45..70d8c4089d3 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -30,6 +30,7 @@ from .properties_paint_common import (
brush_texpaint_common,
brush_mask_texture_settings,
)
+from bl_operators.presets import PresetMenu
class View3DPanel:
@@ -1433,6 +1434,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
bl_label = "Options"
bl_options = {'DEFAULT_CLOSED'}
+ def draw_header_preset(self, context):
+ VIEW3D_PT_gpencil_brush_presets.draw_panel_header(self.layout)
+
@staticmethod
def draw(self, context):
layout = self.layout
@@ -1711,6 +1715,15 @@ class VIEW3D_PT_tools_grease_pencil_weight_appearance(GreasePencilAppearancePane
bl_context = ".greasepencil_weight"
bl_label = "Appearance"
+
+class VIEW3D_PT_gpencil_brush_presets(PresetMenu):
+ """Brush settings"""
+ bl_label = "Brush Presets"
+ preset_subdir = "gpencil_brush"
+ preset_operator = "script.execute_preset"
+ preset_add_operator = "scene.gpencil_brush_preset_add"
+
+
classes = (
VIEW3D_PT_tools_meshedit_options,
VIEW3D_PT_tools_curveedit_options_stroke,
@@ -1741,6 +1754,7 @@ classes = (
VIEW3D_MT_tools_projectpaint_stencil,
VIEW3D_PT_tools_particlemode,
+ VIEW3D_PT_gpencil_brush_presets,
VIEW3D_PT_tools_grease_pencil_brush,
VIEW3D_PT_tools_grease_pencil_brush_option,
VIEW3D_PT_tools_grease_pencil_brush_settings,
More information about the Bf-blender-cvs
mailing list