def export_bs_lighting_shader_prop_textures(self, bsshader):
        texset = self._create_textureset()
        bsshader.texture_set = texset

        # Add in extra texture slots
        texset.num_textures = 9
        texset.textures.update_size()

        if self.slots["Detail"]:
            texset.textures[6] = TextureWriter.export_texture_filename(self.slots["Detail"])

        if self.slots["Gloss"]:
            texset.textures[7] = TextureWriter.export_texture_filename(self.slots["Gloss"])

        # TODO [shader] UV offset node support
        # # UV Offset
        # if hasattr(bsshader, 'uv_offset'):
        #     self.export_uv_offset(bsshader)
        #
        # # UV Scale
        # if hasattr(bsshader, 'uv_scale'):
        #     self.export_uv_scale(bsshader)

        # Texture Clamping mode
        b_img = self.slots["Base"].image
Пример #2
0
    def export_texture_shader_effect(self, tex_prop):
        # disable
        return
        # export extra shader textures
        if bpy.context.scene.niftools_scene.game == 'SID_MEIER_S_RAILROADS':
            # sid meier's railroads:
            # some textures end up in the shader texture list there are 5 slots available, so set them up
            tex_prop.num_shader_textures = 5
            tex_prop.shader_textures.update_size()
            for mapindex, shadertexdesc in enumerate(tex_prop.shader_textures):
                # set default values
                shadertexdesc.is_used = False
                shadertexdesc.map_index = mapindex

            # some texture slots required by the engine
            shadertexdesc_envmap = tex_prop.shader_textures[0]
            shadertexdesc_envmap.is_used = True
            shadertexdesc_envmap.texture_data.source = TextureWriter.export_source_texture(filename="RRT_Engine_Env_map.dds")

            shadertexdesc_cubelightmap = tex_prop.shader_textures[4]
            shadertexdesc_cubelightmap.is_used = True
            shadertexdesc_cubelightmap.texture_data.source = TextureWriter.export_source_texture(filename="RRT_Cube_Light_map_128.dds")

        elif bpy.context.scene.niftools_scene.game == 'CIVILIZATION_IV':
            # some textures end up in the shader texture list there are 4 slots available, so set them up
            tex_prop.num_shader_textures = 4
            tex_prop.shader_textures.update_size()
            for mapindex, shadertexdesc in enumerate(tex_prop.shader_textures):
                # set default values
                shadertexdesc.is_used = False
                shadertexdesc.map_index = mapindex
    def export_bs_effect_shader_prop_textures(self, bsshader):
        bsshader.texture_set = self._create_textureset()

        if self.slots["Base"]:
            bsshader.source_texture = TextureWriter.export_texture_filename(self.slots["Base"])
        if self.slots["Glow"]:
            bsshader.greyscale_texture = TextureWriter.export_texture_filename(self.slots["Glow"])

        # clamp Mode
        bsshader.texture_clamp_mode = 65283
    def export_bs_effect_shader_prop_textures(self, bsshader):
        bsshader.texture_set = self._create_textureset()

        if self.slots[TEX_SLOTS.BASE]:
            bsshader.source_texture = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.BASE])
        if self.slots[TEX_SLOTS.GLOW]:
            bsshader.greyscale_texture = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.GLOW])

        # get the offset, scale and UV wrapping mode and set them
        self.export_uv_transform(bsshader)
    def _create_textureset(self):
        texset = NifFormat.BSShaderTextureSet()

        if self.slots["Base"]:
            texset.textures[0] = TextureWriter.export_texture_filename(self.slots["Base"])

        if self.slots["Normal"]:
            texset.textures[1] = TextureWriter.export_texture_filename(self.slots["Normal"])

        if self.slots["Glow"]:
            texset.textures[2] = TextureWriter.export_texture_filename(self.slots["Glow"])

        if self.slots["Detail"]:
            texset.textures[3] = TextureWriter.export_texture_filename(self.slots["Detail"])

        return texset
    def export_bs_lighting_shader_prop_textures(self, bsshader):
        texset = self._create_textureset()
        bsshader.texture_set = texset

        # Add in extra texture slots
        texset.num_textures = 9
        texset.textures.update_size()

        if self.slots[TEX_SLOTS.DECAL_0]:
            texset.textures[6] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.DECAL_0])

        if self.slots[TEX_SLOTS.GLOSS]:
            texset.textures[7] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.GLOSS])

        # get the offset, scale and UV wrapping mode and set them
        self.export_uv_transform(bsshader)
    def _create_textureset(self):
        texset = NifFormat.BSShaderTextureSet()

        if self.slots[TEX_SLOTS.BASE]:
            texset.textures[0] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.BASE])

        if self.slots[TEX_SLOTS.NORMAL]:
            texset.textures[1] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.NORMAL])

        if self.slots[TEX_SLOTS.GLOW]:
            texset.textures[2] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.GLOW])

        if self.slots[TEX_SLOTS.DETAIL]:
            texset.textures[3] = TextureWriter.export_texture_filename(
                self.slots[TEX_SLOTS.DETAIL])

        return texset
Пример #8
0
 def export_nitextureprop_tex_descs(self, texprop):
     # go over all valid texture slots
     for slot_name, b_texture_node in self.slots.items():
         if b_texture_node:
             # get the field name used by nif xml for this texture
             field_name = f"{slot_name.lower().replace(' ', '_')}_texture"
             NifLog.debug(f"Activating {field_name} for {b_texture_node.name}")
             setattr(texprop, "has_"+field_name, True)
             # get the tex desc link
             texdesc = getattr(texprop, field_name)
             uv_index = self.get_uv_node(b_texture_node)
             # set uv index and source texture to the texdesc
             texdesc.uv_set = uv_index
             texdesc.source = TextureWriter.export_source_texture(b_texture_node)
Пример #9
0
 def export_texture_effect(self, b_texture_node=None):
     """Export a texture effect block from material texture mtex (MTex, not Texture)."""
     texeff = NifFormat.NiTextureEffect()
     texeff.flags = 4
     texeff.rotation.set_identity()
     texeff.scale = 1.0
     texeff.model_projection_matrix.set_identity()
     texeff.texture_filtering = NifFormat.TexFilterMode.FILTER_TRILERP
     texeff.texture_clamping = NifFormat.TexClampMode.WRAP_S_WRAP_T
     texeff.texture_type = NifFormat.EffectType.EFFECT_ENVIRONMENT_MAP
     texeff.coordinate_generation_type = NifFormat.CoordGenType.CG_SPHERE_MAP
     if b_texture_node:
         texeff.source_texture = TextureWriter.export_source_texture(b_texture_node.texture)
         if bpy.context.scene.niftools_scene.game == 'MORROWIND':
             texeff.num_affected_node_list_pointers += 1
             texeff.affected_node_list_pointers.update_size()
     texeff.unknown_vector.x = 1.0
     return block_store.register_block(texeff)