-
Notifications
You must be signed in to change notification settings - Fork 51
/
fixcentrifuge.py
53 lines (48 loc) · 1.42 KB
/
fixcentrifuge.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from mu import Mu
def check_clip(clip):
i = len(clip.curves)
while i > 0:
i -= 1
curve = clip.curves[i]
if curve.path == "Center_Cylinder/coll torus":
print("deleting " + curve.path + ", " + curve.property)
del clip.curves[i]
continue
if curve.path[:-1] == "Center_Cylinder/coll torus/coll_torus":
if curve.property[:-1] == "m_LocalPosition.":
print("deleting " + curve.path + ", " + curve.property)
del clip.curves[i]
continue
if curve.property == "m_LocalScale.y":
print("deleting " + curve.path + ", " + curve.property)
del clip.curves[i]
continue
broken_xforms = [
"coll torus",
"coll_torus1",
"coll_torus2",
"coll_torus3",
"coll_torus4",
"coll_torus5",
"coll_torus6",
"coll_torus7",
"coll_torus8",
]
def check_transform(obj):
if obj.transform.name in broken_xforms:
print("zeroing lp for " + obj.transform.name)
obj.transform.localPosition = 0, 0, 0
def check_obj(obj):
for o in obj.children:
check_obj(o)
check_transform(obj)
if hasattr(obj, "animation"):
for clip in obj.animation.clips:
check_clip(clip)
fname = "centrifuge.mu"
mu = Mu()
if not mu.read(fname):
print("could not read: " + fname)
raise
check_obj(mu.obj)
mu.write("output.mu")