def draw(self, context):
        layout = self.layout

        settings = self.paint_settings(context)
        brush = settings.brush
        tex_slot = brush.texture_slot

        col = layout.column()

        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, context.sculpt_object)

        if context.sculpt_object:
            # use_texture_overlay and texture_overlay_alpha
            col = layout.column(align=True)
            col.active = brush.sculpt_capabilities.has_overlay
            col.label(text="Overlay:")

            row = col.row()
            if brush.use_texture_overlay:
                row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
            else:
                row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
            sub = row.row()
            sub.prop(brush, "texture_overlay_alpha", text="Alpha")
    def draw(self, context):
        layout = self.layout

        toolsettings = context.tool_settings.image_paint
        brush = toolsettings.brush
        tex_slot = brush.texture_slot

        col = layout.column()
        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, 0)

        # use_texture_overlay and texture_overlay_alpha
        col = layout.column(align=True)
        col.active = brush.brush_capabilities.has_overlay
        col.label(text="Overlay:")

        row = col.row(align=True)
        if tex_slot.map_mode != 'STENCIL':
            if brush.use_primary_overlay:
                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
            else:
                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')

        sub = row.row(align=True)
        sub.prop(brush, "texture_overlay_alpha", text="Alpha")
        sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
Example #3
0
    def draw(self, context):
        layout = self.layout

        toolsettings = context.tool_settings.image_paint
        brush = toolsettings.brush
        tex_slot = brush.texture_slot

        col = layout.column()
        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, 0)

        # use_texture_overlay and texture_overlay_alpha
        col = layout.column(align=True)
        col.active = brush.brush_capabilities.has_overlay
        col.label(text="Overlay:")

        row = col.row()
        if tex_slot.map_mode != 'STENCIL':
            if brush.use_primary_overlay:
                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
            else:
                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')

        sub = row.row()
        sub.prop(brush, "texture_overlay_alpha", text="Alpha")
        sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
Example #4
0
    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        flow = layout.grid_flow(row_major=False,
                                columns=0,
                                even_columns=True,
                                even_rows=False,
                                align=True)

        idblock = context_tex_datablock(context)

        tex = context.texture_slot

        if isinstance(idblock, Brush):
            if context.sculpt_object or context.image_paint_object:
                brush_texture_settings(layout, idblock, context.sculpt_object)
        else:
            col = flow.column()

            col.prop(tex, "texture_coords", text="Coordinates")

            # Note: the ORCO case used to call ob.data, "texco_mesh" prop.
            if tex.texture_coords == 'UV':
                ob = context.object

                if ob and ob.type == 'MESH':
                    col.prop_search(tex,
                                    "uv_layer",
                                    ob.data,
                                    "uv_layers",
                                    text="Map")
                else:
                    col.prop(tex, "uv_layer", text="Map")

            elif tex.texture_coords == 'OBJECT':
                col.prop(tex, "object", text="Object")

            col.separator()

            if isinstance(idblock, FreestyleLineStyle):
                col = flow.column()
                col.prop(tex, "mapping", text="Projection")

                col.separator()

                col = flow.column()
                col.prop(tex, "mapping_x", text="Mapping X")
                col.prop(tex, "mapping_y", text="Y")
                col.prop(tex, "mapping_z", text="Z")

                col.separator()

            col = flow.column(align=True)
            col.column().prop(tex, "offset")

            col = flow.column(align=True)
            col.column().prop(tex, "scale")
Example #5
0
    def draw(self, context):
        layout = self.layout

        tool_settings = context.tool_settings.image_paint
        brush = tool_settings.brush

        col = layout.column()
        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, 0)
Example #6
0
    def draw(self, context):
        layout = self.layout

        toolsettings = context.tool_settings.image_paint
        brush = toolsettings.brush

        col = layout.column()
        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, 0)
    def draw(self, context):
        layout = self.layout

        settings = self.paint_settings(context)
        brush = settings.brush
        tex_slot = brush.texture_slot

        col = layout.column()

        col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)

        brush_texture_settings(col, brush, context.sculpt_object)
Example #8
0
def texture_unregister_draw(self, context):
    layout = self.layout

    settings = self.paint_settings(context)
    brush = settings.brush

    col = layout.column()

    col.template_ID_preview(brush,
                            "texture",
                            new="texture.new",
                            rows=3,
                            cols=8)

    brush_texture_settings(col, brush, context.sculpt_object)
Example #9
0
    def draw(self, context):
        layout = self.layout

        settings = self.paint_settings(context)
        brush = settings.brush
        tex_slot = brush.texture_slot

        col = layout.column()

        col.template_ID_preview(brush,
                                "texture",
                                new="texture.new",
                                rows=3,
                                cols=8)

        brush_texture_settings(col, brush, context.sculpt_object)

        # use_texture_overlay and texture_overlay_alpha
        col = layout.column(align=True)
        col.active = brush.brush_capabilities.has_overlay
        col.label(text="Overlay:")

        row = col.row()
        if brush.use_texture_overlay:
            row.prop(brush,
                     "use_texture_overlay",
                     toggle=True,
                     text="",
                     icon='RESTRICT_VIEW_OFF')
        else:
            row.prop(brush,
                     "use_texture_overlay",
                     toggle=True,
                     text="",
                     icon='RESTRICT_VIEW_ON')
        sub = row.row()
        sub.prop(brush, "texture_overlay_alpha", text="Alpha")
