Fixed some bugs
This commit is contained in:
@@ -2266,14 +2266,14 @@
|
|||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\_py_abc.py',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\_py_abc.py',
|
||||||
'PYMODULE'),
|
'PYMODULE'),
|
||||||
('tracemalloc',
|
|
||||||
'C:\\Program '
|
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\tracemalloc.py',
|
|
||||||
'PYMODULE'),
|
|
||||||
('stringprep',
|
('stringprep',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\stringprep.py',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\stringprep.py',
|
||||||
'PYMODULE'),
|
'PYMODULE'),
|
||||||
|
('tracemalloc',
|
||||||
|
'C:\\Program '
|
||||||
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\tracemalloc.py',
|
||||||
|
'PYMODULE'),
|
||||||
('PIL.Image',
|
('PIL.Image',
|
||||||
'C:\\Users\\Niklas\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PIL\\Image.py',
|
'C:\\Users\\Niklas\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PIL\\Image.py',
|
||||||
'PYMODULE'),
|
'PYMODULE'),
|
||||||
@@ -3232,29 +3232,29 @@
|
|||||||
'E:\\Arma Reforger '
|
'E:\\Arma Reforger '
|
||||||
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\LICENSE',
|
('setuptools-65.5.0.dist-info\\METADATA',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
||||||
|
'DATA'),
|
||||||
|
('setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
|
'C:\\Program '
|
||||||
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\RECORD',
|
('setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\METADATA',
|
('setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'DATA'),
|
|
||||||
('setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'C:\\Program '
|
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\WHEEL',
|
('setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\top_level.txt',
|
('setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
|
|||||||
@@ -277,29 +277,29 @@
|
|||||||
'E:\\Arma Reforger '
|
'E:\\Arma Reforger '
|
||||||
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\LICENSE',
|
('setuptools-65.5.0.dist-info\\METADATA',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
||||||
|
'DATA'),
|
||||||
|
('setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
|
'C:\\Program '
|
||||||
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\RECORD',
|
('setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\METADATA',
|
('setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'DATA'),
|
|
||||||
('setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'C:\\Program '
|
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\WHEEL',
|
('setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\top_level.txt',
|
('setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
[],
|
[],
|
||||||
False,
|
False,
|
||||||
False,
|
False,
|
||||||
1729259223,
|
1729345827,
|
||||||
[('run.exe',
|
[('run.exe',
|
||||||
'C:\\Users\\Niklas\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\run.exe',
|
'C:\\Users\\Niklas\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\run.exe',
|
||||||
'EXECUTABLE')],
|
'EXECUTABLE')],
|
||||||
|
|||||||
@@ -253,29 +253,29 @@
|
|||||||
'E:\\Arma Reforger '
|
'E:\\Arma Reforger '
|
||||||
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
'Work\\1960-utils\\Texturing\\MergeTextures2\\build\\merge_textures\\base_library.zip',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\LICENSE',
|
('setuptools-65.5.0.dist-info\\METADATA',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
||||||
|
'DATA'),
|
||||||
|
('setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
|
'C:\\Program '
|
||||||
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\RECORD',
|
('setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\RECORD',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\METADATA',
|
('setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\METADATA',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\LICENSE',
|
||||||
'DATA'),
|
|
||||||
('setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'C:\\Program '
|
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\WHEEL',
|
('setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\WHEEL',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\top_level.txt',
|
('setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\top_level.txt',
|
'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\\lib\\site-packages\\setuptools-65.5.0.dist-info\\INSTALLER',
|
||||||
'DATA'),
|
'DATA'),
|
||||||
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
('setuptools-65.5.0.dist-info\\entry_points.txt',
|
||||||
'C:\\Program '
|
'C:\\Program '
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Texturing/MergeTextures2/dist/merge_textures.exe
vendored
BIN
Texturing/MergeTextures2/dist/merge_textures.exe
vendored
Binary file not shown.
@@ -1,15 +1,16 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from PIL import Image
|
from PIL import Image # type: ignore
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# Define suffix lists for BaseColor, Normal, RMA/ORM
|
# Define suffix lists for BaseColor, Normal, RMA/ORM
|
||||||
BASECOLOR_SUFFIXES = ['_alb', '_albedo', '_bc', '_basecolor', '_b']
|
BASECOLOR_SUFFIXES = ['_alb.', '_albedo.', '_bc.', '_basecolor.', '_b.']
|
||||||
NORMAL_SUFFIXES = ['_nrm', '_normal', '_n']
|
NORMAL_SUFFIXES = ['_nrm.', '_normal.', '_n.']
|
||||||
RMA_SUFFIXES = ['_rma']
|
RMA_SUFFIXES = ['_rma.']
|
||||||
ORM_SUFFIXES = ['_orm']
|
ORM_SUFFIXES = ['_orm.']
|
||||||
EMISSIVE_SUFFIXES = ['_emissive']
|
EMISSIVE_SUFFIXES = ['_emissive.']
|
||||||
OPACITY_SUFFIXES = ['_opacity']
|
OPACITY_SUFFIXES = ['_opacity.']
|
||||||
|
MASK_SUFFIXES = ['_mask.','_m.']
|
||||||
|
|
||||||
def detect_texture_type(filename):
|
def detect_texture_type(filename):
|
||||||
""" Detects the type of texture based on its suffix """
|
""" Detects the type of texture based on its suffix """
|
||||||
@@ -25,16 +26,23 @@ def detect_texture_type(filename):
|
|||||||
return 'Emissive'
|
return 'Emissive'
|
||||||
elif any(suffix in filename.lower() for suffix in OPACITY_SUFFIXES):
|
elif any(suffix in filename.lower() for suffix in OPACITY_SUFFIXES):
|
||||||
return 'Opacity'
|
return 'Opacity'
|
||||||
|
elif any(suffix in filename.lower() for suffix in MASK_SUFFIXES):
|
||||||
|
return 'Mask'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_material_name(filename):
|
def get_material_name(filename):
|
||||||
""" Strips the 'T_' or 'TX_' prefix and returns the material name """
|
""" Strips the 'T_' or 'TX_' prefix but keeps the suffix for texture type detection.
|
||||||
|
Returns the full material name without the suffix for output file naming. """
|
||||||
base_name = os.path.basename(filename)
|
base_name = os.path.basename(filename)
|
||||||
|
|
||||||
|
# Remove the 'T_' or 'TX_' prefix
|
||||||
if base_name.startswith('T_'):
|
if base_name.startswith('T_'):
|
||||||
return base_name[2:].split('_')[0] # Assumes 'T_Material_Suffix'
|
base_name = base_name[2:]
|
||||||
elif base_name.startswith('TX_'):
|
elif base_name.startswith('TX_'):
|
||||||
return base_name[3:].split('_')[0] # Assumes 'TX_Material_Suffix'
|
base_name = base_name[3:]
|
||||||
return base_name.split('_')[0]
|
|
||||||
|
# Return the base_name without the suffix for output naming
|
||||||
|
return base_name.rsplit('_', 1)[0] # Split only at the last underscore
|
||||||
|
|
||||||
def process_textures(input_files):
|
def process_textures(input_files):
|
||||||
""" Main function to process all textures in a folder and convert to BCR/NMO """
|
""" Main function to process all textures in a folder and convert to BCR/NMO """
|
||||||
@@ -55,26 +63,43 @@ def process_textures(input_files):
|
|||||||
output_folder = os.path.join(base_path, 'merged')
|
output_folder = os.path.join(base_path, 'merged')
|
||||||
os.makedirs(output_folder, exist_ok=True)
|
os.makedirs(output_folder, exist_ok=True)
|
||||||
|
|
||||||
|
material_count = len(textures)
|
||||||
|
print(f"Detected {material_count} Materials to process.")
|
||||||
|
|
||||||
# Process each material group
|
# Process each material group
|
||||||
for material, files in textures.items():
|
for index, (material, files) in enumerate(textures.items()):
|
||||||
basecolor_file = files.get('BaseColor')
|
basecolor_file = files.get('BaseColor')
|
||||||
normal_file = files.get('Normal')
|
normal_file = files.get('Normal')
|
||||||
rma_file = files.get('RMA')
|
rma_file = files.get('RMA')
|
||||||
orm_file = files.get('ORM')
|
orm_file = files.get('ORM')
|
||||||
emissive_file = files.get('Emissive')
|
emissive_file = files.get('Emissive')
|
||||||
opacity_file = files.get('Opacity')
|
opacity_file = files.get('Opacity')
|
||||||
|
mask_file = files.get('Mask')
|
||||||
|
|
||||||
if basecolor_file and normal_file and (rma_file or orm_file):
|
missing_files = []
|
||||||
# Convert to BCR/NMO format
|
failed_converts = 0
|
||||||
convert_to_bcr_nmo(material, basecolor_file, normal_file, rma_file, orm_file, emissive_file, opacity_file, output_folder)
|
|
||||||
print(f"{material}: Successfully converted.")
|
# Check for required textures
|
||||||
|
if not basecolor_file:
|
||||||
|
missing_files.append('BaseColor')
|
||||||
|
if not normal_file:
|
||||||
|
missing_files.append('Normal')
|
||||||
|
if not (rma_file or orm_file):
|
||||||
|
missing_files.append('RMA or ORM')
|
||||||
|
|
||||||
|
# Report missing files if any
|
||||||
|
if missing_files:
|
||||||
|
print(f"({index+1}/{material_count}) Skipping {material}: missing {', '.join(missing_files)}")
|
||||||
|
failed_converts += 1
|
||||||
else:
|
else:
|
||||||
print(f"Skipping {material}: missing necessary files")
|
# Convert to BCR/NMO format
|
||||||
|
convert_to_bcr_nmo(material, basecolor_file, normal_file, rma_file, orm_file, emissive_file, opacity_file, mask_file, output_folder)
|
||||||
|
print(f"({index+1}/{material_count}) {material}: Successfully converted.")
|
||||||
|
|
||||||
print("+++All materials successfully converted+++")
|
print(f"+++{material_count - failed_converts} of {material_count} materials successfully converted+++")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
def convert_to_bcr_nmo(material, basecolor_file, normal_file, rma_file, orm_file, emissive_file, opacity_file, output_folder):
|
def convert_to_bcr_nmo(material, basecolor_file, normal_file, rma_file, orm_file, emissive_file, opacity_file, mask_file, output_folder):
|
||||||
""" Converts given textures to BCR and NMO formats """
|
""" Converts given textures to BCR and NMO formats """
|
||||||
basecolor_img = Image.open(basecolor_file).convert('RGBA')
|
basecolor_img = Image.open(basecolor_file).convert('RGBA')
|
||||||
normal_img = Image.open(normal_file).convert('RGBA')
|
normal_img = Image.open(normal_file).convert('RGBA')
|
||||||
@@ -103,6 +128,10 @@ def convert_to_bcr_nmo(material, basecolor_file, normal_file, rma_file, orm_file
|
|||||||
if opacity_file:
|
if opacity_file:
|
||||||
opacity_img = Image.open(opacity_file).convert('L')
|
opacity_img = Image.open(opacity_file).convert('L')
|
||||||
opacity_img.save(os.path.join(output_folder, f"{material}_OP.png"))
|
opacity_img.save(os.path.join(output_folder, f"{material}_OP.png"))
|
||||||
|
|
||||||
|
if mask_file:
|
||||||
|
mask_img = Image.open(mask_file).convert('L')
|
||||||
|
mask_img.save(os.path.join(output_folder, f"{material}_MASK.png"))
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Usage: drag and drop texture files onto the script")
|
print("Usage: drag and drop texture files onto the script")
|
||||||
|
|||||||
Reference in New Issue
Block a user