-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTU_Functions.py
81 lines (49 loc) · 1.98 KB
/
TU_Functions.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import bpy
def RemapKeyframe(old, new, subframe):
rate = old/new
for action in bpy.data.actions:
for fc in action.fcurves:
for kf in fc.keyframe_points:
if subframe:
kf.co.x = int(kf.co.x / rate)
kf.handle_left[0] = int(kf.handle_left[0] / rate)
kf.handle_right[0] = int(kf.handle_right [0] / rate)
else:
kf.co.x = kf.co.x / rate
kf.handle_left[0] = kf.handle_left[0] / rate
kf.handle_right[0] = kf.handle_right [0] / rate
def RemapTimelineMarker(old, new, subframe):
rate = old/new
for scene in bpy.data.scenes:
for tm in scene.timeline_markers:
if subframe:
tm.frame = int(tm.frame / rate)
else:
tm.frame = int(tm.frame / rate)
def RemapPoseMarker(old, new, subframe):
rate = old/new
for action in bpy.data.actions:
for pm in action.pose_markers:
if subframe:
pm.frame = int(pm.frame / rate)
else:
pm.frame = int(pm.frame / rate)
def RemapFrameRange(context, old, new, subframe):
rate = old/new
if subframe:
context.scene.frame_end = int(context.scene.frame_end / rate)
context.scene.frame_start = int(context.scene.frame_start / rate)
else:
context.scene.frame_end =int(context.scene.frame_end / rate)
context.scene.frame_start = int(context.scene.frame_start / rate)
def Nudge_Keyframe():
for action in bpy.data.actions:
for fc in action.fcurves:
for kf in fc.keyframe_points:
kf.co.x = int(kf.co.x)
kf.handle_left[0] = int(kf.handle_left[0])
kf.handle_right[0] = int(kf.handle_right [0])
def Nudge_TimelineMarker():
for scene in bpy.data.scenes:
for tm in scene.timeline_markers:
tm.frame = int(tm.frame)