Skip to content

Commit

Permalink
ms2 - allow injection with empty vert buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
HENDRIX-ZT2 committed Nov 12, 2023
1 parent c595ba4 commit 7803b03
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions generated/formats/ms2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,14 @@ def get_static_buffer(self):

@staticmethod
def get_bytes(buffer_reader):
buffer_reader.seek(0, 2)
buffer_reader.write(get_padding(buffer_reader.tell(), alignment=16))
return buffer_reader.getvalue()
if buffer_reader:
buffer_reader.seek(0, 2)
buffer_reader.write(get_padding(buffer_reader.tell(), alignment=16))
return buffer_reader.getvalue()
return b""

def get_all_bytes(self, buffer_info):
return b"".join(self.get_bytes(getattr(buffer_info, b_name)) for b_name in BUFFER_NAMES)
return b"".join(self.get_bytes(getattr(buffer_info, b_name, None)) for b_name in BUFFER_NAMES)

@property
def buffers(self):
Expand Down
10 changes: 6 additions & 4 deletions source/formats/ms2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,14 @@ def get_static_buffer(self):

@staticmethod
def get_bytes(buffer_reader):
buffer_reader.seek(0, 2)
buffer_reader.write(get_padding(buffer_reader.tell(), alignment=16))
return buffer_reader.getvalue()
if buffer_reader:
buffer_reader.seek(0, 2)
buffer_reader.write(get_padding(buffer_reader.tell(), alignment=16))
return buffer_reader.getvalue()
return b""

def get_all_bytes(self, buffer_info):
return b"".join(self.get_bytes(getattr(buffer_info, b_name)) for b_name in BUFFER_NAMES)
return b"".join(self.get_bytes(getattr(buffer_info, b_name, None)) for b_name in BUFFER_NAMES)

@property
def buffers(self):
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b52e64a36 - Sun Nov 12 13:14:35 2023 +0100
c595ba448 - Sun Nov 12 13:46:49 2023 +0100

0 comments on commit 7803b03

Please sign in to comment.