Exemple #1
0
    def draw(self, context):
        material = context.active_object.active_material
        mmd_material = material.mmd_material

        layout = self.layout

        fnMat = FnMaterial(material)

        col = layout.column()
        col.label(text='Texture:')
        r = col.row(align=True)
        tex = fnMat.get_texture()
        if tex:
            if tex.type == 'IMAGE' and tex.image:
                r.prop(tex.image, 'filepath', text='')
                r.operator('mmd_tools.material_remove_texture',
                           text='',
                           icon='PANEL_CLOSE')
            else:
                r.operator('mmd_tools.material_remove_texture',
                           text='Remove',
                           icon='PANEL_CLOSE')
                r.label(icon='ERROR')
        else:
            r.operator('mmd_tools.material_open_texture',
                       text='Add',
                       icon=ICON_FILE_FOLDER)

        col = layout.column()
        col.label(text='Sphere Texture:')
        r = col.row(align=True)
        tex = fnMat.get_sphere_texture()
        if tex:
            if tex.type == 'IMAGE' and tex.image:
                r.prop(tex.image, 'filepath', text='')
                r.operator('mmd_tools.material_remove_sphere_texture',
                           text='',
                           icon='PANEL_CLOSE')
            else:
                r.operator('mmd_tools.material_remove_sphere_texture',
                           text='Remove',
                           icon='PANEL_CLOSE')
                r.label(icon='ERROR')
        else:
            r.operator('mmd_tools.material_open_sphere_texture',
                       text='Add',
                       icon=ICON_FILE_FOLDER)
        col.row(align=True).prop(mmd_material,
                                 'sphere_texture_type',
                                 expand=True)

        col = layout.column()
        row = col.row()
        row.prop(mmd_material, 'is_shared_toon_texture')
        r = row.row()
        r.active = mmd_material.is_shared_toon_texture
        r.prop(mmd_material, 'shared_toon_texture')
        r = col.row()
        r.active = not mmd_material.is_shared_toon_texture
        r.prop(mmd_material, 'toon_texture')