Esempio n. 1
0
        def execute(self, context):

            material = context.active_object.active_material

            if material:
                shader_texture_filepath = getattr(material.scs_props, "shader_texture_" + self.texture_type)

                if _material_utils.is_valid_shader_texture_path(shader_texture_filepath):

                    tex_filepath = _path_utils.get_abs_path(shader_texture_filepath)

                    if tex_filepath and (tex_filepath.endswith(".tga") or tex_filepath.endswith(".png")):

                        if _tobj_exp.export(tex_filepath[:-4] + ".tobj", os.path.basename(tex_filepath), set()):

                            _material_utils.reload_tobj_settings(material, self.texture_type)

                else:
                    self.report({'ERROR'}, "Please load texture properly first!")

            return {'FINISHED'}
Esempio n. 2
0
def __update_shader_texture_tobj_file__(self, context, tex_type):
    """Hookup function for updating TOBJ file on any texture type.

    :param context: Blender context
    :type context: bpy.types.Context
    :param tex_type: string representig texture type
    :type tex_type: str
    """

    # dummy context arg usage so IDE doesn't report it as unused
    if context == context:
        pass

    shader_texture_str = "shader_texture_" + tex_type
    if _material_utils.is_valid_shader_texture_path(getattr(self, shader_texture_str)):
        tex_filepath = _path_utils.get_abs_path(getattr(self, shader_texture_str))

        if tex_filepath and (tex_filepath.endswith(".tga") or tex_filepath.endswith(".png")):
            tobj_file = tex_filepath[:-4] + ".tobj"

            if _tobj_exp.export(tobj_file, os.path.basename(tex_filepath), getattr(self, shader_texture_str + "_settings")):
                self[shader_texture_str + "_tobj_load_time"] = str(os.path.getmtime(tobj_file))
