[Bf-blender-cvs] [aed1892c24d] greasepencil-object: Code Cleanup: Move panel definitions for Palette-based colors to the Material panels file

Joshua Leung noreply at git.blender.org
Wed Oct 4 14:17:09 CEST 2017


Commit: aed1892c24d9671e34853a52f072da0cd258d898
Author: Joshua Leung
Date:   Wed Oct 4 00:16:50 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBaed1892c24d9671e34853a52f072da0cd258d898

Code Cleanup: Move panel definitions for Palette-based colors to the Material panels file

Annotations (GP in 2D editors) will not be using this stuff,
as they will not have most of the fancy drawing options (as
they are based on the traditional 2D api instead).

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/properties_material_gpencil.py

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index bb84cfae026..034ee2d2c23 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -1484,250 +1484,16 @@ class GreasePencilInfoPanel:
 
 ###############################
 
+# XXX: Placeholder - Annotation views shouldn't use this anymore...
 class GreasePencilPaletteColorPanel:
-    # subclass must set
     bl_label = "Grease Pencil Colors"
-    bl_category = "Grease Pencil"
     bl_region_type = 'TOOLS'
-    bl_options = {'HIDE_HEADER'}
     
     @staticmethod
-    def paint_settings(context):
-        toolsettings = context.tool_settings
-
-        if context.sculpt_object:
-            return toolsettings.sculpt
-        elif context.vertex_paint_object:
-            return toolsettings.vertex_paint
-        elif context.weight_paint_object:
-            return toolsettings.weight_paint
-        elif context.image_paint_object:
-            if (toolsettings.image_paint and toolsettings.image_paint.detect_data()):
-                return toolsettings.image_paint
-
-            return toolsettings.image_paint
-
-        return toolsettings.image_paint
-
-    @classmethod
-    def poll(cls, context):
-        paint = cls.paint_settings(context)
-        if paint is None:
-            return False
-        else:
-            return True
-
-    @staticmethod
-    def draw(self, context):
-        layout = self.layout
-        palette = context.active_palette
-        paint = self.paint_settings(context)
-
-        row = layout.row()
-        row.template_ID(paint, "palette", new="palette.new_gpencil")
-
-        if palette:
-            row = layout.row()
-            col = row.column()
-            if len(palette.colors) >= 2:
-                color_rows = 5
-            else:
-                color_rows = 2
-            col.template_list("GPENCIL_UL_palettecolor", "", palette, "colors", palette, "active_index",
-                              rows=color_rows)
-
-            col = row.column()
-
-            sub = col.column(align=True)
-            sub.operator("palette.color_add", icon='ZOOMIN', text="").grease_pencil = True
-            sub.operator("palette.color_delete", icon='ZOOMOUT', text="")
-
-            palcol = context.active_palettecolor
-            if palcol:
-                sub.menu("GPENCIL_MT_palettecolor_specials", icon='DOWNARROW_HLT', text="")
-
-            if len(palette.colors) > 1:
-                col.separator()
-
-                sub = col.column(align=True)
-                sub.operator("palette.palettecolor_move", icon='TRIA_UP', text="").direction = 'UP'
-                sub.operator("palette.palettecolor_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
-
-                col.separator()
-
-                sub = col.column(align=True)
-                sub.operator("palette.palettecolor_isolate", icon='LOCKED', text="").affect_visibility = False
-                sub.operator("palette.palettecolor_isolate", icon='RESTRICT_VIEW_OFF', text="").affect_visibility = True
-
-            row = layout.row()
-            row.operator_menu_enum("gpencil.stroke_change_palette", text="Change Palette...", property="type")
-
-
-class GreasePencilPaletteStrokePanel:
-    # subclass must set
-    bl_label = "Stroke"
-    bl_category = "Grease Pencil"
-    bl_region_type = 'TOOLS'
-
-    @staticmethod
-    def paint_settings(context):
-        toolsettings = context.tool_settings
-
-        if context.sculpt_object:
-            return toolsettings.sculpt
-        elif context.vertex_paint_object:
-            return toolsettings.vertex_paint
-        elif context.weight_paint_object:
-            return toolsettings.weight_paint
-        elif context.image_paint_object:
-            if (toolsettings.image_paint and toolsettings.image_paint.detect_data()):
-                return toolsettings.image_paint
-
-            return toolsettings.image_paint
-
-        return toolsettings.image_paint
-
-    @classmethod
-    def poll(cls, context):
-        paint = cls.paint_settings(context)
-        palcol = context.active_palettecolor
-        if paint is None or palcol is None:
-            return False
-        else:
-            return True
-
-    @staticmethod
     def draw(self, context):
         layout = self.layout
-        palette = context.active_palette
-        pcolor = palette.colors.active
-
-        split = layout.split(percentage=1.0)
-        split.active = not pcolor.lock
-
-        col = split.column(align=True)
-        col.enabled = not pcolor.lock
-        col.prop(pcolor, "stroke_style", text="")
-
-        if pcolor.stroke_style == 'TEXTURE':
-            row = layout.row()
-            row.enabled = not pcolor.lock
-            col = row.column(align=True)
-            col.template_ID(pcolor, "stroke_image", open="image.open")
-            col.prop(pcolor, "use_pattern", text="Use as Pattern")
-
-        if pcolor.stroke_style == 'SOLID' or pcolor.use_pattern is True:
-            row = layout.row()
-            col = row.column(align=True)
-            col.prop(pcolor, "color", text="")
-            col.prop(pcolor, "alpha", slider=True)
-
-        row = layout.row(align=True)
-        row.enabled = not pcolor.lock
-        row.prop(pcolor, "use_dot", text="Dots")
-
-        # Options
-        row = layout.row()
-        row.active = not pcolor.lock
-        row.prop(pcolor, "pass_index")
-
-
-class GreasePencilPaletteFillPanel:
-    # subclass must set
-    bl_label = "Fill"
-    bl_category = "Grease Pencil"
-    bl_region_type = 'TOOLS'
-
-    @staticmethod
-    def paint_settings(context):
-        toolsettings = context.tool_settings
-
-        if context.sculpt_object:
-            return toolsettings.sculpt
-        elif context.vertex_paint_object:
-            return toolsettings.vertex_paint
-        elif context.weight_paint_object:
-            return toolsettings.weight_paint
-        elif context.image_paint_object:
-            if (toolsettings.image_paint and toolsettings.image_paint.detect_data()):
-                return toolsettings.image_paint
-
-            return toolsettings.image_paint
-
-        return toolsettings.image_paint
-
-    @classmethod
-    def poll(cls, context):
-        paint = cls.paint_settings(context)
-        palcol = context.active_palettecolor
-        if paint is None or palcol is None:
-            return False
-        else:
-            return True
-
-    @staticmethod
-    def draw(self, context):
-        layout = self.layout
-        palette = context.active_palette
-        pcolor = palette.colors.active
-
-        # color settings
-        split = layout.split(percentage=1.0)
-        split.active = not pcolor.lock
-
-        row = layout.row()
-        col = row.column(align=True)
-        col.enabled = not pcolor.lock
-        col.prop(pcolor, "fill_style", text="")
-
-        row = layout.row()
-        col = row.column(align=True)
-
-        if pcolor.fill_style != 'TEXTURE':
-            col.prop(pcolor, "fill_color", text="")
-            col.prop(pcolor, "fill_alpha", text="Opacity", slider=True)
-            col.separator()
-            if pcolor.texture_mix is True or pcolor.fill_style in ('GRADIENT', 'RADIAL'):
-                col.prop(pcolor, "mix_factor", text="Mix", slider=True)
-
-        if pcolor.fill_style in ('GRADIENT', 'RADIAL', 'CHESSBOARD'):
-            if pcolor.texture_mix is False or pcolor.fill_style == 'CHESSBOARD':
-                col.prop(pcolor, "mix_color", text="")
-            split = col.split(percentage=0.5)
-            subcol = split.column(align=True)
-            subcol.prop(pcolor, "pattern_shift", text="Location")
-            subrow = subcol.row(align=True)
-            if pcolor.fill_style == 'RADIAL':
-                subrow.enabled = False
-            subrow.prop(pcolor, "pattern_angle", text="Angle")
-            subcol.prop(pcolor, "flip", text="Flip")
-
-            subcol = split.column(align=True)
-            subcol.prop(pcolor, "pattern_scale", text="Scale")
-            subrow = subcol.row(align=True)
-            if pcolor.fill_style != 'RADIAL':
-                subrow.enabled = False
-            subrow.prop(pcolor, "pattern_radius", text="Radius")
-            subrow = subcol.row(align=True)
-            if pcolor.fill_style != 'CHESSBOARD':
-                subrow.enabled = False
-            subrow.prop(pcolor, "pattern_boxsize", text="Box")
-
-        col.separator()
-        col.label("Texture")
-        if pcolor.fill_style not in ('TEXTURE', 'PATTERN'):
-            col.prop(pcolor, "texture_mix", text="Mix Texture")
-        if pcolor.fill_style in ('TEXTURE', 'PATTERN') or pcolor.texture_mix is True:
-            col.template_ID(pcolor, "fill_image", open="image.open")
-            split = col.split(percentage=0.5)
-            subcol = split.column(align=True)
-            subcol.prop(pcolor, "texture_shift", text="Location")
-            subcol.prop(pcolor, "texture_angle")
-            subcol.prop(pcolor, "texture_clamp", text="Clip Image")
-            subcol = split.column(align=True)
-            subcol.prop(pcolor, "texture_scale", text="Scale")
-            subcol.prop(pcolor, "texture_opacity")
-
+        
+        layout.label("Placeholder")
 
 ###############################
 
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 01ee5c31063..d60264f33eb 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -19,11 +19,6 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Panel
-from bl_ui.properties_grease_pencil_common import (
-        GreasePencilPaletteColorPanel,
-        GreasePencilPaletteStrokePanel,
-        GreasePencilPaletteFillPanel
-)
 
 
 class MaterialButtonsPanel:
@@ -36,18 +31,83 @@ class MaterialButtonsPanel:
         return context.object and context.object.type == 'GPENCIL'
 
 
-class MATERIAL_PT_gpencil_palettecolor(GreasePencilPale

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list