Example #10
0
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot

        if not isinstance(idblock, Brush):
            split = layout.split(percentage=0.3)
            col = split.column()
            col.label(text="Coordinates:")
            col = split.column()
            col.prop(tex, "texture_coords", text="")

            if tex.texture_coords == 'ORCO':
                """
                ob = context.object
                if ob and ob.type == 'MESH':
                    split = layout.split(percentage=0.3)
                    split.label(text="Mesh:")
                    split.prop(ob.data, "texco_mesh", text="")
                """
            elif tex.texture_coords == 'UV':
                split = layout.split(percentage=0.3)
                split.label(text="Map:")
                ob = context.object
                if ob and ob.type == 'MESH':
                    split.prop_search(tex,
                                      "uv_layer",
                                      ob.data,
                                      "uv_textures",
                                      text="")
                else:
                    split.prop(tex, "uv_layer", text="")

            elif tex.texture_coords == 'OBJECT':
                split = layout.split(percentage=0.3)
                split.label(text="Object:")
                split.prop(tex, "object", text="")

        if isinstance(idblock, Brush):
            if context.sculpt_object or context.image_paint_object:
                brush_texture_settings(layout, idblock, context.sculpt_object)
        else:
            if isinstance(idblock, Material):
                split = layout.split(percentage=0.3)
                split.label(text="Projection:")
                split.prop(tex, "mapping", text="")

                split = layout.split()

                col = split.column()
                if tex.texture_coords in {'ORCO', 'UV'}:
                    col.prop(tex, "use_from_dupli")
                    if (idblock.type == 'VOLUME'
                            and tex.texture_coords == 'ORCO'):
                        col.prop(tex, "use_map_to_bounds")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                    if (idblock.type == 'VOLUME'):
                        col.prop(tex, "use_map_to_bounds")
                else:
                    col.label()

                col = split.column()
                row = col.row()
                row.prop(tex, "mapping_x", text="")
                row.prop(tex, "mapping_y", text="")
                row.prop(tex, "mapping_z", text="")

            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Example #11
0
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot

        if not isinstance(idblock, Brush):
            split = layout.split(percentage=0.3)
            col = split.column()
            col.label(text="Coordinates:")
            col = split.column()
            col.prop(tex, "texture_coords", text="")

            if tex.texture_coords == 'ORCO':
                """
                ob = context.object
                if ob and ob.type == 'MESH':
                    split = layout.split(percentage=0.3)
                    split.label(text="Mesh:")
                    split.prop(ob.data, "texco_mesh", text="")
                """
            elif tex.texture_coords == 'UV':
                split = layout.split(percentage=0.3)
                split.label(text="Map:")
                ob = context.object
                if ob and ob.type == 'MESH':
                    split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
                else:
                    split.prop(tex, "uv_layer", text="")

            elif tex.texture_coords == 'OBJECT':
                split = layout.split(percentage=0.3)
                split.label(text="Object:")
                split.prop(tex, "object", text="")

        if isinstance(idblock, Brush):
            if context.sculpt_object or context.image_paint_object:
                brush_texture_settings(layout, idblock, context.sculpt_object)
        else:
            if isinstance(idblock, Material):
                split = layout.split(percentage=0.3)
                split.label(text="Projection:")
                split.prop(tex, "mapping", text="")

                split = layout.split()

                col = split.column()
                if tex.texture_coords in {'ORCO', 'UV'}:
                    col.prop(tex, "use_from_dupli")
                    if (idblock.type == 'VOLUME' and tex.texture_coords == 'ORCO'):
                        col.prop(tex, "use_map_to_bounds")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                    if (idblock.type == 'VOLUME'):
                        col.prop(tex, "use_map_to_bounds")
                else:
                    col.label()

                col = split.column()
                row = col.row()
                row.prop(tex, "mapping_x", text="")
                row.prop(tex, "mapping_y", text="")
                row.prop(tex, "mapping_z", text="")

            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Example #12
