mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-25 06:57:19 +00:00
fix offsets
This commit is contained in:
parent
c9d329b1a1
commit
7500be5d71
@ -364,25 +364,29 @@ def split_ugc(path):
|
|||||||
else:
|
else:
|
||||||
raise Exception("WHY ARE THERE NO MODELS????")
|
raise Exception("WHY ARE THERE NO MODELS????")
|
||||||
|
|
||||||
|
filename = 0
|
||||||
for xml in output_xmls:
|
for xml in output_xmls:
|
||||||
rigidsystems = xml.findall('.//RigidSystem')
|
rigidsystems = xml.findall('.//RigidSystem')
|
||||||
rigids_parts = {}
|
rigids_parts = {}
|
||||||
i = 0
|
i = 0
|
||||||
for rigidsytem in rigidsystems:
|
for rigidsytem in rigidsystems:
|
||||||
rigids = rigidsytem.findall('.//Rigid')
|
rigids = rigidsytem.findall('.//Rigid')
|
||||||
for rigid in rigids:
|
bricks = xml.findall('.//Bone')
|
||||||
bricks = rigid.attrib['boneRefs'].split(',')
|
transformation = list(map(float, rigids[0].attrib['transformation'].split(',')))
|
||||||
transformation = list(map(float, rigid.attrib['transformation'].split(',')))
|
|
||||||
print(f"x: {transformation[-3]}")
|
print(f"x: {transformation[-3]}")
|
||||||
print(f"y: {transformation[-2]}")
|
print(f"y: {transformation[-2]}")
|
||||||
print(f"z: {transformation[-1]}")
|
print(f"z: {transformation[-1]}")
|
||||||
for brickID in bricks:
|
for brick in bricks:
|
||||||
brick = xml.find(f".//Bone[@refID='{brickID}']")
|
|
||||||
old_transform = list(map(float, brick.attrib['transformation'].split(',')))
|
old_transform = list(map(float, brick.attrib['transformation'].split(',')))
|
||||||
old_transform[-1] = old_transform[-1] - transformation[-1]
|
old_transform[-1] = old_transform[-1] - transformation[-1]
|
||||||
old_transform[-2] = old_transform[-2] - transformation[-2]
|
old_transform[-2] = old_transform[-2] - transformation[-2]
|
||||||
old_transform[-3] = old_transform[-3] - transformation[-3]
|
old_transform[-3] = old_transform[-3] - transformation[-3]
|
||||||
new_transform = ','.join(map(str, old_transform))
|
new_transform = ','.join(map(str, old_transform))
|
||||||
brick.set("transformation", new_transform)
|
brick.set("transformation", new_transform)
|
||||||
|
# only do it once
|
||||||
print(ET.tostring(xml))
|
break
|
||||||
|
f = open(f"{filename}.bin", "ab")
|
||||||
|
out = ET.tostring(xml).replace(b"\n", b"").replace(b" ", b"")
|
||||||
|
f.write(zlib.compress(out))
|
||||||
|
f.close()
|
||||||
|
filename += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user