parse: improve parsing behavior for unimplemented collada features
This commit is contained in:
parent
83bb7498eb
commit
a5d1dac6d8
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@
|
|||||||
*.aps
|
*.aps
|
||||||
__pycache__
|
__pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
.#*
|
.\#*
|
||||||
|
\#*
|
||||||
@ -38,9 +38,23 @@ def parse_surface(lookup, root):
|
|||||||
|
|
||||||
init_from = None
|
init_from = None
|
||||||
for child in root.getchildren():
|
for child in root.getchildren():
|
||||||
|
if child.tag == tag("format"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("format_hint"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("size"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("viewport_ratio"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("mip_levels"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("mipmap_generate"):
|
||||||
|
assert False, child.tag
|
||||||
if child.tag == tag("init_from"):
|
if child.tag == tag("init_from"):
|
||||||
assert init_from is None
|
assert init_from is None
|
||||||
init_from = parse_init_from(lookup, child)
|
init_from = parse_init_from(lookup, child)
|
||||||
|
if child.tag == tag("generator"):
|
||||||
|
assert False, child.tag
|
||||||
|
|
||||||
surface = types.Surface(type, init_from)
|
surface = types.Surface(type, init_from)
|
||||||
return surface
|
return surface
|
||||||
@ -64,6 +78,14 @@ def parse_newparam(lookup, sid_lookup, root):
|
|||||||
|
|
||||||
parameter_type = None
|
parameter_type = None
|
||||||
for child in root.getchildren():
|
for child in root.getchildren():
|
||||||
|
if child.tag == tag("float"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("float2"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("float3"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("float4"):
|
||||||
|
assert False, child.tag
|
||||||
if child.tag == tag("surface"):
|
if child.tag == tag("surface"):
|
||||||
assert parameter_type is None
|
assert parameter_type is None
|
||||||
parameter_type = parse_surface(lookup, child)
|
parameter_type = parse_surface(lookup, child)
|
||||||
@ -165,11 +187,15 @@ def parse_technique_fx(lookup, sid_lookup, root):
|
|||||||
return technique
|
return technique
|
||||||
|
|
||||||
def parse_profile_common(lookup, root):
|
def parse_profile_common(lookup, root):
|
||||||
|
id = root.attribs.get("id")
|
||||||
|
|
||||||
newparam = []
|
newparam = []
|
||||||
technique_fx = None
|
technique_fx = None
|
||||||
sid_lookup = {}
|
sid_lookup = {}
|
||||||
|
|
||||||
for child in root.getchildren():
|
for child in root.getchildren():
|
||||||
|
if child.tag == tag("image"):
|
||||||
|
assert False, child.tag
|
||||||
if child.tag == tag("newparam"):
|
if child.tag == tag("newparam"):
|
||||||
newparam.append(parse_newparam(lookup, sid_lookup, child))
|
newparam.append(parse_newparam(lookup, sid_lookup, child))
|
||||||
if child.tag == tag("technique"):
|
if child.tag == tag("technique"):
|
||||||
@ -177,7 +203,9 @@ def parse_profile_common(lookup, root):
|
|||||||
technique_fx = parse_technique_fx(lookup, sid_lookup, child)
|
technique_fx = parse_technique_fx(lookup, sid_lookup, child)
|
||||||
|
|
||||||
assert technique_fx is not None
|
assert technique_fx is not None
|
||||||
return types.ProfileCommon(newparam, technique_fx, sid_lookup)
|
profile_common = types.ProfileCommon(id, newparam, technique_fx, sid_lookup)
|
||||||
|
lookup_add(lookup, id, profile_common)
|
||||||
|
return profile_common
|
||||||
|
|
||||||
def parse_effect(lookup, root):
|
def parse_effect(lookup, root):
|
||||||
id = root.attrib["id"]
|
id = root.attrib["id"]
|
||||||
@ -430,8 +458,20 @@ def parse_mesh(lookup, root):
|
|||||||
if child.tag == tag("vertices"):
|
if child.tag == tag("vertices"):
|
||||||
assert vertices is None
|
assert vertices is None
|
||||||
vertices = parse_vertices(lookup, child)
|
vertices = parse_vertices(lookup, child)
|
||||||
|
if child.tag == tag("lines"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("linestrips"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("polygons"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("polylist"):
|
||||||
|
assert False, child.tag
|
||||||
if child.tag == tag("triangles"):
|
if child.tag == tag("triangles"):
|
||||||
primitive_elements.append(parse_triangles(lookup, child))
|
primitive_elements.append(parse_triangles(lookup, child))
|
||||||
|
if child.tag == tag("trifans"):
|
||||||
|
assert False, child.tag
|
||||||
|
if child.tag == tag("tristrips"):
|
||||||
|
assert False, child.tag
|
||||||
assert vertices is not None
|
assert vertices is not None
|
||||||
assert len(sources) >= 1
|
assert len(sources) >= 1
|
||||||
|
|
||||||
@ -445,9 +485,13 @@ def parse_geometry(lookup, root):
|
|||||||
geometric_element = None
|
geometric_element = None
|
||||||
|
|
||||||
for child in root.getchildren():
|
for child in root.getchildren():
|
||||||
|
if child.tag == tag("convex_mesh"):
|
||||||
|
assert child.tag, False
|
||||||
if child.tag == tag("mesh"):
|
if child.tag == tag("mesh"):
|
||||||
assert geometric_element is None
|
assert geometric_element is None
|
||||||
geometric_element = parse_mesh(lookup, child)
|
geometric_element = parse_mesh(lookup, child)
|
||||||
|
if child.tag == tag("spline"):
|
||||||
|
assert child.tag, False
|
||||||
assert geometric_element is not None
|
assert geometric_element is not None
|
||||||
|
|
||||||
geometry = types.Geometry(id, name, geometric_element)
|
geometry = types.Geometry(id, name, geometric_element)
|
||||||
@ -549,6 +593,8 @@ def parse_image(lookup, root):
|
|||||||
image_source = None
|
image_source = None
|
||||||
|
|
||||||
for child in root.getchildren():
|
for child in root.getchildren():
|
||||||
|
if child.tag == tag("data"):
|
||||||
|
assert False, child.tag
|
||||||
if child.tag == tag("init_from"):
|
if child.tag == tag("init_from"):
|
||||||
assert image_source is None
|
assert image_source is None
|
||||||
image_source = parse_init_from(lookup, child)
|
image_source = parse_init_from(lookup, child)
|
||||||
|
|||||||
@ -236,6 +236,8 @@ class TechniqueFX:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ProfileCommon:
|
class ProfileCommon:
|
||||||
|
id: Optional[ID]
|
||||||
|
|
||||||
newparam: List[Newparam]
|
newparam: List[Newparam]
|
||||||
technique: TechniqueFX
|
technique: TechniqueFX
|
||||||
|
|
||||||
@ -318,7 +320,7 @@ class SourceCore:
|
|||||||
id: ID
|
id: ID
|
||||||
name: Optional[str]
|
name: Optional[str]
|
||||||
|
|
||||||
array_element: Union[FloatArray]
|
array_element: Union[NameArray, BoolArray, FloatArray, IntArray]
|
||||||
technique_common: TechniqueCommon_SourceCore
|
technique_common: TechniqueCommon_SourceCore
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user