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:
authorCampbell Barton <ideasman42@gmail.com>2018-12-02 05:09:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-02 05:12:06 +0300
commit4320adbf860a47d2557ec9486e4fb3b0684fe27a (patch)
tree2c9e96c3beeddddc3b129436a3bb11c056ce8792 /release/scripts/startup/bl_ui/properties_material_gpencil.py
parent2c6f767452104fd45b33d7accd30aa217f8160e5 (diff)
Cleanup: remove redundant gpencil material checks
Poll checks for an object, no need to check for non-object materials in the draw function.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_material_gpencil.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_material_gpencil.py57
1 files changed, 25 insertions, 32 deletions
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 3aba3489a57..fc25b70b36a 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -100,54 +100,47 @@ class MATERIAL_PT_gpencil_slots(Panel):
layout = self.layout
gpd = context.gpencil_data
- mat = context.object.active_material
ob = context.object
slot = context.material_slot
- space = context.space_data
- if ob:
- is_sortable = len(ob.material_slots) > 1
- rows = 7
+ is_sortable = len(ob.material_slots) > 1
+ rows = 7
- row = layout.row()
+ row = layout.row()
- row.template_list("GPENCIL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows)
+ row.template_list("GPENCIL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows)
- col = row.column(align=True)
- col.operator("object.material_slot_add", icon='ADD', text="")
- col.operator("object.material_slot_remove", icon='REMOVE', text="")
+ col = row.column(align=True)
+ col.operator("object.material_slot_add", icon='ADD', text="")
+ col.operator("object.material_slot_remove", icon='REMOVE', text="")
- col.menu("GPENCIL_MT_color_specials", icon='DOWNARROW_HLT', text="")
+ col.menu("GPENCIL_MT_color_specials", icon='DOWNARROW_HLT', text="")
- if is_sortable:
- col.separator()
+ if is_sortable:
+ col.separator()
- col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP'
- col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+ col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP'
+ col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
- col.separator()
+ col.separator()
- sub = col.column(align=True)
- sub.operator("gpencil.color_isolate", icon='LOCKED', text="").affect_visibility = False
- sub.operator("gpencil.color_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
+ sub = col.column(align=True)
+ sub.operator("gpencil.color_isolate", icon='LOCKED', text="").affect_visibility = False
+ sub.operator("gpencil.color_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
row = layout.row()
- if ob:
- row.template_ID(ob, "active_material", new="material.new", live_icon=True)
-
- if slot:
- icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
- row.prop(slot, "link", icon=icon_link, icon_only=True)
+ row.template_ID(ob, "active_material", new="material.new", live_icon=True)
- if gpd.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.operator("gpencil.stroke_change_color", text="Assign")
- row.operator("gpencil.color_select", text="Select").deselect = False
- row.operator("gpencil.color_select", text="Deselect").deselect = True
+ if slot:
+ icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
+ row.prop(slot, "link", icon=icon_link, icon_only=True)
- elif mat:
- row.template_ID(space, "pin_id")
+ if gpd.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.operator("gpencil.stroke_change_color", text="Assign")
+ row.operator("gpencil.color_select", text="Select").deselect = False
+ row.operator("gpencil.color_select", text="Deselect").deselect = True
# Used as parent for "Stroke" and "Fill" panels