0
def texture_register_draw(self, context):
    preferences = context.preferences.addons[__name__].preferences

    showLabels = preferences.show_labels
    iconTemplateScale = preferences.preview_scale
    iconScale = (iconTemplateScale + 3)
    iconScaleLabel = (iconScale - 4)

    settings = self.paint_settings(context)
    brush = settings.brush
    mode = context.object.mode
    tool = context.tool_settings
    texture = brush.texture
    procedurals = preview_procedural_items(self, context)
    is_sub_folders = preview_sub_folders_textures(self, context)
    path_folder = lib_path_folder(self, context)
    items = preview_category_items(self, context)
    path = lib_path(self, context)

    layout = self.layout

    brush = brush_mode(self, context)

    category_pointer = brush.brush_texture

    category = brush.brush_texture.category
    sub_category = brush.brush_texture.sub_category

    if is_sub_folders and sub_category != 'NONE':
        texture_category = brush.brush_texture.sub_category
    else:
        texture_category = brush.brush_texture.category

    # Text and icon, if using / not using library preview
    if not brush.use_library_preview:
        previewText = 'Library Preview'
        previewIcon = 'ASSET_MANAGER'
    else:
        previewText = 'Default Preview'
        previewIcon = 'PREFERENCES'

    # Text and icon, if using / not using procedural textures
    if not brush.use_procedural_textures:
        proceduralText = 'Procedural'
        proceduralIcon = 'TEXTURE'

    else:
        proceduralText = 'Images'
        proceduralIcon = 'IMAGE_RGB'

    # Library preview setting
    row = layout.row(align=alignLayout)
    row.alignment = 'RIGHT'

    row.label(text=previewText)
    row.prop(brush,
             "use_library_preview",
             text='',
             icon=previewIcon,
             toggle=propToggle)

    # Settings if using library preview
    if brush.use_library_preview:

        row = layout.row(align=alignLayout)
        row.alignment = 'RIGHT'

        # Procedural texture setting
        row.label(text=proceduralText)
        row.prop(brush,
                 "use_procedural_textures",
                 text='',
                 icon=proceduralIcon,
                 toggle=propToggle)

        col = layout.column(align=False)
        row = col.row(align=alignLayout)

        # Settings if not using procedural textures
        if not brush.use_procedural_textures:
            # Settings if path found
            if path:
                sub_cats_found = found_sub_categories(self, context)

                # Texture categories settings
                row.label(text='Categories:')
                row.prop(category_pointer, "category", text='')
                row.operator("texture_category.open",
                             text='',
                             icon='FILE_FOLDER')

                # If sub folders found and items found in selected category
                if is_sub_folders is not None and items and sub_cats_found:
                    # Texture sub categories settings
                    row = col.row(align=alignLayout)
                    row.label(text='Sub Categories:')
                    row.prop(category_pointer, "sub_category", text='')

                    # Check to see if open sub category folder operator setting can be enabled
                    row_enabled = row.row(align=alignLayout)
                    if sub_category == 'NONE':
                        row_enabled.enabled = False
                    elif sub_category == category:
                        row_enabled.enabled = False
                    else:
                        row_enabled.enabled = True

                    row_enabled.operator("texture_sub_category.open",
                                         text='',
                                         icon='FILE_FOLDER')

            # Path setting, if path not found
            else:
                row.prop(preferences, path_folder, text='')

            col = layout.column(align=alignLayout)

            # Preview setting, if items found in selected category
            if len(items) >= 2:
                col.template_icon_view(category_pointer,
                                       "items_in_selected_category",
                                       show_labels=showLabels,
                                       scale=iconTemplateScale)
            else:
                # Preview setting, if only NONE item found
                if path and len(items) == 1:
                    col.template_icon_view(category_pointer,
                                           "items_in_selected_category",
                                           show_labels=showLabels,
                                           scale=iconTemplateScale)
                # Only a icon, if no path found
                else:
                    row = col.row(align=alignLayout)
                    row.alignment = 'CENTER'
                    row.label(text='No library folder selected !')
                    col.template_icon(icon_value=iconFolder,
                                      scale=iconScaleLabel)

            # Texture pointer property and brush settings, if assigned a texture
            if texture:
                row = col.row(align=alignLayout)
                row.alignment = 'LEFT'
                row.label(text=brush.image_texture.name, icon='TEXTURE')

                col = layout.column()
                brush_texture_settings(col, brush, context.sculpt_object)

        # Settings if using procedural textures
        else:
            col = layout.column(align=alignLayout)
            # Icon and new precedural texture, if no procedural textures found
            if brush.use_procedural_textures and not procedurals:
                col.template_icon(icon_value=iconTexture, scale=iconScaleLabel)
                col.template_ID(brush,
                                "procedural_texture",
                                new="procedural_texture.new",
                                live_icon=iconLive)

            # Preview and procedural pointer property settings, if procedural textures found
            else:
                col.template_icon_view(category_pointer,
                                       "items_procedural_textures",
                                       show_labels=showLabels,
                                       scale=iconTemplateScale)
                col.template_ID(brush,
                                "procedural_texture",
                                new="procedural_texture.new",
                                live_icon=iconLive)

            # Brush settings
            col = layout.column()
            brush_texture_settings(col, brush, context.sculpt_object)

    # Default settings, if not using library preview
    else:
        col = layout.column()

        col.template_ID_preview(brush,
                                "texture",
                                new="texture.new",
                                rows=3,
                                cols=8)

        brush_texture_settings(col, brush, context.sculpt_object)