Example #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 _path_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'}
Example #2
0
        def execute(self, context):

            material = context.active_object.active_material

            if material:

                _material_utils.reload_tobj_settings(material, self.texture_type)

            return {'FINISHED'}
Example #3
0
        def execute(self, context):

            material = context.active_object.active_material

            if material:

                _material_utils.reload_tobj_settings(material,
                                                     self.texture_type)

            return {'FINISHED'}
Example #4
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'}
Example #5
0
def __update_shader_texture__(self, context, tex_type):
    """Hookup function for update of shader texture of any texture type.

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

    __update_look__((), context)

    material = _material_utils.get_material_from_context(context)

    if material:
        shader_texture_str = "shader_texture_" + tex_type
        shader_texture_filepath = getattr(self, shader_texture_str)

        # create texture and use it on shader
        texture = _material_utils.get_texture(shader_texture_filepath, tex_type)
        _shader.set_texture(material, tex_type, texture)

        # reload TOBJ settings
        _material_utils.reload_tobj_settings(material, tex_type)