Commit c35d34ad06873efb63a51a03f155e843bd842d3f

Authored by gtaaas
1 parent 7357e74e
Exists in master

Corrige inserção de frames no movimento circular

Showing 3 changed files with 109 additions and 99 deletions   Show diff stats
libras.py
... ... @@ -79,7 +79,7 @@ def get_endFrame():
79 79  
80 80 initialFrame, endFrame = 15, get_endFrame()
81 81  
82   -def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 5, initialFrame = 15):
  82 +def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 10, initialFrame = 18):
83 83 center = pose.location.x, pose.location.y, pose.location.z
84 84 if(orientation == 'perpendicular'):
85 85 if(direction == 'horario'):
... ... @@ -91,6 +91,11 @@ def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensi
91 91 endFrame = moves.locationCircular(center, radius, 1, 2, 0, pose, 0, laps, intensity, initialFrame)
92 92 else:
93 93 endFrame = moves.locationCircular(center, radius, 2, 1, 0, pose, 0, laps, intensity, initialFrame)
  94 + elif(orientation == 'plano'):
  95 + if(direction == 'horario'):
  96 + endFrame = moves.locationCircular(center, radius, 2, 0, 1, pose, 0, laps, intensity, initialFrame)
  97 + else:
  98 + endFrame = moves.locationCircular(center, radius, 0, 2, 1, pose, 0, laps, intensity, initialFrame)
94 99 return endFrame
95 100  
96 101  
... ... @@ -125,9 +130,10 @@ def configureFace():
125 130 global endFrame
126 131 if(json_input["facialExp"] != []):
127 132 # Set face
128   - faceConfiguration(json_input["facialExp"], [endFrame/2], util.faceBonesConf)
  133 + faceConfiguration(json_input["facialExp"], [endFrame/4], util.faceBonesConf)
129 134  
130 135 # Default Pose
  136 +
131 137 poseDefault([1, endFrame+15], util.allBones)
132 138 configureHands()
133 139 configureFace()
... ...
moves.py
1 1 # -*- coding: UTF-8 -*-
2 2 import math
3 3  
4   -def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPosition, laps, frameJump = 10, initialFrame = 15, turn = None):
5   - sqrt22 = radius * (math.sqrt(2) / 2)
6   - rad2 = (radius/2)
7   - currentFrame = initialFrame
8   - for l in range(initialPosition, initialPosition + math.floor(8 * laps) + 1):
9   - if ((l % 8) == 0 ):
10   - pose.location[i_axis] = center[i_axis] + radius
11   - pose.location[j_axis] = center[j_axis]
12   - pose.location[k_axis] = center[k_axis]
13   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
14   - currentFrame += frameJump
15   - if ((l % 8) == 1):
  4 +def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPosition, laps, frameJump = 10, initialFrame = 18, turn = None):
  5 + sqrt22 = radius * (math.sqrt(2) / 2)
  6 + rad2 = (radius/2)
  7 + currentFrame = initialFrame
  8 + for l in range(initialPosition, initialPosition + math.floor(8 * laps) + 1):
  9 + if ((l % 8) == 0 ):
  10 + pose.location[i_axis] = center[i_axis] + radius
  11 + pose.location[j_axis] = center[j_axis]
  12 + pose.location[k_axis] = center[k_axis]
  13 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  14 + currentFrame += frameJump
  15 + if ((l % 8) == 1):
  16 + pose.location[i_axis] = center[i_axis] + sqrt22
  17 + pose.location[j_axis] = center[j_axis] + sqrt22
  18 + pose.location[k_axis] = center[k_axis]
  19 + if(turn == 1):
16 20 pose.location[i_axis] = center[i_axis] + sqrt22
  21 + pose.location[j_axis] = center[j_axis] + rad2
  22 + pose.location[k_axis] = center[k_axis] - rad2
  23 + elif(turn == -1):
  24 + pose.location[i_axis] = center[i_axis] + sqrt22
  25 + pose.location[j_axis] = center[j_axis] + rad2
  26 + pose.location[k_axis] = center[k_axis] + rad2
  27 + pose.keyframe_insert(frame = initialPosition, index = -1, data_path = 'location')
  28 + currentFrame += frameJump
  29 + if ((l % 8) == 2):
  30 + pose.location[i_axis] = center[i_axis]
  31 + pose.location[j_axis] = center[j_axis] + radius
  32 + pose.location[k_axis] = center[k_axis]
  33 + if(turn == 1):
