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 208b0a63075b0f30c48276d5e0f93241cb8dfb4b..4ceaffbaf8dc111cdc54737e8ca0e56f6f76ebf2 100644 (file)
 # menus are referenced `as is`
 
 import bpy
 # 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:
 
 
 class MASK_PT_mask:
@@ -69,7 +87,7 @@ class MASK_PT_layers:
         rows = 5 if active_layer else 2
 
         row = layout.row()
         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)
                           mask, "active_layer_index", rows=rows)
 
         sub = row.column(align=True)