Esempio n. 3
0
def _draw_shader_texture(layout, mat, split_perc, texture, read_only):
    """Draws texture box with it's properties.

    :param layout: layout to draw attribute to
    :type layout: bpy.types.UILayout
    :param mat: material from which data should be displayed
    :type mat: bpy.types.Material
    :param split_perc: split percentage for attribute name/value
    :type split_perc: float
    :param texture: texture data
    :type texture: dict
    :param read_only: if texture should be read only
    :type read_only: bool
    """

    tag = texture.get('Tag', None)
    hide_state = texture.get('Hide', None)
    tag_id = tag.split(':')
    tag_id_string = tag_id[1]
    texture_type = tag_id_string[8:]
    shader_texture_id = str('shader_' + tag_id_string)

    if hide_state == 'True':
        return

    texture_box = layout.box()

    header_split = texture_box.row().split(percentage=0.5)
    header_split.label(texture_type.title(), icon="TEXTURE_SHADED")

    if hasattr(mat.scs_props, shader_texture_id):

        shader_texture = mat.scs_props.get(shader_texture_id, "")
        # imported tobj boolean switch (only for imported shaders)
        use_imported_tobj = getattr(mat.scs_props, shader_texture_id + "_use_imported", False)
        if read_only:
            row = header_split.row(align=True)
            row.alignment = 'RIGHT'
            row.prop(mat.scs_props, shader_texture_id + "_use_imported")

            if use_imported_tobj:

                texture_row = texture_box.row()
                item_space = texture_row.split(percentage=split_perc, align=True)
                item_space.label("TOBJ Path:")

                item_space = item_space.split(percentage=(1 - split_perc) * 0.2, align=True)
                props = item_space.operator("material.scs_looks_wt", text="WT")
                props.property_str = shader_texture_id
                item_space.prop(mat.scs_props, shader_texture_id + "_imported_tobj", text="")

        # disable whole texture layout if it's locked
        texture_box.enabled = not mat.scs_props.get(shader_texture_id + "_locked", False)

        texture_row = texture_box.row()
        item_space = texture_row.split(percentage=split_perc, align=True)

        # in case of custom tobj value texture is used only for preview
        if read_only and use_imported_tobj:
            item_space.label("Preview Tex:")
        else:
            item_space.label("Texture:")

        layout_box_col = item_space.column(align=True)
        layout_box_row = layout_box_col.row(align=True)

        if shader_texture:
            texture_icon = 'TEXTURE'
        else:
            texture_icon = 'MATPLANE'

        # MARK INVALID SLOTS
        if _material_utils.is_valid_shader_texture_path(shader_texture):
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
            texture_icon = 'ERROR'

        # MARK EMPTY SLOTS
        if shader_texture == "":
            layout_box_row.alert = True

        layout_box_row = layout_box_row.split(percentage=(1 - split_perc) * 0.2, align=True)
        props = layout_box_row.operator("material.scs_looks_wt", text="WT")
        props.property_str = shader_texture_id

        layout_box_row = layout_box_row.row(align=True)
        layout_box_row.prop(mat.scs_props, shader_texture_id, text='', icon=texture_icon)
        props = layout_box_row.operator('scene.select_shader_texture_filepath', text='', icon='FILESEL')
        props.shader_texture = shader_texture_id  # DYNAMIC ID SAVE (FOR FILE REQUESTER)

        # ADDITIONAL TEXTURE SETTINGS
        if (not read_only or (read_only and not use_imported_tobj)) and texture_box.enabled:

            tobj_exists = _material_utils.is_valid_shader_texture_path(shader_texture, True)

            if not tobj_exists:
                item_split = layout_box_col.split(percentage=(1 - split_perc) * 0.2, align=True)

                item_space = item_split.row(align=True)
                props = item_space.operator("material.scs_create_tobj", icon="NEW", text="")
                props.texture_type = texture_type

                item_space = item_split.row(align=True)
            else:
                item_space = layout_box_col.row(align=True)

            item_space.enabled = tobj_exists

            if tobj_exists:
                mtime = str(os.path.getmtime(_path_utils.get_abs_path(shader_texture[:-4] + ".tobj")))
                item_space.alert = (mtime != getattr(mat.scs_props, shader_texture_id + "_tobj_load_time", "NOT FOUND"))
            else:
                item_space.alert = True

            props = item_space.operator("material.scs_reload_tobj", icon="LOAD_FACTORY", text="")
            props.texture_type = texture_type

            item_space.prop_menu_enum(
                mat.scs_props,
                str('shader_' + tag_id_string + '_settings'),
                icon='SETTINGS',
            )

        # UV LAYERS FOR TEXTURE
        uv_mappings = getattr(mat.scs_props, "shader_" + tag_id_string + "_uv", None)

        if len(uv_mappings) > 0:

            texture_row = texture_box.row()
            item_space = texture_row.split(percentage=split_perc, align=True)
            if read_only:
                item_space.label("Preview UV Map:")
            else:
                item_space.label("Mapping:")
            layout_box_col = item_space.column(align=True)

            for mapping in uv_mappings:

                item_space_row = layout_box_col.row(align=True)

                # add info about normal map uv mapping property in case of imported shader
                if read_only and tag_id_string == "texture_nmap":
                    item_space_row.operator("material.show_normal_maps_mapping_info", text="", icon="INFO")

                # add ensuring operator for norma map uv mapping
                if tag_id_string == "texture_nmap":
                    props = item_space_row.operator("mesh.scs_ensure_active_uv", text="", icon="FILE_REFRESH")
                    props.mat_name = mat.name
                    props.uv_layer = uv_mappings[0].value

                if mapping.value and mapping.value != "" and mapping.value in bpy.context.active_object.data.uv_layers:
                    icon = "GROUP_UVS"
                else:
                    icon = "ERROR"

                item_space_row.prop_search(
                    data=mapping,
                    property="value",
                    search_data=bpy.context.active_object.data,
                    search_property='uv_layers',
                    text="",
                    icon=icon,
                )

    else:
        texture_box.row().label('Unsupported Shader Texture Type!', icon="ERROR")
Esempio n. 4
0
def _draw_shader_parameters(layout,
                            mat,
                            scs_props,
                            scs_globals,
                            read_only=False):
    """Creates Shader Parameters sub-panel."""
    linked_vals = False  # DEBUG: Side by side display of values
    split_perc = 0.4
    # panel_header = layout_box.split(percentage=0.5)
    # panel_header_1 = panel_header.row()
    # panel_header_1.prop(scene.scs_props, 'shader_presets_expand', text="Shader Parameters:", icon='TRIA_DOWN', icon_only=True, emboss=False)
    # panel_header_1.label('Shader Parameters:', icon='NONE')

    shader_data = mat.get("scs_shader_attributes", {})
    # print(' shader_data: %s' % str(shader_data))

    if len(shader_data) == 0:
        info_box = layout.box()
        info_box.label('Select a shader from the preset list.', icon='ERROR')
    else:
        # PRESET INFO
        # print(' ...active_shader_preset_name: %r' % str(mat.scs_props.active_shader_preset_name))
        preset_name = mat.scs_props.active_shader_preset_name.upper()
        # effect_name = shader_data.get('effect', "NO EFFECT")
        effect_name = mat.scs_props.mat_effect_name
        effect_name = str('"' + effect_name + '"')
        preset_info_row = layout.row()
        preset_info_space = preset_info_row.split(percentage=split_perc,
                                                  align=True)
        preset_info_space.label(preset_name, icon='NONE')
        preset_info_space.label(effect_name, icon='NONE')

        # MATERIAL SUBSTANCE
        substance_row = layout.row()
        substance_row.enabled = not read_only
        substance_row = substance_row.split(percentage=split_perc)
        substance_row.label("Substance:")
        substance_row.prop_search(mat.scs_props,
                                  'substance',
                                  scs_globals,
                                  'scs_matsubs_inventory',
                                  icon='NONE',
                                  text="")

        if len(shader_data['attributes']) == 0 and len(
                shader_data['textures']) == 0:
            info_box = layout.box()
            if shader_data['effect'].endswith('mlaaweight'):
                info_box.label(
                    '"Multi Level Anti-Aliasing" shader has no parameters.',
                    icon='INFO')
            else:
                info_box.label('No shader parameters!', icon='INFO')

        if 'attributes' in shader_data and len(shader_data["attributes"]) > 0:

            attributes_box = layout.box()
            attributes_box.enabled = not read_only

            if scs_props.shader_attributes_expand:
                panel_header = attributes_box.split(percentage=0.5)
                panel_header_1 = panel_header.row()
                panel_header_1.prop(scs_props,
                                    'shader_attributes_expand',
                                    text="Material Attributes",
                                    icon='TRIA_DOWN',
                                    icon_only=True,
                                    emboss=False)
                # panel_header_2 = panel_header.row(align=True)
                # panel_header_2.alignment = 'RIGHT'
                # panel_header_2.label('...', icon='DOT')

                attributes_data = shader_data['attributes']
                if attributes_data:
                    # title_line = attributes_box.row()
                    # title_line.alignment = 'CENTER'
                    # title_line.label("Attributes:")
                    for attribute_key in sorted(attributes_data.keys()):
                        attribute = attributes_data[attribute_key]
                        tag = attribute.get('Tag', None)
                        hide_state = attribute.get('Hide', None)
                        lock_state = attribute.get('Lock', None)
                        attribute_label = str(
                            tag.replace('_', ' ').title() + ":")

                        if hide_state == 'True':
                            continue

                        attr_row = attributes_box.row()
                        item_space = attr_row.split(percentage=split_perc,
                                                    align=True)

                        label_icon = 'ERROR'
                        if lock_state == 'True':
                            item_space.enabled = False
                            attribute_label = str(attribute_label[:-1] +
                                                  " (locked):")
                            label_icon = 'LOCKED'
                        '''
                        if hide_state == 'True':
                            if not item_space.enabled:
                                attribute_label = str(attribute_label[:-2] + ", hidden):")
                            else:
                                item_space.enabled = False
                                attribute_label = str(attribute_label[:-1] + " (hidden):")
                            label_icon = 'GHOST_ENABLED'
                        '''

                        item_space.label(attribute_label)
                        '''
                        shader_attribute_id = str("shader_attribute_" + tag)
                        if shader_attribute_id in mat.scs_props:
                            item_space.prop(mat.scs_props, shader_attribute_id, text='')
                        else:
                            print(' %r is NOT defined in SCS Blender Tools...!' % shader_attribute_id)
                        '''

                        if tag == 'diffuse':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_diffuse',
                                            text='')
                            if linked_vals:
                                item_space.prop(mat, 'diffuse_color', text='')
                        elif tag == 'specular':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_specular',
                                            text='')
                            if linked_vals:
                                item_space.prop(mat, 'specular_color', text='')
                        elif tag == 'shininess':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_shininess',
                                            text='')
                            # if linked_vals: item_space.prop(mat, 'specular_intensity', text='')
                            if linked_vals:
                                item_space.prop(mat,
                                                'specular_hardness',
                                                text='')
                        elif tag == 'add_ambient':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_add_ambient',
                                            text='')
                            if linked_vals:
                                item_space.prop(mat, 'ambient', text='')
                        elif tag == 'reflection':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_reflection',
                                            text='')
                            if linked_vals:
                                item_space.prop(mat.raytrace_mirror,
                                                'reflect_factor',
                                                text='')
                        elif tag == 'reflection2':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_reflection2',
                                            text='')
                        elif tag == 'shadow_bias':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_shadow_bias',
                                            text='')
                            if linked_vals:
                                item_space.prop(mat,
                                                'shadow_buffer_bias',
                                                text='')
                        elif tag == 'env_factor':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_env_factor',
                                            text='')
                        elif tag == 'fresnel':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_fresnel',
                                            text='')
                        elif tag == 'tint':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_tint',
                                            text='')
                        elif tag == 'tint_opacity':
                            item_space.prop(mat.scs_props,
                                            'shader_attribute_tint_opacity',
                                            text='')
                        elif tag in ("aux3", "aux5", "aux6", "aux7", "aux8"):

                            col = item_space.column(align=True)

                            auxiliary_prop = getattr(mat.scs_props,
                                                     "shader_attribute_" + tag,
                                                     None)

                            for item in auxiliary_prop:
                                col.prop(item, 'value', text='')

                        else:
                            item_space.label(
                                'Undefined Shader Attribute Type!',
                                icon=label_icon)
            else:
                panel_header = attributes_box.split(percentage=0.5)
                panel_header_1 = panel_header.row()
                panel_header_1.prop(scs_props,
                                    'shader_attributes_expand',
                                    text="Material Attributes",
                                    icon='TRIA_RIGHT',
                                    icon_only=True,
                                    emboss=False)
                # panel_header_2 = panel_header.row(align=True)
                # panel_header_2.alignment = 'RIGHT'
                # panel_header_2.label('...', icon='DOT')

        if 'textures' in shader_data and len(shader_data["textures"]) > 0:
            textures_box = layout.box()
            if scs_props.shader_textures_expand:
                panel_header = textures_box.split(percentage=0.5)
                panel_header_1 = panel_header.row()
                panel_header_1.prop(scs_props,
                                    'shader_textures_expand',
                                    text="Material Textures",
                                    icon='TRIA_DOWN',
                                    icon_only=True,
                                    emboss=False)

                textures_data = shader_data['textures']
                if textures_data:

                    if read_only:

                        mappings_box = textures_box.box()
                        row = mappings_box.row()
                        row.label("Mappings:", icon="GROUP_UVS")
                        row = mappings_box.row()
                        row.template_list(
                            'SCSMaterialCustomMappingSlot',
                            list_id="",
                            dataptr=mat.scs_props,
                            propname="shader_custom_tex_coord_maps",
                            active_dataptr=mat.scs_props,
                            active_propname="active_custom_tex_coord",
                            rows=3,
                            maxrows=5,
                            type='DEFAULT',
                            columns=9)

                        col = row.column(align=True)
                        col.operator('material.add_custom_tex_coord_map',
                                     text="",
                                     icon='ZOOMIN')
                        col.operator('material.remove_custom_tex_coord_map',
                                     text="",
                                     icon='ZOOMOUT')

                    for texture_key in sorted(textures_data.keys()):
                        texture = textures_data[texture_key]
                        tag = texture.get('Tag', None)
                        hide_state = texture.get('Hide', None)
                        lock_state = texture.get('Lock', None)
                        tag_id = tag.split(':')
                        tag_id_string = tag_id[1]
                        texture_label = tag_id_string[8:].title()
                        shader_texture_id = str('shader_' + tag_id_string)

                        if hide_state == 'True':
                            continue

                        texture_box = textures_box.box()

                        header_split = texture_box.row().split(percentage=0.5)
                        header_split.label(texture_label,
                                           icon="TEXTURE_SHADED")

                        if hasattr(mat.scs_props, shader_texture_id):
                            # imported tobj boolean switch (only for imported shaders)
                            use_imported_tobj = getattr(
                                mat.scs_props,
                                shader_texture_id + "_use_imported", False)
                            if read_only:
                                row = header_split.row(align=True)
                                row.alignment = 'RIGHT'
                                row.prop(mat.scs_props,
                                         shader_texture_id + "_use_imported")

                                if use_imported_tobj:

                                    texture_row = texture_box.row()
                                    item_space = texture_row.split(
                                        percentage=split_perc, align=True)
                                    item_space.label("TOBJ Path:")

                                    item_space.prop(mat.scs_props,
                                                    shader_texture_id +
                                                    "_imported_tobj",
                                                    text="")

                            shader_texture = mat.scs_props.get(
                                shader_texture_id, "")
                            if lock_state == 'True' and shader_texture:
                                texture_box.enabled = False

                            texture_row = texture_box.row()
                            item_space = texture_row.split(
                                percentage=split_perc, align=True)

                            # in case of custom tobj value texture is used only for preview
                            if read_only and use_imported_tobj:
                                item_space.label("Preview Tex:")
                            else:
                                item_space.label("Texture:")

                            layout_box_col = item_space.column(align=True)
                            layout_box_row = layout_box_col.row(align=True)

                            if shader_texture:
                                texture_icon = 'TEXTURE'
                            else:
                                texture_icon = 'MATPLANE'

                            # MARK INVALID SLOTS
                            if _material_utils.is_valid_shader_texture_path(
                                    shader_texture):
                                layout_box_row.alert = False
                            else:
                                layout_box_row.alert = True
                                texture_icon = 'ERROR'

                            # MARK EMPTY SLOTS
                            if shader_texture == "":
                                layout_box_row.alert = True

                            layout_box_row.prop(mat.scs_props,
                                                shader_texture_id,
                                                text='',
                                                icon=texture_icon)
                            props = layout_box_row.operator(
                                'scene.select_shader_texture_filepath',
                                text='',
                                icon='FILESEL')
                            props.shader_texture = shader_texture_id  # DYNAMIC ID SAVE (FOR FILE REQUESTER)

                            # UV LAYERS FOR TEXTURE
                            uv_mappings = getattr(
                                mat.scs_props,
                                "shader_" + tag_id_string + "_uv", None)

                            if len(uv_mappings) > 0:

                                texture_row = texture_box.row()
                                item_space = texture_row.split(
                                    percentage=split_perc, align=True)
                                if read_only:
                                    item_space.label("Preview UV Map:")
                                else:
                                    item_space.label("Mapping:")
                                layout_box_col = item_space.column(align=True)

                                for mapping in uv_mappings:

                                    item_space_row = layout_box_col.row(
                                        align=True)

                                    # add info about normal map uv mapping property in case of imported shader
                                    if read_only and tag_id_string == "texture_nmap":
                                        item_space_row.operator(
                                            "material.show_normal_maps_mapping_info",
                                            text="",
                                            icon="INFO")

                                    if mapping.value and mapping.value != "" and mapping.value in bpy.context.active_object.data.uv_layers:
                                        icon = "GROUP_UVS"
                                    else:
                                        icon = "ERROR"

                                    item_space_row.prop_search(
                                        data=mapping,
                                        property="value",
                                        search_data=bpy.context.active_object.
                                        data,
                                        search_property='uv_layers',
                                        text="",
                                        icon=icon,
                                    )

                            # ADDITIONAL TEXTURE SETTINGS
                            if not read_only or (read_only
                                                 and not use_imported_tobj):

                                export_tobj = getattr(
                                    mat.scs_props,
                                    shader_texture_id + "_export_tobj", False)

                                item_space = texture_box.row(align=True)
                                item_space.active = export_tobj

                                if export_tobj:
                                    icon = "FILE_TICK"
                                else:
                                    icon = "X_VEC"
                                item_space.prop(mat.scs_props,
                                                shader_texture_id +
                                                "_export_tobj",
                                                icon=icon,
                                                toggle=True)

                                item_space.prop_menu_enum(
                                    mat.scs_props,
                                    str('shader_' + tag_id_string +
                                        '_settings'),
                                    icon='SETTINGS',
                                )

                        else:
                            texture_box.row().label(
                                'Unsupported Shader Texture Type!',
                                icon="ERROR")
            else:
                panel_header = textures_box.split(percentage=0.5)
                panel_header_1 = panel_header.row()
                panel_header_1.prop(scs_props,
                                    'shader_textures_expand',
                                    text="Material Textures",
                                    icon='TRIA_RIGHT',
                                    icon_only=True,
                                    emboss=False)
Esempio n. 5
0
def _draw_shader_texture(layout, mat, split_perc, texture, read_only):
    """Draws texture box with it's properties.

    :param layout: layout to draw attribute to
    :type layout: bpy.types.UILayout
    :param mat: material from which data should be displayed
    :type mat: bpy.types.Material
    :param split_perc: split percentage for attribute name/value
    :type split_perc: float
    :param texture: texture data
    :type texture: dict
    :param read_only: if texture should be read only
    :type read_only: bool
    """

    tag = texture.get('Tag', None)
    hide_state = texture.get('Hide', None)
    tag_id = tag.split(':')
    tag_id_string = tag_id[1]
    texture_type = tag_id_string[8:]
    shader_texture_id = str('shader_' + tag_id_string)

    if hide_state == 'True':
        return

    texture_box = layout.box()

    header_split = texture_box.row().split(percentage=0.5)
    header_split.label(texture_type.title(), icon="TEXTURE_SHADED")

    if hasattr(mat.scs_props, shader_texture_id):

        shader_texture = mat.scs_props.get(shader_texture_id, "")
        # imported tobj boolean switch (only for imported shaders)
        use_imported_tobj = getattr(mat.scs_props,
                                    shader_texture_id + "_use_imported", False)
        if read_only:
            row = header_split.row(align=True)
            row.alignment = 'RIGHT'
            row.prop(mat.scs_props, shader_texture_id + "_use_imported")

            if use_imported_tobj:

                texture_row = texture_box.row()
                item_space = texture_row.split(percentage=split_perc,
                                               align=True)
                item_space.label("TOBJ Path:")

                item_space = item_space.split(percentage=(1 - split_perc) *
                                              0.2,
                                              align=True)
                props = item_space.operator("material.scs_looks_wt", text="WT")
                props.property_str = shader_texture_id
                item_space.prop(mat.scs_props,
                                shader_texture_id + "_imported_tobj",
                                text="")

        # disable whole texture layout if it's locked
        texture_box.enabled = not mat.scs_props.get(
            shader_texture_id + "_locked", False)

        texture_row = texture_box.row()
        item_space = texture_row.split(percentage=split_perc, align=True)

        # in case of custom tobj value texture is used only for preview
        if read_only and use_imported_tobj:
            item_space.label("Preview Tex:")
        else:
            item_space.label("Texture:")

        layout_box_col = item_space.column(align=True)
        layout_box_row = layout_box_col.row(align=True)

        if shader_texture:
            texture_icon = 'TEXTURE'
        else:
            texture_icon = 'MATPLANE'

        # MARK INVALID SLOTS
        if _material_utils.is_valid_shader_texture_path(shader_texture):
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
            texture_icon = 'ERROR'

        # MARK EMPTY SLOTS
        if shader_texture == "":
            layout_box_row.alert = True

        layout_box_row = layout_box_row.split(percentage=(1 - split_perc) *
                                              0.2,
                                              align=True)
        props = layout_box_row.operator("material.scs_looks_wt", text="WT")
        props.property_str = shader_texture_id

        layout_box_row = layout_box_row.row(align=True)
        layout_box_row.prop(mat.scs_props,
                            shader_texture_id,
                            text='',
                            icon=texture_icon)
        props = layout_box_row.operator('scene.select_shader_texture_filepath',
                                        text='',
                                        icon='FILESEL')
        props.shader_texture = shader_texture_id  # DYNAMIC ID SAVE (FOR FILE REQUESTER)

        # ADDITIONAL TEXTURE SETTINGS
        if (not read_only or
            (read_only and not use_imported_tobj)) and texture_box.enabled:

            tobj_exists = _material_utils.is_valid_shader_texture_path(
                shader_texture, True)

            if not tobj_exists:
                item_split = layout_box_col.split(percentage=(1 - split_perc) *
                                                  0.2,
                                                  align=True)

                item_space = item_split.row(align=True)
                props = item_space.operator("material.scs_create_tobj",
                                            icon="NEW",
                                            text="")
                props.texture_type = texture_type

                item_space = item_split.row(align=True)
            else:
                item_space = layout_box_col.row(align=True)

            item_space.enabled = tobj_exists

            if tobj_exists:
                mtime = str(
                    os.path.getmtime(
                        _path_utils.get_abs_path(shader_texture[:-4] +
                                                 ".tobj")))
                item_space.alert = (mtime != getattr(
                    mat.scs_props, shader_texture_id + "_tobj_load_time",
                    "NOT FOUND"))
            else:
                item_space.alert = True

            props = item_space.operator("material.scs_reload_tobj",
                                        icon="LOAD_FACTORY",
                                        text="")
            props.texture_type = texture_type

            item_space.prop_menu_enum(
                mat.scs_props,
                str('shader_' + tag_id_string + '_settings'),
                icon='SETTINGS',
            )

        # UV LAYERS FOR TEXTURE
        uv_mappings = getattr(mat.scs_props, "shader_" + tag_id_string + "_uv",
                              None)

        if len(uv_mappings) > 0:

            texture_row = texture_box.row()
            item_space = texture_row.split(percentage=split_perc, align=True)
            if read_only:
                item_space.label("Preview UV Map:")
            else:
                item_space.label("Mapping:")
            layout_box_col = item_space.column(align=True)

            for mapping in uv_mappings:

                item_space_row = layout_box_col.row(align=True)

                # add info about normal map uv mapping property in case of imported shader
                if read_only and tag_id_string == "texture_nmap":
                    preview_nmap_msg = str(
                        "Maping value for normal maps is in the case of imported shader\n"
                        "also used for defining uv map layer for tangent calculations!\n"
                        "If the uv map is not provided first entry from Mappings list above will be used!"
                    )
                    _shared.draw_warning_operator(item_space_row,
                                                  "Mapping Info",
                                                  preview_nmap_msg,
                                                  icon="INFO")

                # add ensuring operator for norma map uv mapping
                if tag_id_string == "texture_nmap":
                    props = item_space_row.operator(
                        "mesh.scs_ensure_active_uv",
                        text="",
                        icon="FILE_REFRESH")
                    props.mat_name = mat.name
                    props.uv_layer = uv_mappings[0].value

                if mapping.value and mapping.value != "" and mapping.value in bpy.context.active_object.data.uv_layers:
                    icon = "GROUP_UVS"
                else:
                    icon = "ERROR"

                item_space_row.prop_search(
                    data=mapping,
                    property="value",
                    search_data=bpy.context.active_object.data,
                    search_property='uv_layers',
                    text="",
                    icon=icon,
                )

    else:
        texture_box.row().label('Unsupported Shader Texture Type!',
                                icon="ERROR")