17 34 pose.location[j_axis] = center[j_axis] + sqrt22
18   - pose.location[k_axis] = center[k_axis]
19   - if(turn == 1):
20   - pose.location[i_axis] = center[i_axis] + sqrt22
21   - pose.location[j_axis] = center[j_axis] + rad2
22   - pose.location[k_axis] = center[k_axis] - rad2
23   - elif(turn == -1):
24   - pose.location[i_axis] = center[i_axis] + sqrt22
25   - pose.location[j_axis] = center[j_axis] + rad2
26   - pose.location[k_axis] = center[k_axis] + rad2
27   - pose.keyframe_insert(frame = initialPosition, index = -1, data_path = 'location')
28   - currentFrame += frameJump
29   - if ((l % 8) == 2):
30   - pose.location[i_axis] = center[i_axis]
31   - pose.location[j_axis] = center[j_axis] + radius
32   - pose.location[k_axis] = center[k_axis]
33   - if(turn == 1):
34   - pose.location[j_axis] = center[j_axis] + sqrt22
35   - pose.location[k_axis] = center[k_axis] - sqrt22
36   - elif(turn == -1):
37   - pose.location[j_axis] = center[j_axis] + sqrt22
38   - pose.location[k_axis] = center[k_axis] + sqrt22
39   - pose.keyframe_insert(frame = initialPosition, index = -1, data_path = 'location')
40   - currentFrame += frameJump
41   - if ((l % 8) == 3):
42   - pose.location[i_axis] = center[i_axis] - sqrt22
  35 + pose.location[k_axis] = center[k_axis] - sqrt22
  36 + elif(turn == -1):
43 37 pose.location[j_axis] = center[j_axis] + sqrt22
44   - pose.location[k_axis] = center[k_axis]
45   - if(turn == 1):
46   - pose.location[i_axis] = center[i_axis] - sqrt22
47   - pose.location[j_axis] = center[j_axis] + rad2
48   - pose.location[k_axis] = center[k_axis] - rad2
49   - elif(turn == -1):
50   - pose.location[i_axis] = center[i_axis] - sqrt22
51   - pose.location[j_axis] = center[j_axis] + rad2
52   - pose.location[k_axis] = center[k_axis] + rad2
53   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
54   - currentFrame += frameJump
55   -
56   - if ((l % 8) == 4):
57   - pose.location[i_axis] = center[i_axis] - radius
58   - pose.location[j_axis] = center[j_axis]
59   - pose.location[k_axis] = center[k_axis]
60   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
61   - currentFrame += frameJump
62   -
63   - if ((l % 8) == 5):
  38 + pose.location[k_axis] = center[k_axis] + sqrt22
  39 + pose.keyframe_insert(frame = initialPosition, index = -1, data_path = 'location')
  40 + currentFrame += frameJump
  41 + if ((l % 8) == 3):
  42 + pose.location[i_axis] = center[i_axis] - sqrt22
  43 + pose.location[j_axis] = center[j_axis] + sqrt22
  44 + pose.location[k_axis] = center[k_axis]
  45 + if(turn == 1):
  46 + pose.location[i_axis] = center[i_axis] - sqrt22
  47 + pose.location[j_axis] = center[j_axis] + rad2
  48 + pose.location[k_axis] = center[k_axis] - rad2
  49 + elif(turn == -1):
  50 + pose.location[i_axis] = center[i_axis] - sqrt22
  51 + pose.location[j_axis] = center[j_axis] + rad2
  52 + pose.location[k_axis] = center[k_axis] + rad2
  53 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  54 + currentFrame += frameJump
  55 +
  56 + if ((l % 8) == 4):
  57 + pose.location[i_axis] = center[i_axis] - radius
  58 + pose.location[j_axis] = center[j_axis]
  59 + pose.location[k_axis] = center[k_axis]
  60 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  61 + currentFrame += frameJump
  62 +
  63 + if ((l % 8) == 5):
  64 + pose.location[i_axis] = center[i_axis] - sqrt22
  65 + pose.location[j_axis] = center[j_axis] - sqrt22
  66 + pose.location[k_axis] = center[k_axis]
  67 + if(turn == 1):
64 68 pose.location[i_axis] = center[i_axis] - sqrt22
  69 + pose.location[j_axis] = center[j_axis] - rad2
  70 + pose.location[k_axis] = center[k_axis] + rad2
  71 + elif(turn == -1):
  72 + pose.location[i_axis] = center[i_axis] - sqrt22
  73 + pose.location[j_axis] = center[j_axis] - ray2
  74 + pose.location[k_axis] = center[k_axis] - ray2
  75 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  76 + currentFrame += frameJump
  77 +
  78 + if ((l % 8) == 6):
  79 + pose.location[i_axis] = center[i_axis]
  80 + pose.location[j_axis] = center[j_axis] - radius
  81 + pose.location[k_axis] = center[k_axis]
  82 + if(turn == 1):
