Skip to content

Commit

Permalink
0.7.5
Browse files Browse the repository at this point in the history
Weights Writing fix
  • Loading branch information
danila-schelkov committed Oct 21, 2020
1 parent f477269 commit f7664e8
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 23 deletions.
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

/3d_converter.egg-info/
/.idea/
/build/
/dist/
/test_upload.bat
/upload.bat
build.bat
/dist/
/build/
/3d_converter.egg-info/
/.idea/
upload.bat
test_upload.bat
/build.bat
*.pyc
*.pyc
4 changes: 2 additions & 2 deletions 3d_converter.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Metadata-Version: 2.1
Name: 3d-converter
Version: 0.7.3
Version: 0.7.5
Summary: Python 3D Models Converter
Home-page: https://github.com/vorono4ka/3d-converter
Author: Vorono4ka
Author-email: [email protected]
License: GPLv3
Description: ## `Python 3D Models Converter`

**Version**: 0.7.3
**Version**: 0.7.4

### Thanks a lot for motivating [AMIRMISTIK]!

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## `Python 3D Models Converter`

**Version**: 0.7.3
**Version**: 0.7.5

### Thanks a lot for motivating [AMIRMISTIK]!

Expand Down
30 changes: 19 additions & 11 deletions models_converter/chunks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ def parse_vertices(self):
vertex = []
vertex_type = self.readString()
vertex_index = self.readUByte()
vertex_shorts = self.readUShort()
self.readUByte() # sub_index
vertex_stride = self.readUByte()
vertex_scale = self.readFloat()
vertex_count = self.readUInt32()

Expand All @@ -171,7 +172,7 @@ def parse_vertices(self):

for x1 in range(vertex_count):
coordinates_massive = []
for x2 in range(vertex_shorts):
for x2 in range(vertex_stride):
coordinate = self.readShort()
coordinates_massive.append(coordinate / 32512)
if vertex_type == 'TEXCOORD':
Expand Down Expand Up @@ -303,7 +304,8 @@ def encode_vertices(self, vertices: dict):
for vertex in vertices:
self.writeString(vertex['type'])
self.writeUByte(vertex['index'])
self.writeUShort(len(vertex['vertex'][0]))
self.writeUByte(0) # sub_index
self.writeUByte(len(vertex['vertex'][0]))
self.writeFloat(vertex['scale'])
self.writeUInt32(len(vertex['vertex']))
for coordinates_massive in vertex['vertex']:
Expand Down Expand Up @@ -350,10 +352,11 @@ def encode_weight(self):

if weight > 1:
weight = 1
elif weight < 1:
elif weight < 0:
weight = 0

weight = int(weight * 65535)

temp_list.append([joint_id, weight])
past_index += vcount
while len(temp_list) < 4:
Expand Down Expand Up @@ -434,10 +437,10 @@ def parse(self, buffer: bytes):

nodes_count = self.readUShort()
for node in range(nodes_count):
node_data = {}

node_data['name'] = self.readString()
node_data['parent'] = self.readString()
node_data = {
'name': self.readString(),
'parent': self.readString()
}

instances_count = self.readUShort()
node_data['instances'] = [{}] * instances_count
Expand Down Expand Up @@ -465,13 +468,18 @@ def parse(self, buffer: bytes):
frames_count = self.readUShort()
node_data['frames'] = []
if frames_count > 0:
rotation = {'x': 0, 'y': 0, 'z': 0, 'w': 0}
scale_x, scale_y, scale_z = 0, 0, 0
pos_x, pos_y, pos_z = 0, 0, 0

settings = list(bin(self.readUByte())[2:].zfill(8))
settings = [bool(int(value)) for value in settings]
node_data['frames_settings'] = settings
for frame in range(frames_count):
frame_data = {}
frame_data = {
'frame_id': self.readUShort()
}

frame_data['frame_id'] = self.readUShort()
if settings[7] or frame == 0: # Rotation
rotation = {
'x': self.readNShort(),
Expand Down
Binary file modified models_converter/chunks/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified models_converter/formats/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified models_converter/formats/__pycache__/scw.cpython-39.pyc
Binary file not shown.
Binary file modified models_converter/utils/__pycache__/reader.cpython-39.pyc
Binary file not shown.
Binary file modified models_converter/utils/__pycache__/writer.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='3d-converter',
version='0.7.3',
version='0.7.5',
author='Vorono4ka',
author_email='[email protected]',
description='Python 3D Models Converter',
Expand Down

0 comments on commit f7664e8

Please sign in to comment.