Cleanup: Grease Pencil: Remove legacy UI code
Remove stale legacy python UI code, not used anymore by new grease pencil structure. Pull Request: https://projects.blender.org/blender/blender/pulls/135507
This commit is contained in:
committed by
Pratik Borhade
parent
a599ce0908
commit
08cf64315d
@@ -90,13 +90,13 @@ class GreasePencilDisplayPanel:
|
||||
return
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
if context.mode == 'PAINT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
elif context.mode == 'SCULPT_GPENCIL':
|
||||
elif context.mode == 'SCULPT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
|
||||
elif context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode in {'VERTEX_GPENCIL', 'VERTEX_GREASE_PENCIL'}:
|
||||
elif context.mode == 'VERTEX_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
brush = settings.brush
|
||||
if brush:
|
||||
@@ -108,13 +108,13 @@ class GreasePencilDisplayPanel:
|
||||
layout.use_property_decorate = False
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
if context.mode in {'PAINT_GPENCIL', 'PAINT_GREASE_PENCIL'}:
|
||||
if context.mode == 'PAINT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
elif context.mode in {'SCULPT_GPENCIL', 'SCULPT_GREASE_PENCIL'}:
|
||||
elif context.mode == 'SCULPT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
|
||||
elif context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode in {'VERTEX_GPENCIL', 'VERTEX_GREASE_PENCIL'}:
|
||||
elif context.mode == 'VERTEX_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
brush = settings.brush
|
||||
gp_settings = brush.gpencil_settings
|
||||
@@ -162,13 +162,13 @@ class GreasePencilBrushFalloff:
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
settings = None
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
if context.mode == 'PAINT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
if context.mode == 'SCULPT_GPENCIL':
|
||||
if context.mode == 'SCULPT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
elif context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode == 'VERTEX_GPENCIL':
|
||||
elif context.mode == 'VERTEX_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
|
||||
if settings:
|
||||
@@ -442,7 +442,7 @@ class GreasePencilMaterialsPanel:
|
||||
|
||||
col.separator()
|
||||
|
||||
col.menu("GPENCIL_MT_material_context_menu", icon='DOWNARROW_HLT', text="")
|
||||
col.menu("GREASE_PENCIL_MT_material_context_menu", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
if is_sortable:
|
||||
col.separator()
|
||||
@@ -501,38 +501,6 @@ class GreasePencilMaterialsPanel:
|
||||
row.template_ID(space, "pin_id")
|
||||
|
||||
|
||||
class GPENCIL_UL_layer(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, _icon, _active_data, _active_propname, _index):
|
||||
# assert(isinstance(item, bpy.types.GPencilLayer)
|
||||
gpl = item
|
||||
if gpl.lock:
|
||||
layout.active = False
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(
|
||||
text="",
|
||||
icon='BONE_DATA' if gpl.is_parented else 'BLANK1',
|
||||
)
|
||||
row.prop(gpl, "info", text="", emboss=False)
|
||||
|
||||
row = layout.row(align=True)
|
||||
|
||||
icon_mask = 'CLIPUV_DEHLT' if gpl.use_mask_layer else 'CLIPUV_HLT'
|
||||
|
||||
row.prop(gpl, "use_mask_layer", text="", icon=icon_mask, emboss=False)
|
||||
|
||||
subrow = row.row(align=True)
|
||||
subrow.prop(
|
||||
gpl,
|
||||
"use_onion_skinning",
|
||||
text="",
|
||||
icon='ONIONSKIN_ON' if gpl.use_onion_skinning else 'ONIONSKIN_OFF',
|
||||
emboss=False,
|
||||
)
|
||||
row.prop(gpl, "hide", text="", emboss=False)
|
||||
row.prop(gpl, "lock", text="", emboss=False)
|
||||
|
||||
|
||||
class GreasePencilSimplifyPanel:
|
||||
|
||||
def draw_header(self, context):
|
||||
@@ -557,162 +525,6 @@ class GreasePencilSimplifyPanel:
|
||||
col.prop(rd, "simplify_gpencil_antialiasing")
|
||||
|
||||
|
||||
class GreasePencilLayerTransformPanel:
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
gpd = ob.data
|
||||
gpl = gpd.layers.active
|
||||
layout.active = not gpl.lock
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(gpl, "location")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(gpl, "rotation")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(gpl, "scale")
|
||||
|
||||
|
||||
class GreasePencilLayerAdjustmentsPanel:
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
gpd = ob.data
|
||||
gpl = gpd.layers.active
|
||||
layout.active = not gpl.lock
|
||||
|
||||
# Layer options
|
||||
# Offsets - Color Tint
|
||||
layout.enabled = not gpl.lock
|
||||
col = layout.column(align=True)
|
||||
col.prop(gpl, "tint_color")
|
||||
col.prop(gpl, "tint_factor", text="Factor", slider=True)
|
||||
|
||||
# Offsets - Thickness
|
||||
col = layout.row(align=True)
|
||||
col.prop(gpl, "line_change", text="Stroke Thickness")
|
||||
|
||||
|
||||
class GPENCIL_UL_masks(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
|
||||
mask = item
|
||||
row = layout.row(align=True)
|
||||
row.prop(mask, "name", text="", emboss=False, icon_value=icon)
|
||||
row.prop(mask, "invert", text="", emboss=False)
|
||||
row.prop(mask, "hide", text="", emboss=False)
|
||||
|
||||
|
||||
class GreasePencilLayerRelationsPanel:
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
scene = context.scene
|
||||
ob = context.object
|
||||
gpd = ob.data
|
||||
gpl = gpd.layers.active
|
||||
|
||||
col = layout.column()
|
||||
col.active = not gpl.lock
|
||||
col.prop(gpl, "parent")
|
||||
col.prop(gpl, "parent_type", text="Type")
|
||||
parent = gpl.parent
|
||||
|
||||
if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE':
|
||||
col.prop_search(gpl, "parent_bone", parent.data, "bones", text="Bone")
|
||||
|
||||
layout.separator()
|
||||
|
||||
col = layout.row(align=True)
|
||||
col.prop(gpl, "pass_index")
|
||||
|
||||
col = layout.row(align=True)
|
||||
col.prop_search(gpl, "viewlayer_render", scene, "view_layers", text="View Layer")
|
||||
|
||||
col = layout.row(align=True)
|
||||
# Only enable this property when a view layer is selected.
|
||||
col.enabled = bool(gpl.viewlayer_render)
|
||||
col.prop(gpl, "use_viewlayer_masks")
|
||||
|
||||
|
||||
class GreasePencilLayerDisplayPanel:
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
ob = context.object
|
||||
gpd = ob.data
|
||||
gpl = gpd.layers.active
|
||||
|
||||
use_colors = context.preferences.edit.use_anim_channel_group_colors
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.active = use_colors
|
||||
row = col.row(align=True)
|
||||
row.prop(gpl, "channel_color")
|
||||
if not use_colors:
|
||||
col.label(text="Channel Colors are disabled in Animation preferences")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(gpl, "use_solo_mode", text="Show Only on Keyframed")
|
||||
|
||||
|
||||
class GreasePencilFlipTintColors(Operator):
|
||||
"""Switch tint colors"""
|
||||
bl_label = "Flip Colors"
|
||||
bl_idname = "gpencil.tint_flip"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
tool_settings = context.tool_settings
|
||||
settings = None
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
if context.mode == 'SCULPT_GPENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode == 'VERTEX_GPENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
|
||||
return settings and settings.brush
|
||||
|
||||
def execute(self, context):
|
||||
tool_settings = context.tool_settings
|
||||
settings = None
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
if context.mode == 'SCULPT_GPENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode == 'VERTEX_GPENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
|
||||
brush = settings.brush
|
||||
color = brush.color
|
||||
secondary_color = brush.secondary_color
|
||||
|
||||
orig_prim = color.hsv
|
||||
orig_sec = secondary_color.hsv
|
||||
|
||||
color.hsv = orig_sec
|
||||
secondary_color.hsv = orig_prim
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class GREASE_PENCIL_MT_snap(Menu):
|
||||
bl_label = "Snap"
|
||||
|
||||
@@ -782,8 +594,6 @@ class GREASE_PENCIL_MT_stroke_simplify(Menu):
|
||||
|
||||
classes = (
|
||||
GPENCIL_UL_annotation_layer,
|
||||
GPENCIL_UL_layer,
|
||||
GPENCIL_UL_masks,
|
||||
|
||||
GREASE_PENCIL_MT_move_to_layer,
|
||||
GREASE_PENCIL_MT_layer_active,
|
||||
@@ -795,7 +605,6 @@ classes = (
|
||||
|
||||
GREASE_PENCIL_MT_stroke_simplify,
|
||||
|
||||
GreasePencilFlipTintColors,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
||||
@@ -13,7 +13,7 @@ from bl_ui.properties_grease_pencil_common import (
|
||||
)
|
||||
|
||||
|
||||
class GPENCIL_MT_material_context_menu(Menu):
|
||||
class GREASE_PENCIL_MT_material_context_menu(Menu):
|
||||
bl_label = "Material Specials"
|
||||
|
||||
def draw(self, _context):
|
||||
@@ -253,7 +253,7 @@ class MATERIAL_PT_gpencil_material_presets(PresetPanel, Panel):
|
||||
|
||||
classes = (
|
||||
GPENCIL_UL_matslots,
|
||||
GPENCIL_MT_material_context_menu,
|
||||
GREASE_PENCIL_MT_material_context_menu,
|
||||
MATERIAL_PT_gpencil_slots,
|
||||
MATERIAL_PT_gpencil_preview,
|
||||
MATERIAL_PT_gpencil_material_presets,
|
||||
|
||||
@@ -239,19 +239,9 @@ class UnifiedPaintPanel:
|
||||
# 2D paint settings
|
||||
elif mode == 'PAINT_2D':
|
||||
return tool_settings.image_paint
|
||||
# Grease Pencil settings
|
||||
elif mode == 'PAINT_GPENCIL':
|
||||
return tool_settings.gpencil_paint
|
||||
elif mode == 'SCULPT_GPENCIL':
|
||||
return tool_settings.gpencil_sculpt_paint
|
||||
elif mode == 'WEIGHT_GPENCIL':
|
||||
return tool_settings.gpencil_weight_paint
|
||||
elif mode == 'VERTEX_GPENCIL':
|
||||
return tool_settings.gpencil_vertex_paint
|
||||
elif mode == 'PAINT_GREASE_PENCIL':
|
||||
return tool_settings.gpencil_paint
|
||||
elif mode == 'SCULPT_CURVES':
|
||||
return tool_settings.curves_sculpt
|
||||
# Grease Pencil settings
|
||||
elif mode == 'PAINT_GREASE_PENCIL':
|
||||
return tool_settings.gpencil_paint
|
||||
elif mode == 'SCULPT_GREASE_PENCIL':
|
||||
|
||||
@@ -904,26 +904,6 @@ class DOPESHEET_MT_snap_pie(Menu):
|
||||
pie.operator("action.snap", text="Selection to Nearest Marker").type = 'NEAREST_MARKER'
|
||||
|
||||
|
||||
class LayersDopeSheetPanel:
|
||||
bl_space_type = 'DOPESHEET_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "View"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
st = context.space_data
|
||||
ob = context.object
|
||||
if st.mode != 'GPENCIL' or ob is None or ob.type != 'GREASEPENCIL':
|
||||
return False
|
||||
|
||||
gpd = ob.data
|
||||
gpl = gpd.layers.active
|
||||
if gpl:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class GreasePencilLayersDopeSheetPanel:
|
||||
bl_space_type = 'DOPESHEET_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
|
||||
@@ -2921,11 +2921,6 @@ class _defs_grease_pencil_sculpt:
|
||||
)
|
||||
|
||||
|
||||
class _defs_gpencil_weight:
|
||||
# No mode specific tools currently (only general ones).
|
||||
pass
|
||||
|
||||
|
||||
class _defs_grease_pencil_weight:
|
||||
@ToolDef.from_fn
|
||||
def blur():
|
||||
|
||||
@@ -62,30 +62,6 @@ class VIEW3D_MT_brush_context_menu(Menu):
|
||||
layout.operator("brush.asset_revert", text="Revert to Asset")
|
||||
|
||||
|
||||
class VIEW3D_MT_brush_gpencil_context_menu(Menu):
|
||||
bl_label = "Brush Specials"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
settings = None
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
settings = tool_settings.gpencil_paint
|
||||
if context.mode == 'SCULPT_GPENCIL':
|
||||
settings = tool_settings.gpencil_sculpt_paint
|
||||
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
|
||||
settings = tool_settings.gpencil_weight_paint
|
||||
elif context.mode == 'VERTEX_GPENCIL':
|
||||
settings = tool_settings.gpencil_vertex_paint
|
||||
|
||||
brush = getattr(settings, "brush", None)
|
||||
# skip if no active brush
|
||||
if not brush:
|
||||
layout.label(text="No Brushes currently available", icon='INFO')
|
||||
return
|
||||
|
||||
|
||||
class View3DPanel:
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
@@ -2374,7 +2350,6 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_gap_closure(View3DPanel, Panel):
|
||||
|
||||
classes = (
|
||||
VIEW3D_MT_brush_context_menu,
|
||||
VIEW3D_MT_brush_gpencil_context_menu,
|
||||
VIEW3D_PT_tools_object_options,
|
||||
VIEW3D_PT_tools_object_options_transform,
|
||||
VIEW3D_PT_tools_meshedit_options,
|
||||
|
||||
Reference in New Issue
Block a user