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.
This commit is contained in:
parent
02e9dba07b
commit
59670e999a
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue