def draw(self, context):
        layout = self.layout
        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = pin_id
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)

        tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()
            if bpy.app.version < (2, 65, 3 ):
                row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
            else:
                row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots", idblock, "active_texture_index", rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(percentage=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")
    def poll(cls, context):
        idblock = context_tex_datablock(context)
        if isinstance(idblock, Brush):
            return False

        if not getattr(context, "texture_slot", None):
            return False

        engine = context.scene.render.engine
        return (engine in cls.COMPAT_ENGINES)
    def draw(self, context):
        layout = self.layout

        tex = context.texture
        slot = getattr(context, "texture_slot", None)
        idblock = context_tex_datablock(context)

        if idblock:
            layout.template_preview(tex, parent=idblock, slot=slot)
        else:
            layout.template_preview(tex, slot=slot)
Exemplo n.º 4
0
 def draw(self, context):
     tex = context.texture
     slot = getattr(context, "texture_slot", None)
     idblock = context_tex_datablock(context)
     layout = self.layout
     # if idblock:
         # layout.template_preview(tex, parent=idblock, slot=slot)
     if tex.pov.tex_pattern_type != 'emulator':
         layout.operator("tex.preview_update")
     else:
         layout.template_preview(tex, slot=slot)
    def draw(self, context):
        layout = self.layout

        tex = context.texture
        slot = getattr(context, "texture_slot", None)
        idblock = context_tex_datablock(context)

        if idblock:
            layout.template_preview(tex, parent=idblock, slot=slot)
        else:
            layout.template_preview(tex, slot=slot)

        #Show Alpha Button for Brush Textures, see #29502
        if context.space_data.texture_context == 'BRUSH':
            layout.prop(tex, "use_preview_alpha")
Exemplo n.º 6
0
 def draw(self, context):
     idblock = context_tex_datablock(context)
     layout = self.layout
     tex = context.texture
     row= layout.row()
     
     if not isinstance(idblock, World):
         row = layout.row(align=True)
         row.prop(tex, "yaf_use_alpha", text="Use Alpha")
         row.prop(tex, "use_calculate_alpha", text="Calculate Alpha")
     
         row = layout.row(align=True)
         row.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
     #
     layout.prop(tex,"interpolation_type")
    def draw(self, context):
        layout = self.layout
        idblock = context_tex_datablock(context)

        tex = context.texture
        layout.label(text="Image:")
        row = layout.row(align=True)
        if not isinstance(idblock, World):
            '''povman: change layout to row for save space
                and show only options in each context
            '''
            row.prop(tex, "yaf_use_alpha", text="Use Alpha")
            row.prop(tex, "use_calculate_alpha", text="Calculate Alpha")
            layout.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
        else:
            row.prop(tex, "use_interpolation", text="Use image background interpolation")
    def draw(self, context):
        layout = self.layout
        idblock = context_tex_datablock(context)

        tex = context.texture
        layout.label(text="Image:")
        row = layout.row(align=True)
        if not isinstance(idblock, World):
            '''povman: change layout to row for save space
                and show only options in each context
            '''
            row.prop(tex, "yaf_use_alpha", text="Use Alpha")
            row.prop(tex, "use_calculate_alpha", text="Calculate Alpha")
            layout.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
            layout.prop(tex, "yaf_tex_interpolate")
            if tex.yaf_tex_interpolate == "mipmap_ewa":
                layout.prop(tex, "yaf_ewa_max_anisotropy")
            elif tex.yaf_tex_interpolate == "mipmap_trilinear":
                layout.prop(tex, "yaf_trilinear_level_bias")
        else:
            row.prop(tex, "use_interpolation", text="Use image background interpolation")
            #row.prop(tex, "use_calculate_alpha", text="Calculate Alpha")
        layout.prop(tex, "yaf_tex_optimization")
        layout.prop(tex, "yaf_img_grayscale", text="Use as Grayscale")
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot
        # textype = context.texture

        if not isinstance(idblock, Brush):
            if isinstance(idblock, World):
                split = layout.split(percentage=0.3)
                col = split.column()
                world = context.world
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(world, "yaf_mapworld_type", text="")
            else:
                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 == 'UV':
                pass
                #### UV layers not supported in yafaray engine ###
                """
                split = layout.split(percentage=0.3)
                split.label(text="Layer:")
                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:
                layout.label(text="Brush Mapping:")
                layout.prop(tex, "map_mode", expand=True)

                row = layout.row()
                row.active = tex.map_mode in {'FIXED', 'TILED'}
                row.prop(tex, "angle")
        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")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                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="")

        # tes povman
        if not isinstance(idblock, World):
            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Exemplo n.º 10
0
    def draw(self, context):

        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot
        texture = context.texture

        def factor_but(layout, toggle, factor, name):
            row = layout.row(align=True)
            row.prop(tex, toggle, text="")
            sub = row.row()
            sub.active = getattr(tex, toggle)
            sub.prop(tex, factor, text=name, slider=True)
            return sub  # XXX, temp. use_map_normal needs to override.

        shaderNodes = dict()
        shaderNodes["Bump"] = ["use_map_normal", "normal_factor", "Bump"]
        shaderNodes["MirrorAmount"] = [
            "use_map_raymir", "raymir_factor", "Mirror Amount"
        ]
        shaderNodes["SigmaOren"] = [
            "use_map_hardness", "hardness_factor",
            "Sigma Amount for Oren Nayar"
        ]
        shaderNodes["MirrorColor"] = [
            "use_map_mirror", "mirror_factor", "Mirror Color"
        ]
        shaderNodes["DiffuseColor"] = [
            "use_map_color_diffuse", "diffuse_color_factor", "Diffuse Color"
        ]
        shaderNodes["GlossyColor"] = [
            "use_map_color_spec", "specular_color_factor", "Glossy Color"
        ]
        shaderNodes["GlossyAmount"] = [
            "use_map_specular", "specular_factor", "Glossy Amount"
        ]
        shaderNodes["Transparency"] = [
            "use_map_alpha", "alpha_factor", "Transparency"
        ]
        shaderNodes["Translucency"] = [
            "use_map_translucency", "translucency_factor", "Translucency"
        ]
        shaderNodes["BlendAmount"] = [
            "use_map_diffuse", "diffuse_factor", "Blending Amount"
        ]
        shaderNodes["DiffuseReflection"] = [
            "use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"
        ]
        shaderNodes["FilterColor"] = [
            "use_map_color_reflection", "reflection_color_factor",
            "Filter Color Amount"
        ]
        shaderNodes["IORAmount"] = [
            "use_map_warp", "warp_factor", "IOR Amount (added to material IOR)"
        ]
        shaderNodes["RoughnessAmount"] = [
            "use_map_hardness", "hardness_factor", "Roughness amount"
        ]
        shaderNodes["ExponentAmount"] = [
            "use_map_ambient", "ambient_factor", "Glossy Exponent amount"
        ]
        shaderNodes["Wireframe"] = [
            "use_map_displacement", "displacement_factor", "Wireframe Amount"
        ]

        materialShaderNodes = dict()
        materialShaderNodes["glass"] = [
            "FilterColor", "MirrorColor", "IORAmount", "Bump", "Wireframe"
        ]
        materialShaderNodes["rough_glass"] = [
            "RoughnessAmount", "FilterColor", "MirrorColor", "IORAmount",
            "Bump", "Wireframe"
        ]
        materialShaderNodes["glossy"] = [
            "DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor",
            "GlossyAmount", "ExponentAmount", "Bump", "Wireframe"
        ]
        materialShaderNodes["coated_glossy"] = [
            "DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor",
            "GlossyAmount", "ExponentAmount", "MirrorAmount", "MirrorColor",
            "IORAmount", "Bump", "Wireframe"
        ]
        materialShaderNodes["shinydiffusemat"] = [
            "DiffuseColor", "DiffuseReflection", "SigmaOren", "MirrorAmount",
            "MirrorColor", "IORAmount", "Transparency", "Translucency", "Bump",
            "Wireframe"
        ]
        materialShaderNodes["blend"] = ["BlendAmount"]

        if isinstance(idblock, Material):
            nodes = materialShaderNodes[idblock.mat_type]
            col = layout.column()

            for node in nodes:
                value = shaderNodes[node]
                factor_but(col, value[0], value[1], value[2])
                if node == "Bump" and getattr(
                        tex,
                        "use_map_normal") and texture.yaf_tex_type == 'IMAGE':
                    col.prop(texture, "yaf_is_normal_map",
                             "Use map as normal map")

        elif isinstance(idblock, World):  # for setup world texture
            split = layout.split()

            col = split.column()
            factor_but(col, "use_map_blend", "blend_factor", "Blend")
            factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")

            col = split.column()
            factor_but(col, "use_map_zenith_up", "zenith_up_factor",
                       "Zenith Up")
            factor_but(col, "use_map_zenith_down", "zenith_down_factor",
                       "Zenith Down")

        if not isinstance(idblock, ParticleSettings) and not isinstance(
                idblock, World):
            split = layout.split()

            col = split.column()
            col.prop(tex, "blend_type", text="Blend")
            col.prop(tex, "use_rgb_to_intensity", text="No RGB")
            col.prop(tex, "color", text="")

            col = split.column()
            col.prop(tex, "invert", text="Negative")
            col.prop(tex, "use_stencil")

        if isinstance(idblock, Material) or isinstance(idblock, World):
            layout.separator()
            layout.row().prop(tex,
                              "default_value",
                              text="Default Value",
                              slider=True)
Exemplo n.º 11
0
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot
        # textype = context.texture

        if not isinstance(idblock, Brush):
            if isinstance(idblock, World):
                split = layout.split(factor=0.3)
                col = split.column()
                world = context.world
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(world, "yaf_mapworld_type", text="")
            else:
                split = layout.split(factor=0.3)
                col = split.column()
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(tex, "texture_coords", text="")

            if tex.texture_coords == 'UV':
                pass
                #### UV layers not supported in yafaray engine ###
                """
                split = layout.split(factor=0.3)
                split.label(text="Layer:")
                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(factor=0.3)
                split.label(text="Object:")
                split.prop(tex, "object", text="")

        if isinstance(idblock, Brush):
            if context.sculpt_object:
                layout.label(text="Brush Mapping:")
                layout.prop(tex, "map_mode", expand=True)

                row = layout.row()
                row.active = tex.map_mode in {'FIXED', 'TILED'}
                row.prop(tex, "angle")
        else:
            if isinstance(idblock, Material):
                split = layout.split(factor=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")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                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="")

        # tes povman
        if not isinstance(idblock, World):
            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Exemplo n.º 12
0
    def draw(self, context):
        layout = self.layout

        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        space.use_limited_texture_context = True

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)
            pin_id = None

        if space.texture_context == 'OTHER':
            if not pin_id:
                layout.template_texture_user()
            user = context.texture_user
            if user or pin_id:
                layout.separator()

                row = layout.row()

                if pin_id:
                    row.template_ID(space, "pin_id")
                else:
                    propname = context.texture_user_property.identifier
                    row.template_ID(user, propname, new="texture.new")

                if tex:
                    split = layout.split(factor=0.2)
                    if tex.use_nodes:
                        if slot:
                            split.label(text="Output:")
                            split.prop(slot, "output_node", text="")
                    else:
                        split.label(text="Type:")
                        split.prop(tex, "type", text="")
            return

        tex_collection = (pin_id is None) and (node is None) and (
            not isinstance(idblock, Brush))

        if tex_collection and False:  #FIXME DAVID!
            row = layout.row()
            row.template_list("TEXTURE_UL_texslots",
                              "",
                              idblock,
                              "texture_slots",
                              idblock,
                              "active_texture_index",
                              rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="",
                         icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="",
                         icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(factor=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")
Exemplo n.º 13
0
def imageTexturePoll(cls, context):
    idblock = context_tex_datablock(context)
    engine = context.scene.render.engine
    tex = context.texture
    
    return tex and (tex.yaf_tex_type == cls.tex_type and (engine in cls.COMPAT_ENGINES))
Exemplo n.º 14
0
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot

        if not isinstance(idblock, Brush):
            if isinstance(idblock, World):
                split = layout.split(percentage=0.3)
                col = split.column()
                world = context.world.bounty
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(world, "bg_mapping_type", text="")
                #col.prop(tex, "use_interpolation", text="Use image background interpolation")
            else:
                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 == 'UV':
                #pass
                '''
                 Maybe UV layers ist not supported in TheBounty engine
                '''
                split = layout.split(percentage=0.3)
                split.label(text="Layer:")
                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:
                layout.label(text="Brush Mapping:")
                layout.prop(tex, "map_mode", expand=True)

                row = layout.row()
                row.active = tex.map_mode in {'FIXED', 'TILED'}
                row.prop(tex, "angle")
        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")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                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="")

        # not use offset and scale in world texture
        if not isinstance(idblock, World):
            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Exemplo n.º 15
0
 def poll(cls, context):
     idblock = context_tex_datablock(context)
     #
     return imageTexturePoll(cls,
                             context) and not isinstance(idblock, World)
Exemplo n.º 16
0
    def draw(self, context):
        layout = self.layout        
        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        space.use_limited_texture_context = True

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)
            pin_id = None
        
        # copied from Blender, but not use atm
        # TODO: review
        #'''
        if space.texture_context == 'OTHER':
            if not pin_id:
                layout.template_texture_user()
            user = context.texture_user
            if user or pin_id:
                layout.separator()

                split = layout.split(percentage=0.65)
                col = split.column()

                if pin_id:
                    col.template_ID(space, "pin_id")
                else:
                    propname = context.texture_user_property.identifier
                    col.template_ID(user, propname, new="texture.new")

                if tex:
                    split = layout.split(percentage=0.2)
                    if tex.use_nodes:
                        if slot:
                            split.label(text="Output:")
                            split.prop(slot, "output_node", text="")
                    else:
                        split.label(text="Type:")
                        split.prop(tex, "yaf_tex_type", text="")
            return
        #"""

        tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()
            if bpy.app.version < (2, 65, 3 ):
                row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
            else:
                row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots", idblock, "active_texture_index", rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(percentage=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")
