-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.8.6: COLLADA writing fix (inputs count) 0.8.7: Writer and Reader interfaces, fields encapsulating 0.8.8: Added "Universal" format instead of python dicts, some fixes, a lot of refactoring
1 parent
9706b9b
commit d588b18
Showing
45 changed files
with
1,884 additions
and
1,685 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
__all__ = [ | ||
'formats', | ||
'chunks', | ||
'utils' | ||
'utilities' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
__all__ = [ | ||
'scw', | ||
'dae', | ||
'obj', | ||
'collada', | ||
'wavefront', | ||
'gltf' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .writer import Writer | ||
from .parser import Parser | ||
|
||
__all__ = [ | ||
'Writer', | ||
'Parser' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from xml.etree.ElementTree import * | ||
|
||
|
||
VERSION = '1.4.1' | ||
NAMESPACE = 'http://www.collada.org/2005/11/COLLADASchema' | ||
|
||
|
||
class Collada: | ||
def __init__(self): | ||
self.root = Element('COLLADA', version=VERSION, xmlns=NAMESPACE) | ||
|
||
@staticmethod | ||
def write_source(parent, | ||
source_id: str, | ||
array_tag: str, | ||
array_data: tuple, | ||
stride: int, | ||
params: list): | ||
source = SubElement(parent, 'source', id=source_id) | ||
|
||
array = SubElement(source, array_tag) | ||
array.attrib = {'id': f'{source_id}-array', | ||
'count': f'{len(array_data) * stride}'} | ||
|
||
technique_common = SubElement(source, 'technique_common') | ||
accessor = SubElement(technique_common, 'accessor') | ||
accessor.attrib = {'source': f'#{source_id}-array', | ||
'count': f'{len(array_data)}', | ||
'stride': f'{stride}'} | ||
|
||
for param_data in params: | ||
param = SubElement(accessor, 'param') | ||
param.attrib = param_data | ||
|
||
array.text = ' '.join(array_data) | ||
|
||
@staticmethod | ||
def write_input(parent, | ||
semantic: str, | ||
source_id: str, | ||
offset: int = None): | ||
attributes = { | ||
'semantic': semantic, | ||
'source': f'#{source_id}' | ||
} | ||
|
||
if offset is not None: | ||
attributes['offset'] = f'{offset}' | ||
|
||
_input = SubElement(parent, 'input') | ||
_input.attrib = attributes |
Oops, something went wrong.