Fix uilists showing data names translated (reported on bf-translations ML by Satoshi...
[blender.git] / release / scripts / startup / bl_ui / properties_mask_common.py
index a4a81b01980111d366ca22e839ada9b97cb0ec61..4ceaffbaf8dc111cdc54737e8ca0e56f6f76ebf2 100644 (file)
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
+# <pep8-80 compliant>
 
 # panels get subclassed (not registered directly)
 # menus are referenced `as is`
 
 import bpy
-from bpy.types import Menu
+from bpy.types import Menu, UIList
+
+
+class MASK_UL_layers(UIList):
+    def draw_item(self, context, layout, data, item, icon,
+                  active_data, active_propname, index):
+        # assert(isinstance(item, bpy.types.MaskLayer)
+        mask = item
+        if self.layout_type in {'DEFAULT', 'COMPACT'}:
+            split = layout.split()
+            split.label(text=mask.name, translate=False, icon_value=icon)
+            row = split.row(align=True)
+            row.prop(mask, "alpha", text="", emboss=False)
+            row.prop(mask, "hide", text="", emboss=False)
+            row.prop(mask, "hide_select", text="", emboss=False)
+            row.prop(mask, "hide_render", text="", emboss=False)
+        elif self.layout_type in {'GRID'}:
+            layout.alignment = 'CENTER'
+            layout.label(text="", icon_value=icon)
 
 
 class MASK_PT_mask:
@@ -69,7 +87,7 @@ class MASK_PT_layers:
         rows = 5 if active_layer else 2
 
         row = layout.row()
-        row.template_list(mask, "layers",
+        row.template_list("MASK_UL_layers", "", mask, "layers",
                           mask, "active_layer_index", rows=rows)
 
         sub = row.column(align=True)
@@ -121,10 +139,14 @@ class MASK_PT_spline():
         spline = mask.layers.active.splines.active
 
         col = layout.column()
+        col.prop(spline, "offset_mode")
         col.prop(spline, "weight_interpolation")
-        rowsub = col.row()
-        rowsub.prop(spline, "use_cyclic")
-        rowsub.prop(spline, "use_fill")
+
+        row = col.row()
+        row.prop(spline, "use_cyclic")
+        row.prop(spline, "use_fill")
+
+        col.prop(spline, "use_self_intersection_check")
 
 
 class MASK_PT_point():
@@ -220,7 +242,7 @@ class MASK_PT_tools():
         col.operator("transform.translate")
         col.operator("transform.rotate")
         col.operator("transform.resize", text="Scale")
-        props = col.operator("transform.transform", text="Shrink/Fatten")
+        props = col.operator("transform.transform", text="Scale Feather")
         props.mode = 'MASK_SHRINKFATTEN'
 
         col = layout.column(align=True)
@@ -234,6 +256,13 @@ class MASK_PT_tools():
         col.operator("mask.parent_set")
         col.operator("mask.parent_clear")
 
+        col = layout.column(align=True)
+        col.label(text="Animation:")
+        col.operator("mask.shape_key_clear")
+        col.operator("mask.shape_key_insert")
+        col.operator("mask.shape_key_feather_reset")
+        col.operator("mask.shape_key_rekey")
+
 
 class MASK_MT_mask(Menu):
     bl_label = "Mask"
@@ -281,7 +310,7 @@ class MASK_MT_transform(Menu):
         layout.operator("transform.translate")
         layout.operator("transform.rotate")
         layout.operator("transform.resize")
-        props = layout.operator("transform.transform", text="Shrink/Fatten")
+        props = layout.operator("transform.transform", text="Scale Feather")
         props.mode = 'MASK_SHRINKFATTEN'
 
 
@@ -309,10 +338,8 @@ class MASK_MT_select(Menu):
 
         layout.separator()
 
-        layout.operator("mask.select_all"
-                        ).action = 'TOGGLE'
-        layout.operator("mask.select_all",
-                        text="Inverse").action = 'INVERT'
+        layout.operator("mask.select_all").action = 'TOGGLE'
+        layout.operator("mask.select_all", text="Inverse").action = 'INVERT'
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)