Skip to content

Commit

Permalink
Support stubbs model in model converter (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShellyHerself authored Jun 7, 2020
2 parents 975dfd4 + 7f35a20 commit ab28bb4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

This project also inherits changes from [Binilla](https://github.com/Sigmmma/binilla).

## [1.9.5]
### Changed
- Allow converting from stubbs in model converter.

## [1.9.4]
### Changed
- Settings directory is for Windows is now in the user folder.
Expand Down
4 changes: 2 additions & 2 deletions mozzarilla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# ##############
__author__ = "Sigmmma"
# YYYY.MM.DD
__date__ = "2020.05.15"
__version__ = (1, 9, 4)
__date__ = "2020.06.06"
__version__ = (1, 9, 5)
__website__ = "https://github.com/Sigmmma/mozzarilla"
12 changes: 8 additions & 4 deletions mozzarilla/windows/tag_converters/model_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
from math import sqrt
from traceback import format_exc

from reclaimer.hek.defs.mod2 import fast_mod2_def as mod2_def
from reclaimer.stubbs.defs.mode import fast_mode_def as mode_def
from reclaimer.hek.defs.mod2 import fast_mod2_def as mod2_def
from reclaimer.hek.defs.mode import fast_mode_def as halo_mode_def
from reclaimer.stubbs.defs.mode import fast_mode_def as stubbs_mode_def

window_base_class = tk.Toplevel
if __name__ == "__main__":
Expand Down Expand Up @@ -148,12 +149,15 @@ def destroy(self):
window_base_class.destroy(self)

def convert(self, tag_path):
# for compatibility with stubbs, we'll read as stubbs mode(since
# stubbs simply adds fields), but we'll write as halo mode(no one is
# creating stubbs models, so they'll want everything as halo models)
if self.to_gbxmodel:
src_tag = mode_def.build(filepath=tag_path)
src_tag = stubbs_mode_def.build(filepath=tag_path)
dst_tag = mod2_def.build()
else:
src_tag = mod2_def.build(filepath=tag_path)
dst_tag = mode_def.build()
dst_tag = halo_mode_def.build()

dst_tag.filepath = PurePath(tag_path).with_suffix("." + self.dst_ext)
convert_model(src_tag, dst_tag, self.to_gbxmodel)
Expand Down

0 comments on commit ab28bb4

Please sign in to comment.