~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to release/scripts/startup/bl_ui/properties_material.py

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
# <pep8 compliant>
20
20
import bpy
21
 
from bpy.types import Menu, Panel
 
21
from bpy.types import Menu, Panel, UIList
22
22
from rna_prop_ui import PropertyPanel
 
23
from bpy.app.translations import pgettext_iface as iface_
23
24
 
24
25
 
25
26
def active_node_mat(mat):
69
70
        layout.operator("material.paste", icon='PASTEDOWN')
70
71
 
71
72
 
 
73
class MATERIAL_UL_matslots(UIList):
 
74
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
 
75
        # assert(isinstance(item, bpy.types.MaterialSlot)
 
76
        ob = data
 
77
        slot = item
 
78
        ma = slot.material
 
79
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
 
80
            layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
 
81
            if ma and not context.scene.render.use_shading_nodes:
 
82
                manode = ma.active_node_material
 
83
                if manode:
 
84
                    layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
 
85
                elif ma.use_nodes:
 
86
                    layout.label(text="Node <none>")
 
87
        elif self.layout_type in {'GRID'}:
 
88
            layout.alignment = 'CENTER'
 
89
            layout.label(text="", icon_value=icon)
 
90
 
 
91
 
72
92
class MaterialButtonsPanel():
73
93
    bl_space_type = 'PROPERTIES'
74
94
    bl_region_type = 'WINDOW'
104
124
        if ob:
105
125
            row = layout.row()
106
126
 
107
 
            row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
 
127
            row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=2)
108
128
 
109
129
            col = row.column(align=True)
110
130
            col.operator("object.material_slot_add", icon='ZOOMIN', text="")
350
370
 
351
371
class MATERIAL_PT_transp(MaterialButtonsPanel, Panel):
352
372
    bl_label = "Transparency"
353
 
    # bl_options = {'DEFAULT_CLOSED'}
354
373
    COMPAT_ENGINES = {'BLENDER_RENDER'}
355
374
 
356
375
    @classmethod
545
564
            row.prop(halo, toggle, text="")
546
565
            sub = row.column()
547
566
            sub.active = getattr(halo, toggle)
548
 
            sub.prop(halo, number, text=name)
 
567
            sub.prop(halo, number, text=name, translate=False)
549
568
            if not color == "":
550
569
                sub.prop(mat, color, text="")
551
570
 
572
591
        col.prop(halo, "use_soft")
573
592
 
574
593
        col = split.column()
575
 
        number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
576
 
        number_but(col, "use_lines", "line_count", "Lines", "specular_color")
577
 
        number_but(col, "use_star", "star_tip_count", "Star tips", "")
 
594
        number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
 
595
        number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
 
596
        number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
578
597
 
579
598
 
580
599
class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
754
773
        row = sub.row()
755
774
        row.active = bool(mat.light_group)
756
775
        row.prop(mat, "use_light_group_exclusive", text="Exclusive")
 
776
        row.prop(mat, "use_light_group_local", text="Local")
757
777
 
758
778
        col = split.column()
759
779
        col.prop(mat, "use_face_texture")
764
784
        col.prop(mat, "use_vertex_color_paint")
765
785
        col.prop(mat, "use_vertex_color_light")
766
786
        col.prop(mat, "use_object_color")
 
787
        col.prop(mat, "use_uv_project")
767
788
        if simple_material(base_mat):
768
789
            col.prop(mat, "pass_index")
769
790