Skip to content

Commit

Permalink
0.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
danila-schelkov committed Nov 28, 2020
1 parent 5ef57c6 commit 6f604c3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
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.6
Version: 0.7.7
Summary: Python 3D Models Converter
Home-page: https://github.com/vorono4ka/3d-converter
Author: Vorono4ka
Author-email: crowo4ka@gmail.com
License: GPLv3
Description: ## `Python 3D Models Converter`

**Version**: 0.7.6
**Version**: 0.7.7

### 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.6
**Version**: 0.7.7

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

Expand Down
35 changes: 20 additions & 15 deletions models_converter/formats/dae.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def node(self, nodes):
instance_geometry = node.findall('collada:instance_geometry', self.namespaces)
instance_controller = node.findall('collada:instance_controller', self.namespaces)

instances = instance_geometry.extend(instance_controller)
instances = [*instance_geometry, *instance_controller]

children = self.node(node.findall('collada:node', self.namespaces))

Expand All @@ -434,7 +434,7 @@ def node(self, nodes):
}

for instance in instances:
node_data['instances'] = [{}]
instance_data = {}
binds = []

bind_material = instance.find('collada:bind_material', self.namespaces)
Expand All @@ -447,17 +447,18 @@ def node(self, nodes):
})

if instance_geometry:
node_data['instances'][0]['instance_type'] = 'GEOM'
instance_data['instance_type'] = 'GEOM'

geometry_url = instance_geometry.attrib['url']
node_data['instances'][0]['instance_name'] = geometry_url[1:]
geometry_url = instance.attrib['url']
instance_data['instance_name'] = geometry_url[1:]
elif instance_controller:
node_data['instances'][0]['instance_type'] = 'CONT'
instance_data['instance_type'] = 'CONT'

controller_url = instance_controller.attrib['url']
node_data['instances'][0]['instance_name'] = controller_url[1:]
controller_url = instance.attrib['url']
instance_data['instance_name'] = controller_url[1:]

node_data['instances'][len(node_data['instances'])-1]['binds'] = binds
instance_data['binds'] = binds
node_data['instances'][len(node_data['instances'])-1] = instance_data

matrix = node.findall('collada:matrix', self.namespaces)
if matrix:
Expand Down Expand Up @@ -615,29 +616,32 @@ def parse_nodes(self):
controller = None
geometry = None

if node['instance_type'] == 'CONT':
if instance['instance_type'] == 'CONT':
controller = self.library_controllers \
.find(f'collada:controller[@id="{instance["instance_name"]}"]', self.namespaces)

geometry_url = controller[0].attrib['source'][1:]
geometry = self.library_geometries \
.find(f'collada:geometry[@id="{geometry_url}"]', self.namespaces)
elif node['instance_type'] == 'GEOM':
elif instance['instance_type'] == 'GEOM':
geometry = self.library_geometries \
.find(f'collada:geometry[@id="{instance["instance_name"]}"]', self.namespaces)

node['instance_name'] = geometry.attrib['name']
if not ('name' in geometry.attrib):
geometry.attrib['name'] = geometry.attrib['id']

instance['instance_name'] = geometry.attrib['name']

for suffix in ['-skin', '-cont']:
node['instance_name'] = node['instance_name'].removesuffix(suffix)
instance['instance_name'] = instance['instance_name'].removesuffix(suffix)
for suffix in ['-mesh', '-geom']:
node['instance_name'] = node['instance_name'].removesuffix(suffix)
instance['instance_name'] = instance['instance_name'].removesuffix(suffix)

self.parsed['nodes'][node_index] = node

if geometry is not None:
self.geometry_info = {'name': '',
'group': node['parent'],
'group': '', # node['parent'],
'vertices': [],
'have_bind_matrix': False,
'materials': []}
Expand Down Expand Up @@ -724,6 +728,7 @@ def parse_geometry(self, geometry):
name = name[:-5]

self.geometry_info['name'] = name
self.geometry_info['group'] = name

mesh = geometry[0]

Expand Down
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.6',
version='0.7.7',
author='Vorono4ka',
author_email='crowo4ka@gmail.com',
description='Python 3D Models Converter',
Expand Down

0 comments on commit 6f604c3

Please sign in to comment.