Skip to content

Commit

Permalink
Merge pull request #15 from matyalatte/dev
Browse files Browse the repository at this point in the history
v0.3.4 update
  • Loading branch information
matyalatte authored Dec 27, 2023
2 parents 13d4a4c + d67fb91 commit 180f346
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
test:
# Most code is from pytest-blender's workflow by mondeja.
# https://github.com/mondeja/pytest-blender/blob/master/.github/workflows/ci.yml
name: Test
name: Test-${{ matrix.platform }}-${{ matrix.blender-version }}
runs-on: ${{ matrix.platform }}
env:
pytest-version: '7.1.2'
Expand All @@ -37,22 +37,25 @@ jobs:
fail-fast: false
matrix:
include:
# Test with 2.83, 3.3, and 3.6 on Windows
# Test with 2.83, 3.3, 3.6, and 4.0 on Windows
- platform: windows-latest
blender-version: '3.6.5'

blender-version: '4.0.2'

- platform: windows-latest
blender-version: '3.6.7'

- platform: windows-latest
blender-version: '3.3.7'
blender-version: '3.3.14'

- platform: windows-latest
blender-version: '2.83.20'

# Test with 3.3 on Unix/Linux systems
# Test with 3.6 on Unix/Linux systems
- platform: ubuntu-latest
blender-version: '3.3.7'
blender-version: '3.6.7'

- platform: macos-latest
blender-version: '3.3.7'
blender-version: '3.6.7'

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion addons/blender_dds_addon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
bl_info = {
'name': 'DDS textures',
'author': 'Matyalatte',
'version': (0, 3, 3),
'version': (0, 3, 4),
'blender': (2, 83, 20),
'location': 'Image Editor > Sidebar > DDS Tab',
'description': 'Import and export .dds files',
Expand Down
9 changes: 8 additions & 1 deletion addons/blender_dds_addon/directx/dds.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ def is_array(self):


def is_hdr(name: str):
return 'BC6' in name or 'FLOAT' in name or 'INT' in name or 'SNORM' in name
return 'BC6' in name or 'FLOAT' in name or 'INT' in name


def is_signed(name: str):
return 'SNORM' in name or 'SF16' in name


def convertible_to_tga(name: str):
Expand Down Expand Up @@ -390,6 +394,9 @@ def is_srgb(self):
def is_int(self):
return 'INT' in self.dxgi_format.name

def is_signed(self):
return is_signed(self.dxgi_format.name)

def is_canonical(self):
return self.fourCC not in UNCANONICAL_FOURCC

Expand Down
11 changes: 9 additions & 2 deletions addons/blender_dds_addon/directx/texconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import tempfile

from .dds import DDSHeader, is_hdr
from .dds import DDSHeader, is_hdr, is_signed
from .dxgi_format import DXGI_FORMAT
from . import util

Expand Down Expand Up @@ -131,6 +131,9 @@ def convert_to_tga(self, file, out=None, cubemap_layout="h-cross", invert_normal
if not dds_header.convertible_to_tga():
args += ['-f', 'rgba']

if dds_header.is_signed():
args += '-x2bias'

if dds_header.is_int():
msg = f'Int format detected. ({dds_header.get_format_as_str()})\n It might not be converted correctly.'
print(msg)
Expand All @@ -139,7 +142,8 @@ def convert_to_tga(self, file, out=None, cubemap_layout="h-cross", invert_normal
args += ['-ft', fmt]

if dds_header.is_bc5():
args += ['-reconstructz']
if not dds_header.is_signed():
args += ['-reconstructz']
if invert_normals:
args += ['-inverty']

Expand Down Expand Up @@ -185,6 +189,9 @@ def convert_to_dds(self, file, dds_fmt, out=None,
if image_filter != "LINEAR":
args += ["-if", image_filter]

if is_signed(dds_fmt):
args += '-x2bias'

if "SRGB" in dds_fmt:
args += ['-srgb']

Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ver 0.3.4
- Fixed a bug that SNORM textures are broken when importing and exporting.

ver 0.3.3
- Fixed a crash when closing Blender after exporting BC6 or BC7 textures.
- Fixed a bug that sRGB formats make textures brighter when exporting.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Blender-DDS-Addon v0.3.3
# Blender-DDS-Addon v0.3.4

[![Github All Releases](https://img.shields.io/github/downloads/matyalatte/Blender-DDS-Addon/total.svg)]()
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Expand Down

0 comments on commit 180f346

Please sign in to comment.