[Bf-blender-cvs] [ec963d9d7d1] master: UI: Grease Pencil Modifier Drag and Drop, Layout Changes

Hans Goudey noreply at git.blender.org
Fri Jun 19 20:42:15 CEST 2020


Commit: ec963d9d7d179e3ba12f5bdf748818939c2f17d8
Author: Hans Goudey
Date:   Fri Jun 19 14:42:08 2020 -0400
Branches: master
https://developer.blender.org/rBec963d9d7d179e3ba12f5bdf748818939c2f17d8

UI: Grease Pencil Modifier Drag and Drop, Layout Changes

This patch implements the list panel system D7490 for grease pencil
modifiers. It also moves their drawing to a callback in
GpencilModifierTypeInfo in line with the extensible architecture
refactoring goal T75724.

This also adds the "set_error" function for grease pencil modifiers,
which hadn't been copied from mesh modifiers yet.

The implementation is basically exactly the same as for the modifier
patch (9b099c86123fc82).

Thanks to Matias Mendiola (mendio) for providing mockups for many
of the layout changes.

Differential Revision: https://developer.blender.org/D7978

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/blenkernel/BKE_gpencil_modifier.h
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/editors/include/ED_object.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/object/object_gpencil_modifier.c
M	source/blender/editors/object/object_intern.h
M	source/blender/editors/object/object_ops.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/gpencil_modifiers/CMakeLists.txt
A	source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
A	source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c
M	source/blender/makesrna/intern/rna_ui_api.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e7536838199..d464a3ffc6b 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -46,13 +46,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
     bl_label = "Modifiers"
 
-    def check_conflicts(self, layout, ob):
-        for md in ob.grease_pencil_modifiers:
-            if md.type == 'GP_TIME':
-                row = layout.row()
-                row.label(text="Build and Time Offset modifier not compatible", icon='ERROR')
-                break
-
     @classmethod
     def poll(cls, context):
         ob = context.object
@@ -60,483 +53,8 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
-
-        ob = context.object
-
         layout.operator_menu_enum("object.gpencil_modifier_add", "type")
