Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_material.py
| Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| mat = context.material | mat = context.material | ||||
| ob = context.object | ob = context.object | ||||
| slot = context.material_slot | slot = context.material_slot | ||||
| space = context.space_data | space = context.space_data | ||||
| is_sortable = len(ob.material_slots) > 1 | |||||
| if ob: | if ob: | ||||
| rows = 1 | |||||
| if (is_sortable): | |||||
| rows = 4 | |||||
| row = layout.row() | row = layout.row() | ||||
| row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=1) | row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows) | ||||
| col = row.column(align=True) | col = row.column(align=True) | ||||
| col.operator("object.material_slot_add", icon='ZOOMIN', text="") | col.operator("object.material_slot_add", icon='ZOOMIN', text="") | ||||
| col.operator("object.material_slot_remove", icon='ZOOMOUT', text="") | col.operator("object.material_slot_remove", icon='ZOOMOUT', text="") | ||||
| col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") | col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") | ||||
| 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' | |||||
| if ob.mode == 'EDIT': | if ob.mode == 'EDIT': | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.operator("object.material_slot_assign", text="Assign") | row.operator("object.material_slot_assign", text="Assign") | ||||
| row.operator("object.material_slot_select", text="Select") | row.operator("object.material_slot_select", text="Select") | ||||
| row.operator("object.material_slot_deselect", text="Deselect") | row.operator("object.material_slot_deselect", text="Deselect") | ||||
| split = layout.split(percentage=0.65) | split = layout.split(percentage=0.65) | ||||
| ▲ Show 20 Lines • Show All 898 Lines • Show Last 20 Lines | |||||