Exemplo n.º 17
0
    def draw(self, context):
        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot

        if not isinstance(idblock, Brush):
            if isinstance(idblock, World):
                split = layout.split(percentage=0.3)
                col = split.column()
                world = context.world.bounty
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(world, "bg_mapping_type", text="")
                #col.prop(tex, "use_interpolation", text="Use image background interpolation")
            else:
                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 == 'UV':
                #pass
                
                '''
                 Maybe UV layers ist not supported in TheBounty engine
                '''
                split = layout.split(percentage=0.3)
                split.label(text="Layer:")
                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:
                layout.label(text="Brush Mapping:")
                layout.prop(tex, "map_mode", expand=True)

                row = layout.row()
                row.active = tex.map_mode in {'FIXED', 'TILED'}
                row.prop(tex, "angle")
        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")
                elif tex.texture_coords == 'OBJECT':
                    col.prop(tex, "use_from_original")
                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="")

        # not use offset and scale in world texture
        if not isinstance(idblock, World):
            row = layout.row()
            row.column().prop(tex, "offset")
            row.column().prop(tex, "scale")
Exemplo n.º 18
0
 def poll(cls, context):
     idblock = context_tex_datablock(context)
     #
     return imageTexturePoll(cls, context) and not isinstance(idblock, World)
    def draw(self, context):

        layout = self.layout

        idblock = context_tex_datablock(context)

        tex = context.texture_slot
        texture = context.texture

        def factor_but(layout, toggle, factor, name):
            row = layout.row(align=True)
            row.prop(tex, toggle, text="")
            sub = row.row()
            sub.active = getattr(tex, toggle)
            sub.prop(tex, factor, text=name, slider=True)
            return sub  # XXX, temp. use_map_normal needs to override.

        shaderNodes = dict()
        shaderNodes["Bump"] = ["use_map_normal", "normal_factor", "Bump"]
        shaderNodes["MirrorAmount"] = ["use_map_raymir", "raymir_factor", "Mirror Amount"]
        shaderNodes["SigmaOren"] = ["use_map_hardness", "hardness_factor", "Sigma Amount for Oren Nayar"]
        shaderNodes["MirrorColor"] = ["use_map_mirror", "mirror_factor", "Mirror Color"]
        shaderNodes["DiffuseColor"] = ["use_map_color_diffuse", "diffuse_color_factor", "Diffuse Color"]
        shaderNodes["GlossyColor"] = ["use_map_color_spec", "specular_color_factor", "Glossy Color"]
        shaderNodes["GlossyAmount"] = ["use_map_specular", "specular_factor", "Glossy Amount"]
        shaderNodes["Transparency"] = ["use_map_alpha", "alpha_factor", "Transparency"]
        shaderNodes["Translucency"] = ["use_map_translucency", "translucency_factor", "Translucency"]
        shaderNodes["BlendAmount"] = ["use_map_diffuse", "diffuse_factor", "Blending Amount"]
        shaderNodes["DiffuseReflection"] = ["use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"]
        shaderNodes["FilterColor"] = ["use_map_color_reflection", "reflection_color_factor", "Filter Color Amount"]
        shaderNodes["IORAmount"] = ["use_map_warp", "warp_factor", "IOR Amount (added to material IOR)"]
        shaderNodes["RoughnessAmount"] = ["use_map_hardness", "hardness_factor", "Roughness amount"]
        shaderNodes["ExponentAmount"] = ["use_map_ambient", "ambient_factor", "Glossy Exponent amount"]
        shaderNodes["Wireframe"] = ["use_map_displacement", "displacement_factor", "Wireframe Amount"]
                
        materialShaderNodes = dict()
        materialShaderNodes["glass"] = ["FilterColor", "MirrorColor", "IORAmount", "Bump", "Wireframe"]
        materialShaderNodes["rough_glass"] = ["RoughnessAmount", "FilterColor", "MirrorColor", "IORAmount", "Bump", "Wireframe"]
        materialShaderNodes["glossy"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor", "GlossyAmount", "ExponentAmount", "Bump", "Wireframe"]
        materialShaderNodes["coated_glossy"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor", "GlossyAmount", "ExponentAmount", "MirrorAmount", "MirrorColor", "IORAmount", "Bump", "Wireframe"]
        materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "MirrorAmount", "MirrorColor", "IORAmount", "Transparency", "Translucency", "Bump", "Wireframe"]
        materialShaderNodes["blend"] = ["BlendAmount"]

        if isinstance(idblock, Material):
            nodes = materialShaderNodes[idblock.mat_type]
            col = layout.column()

            for node in nodes:
                value = shaderNodes[node]
                factor_but(col, value[0], value[1], value[2])
                if node == "Bump" and getattr(tex, "use_map_normal") and texture.yaf_tex_type == 'IMAGE':
                    col.prop(texture, "yaf_is_normal_map", "Use map as normal map")

        elif isinstance(idblock, World):  # for setup world texture
            split = layout.split()

            col = split.column()
            factor_but(col, "use_map_blend", "blend_factor", "Blend")
            factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")

            col = split.column()
            factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
            factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")

        if not isinstance(idblock, ParticleSettings) and not isinstance(idblock, World):
            split = layout.split()

            col = split.column()
            col.prop(tex, "blend_type", text="Blend")
            col.prop(tex, "use_rgb_to_intensity", text="No RGB")
            col.prop(tex, "color", text="")

            col = split.column()
            col.prop(tex, "invert", text="Negative")
            col.prop(tex, "use_stencil")

        if isinstance(idblock, Material) or isinstance(idblock, World):
            layout.separator()
            layout.row().prop(tex, "default_value", text="Default Value", slider=True)
    def draw(self, context):
        layout = self.layout
        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = pin_id
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)

        tex_collection = (pin_id is None) and (node is None) and (
            not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()
            if bpy.app.version < (2, 65, 3):
                row.template_list(idblock,
                                  "texture_slots",
                                  idblock,
                                  "active_texture_index",
                                  rows=2)
            else:
                row.template_list("TEXTURE_UL_texslots",
                                  "",
                                  idblock,
                                  "texture_slots",
                                  idblock,
                                  "active_texture_index",
                                  rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="",
                         icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="",
                         icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(percentage=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")