Skip to content

Commit

Permalink
fix RENDERPARAMETERCURVES from_xml
Browse files Browse the repository at this point in the history
  • Loading branch information
HENDRIX-ZT2 committed Jan 28, 2025
1 parent b2eca30 commit 99a8eea
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Frontier's Cobra Engine Formats",
"author": "Harlequinz Ego, HENDRIX et al.",
"blender": (4, 1, 0),
"version": (2025, 1, 20),
"version": (2025, 1, 22),
"location": "File > Import-Export",
"description": "Import-Export models, skeletons and animations",
"warning": "",
Expand Down
6 changes: 3 additions & 3 deletions __version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# this file is auto-generated by the pre-commit hook increment_version.py
VERSION = "2025.01.20"
COMMIT_HASH = "860c7492c"
COMMIT_TIME = "Mon Jan 20 15:27:56 2025 +0100"
VERSION = "2025.01.22"
COMMIT_HASH = "b2eca30b9"
COMMIT_TIME = "Wed Jan 22 15:36:29 2025 +0100"
2 changes: 1 addition & 1 deletion generated/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def from_xml(cls, instance, elem, prop, arg, template, shape, dtype):
@classmethod
def _from_xml(cls, instance, elem):
# init each member from corresponding sub-elem
instance[:] = [instance.dtype._from_xml(instance.dtype(instance._context, 0, instance.template), sub) for sub in elem]
instance[:] = [instance.dtype._from_xml(instance.dtype(instance._context, instance.arg, instance.template), sub) for sub in elem]
instance.shape = len(elem)
return instance

Expand Down
5 changes: 4 additions & 1 deletion generated/formats/ovl_base/compounds/MemStruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def _from_xml(cls, instance, elem):
if array_name:
array = elem.find(f'./{array_name}')
if array:
# this does not handle arrays that are nested in a wrapper
# handle arrays that are nested in a wrapper, so look there for their count
child = array.find(f'./ptrs')
if child:
array = child
setattr(instance, f_name, len(array))
else:
setattr(instance, f_name, 0)
Expand Down
4 changes: 2 additions & 2 deletions generated/formats/ovl_base/compounds/Pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def from_xml(cls, target, elem, prop, arg, template):
"""Creates object for parent object 'target', from parent element elem."""
# create Pointer instance
instance = cls(target.context, arg, template, set_default=False)
print(f"ptr instance.from_xml {instance.template}")
# print(f"ptr instance.from_xml {instance.template}")
# check if the pointer holds data
sub = elem.find(f'./{prop}')
if sub is None:
Expand All @@ -228,7 +228,7 @@ def from_xml(cls, target, elem, prop, arg, template):
instance.data = ET.tostring(sub[0], encoding="unicode").replace("\t", "").replace("\n", "")
else:
cls._from_xml(instance, sub)
print(f"after ptr instance.from_xml {instance.template}")
# print(f"after ptr instance.from_xml {instance.template}")
return instance

@classmethod
Expand Down
12 changes: 6 additions & 6 deletions modules/formats/RENDERPARAMETERCURVES.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class RenderParameterCurvesLoader(MemStructLoader):
target_class = RenderParameterCurvesRoot
extension = ".renderparametercurves"

def create(self, file_path):
# super().create(file_path)
# print(self.header)
self.header = self.target_class.from_xml_file(file_path, self.context)
print(self.header)
self.write_memory_data()
# def create(self, file_path):
# # super().create(file_path)
# # print(self.header)
# self.header = self.target_class.from_xml_file(file_path, self.context)
# print(self.header)
# self.write_memory_data()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cobra-tools"
version = "2025.01.20"
version = "2025.01.22"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = "==3.11.*"
Expand Down
2 changes: 1 addition & 1 deletion source/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def from_xml(cls, instance, elem, prop, arg, template, shape, dtype):
@classmethod
def _from_xml(cls, instance, elem):
# init each member from corresponding sub-elem
instance[:] = [instance.dtype._from_xml(instance.dtype(instance._context, 0, instance.template), sub) for sub in elem]
instance[:] = [instance.dtype._from_xml(instance.dtype(instance._context, instance.arg, instance.template), sub) for sub in elem]
instance.shape = len(elem)
return instance

Expand Down
5 changes: 4 additions & 1 deletion source/formats/ovl_base/compounds/MemStruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def _from_xml(cls, instance, elem):
if array_name:
array = elem.find(f'./{array_name}')
if array:
# this does not handle arrays that are nested in a wrapper
# handle arrays that are nested in a wrapper, so look there for their count
child = array.find(f'./ptrs')
if child:
array = child
setattr(instance, f_name, len(array))
else:
setattr(instance, f_name, 0)
Expand Down
4 changes: 2 additions & 2 deletions source/formats/ovl_base/compounds/Pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def from_xml(cls, target, elem, prop, arg, template):
"""Creates object for parent object 'target', from parent element elem."""
# create Pointer instance
instance = cls(target.context, arg, template, set_default=False)
print(f"ptr instance.from_xml {instance.template}")
# print(f"ptr instance.from_xml {instance.template}")
# check if the pointer holds data
sub = elem.find(f'./{prop}')
if sub is None:
Expand All @@ -212,7 +212,7 @@ def from_xml(cls, target, elem, prop, arg, template):
instance.data = ET.tostring(sub[0], encoding="unicode").replace("\t", "").replace("\n", "")
else:
cls._from_xml(instance, sub)
print(f"after ptr instance.from_xml {instance.template}")
# print(f"after ptr instance.from_xml {instance.template}")
return instance

@classmethod
Expand Down

0 comments on commit 99a8eea

Please sign in to comment.