65 83 pose.location[j_axis] = center[j_axis] - sqrt22
66   - pose.location[k_axis] = center[k_axis]
67   - if(turn == 1):
68   - pose.location[i_axis] = center[i_axis] - sqrt22
69   - pose.location[j_axis] = center[j_axis] - rad2
70   - pose.location[k_axis] = center[k_axis] + rad2
71   - elif(turn == -1):
72   - pose.location[i_axis] = center[i_axis] - sqrt22
73   - pose.location[j_axis] = center[j_axis] - ray2
74   - pose.location[k_axis] = center[k_axis] - ray2
75   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
76   - currentFrame += frameJump
77   -
78   - if ((l % 8) == 6):
79   - pose.location[i_axis] = center[i_axis]
80   - pose.location[j_axis] = center[j_axis] - radius
81   - pose.location[k_axis] = center[k_axis]
82   - if(turn == 1):
83   - pose.location[j_axis] = center[j_axis] - sqrt22
84   - pose.location[k_axis] = center[k_axis] + sqrt22
85   - elif(turn == -1):
86   - pose.location[j_axis] = center[j_axis] - sqrt22
87   - pose.location[k_axis] = center[k_axis] - sqrt22
88   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
89   - currentFrame += frameJump
90   -
91   - if ((l % 8) == 7):
92   - pose.location[i_axis] = center[i_axis] + sqrt22
  84 + pose.location[k_axis] = center[k_axis] + sqrt22
  85 + elif(turn == -1):
93 86 pose.location[j_axis] = center[j_axis] - sqrt22
94   - pose.location[k_axis] = center[k_axis]
95   - if(turn == 1):
96   - pose.location[i_axis] = center[i_axis] + sqrt22
97   - pose.location[j_axis] = center[j_axis] - ray2
98   - pose.location[k_axis] = center[k_axis] + ray2
99   - elif(turn == -1):
100   - pose.location[i_axis] = center[i_axis] + sqrt22
101   - pose.location[j_axis] = center[j_axis] - ray2
102   - pose.location[k_axis] = center[k_axis] - ray2
103   - pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
104   - currentFrame += frameJump
105   - currentFrame -= frameJump
106   - return currentFrame
  87 + pose.location[k_axis] = center[k_axis] - sqrt22
  88 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  89 + currentFrame += frameJump
  90 +
  91 + if ((l % 8) == 7):
  92 + pose.location[i_axis] = center[i_axis] + sqrt22
  93 + pose.location[j_axis] = center[j_axis] - sqrt22
  94 + pose.location[k_axis] = center[k_axis]
  95 + if(turn == 1):
  96 + pose.location[i_axis] = center[i_axis] + sqrt22
  97 + pose.location[j_axis] = center[j_axis] - ray2
  98 + pose.location[k_axis] = center[k_axis] + ray2
  99 + elif(turn == -1):
  100 + pose.location[i_axis] = center[i_axis] + sqrt22
  101 + pose.location[j_axis] = center[j_axis] - ray2
  102 + pose.location[k_axis] = center[k_axis] - ray2
  103 + pose.keyframe_insert(frame = currentFrame, index = -1, data_path = 'location')
  104 + currentFrame += frameJump
  105 + currentFrame -= frameJump
  106 + return currentFrame
107 107  
108 108  
109 109 # testing . . .
... ...
param.json
... ... @@ -3,3 +3,7 @@
3 3 '{"userId": 4,"rightHand": ["pontual","conf_20","Ori_4","Pa_6"],"leftHand":["circular","perpendicular","horario",0.6,1,"conf_20","Ori_4","Pa_6"],"facialExp": "Exp_6","signName":"pontual_direita"}'
4 4  
5 5 '{"userId": 4,"rightHand": ["semicircular","perpendicular","horario",0.6,0.5,"conf_20","Ori_4","Pa_6"],"leftHand":["pontual","conf_10","Ori_3","Pa_3"],"facialExp": "Exp_6","signName":"SemiCircular"}'
  6 +
  7 +
  8 +'{"userId": 4,"rightHand":[],"leftHand":["circular","perpendicular","horario",1,2,10,24,10],"facialExp":[6],"signName":"circular mão esquerda"}'
  9 +
... ...