-
-        for md in ob.grease_pencil_modifiers:
-            box = layout.template_greasepencil_modifier(md)
-            if box:
-                # match enum type to our functions, avoids a lookup table.
-                getattr(self, md.type)(box, ob, md)
-
-    # the mt.type enum is (ab)used for a lookup on function names
-    # ...to avoid lengthy if statements
-    # so each type must have a function here.
-
-    def gpencil_masking(self, layout, ob, md, use_vertex, use_curve=False):
-        gpd = ob.data
-        layout.separator()
-        layout.label(text="Influence Filters:")
-
-        split = layout.split(factor=0.25)
-
-        col1 = split.column()
-
-        col1.label(text="Layer:")
-        col1.label(text="Material:")
-        if use_vertex:
-            col1.label(text="Vertex Group:")
-
-        col2 = split.column()
-
-        split = col2.split(factor=0.6)
-        row = split.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-
-        row = split.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        split = col2.split(factor=0.6)
-
-        row = split.row(align=True)
-
-        valid = md.material in (slot.material for slot in ob.material_slots) or md.material is None
-        if valid:
-            icon = 'SHADING_TEXTURE'
-        else:
-            icon = 'ERROR'
-
-        row.alert = not valid
-        row.prop_search(md, "material", gpd, "materials", text="", icon=icon)
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-
-        row = split.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        if use_vertex:
-            row = col2.row(align=True)
-            row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-            row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
-
-        if use_curve:
-            col = layout.column()
-            col.separator()
-            col.prop(md, "use_custom_curve")
-            if md.use_custom_curve:
-                col.template_curve_mapping(md, "curve")
-
-    def GP_NOISE(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        row = col.row(align=True)
-        row.prop(md, "factor", text="Position")
-        row = col.row(align=True)
-        row.prop(md, "factor_strength", text="Strength")
-        row = col.row(align=True)
-        row.prop(md, "factor_thickness", text="Thickness")
-        row = col.row(align=True)
-        row.prop(md, "factor_uvs", text="UV")
-
-        col.separator()
-        row = col.row(align=True)
-        row.prop(md, "random", text="", icon='TIME', toggle=True)
-
-        subrow = row.row(align=True)
-        subrow.enabled = md.random
-        subrow.prop(md, "step")
-        subrow.prop(md, "seed")
-
-        col.separator()
-        col.prop(md, "noise_scale")
-
-        self.gpencil_masking(layout, ob, md, True, True)
-
-    def GP_SMOOTH(self, layout, ob, md):
-        col = layout.column()
-        col.prop(md, "factor")
-        col.prop(md, "step", text="Repeat")
-
-        col.label(text="Affect:")
-        row = col.row(align=True)
-        row.prop(md, "use_edit_position", text="Position", toggle=True)
-        row.prop(md, "use_edit_strength", text="Strength", toggle=True)
-        row.prop(md, "use_edit_thickness", text="Thickness", toggle=True)
-        row.prop(md, "use_edit_uv", text="UV", toggle=True)
-
-        self.gpencil_masking(layout, ob, md, True, True)
-
-    def GP_SUBDIV(self, layout, ob, md):
-        layout.row().prop(md, "subdivision_type", expand=True)
-        split = layout.split()
-        col = split.column()
-        row = col.row(align=True)
-        row.prop(md, "level", text="Subdivisions")
-
-        self.gpencil_masking(layout, ob, md, False)
-
-    def GP_SIMPLIFY(self, layout, ob, md):
-        gpd = ob.data
-
-        row = layout.row()
-        row.prop(md, "mode")
-
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Settings:")
-
-        if md.mode == 'FIXED':
-            col.prop(md, "step")
-        elif md.mode == 'ADAPTIVE':
-            col.prop(md, "factor")
-        elif md.mode == 'SAMPLE':
-            col.prop(md, "length")
-        elif md.mode == 'MERGE':
-            col.prop(md, "distance")
-
-        self.gpencil_masking(layout, ob, md, False)
-
-    def GP_THICK(self, layout, ob, md):
-        col = layout.column()
-
-        col.prop(md, "normalize_thickness")
-
-        if md.normalize_thickness:
-            col.prop(md, "thickness")
-        else:
-            col.prop(md, "thickness_factor")
-
-        self.gpencil_masking(layout, ob, md, True, True)
-
-    def GP_TEXTURE(self, layout, ob, md):
-        col = layout.column()
-
-        col.prop(md, "mode")
-        if md.mode in {'STROKE', 'STROKE_AND_FILL'}:
-            col.label(text="Stroke Texture:")
-            col.prop(md, "fit_method")
-            col.prop(md, "uv_offset")
-            col.prop(md, "uv_scale")
-
-        if md.mode == 'STROKE_AND_FILL':
-            col.separator()
-
-        if md.mode in {'FILL', 'STROKE_AND_FILL'}:
-            col.label(text="Fill Texture:")
-            col.prop(md, "fill_rotation", text="Rotation")
-            col.prop(md, "fill_offset", text="Location")
-            col.prop(md, "fill_scale", text="Scale")
-
-        self.gpencil_masking(layout, ob, md, True)
-
-    def GP_TINT(self, layout, ob, md):
-        layout.row().prop(md, "tint_type", expand=True)
-
-        if md.tint_type == 'UNIFORM':
-            col = layout.column()
-            col.prop(md, "color")
-
-            col.separator()
-            col.prop(md, "factor")
-
-        if md.tint_type == 'GRADIENT':
-            col = layout.column()
-            col.label(text="Colors:")
-            col.template_color_ramp(md, "colors")
-
-            col.separator()
-
-            col.label(text="Object:")
-            col.prop(md, "object", text="")
-
-            col.separator()
-            row = col.row(align=True)
-            row.prop(md, "radius")
-            row.prop(md, "factor")
-
-        col.separator()
-        col.prop(md, "vertex_mode")
-
-        self.gpencil_masking(layout, ob, md, True, True)
-
-    def GP_TIME(self, layout, ob, md):
-        gpd = ob.data
-
-        row = layout.row()
-        row.prop(md, "mode", text="Mode")
-
-        row = layout.row()
-        if md.mode == 'FIX':
-            txt = "Frame"
-        else:
-            txt = "Frame Offset"
-        row.prop(md, "offset", text=txt)
-
-        row = layout.row()
-        row.enabled = md.mode != 'FIX'
-        row.prop(md, "frame_scale")
-
-        row = layout.row()
-        row.separator()
-
-        row = layout.row()
-        row.enabled = md.mode != 'FIX'
-        row.prop(md, "use_custom_frame_range")
-
-        row = layout.row(align=True)
-        row.enabled = md.mode != 'FIX' and md.use_custom_frame_range is True
-        row.prop(md, "frame_start")
-        row.prop(md, "frame_end")
-
-        row = layout.row()
-        row.enabled = md.mode != 'FIX'
-        row.prop(md, "use_keep_loop")
-
-        row = layout.row()
-        row.label(text="Layer:")
-        row = layout.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
-
-    def GP_COLOR(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Color:")
-        col.prop(md, "hue", text="H", slider=True)
-        col.prop(md, "saturation", text="S", slider=True)
-        col.prop(md, "value", text="V", slider=True)
-
-        row = layout.row()
-        row.prop(md, "modify_color")
-
-        self.gpencil_masking(layout, ob, md, False, True)
-
-    def GP_OPACITY(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.prop(md, "modify_color")
-
-        if md.modify_color == 'HARDNESS':
-            col.prop(md, "hardness")
-            show = False
-        else:
-            col.prop(md, "normalize_opacity")
-            if md.normalize_opacity is True:
-                text="Strength"
-            else:
-                text="Opacity Factor"
-
-            col.prop(md, "factor", text=text)
-            show = True
-        self.gpencil_masking(layout, ob, md, show, show)
-
-    def GP_ARRAY(self, layout, ob, md):
-        col = layout.column()
-        col.prop(md, "count")
-
-        split = layout.split()
-        col = split.column()
-        col.prop(md, "use_constant_offset", text="Constant Offset")
-        subcol = col.column()
-        subcol.enabled = md.use_constant_of

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list