Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2020-02-01 05:25:32 +0300
committerYimingWu <xp8110@outlook.com>2020-02-01 05:25:32 +0300
commitb47883a990ee68e659a8a8b44729be9b8e0d002f (patch)
tree24a7733807992fc84445d30b63deaedfe1ab40a1 /release/scripts/startup/bl_ui/properties_grease_pencil_common.py
parentb5abbc40a07041af91dca5d0a4acd8e5f1518c91 (diff)
parentd9ec25844b4ac3143775615469fe69b27105c108 (diff)
Merge remote-tracking branch 'origin/master' into temp-lanpr-review
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_grease_pencil_common.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_grease_pencil_common.py193
1 files changed, 46 insertions, 147 deletions
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 5fa98c533c3..45cb10bb3bd 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -131,122 +131,6 @@ class AnnotationDrawingToolsPanel:
gpencil_stroke_placement_settings(context, col)
-class GreasePencilStrokeEditPanel:
- # subclass must set
- # bl_space_type = 'IMAGE_EDITOR'
- bl_label = "Edit Strokes"
- bl_category = "Tools"
- bl_region_type = 'TOOLS'
-
- @classmethod
- def poll(cls, context):
- if context.gpencil_data is None:
- return False
-
- gpd = context.gpencil_data
- return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode)
-
- def draw(self, context):
- layout = self.layout
-
- is_3d_view = context.space_data.type == 'VIEW_3D'
-
- if not is_3d_view:
- layout.label(text="Select:")
- col = layout.column(align=True)
- col.operator("gpencil.select_all", text="Select All")
- col.operator("gpencil.select_box")
- col.operator("gpencil.select_circle")
-
- layout.separator()
-
- col = layout.column(align=True)
- col.operator("gpencil.select_linked")
- col.operator("gpencil.select_more")
- col.operator("gpencil.select_less")
- col.operator("gpencil.select_alternate")
-
- layout.label(text="Edit:")
- row = layout.row(align=True)
- row.operator("gpencil.copy", text="Copy")
- row.operator("gpencil.paste", text="Paste").type = 'ACTIVE'
- row.operator("gpencil.paste", text="Paste by Layer").type = 'LAYER'
-
- col = layout.column(align=True)
- col.operator("gpencil.delete")
- col.operator("gpencil.duplicate_move", text="Duplicate")
- if is_3d_view:
- col.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
- col.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps...", property="type")
-
- layout.separator()
-
- if not is_3d_view:
- col = layout.column(align=True)
- col.operator("transform.translate") # icon='MAN_TRANS'
- col.operator("transform.rotate") # icon='MAN_ROT'
- col.operator("transform.resize", text="Scale") # icon='MAN_SCALE'
-
- layout.separator()
-
- layout.separator()
- col = layout.column(align=True)
- col.operator_menu_enum("gpencil.stroke_arrange", text="Arrange Strokes...", property="direction")
- col.operator("gpencil.stroke_change_color", text="Assign Material")
-
- layout.separator()
- col = layout.column(align=True)
- col.operator("gpencil.stroke_subdivide", text="Subdivide")
- row = col.row(align=True)
- row.operator("gpencil.stroke_simplify_fixed", text="Simplify")
- row.operator("gpencil.stroke_simplify", text="Adaptive")
- row.operator("gpencil.stroke_trim", text="Trim")
-
- col.separator()
-
- row = col.row(align=True)
- row.operator("gpencil.stroke_merge", text="Merge")
- row.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
- row.operator("gpencil.stroke_join", text="& Copy").type = 'JOINCOPY'
-
- col.operator("gpencil.stroke_flip", text="Flip Direction")
-
- if is_3d_view:
- layout.separator()
-
- col = layout.column(align=True)
- col.operator_menu_enum("gpencil.stroke_separate", text="Separate...", property="mode")
- col.operator("gpencil.stroke_split", text="Split")
-
- col = layout.column(align=True)
- col.label(text="Cleanup:")
- col.operator_menu_enum("gpencil.reproject", text="Reproject Strokes...", property="type")
- col.operator_menu_enum("gpencil.frame_clean_fill", text="Clean Boundary Strokes...", property="mode")
-
-
-class GreasePencilStrokeSculptPanel:
- # subclass must set
- # bl_space_type = 'IMAGE_EDITOR'
- bl_label = "Sculpt Strokes"
- bl_category = "Tools"
-
- def draw(self, context):
- layout = self.layout
- layout.use_property_split = True
- layout.use_property_decorate = False
-
- settings = context.tool_settings.gpencil_sculpt
- brush = settings.brush
-
- layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
-
- if not self.is_popover:
- from bl_ui.properties_paint_common import (
- brush_basic_gpencil_sculpt_settings,
- )
- brush_basic_gpencil_sculpt_settings(layout, context, brush)
-
-
class GreasePencilSculptOptionsPanel:
bl_label = "Sculpt Strokes"
@@ -278,14 +162,36 @@ class GreasePencilSculptOptionsPanel:
# GP Object Tool Settings
-class GreasePencilAppearancePanel:
- bl_label = "Brush Appearance"
+class GreasePencilDisplayPanel:
+ bl_label = "Brush Tip"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
ob = context.active_object
- return ob and ob.type == 'GPENCIL'
+ brush = context.tool_settings.gpencil_paint.brush
+ if ob and ob.type == 'GPENCIL' and brush:
+ if context.mode == 'PAINT_GPENCIL':
+ return brush.gpencil_tool != 'ERASE'
+ else:
+ # GP Sculpt and Weight Paint always have Brush Tip panel.
+ return True
+ return False
+
+ def draw_header(self, context):
+ if self.is_popover:
+ return
+
+ if context.mode == 'PAINT_GPENCIL':
+ brush = context.tool_settings.gpencil_paint.brush
+ gp_settings = brush.gpencil_settings
+
+ self.layout.prop(gp_settings, "use_cursor", text="")
+ elif context.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
+ settings = context.tool_settings.gpencil_sculpt
+ brush = settings.brush
+
+ self.layout.prop(brush, "use_cursor", text="")
def draw(self, context):
layout = self.layout
@@ -299,42 +205,36 @@ class GreasePencilAppearancePanel:
brush = tool_settings.gpencil_paint.brush
gp_settings = brush.gpencil_settings
- sub = layout.column(align=True)
- sub.enabled = not brush.use_custom_icon
- sub.prop(gp_settings, "gp_icon", text="Icon")
+ if self.is_popover:
+ row = layout.row(align=True)
+ row.prop(gp_settings, "use_cursor", text="")
+ row.label(text="Display Cursor")
- layout.prop(brush, "use_custom_icon")
- sub = layout.column()
- sub.active = brush.use_custom_icon
- sub.prop(brush, "icon_filepath", text="")
-
- layout.prop(gp_settings, "use_cursor", text="Show Brush")
+ col = layout.column(align=True)
+ col.active = gp_settings.use_cursor
if brush.gpencil_tool == 'DRAW':
- layout.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
+ col.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
if brush.gpencil_tool == 'FILL':
- layout.prop(brush, "cursor_color_add", text="Color")
+ col.prop(brush, "cursor_color_add", text="Cursor Color")
elif ob.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
settings = tool_settings.gpencil_sculpt
brush = settings.brush
tool = settings.sculpt_tool
+ if self.is_popover:
+ row = layout.row(align=True)
+ row.prop(brush, "use_cursor", text="")
+ row.label(text="Display Cursor")
+
col = layout.column(align=True)
- col.prop(brush, "use_cursor", text="Show Brush")
-
- if tool in {'THICKNESS', 'STRENGTH'}:
- col.prop(brush, "cursor_color_add", text="Add")
- col.prop(brush, "cursor_color_sub", text="Subtract")
- elif tool == 'PINCH':
- col.prop(brush, "cursor_color_add", text="Pinch")
- col.prop(brush, "cursor_color_sub", text="Inflate")
- elif tool == 'TWIST':
- col.prop(brush, "cursor_color_add", text="CCW")
- col.prop(brush, "cursor_color_sub", text="CW")
- else:
- col.prop(brush, "cursor_color_add", text="")
+ col.active = brush.use_cursor
+
+ col.prop(brush, "cursor_color_add", text="Cursor Color")
+ if tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
+ col.prop(brush, "cursor_color_sub", text="Inverse Cursor Color")
class GPENCIL_MT_pie_tool_palette(Menu):
@@ -601,7 +501,7 @@ class GPENCIL_MT_move_to_layer(Menu):
gpl_active = context.active_gpencil_layer
tot_layers = len(gpd.layers)
i = tot_layers - 1
- while(i >= 0):
+ while i >= 0:
gpl = gpd.layers[i]
if gpl.info == gpl_active.info:
icon = 'GREASEPENCIL'
@@ -811,12 +711,11 @@ class GreasePencilToolsPanel:
bl_options = {'DEFAULT_CLOSED'}
@classmethod
- def poll(cls, context):
+ def poll(cls, _context):
# XXX - disabled in 2.8 branch.
+ # return (context.gpencil_data is not None)
return False
- return (context.gpencil_data is not None)
-
def draw(self, context):
layout = self.layout