diff --git a/abmatt/build/config.txt b/abmatt/build/config.txt index 39a3616..7162f41 100644 --- a/abmatt/build/config.txt +++ b/abmatt/build/config.txt @@ -1,5 +1,5 @@ build_name = main # build output name build_type = onedir # the type of build, (auto|onefile|onedir) -version = 1.1.0 +version = 1.2.0 run_integration_tests = False run_unit_tests = False diff --git a/abmatt/converters/convert_dae.py b/abmatt/converters/convert_dae.py index 0b8155b..eac8d85 100644 --- a/abmatt/converters/convert_dae.py +++ b/abmatt/converters/convert_dae.py @@ -166,9 +166,6 @@ def __add_bone(self, node, parent_bone=None, matrix=None): return bone def __add_geometry(self, geometry, material_geometry_map): - replace = 'Mesh' - if geometry.name.endswith(replace) and len(replace) < len(geometry.name): - geometry.name = geometry.name[:len(replace) * -1] if not self._should_include_geometry(geometry): return geo = material_geometry_map.get(geometry.material_name) diff --git a/abmatt/converters/convert_lib.py b/abmatt/converters/convert_lib.py index 9293372..64cb21b 100644 --- a/abmatt/converters/convert_lib.py +++ b/abmatt/converters/convert_lib.py @@ -5,6 +5,7 @@ from abmatt.autofix import AutoFix from abmatt.brres import Brres +from abmatt.converters.error import ConvertError from abmatt.brres.lib.matching import fuzzy_match from abmatt.brres.material_library import MaterialLibrary from abmatt.brres.mdl0.material import material @@ -113,6 +114,8 @@ def _start_loading(self, model_name): return self._init_mdl0(brres_name, os.path.splitext(name)[0], model_name) def _before_encoding(self): + if not self.geometries: + raise ConvertError('No geometries found to encode!') if self.patch_existing: replace_names = [x.name for x in self.geometries] for poly in [x for x in self.replacement_model.objects if x.name in replace_names]: diff --git a/abmatt/converters/dae.py b/abmatt/converters/dae.py index cad31f2..a667007 100644 --- a/abmatt/converters/dae.py +++ b/abmatt/converters/dae.py @@ -349,6 +349,9 @@ def decode_geometries(self, xml_geometry, mat_names=None): geo_name = xml_geometry.attrib.get('name') if not geo_name: geo_name = get_id(xml_geometry) + replace = 'Mesh' + if geo_name.endswith(replace) and len(replace) < len(geo_name): + geo_name = geo_name[:len(replace) * -1] geo_count = 0 for tri_node in mesh.iter('triangles'): if not mat_names: @@ -594,7 +597,7 @@ def __initialize_libraries(self, initial_name): def __initialize_assets(self, root): asset = XMLNode('asset', parent=root) contributor = XMLNode('contributor', parent=asset) - authoring_tool = XMLNode('authoring_tool', 'ABMATT COLLADA exporter v1.1.0', parent=contributor) + authoring_tool = XMLNode('authoring_tool', 'ABMATT COLLADA exporter v1.2.0', parent=contributor) time_stamp = datetime.now() created = XMLNode('created', str(time_stamp), parent=asset) modified = XMLNode('modified', str(time_stamp), parent=asset) diff --git a/abmatt/converters/obj.py b/abmatt/converters/obj.py index ef80eeb..8ca50e9 100644 --- a/abmatt/converters/obj.py +++ b/abmatt/converters/obj.py @@ -138,7 +138,7 @@ def save(self): self.save_obj() def save_mtllib(self, folder): - s = '# Wavefront MTL exported with ABMATT v1.1.0' + s = '# Wavefront MTL exported with ABMATT v1.2.0' materials = self.materials for x in materials: s += '\n' + materials[x].get_save_str() @@ -146,7 +146,7 @@ def save_mtllib(self, folder): f.write(s) def save_obj(self): - s = '# Wavefront OBJ exported with ABMATT v1.1.0\n\nmtllib ' + self.mtllib + '\n\n' + s = '# Wavefront OBJ exported with ABMATT v1.2.0\n\nmtllib ' + self.mtllib + '\n\n' vertex_index = 1 normal_index = 1 normal_offset = -1 diff --git a/abmatt/converters/points.py b/abmatt/converters/points.py index b03a72e..1a18f1d 100644 --- a/abmatt/converters/points.py +++ b/abmatt/converters/points.py @@ -90,11 +90,8 @@ def get_format_divisor(minimum, maximum): is_signed = True if point_min < 0 else False point_max = max(point_max, abs(point_min)) max_shift = 16 - math.frexp(point_max)[1] - is_signed - if max_shift <= 6: # guarantee 6 decimals of precision + if max_shift <= 13: # guarantee 4 decimals of precision return 'f', 0 # float - elif max_shift >= 15: - max_shift -= 8 - format = 'b' if is_signed else 'B' else: format = 'h' if is_signed else 'H' return format, max_shift diff --git a/abmatt/dist/install-ubu.txt b/abmatt/dist/install-ubu.txt index b8c6317..25f5cfa 100644 --- a/abmatt/dist/install-ubu.txt +++ b/abmatt/dist/install-ubu.txt @@ -1,6 +1,6 @@ ==================================================================================== ANOOB'S BRRES MATERIAL TOOL -Version: 1.1.0 +Version: 1.2.0 Author: Robert Nelson OS: linux Github: https://github.com/Robert-N7/abmatt diff --git a/abmatt/dist/install-win.txt b/abmatt/dist/install-win.txt index c9e7bf9..a7bb9f7 100644 --- a/abmatt/dist/install-win.txt +++ b/abmatt/dist/install-win.txt @@ -1,6 +1,6 @@ =================================================================================================== ANOOB'S BRRES MATERIAL TOOL -Version 1.1.0 +Version 1.2.0 Robert Nelson OS: Windows 10 64-bit Github: https://github.com/Robert-N7/abmatt diff --git a/abmatt/dist/make_installer.nsi b/abmatt/dist/make_installer.nsi index 389264a..446418d 100644 --- a/abmatt/dist/make_installer.nsi +++ b/abmatt/dist/make_installer.nsi @@ -1,4 +1,4 @@ -!define VERSION "1.1.0" +!define VERSION "1.2.0" !define PROGRAM_NAME "ANoob's Brres Material Tool ${VERSION}" InstallDir "$Documents\abmatt" Name "${PROGRAM_NAME}" diff --git a/abmatt/load_config.py b/abmatt/load_config.py index 27d797f..724deb3 100644 --- a/abmatt/load_config.py +++ b/abmatt/load_config.py @@ -117,7 +117,7 @@ def load_config(app_dir=None, loudness=None, autofix_level=None): return conf -VERSION = '1.1.0' +VERSION = '1.2.0' USAGE = "USAGE: abmatt [command_line][--interactive -f -b -d --overwrite]" diff --git a/setup.py b/setup.py index 32b52c2..19250bc 100755 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ # calling the setup function setup(name='abmatt', - version='1.1.0', + version='1.2.0', entry_points={ 'console_scripts': [ 'abmatt = abmatt.__main__:main'