Commit: 59670e999a436a05858495ef448f34447584856a Author: Antonioya Date: Thu Aug 16 11:24:28 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB59670e999a436a05858495ef448f34447584856a
GP: Add new presets for materials This allow create prests without import materials and include a requested predefined settings for Stroke only, Fill only and Stroke and Fill. =================================================================== A release/scripts/presets/gpencil_material/fill_only.py A release/scripts/presets/gpencil_material/stroke_and_fill.py A release/scripts/presets/gpencil_material/stroke_only.py M release/scripts/startup/bl_operators/presets.py M release/scripts/startup/bl_ui/properties_material_gpencil.py =================================================================== diff --git a/release/scripts/presets/gpencil_material/fill_only.py b/release/scripts/presets/gpencil_material/fill_only.py new file mode 100644 index 00000000000..00cf8663f41 --- /dev/null +++ b/release/scripts/presets/gpencil_material/fill_only.py @@ -0,0 +1,30 @@ +import bpy +material = bpy.context.object.active_material +gpcolor = material.grease_pencil + +gpcolor.mode = 'LINE' +gpcolor.stroke_style = 'SOLID' +gpcolor.color = (0.0, 0.0, 0.0, 0.0) +gpcolor.stroke_image = None +gpcolor.pixel_size = 100.0 +gpcolor.use_stroke_pattern = False +gpcolor.fill_style = 'SOLID' +gpcolor.fill_color = (0.5, 0.5, 0.5, 1.0) +gpcolor.fill_image = None +gpcolor.gradient_type = 'LINEAR' +gpcolor.mix_color = (1.0, 1.0, 1.0, 0.2) +gpcolor.mix_factor = 0.0 +gpcolor.flip = False +gpcolor.pattern_shift = (0.0, 0.0) +gpcolor.pattern_scale = (1.0, 1.0) +gpcolor.pattern_radius = 0.5 +gpcolor.pattern_angle = 0.0 +gpcolor.pattern_gridsize = 0.1 +gpcolor.use_fill_pattern = False +gpcolor.texture_offset = (0.0, 0.0) +gpcolor.texture_scale = (1.0, 1.0) +gpcolor.texture_angle = 0.0 +gpcolor.texture_opacity = 1.0 +gpcolor.texture_clamp = False +gpcolor.texture_mix = False +gpcolor.mix_factor = 0.0 diff --git a/release/scripts/presets/gpencil_material/stroke_and_fill.py b/release/scripts/presets/gpencil_material/stroke_and_fill.py new file mode 100644 index 00000000000..8c3aca4f829 --- /dev/null +++ b/release/scripts/presets/gpencil_material/stroke_and_fill.py @@ -0,0 +1,30 @@ +import bpy +material = bpy.context.object.active_material +gpcolor = material.grease_pencil + +gpcolor.mode = 'LINE' +gpcolor.stroke_style = 'SOLID' +gpcolor.color = (0.0, 0.0, 0.0, 1.0) +gpcolor.stroke_image = None +gpcolor.pixel_size = 100.0 +gpcolor.use_stroke_pattern = False +gpcolor.fill_style = 'SOLID' +gpcolor.fill_color = (0.5, 0.5, 0.5, 1.0) +gpcolor.fill_image = None +gpcolor.gradient_type = 'LINEAR' +gpcolor.mix_color = (1.0, 1.0, 1.0, 0.2) +gpcolor.mix_factor = 0.0 +gpcolor.flip = False +gpcolor.pattern_shift = (0.0, 0.0) +gpcolor.pattern_scale = (1.0, 1.0) +gpcolor.pattern_radius = 0.5 +gpcolor.pattern_angle = 0.0 +gpcolor.pattern_gridsize = 0.1 +gpcolor.use_fill_pattern = False +gpcolor.texture_offset = (0.0, 0.0) +gpcolor.texture_scale = (1.0, 1.0) +gpcolor.texture_angle = 0.0 +gpcolor.texture_opacity = 1.0 +gpcolor.texture_clamp = False +gpcolor.texture_mix = False +gpcolor.mix_factor = 0.0 diff --git a/release/scripts/presets/gpencil_material/stroke_only.py b/release/scripts/presets/gpencil_material/stroke_only.py new file mode 100644 index 00000000000..04262593275 --- /dev/null +++ b/release/scripts/presets/gpencil_material/stroke_only.py @@ -0,0 +1,30 @@ +import bpy +material = bpy.context.object.active_material +gpcolor = material.grease_pencil + +gpcolor.mode = 'LINE' +gpcolor.stroke_style = 'SOLID' +gpcolor.color = (0.0, 0.0, 0.0, 1.0) +gpcolor.stroke_image = None +gpcolor.pixel_size = 100.0 +gpcolor.use_stroke_pattern = False +gpcolor.fill_style = 'SOLID' +gpcolor.fill_color = (0.5, 0.5, 0.5, 0.0) +gpcolor.fill_image = None +gpcolor.gradient_type = 'LINEAR' +gpcolor.mix_color = (1.0, 1.0, 1.0, 0.2) +gpcolor.mix_factor = 0.0 +gpcolor.flip = False +gpcolor.pattern_shift = (0.0, 0.0) +gpcolor.pattern_scale = (1.0, 1.0) +gpcolor.pattern_radius = 0.5 +gpcolor.pattern_angle = 0.0 +gpcolor.pattern_gridsize = 0.1 +gpcolor.use_fill_pattern = False +gpcolor.texture_offset = (0.0, 0.0) +gpcolor.texture_scale = (1.0, 1.0) +gpcolor.texture_angle = 0.0 +gpcolor.texture_opacity = 1.0 +gpcolor.texture_clamp = False +gpcolor.texture_mix = False +gpcolor.mix_factor = 0.0 diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 0fe45f8fee3..59697db0ae3 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -706,6 +706,49 @@ class AddPresetGpencilBrush(AddPresetBase, Operator): preset_subdir = "gpencil_brush" +class AddPresetGpencilMaterial(AddPresetBase, Operator): + """Add or remove grease pencil material preset""" + bl_idname = "scene.gpencil_material_preset_add" + bl_label = "Add Grease Pencil Material Preset" + preset_menu = "MATERIAL_PT_gpencil_material_presets" + + preset_defines = [ + "material = bpy.context.object.active_material", + "gpcolor = material.grease_pencil" + ] + + preset_values = [ + "gpcolor.mode", + "gpcolor.stroke_style", + "gpcolor.color", + "gpcolor.stroke_image", + "gpcolor.pixel_size", + "gpcolor.use_stroke_pattern", + "gpcolor.fill_style", + "gpcolor.fill_color", + "gpcolor.fill_image", + "gpcolor.gradient_type", + "gpcolor.mix_color", + "gpcolor.mix_factor", + "gpcolor.flip", + "gpcolor.pattern_shift", + "gpcolor.pattern_scale", + "gpcolor.pattern_radius", + "gpcolor.pattern_angle", + "gpcolor.pattern_gridsize", + "gpcolor.use_fill_pattern", + "gpcolor.texture_offset", + "gpcolor.texture_scale", + "gpcolor.texture_angle", + "gpcolor.texture_opacity", + "gpcolor.texture_clamp", + "gpcolor.texture_mix", + "gpcolor.mix_factor", + ] + + preset_subdir = "gpencil_material" + + classes = ( AddPresetCamera, AddPresetCloth, @@ -723,6 +766,7 @@ classes = ( AddPresetTrackingTrackColor, AddPresetUnitsLength, AddPresetGpencilBrush, + AddPresetGpencilMaterial, ExecutePreset, WM_MT_operator_presets, ) diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index d83639a361c..cabd6e5677a 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel +from bl_operators.presets import PresetMenu class GPENCIL_MT_color_specials(Menu): @@ -165,6 +166,9 @@ class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel): return ob and ob.type == 'GPENCIL' + def draw_header_preset(self, context): + MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout) + @staticmethod def draw(self, context): layout = self.layout @@ -302,12 +306,20 @@ class MATERIAL_PT_gpencil_options(GPMaterialButtonsPanel, Panel): gpcolor = ma.grease_pencil layout.prop(gpcolor, "pass_index") +class MATERIAL_PT_gpencil_material_presets(PresetMenu): + """Material settings""" + bl_label = "Material Presets" + preset_subdir = "gpencil_material" + preset_operator = "script.execute_preset" + preset_add_operator = "scene.gpencil_material_preset_add" + classes = ( GPENCIL_UL_matslots, GPENCIL_MT_color_specials, MATERIAL_PT_gpencil_slots, MATERIAL_PT_gpencil_preview, + MATERIAL_PT_gpencil_material_presets, MATERIAL_PT_gpencil_surface, MATERIAL_PT_gpencil_strokecolor, MATERIAL_PT_gpencil_fillcolor, _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs