Commit cef27bb8863160b88a8391c275fa7fc5dd7196c4

Authored by André Araújo
1 parent bafb8e39
Exists in master

Corrige lib de expressão facial, remove configuração de mão 33 duplicada no avatar

1 -BLEND = avatar_cartoon_v1.0.0.blend  
2 -BLENDER = blender  
3 -BLUE = \33[34;5m  
4 -CACHE = ./__pycache__ 1 +BLEND = avatar_cartoon_v2.70.blend
5 CONTROLLER = controller.py 2 CONTROLLER = controller.py
6 -CORE = git@git.lavid.ufpb.br:wikilibras-core  
7 -DONE = [$(GREEN)Finalizado$(NONE)]  
8 -FAIL = [$(RED)Falhou$(NONE)] Codigo: $$?  
9 -GREEN = \33[32;5m  
10 -JSON = '{"userId": 2, "rightHand": ["circular", "plano", "horario", 1, 2, 0, 50, 20], "leftHand":[], "facialExp": [6], "signName":"teste_circular"}'  
11 MAIN = libras.py 3 MAIN = libras.py
12 -MODULE = Wikilibras  
13 -NONE = \33[m 4 +# Circular: ['circular', x, x, Raio=1, Voltas=3 CfM=0, PAr=80, Ori=0]
  5 +JSON = '{"userId": 4, "rightHand": ["circular", "plano", "horario", 1, 3, 0, 80, 0], "leftHand":[], "facialExp": [1], "signName": "teste circular"}'
  6 +#JSON = '{"userId": 4, "rightHand": ["pontual", 55, 81, 21], "leftHand":[], "facialExp": [], "signName": "teste pontual"}'
  7 +#JSON = '{"userId": 4, "rightHand": ["pontual", 0, 80, 1], "leftHand":[], "facialExp": [1], "signName": "teste facial 1"}'
  8 +#JSON = '{"userId": 4, "rightHand": ["pontual", 0, 80, 2], "leftHand":[], "facialExp": [21], "signName": "teste facial 2"}'
  9 +BLENDER = blender
  10 +CACHE += "./__pycache__"
  11 +CACHE += "./users"
  12 +CACHE += "./events.log"
  13 +DONE = [\33[32;5mFinalizado\33[m]
  14 +FAIL = [\33[31;5mFalhou\33[m] Codigo: $$?
14 PYTHON = python3 15 PYTHON = python3
15 -RED = \33[31;5m  
16 -WHITE = \33[37;5m  
17 16
18 -__default__: py 17 +.PHONY: py bpy clean help
19 18
20 -.clscr:  
21 - @echo -n "\033c" 19 +py:
  20 + @echo "[\33[32;5mExecutando\33[m]\33[34;5m $(PYTHON) "$(CONTROLLER)" {JSON} ...\33[m"; $(PYTHON) "$(CONTROLLER)" $(JSON) && echo "$(DONE)" || echo "$(FAIL)"
22 21
23 bpy: 22 bpy:
24 - @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" JSON ...$(NONE)";\  
25 - $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" $(JSON)\  
26 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }  
27 -  
28 -clean: .clscr  
29 - @echo -n "$(WHITE)Limpando... $(NONE) ";\  
30 - rm -rf "$(CACHE)"\  
31 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }  
32 -  
33 -git-clone:  
34 - @input="";\  
35 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
36 - do\  
37 - echo -n "$(GREEN)Clonar $(BLUE)$(CORE)?$(NONE) (s/n): ";\  
38 - read input;\  
39 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
40 - done;\  
41 - if [ "$$input" = "s" ];\  
42 - then\  
43 - git clone $(CORE);\  
44 - else\  
45 - exit 0;\  
46 - fi\  
47 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }  
48 -  
49 -git-config:  
50 - @echo -n "$(GREEN)Nome:$(BLUE) ";\  
51 - git config --global user.name;\  
52 - echo -n "$(GREEN)Email:$(BLUE) ";\  
53 - git config --global user.email;\  
54 - input="";\  
55 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
56 - do\  
57 - echo -n "$(GREEN)Configurar Git?$(NONE) (s/n): ";\  
58 - read input;\  
59 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
60 - done;\  
61 - if [ "$$input" = "s" ];\  
62 - then\  
63 - name="";\  
64 - while [ -z "$$name" ];\  
65 - do\  
66 - echo -n "$(GREEN)Digite seu nome:$(NONE) ";\  
67 - read name;\  
68 - done;\  
69 - email="";\  
70 - while [ -z "$$email" ];\  
71 - do\  
72 - echo -n "$(GREEN)Digite seu email:$(NONE) ";\  
73 - read email;\  
74 - done;\  
75 - input="";\  
76 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
77 - do\  
78 - echo -n "$(GREEN)Confirma dados?$(NONE) (s/n): ";\  
79 - read input;\  
80 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
81 - done;\  
82 - if [ "$$input" = "s" ];\  
83 - then\  
84 - git config --global user.name "$$name";\  
85 - git config --global user.email "$$email";\  
86 - git config --global color.diff auto;\  
87 - git config --global color.status auto;\  
88 - git config --global color.branch auto;\  
89 - git config --global color.ui true;\  
90 - git config --global push.default simple;\  
91 - else\  
92 - exit 0;\  
93 - fi;\  
94 - else\  
95 - exit 0;\  
96 - fi\  
97 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } 23 + @echo "[\33[32;5mExecutando\33[m]\33[34;5m $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" {JSON} ...\33[m"; $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" $(JSON) && echo "$(DONE)" || echo "$(FAIL)"
98 24
99 help: 25 help:
100 @echo "" 26 @echo ""
101 - @echo " $(WHITE) Make <args> $(NONE)" 27 + @echo " \33[37;5m Make <args> \33[m"
102 @echo "" 28 @echo ""
103 - @echo " $(GREEN) <args> $(NONE) $(BLUE) <funcao> $(NONE)" 29 + @echo " \33[32;5m <args> \33[m \33[34;5m <funcao> \33[m"
104 @echo "" 30 @echo ""
105 - @echo " $(GREEN) bpy $(NONE) $(BLUE) Executa: $(BLENDER) <$(MAIN)> com parametros JSON do Makefile $(NONE)"  
106 - @echo " $(GREEN) clean $(NONE) $(BLUE) Remove pasta(s) temporaria(s): $(CACHE) $(NONE)"  
107 - @echo " $(GREEN) git-clone $(NONE) $(BLUE) Clona repositorio: \"$(CORE)\" na pasta atual $(NONE)"  
108 - @echo " $(GREEN) git-config $(NONE) $(BLUE) Configura Git para o primeiro uso $(NONE)"  
109 - @echo " $(GREEN) help $(NONE) $(BLUE) Exibe ajuda $(NONE)"  
110 - @echo " $(GREEN) py $(NONE) $(BLUE) Executa: $(PYTHON) <$(CONTROLLER)> com parametros JSON do Makefile $(NONE)"  
111 - @echo " $(GREEN) recv $(NONE) $(BLUE) Recebe dados do repositorio: \"$(CORE)\" $(NONE)"  
112 - @echo " $(GREEN) send $(NONE) $(BLUE) Envia dados para o repositorio: \"$(CORE)\" $(NONE)" 31 + @echo " \33[32;5m bpy \33[m \33[34;5m Executa: $(BLENDER) <$(MAIN)> com parametros JSON do Makefile \33[m"
  32 + @echo " \33[32;5m clean \33[m \33[34;5m Remove pasta(s) temporaria(s): $(CACHE) \33[m"
  33 + @echo " \33[32;5m help \33[m \33[34;5m Exibe ajuda \33[m"
  34 + @echo " \33[32;5m py \33[m \33[34;5m Executa: $(PYTHON) <$(CONTROLLER)> com parametros JSON do Makefile \33[m"
113 @echo "" 35 @echo ""
114 36
115 -py:  
116 - @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(PYTHON) "$(CONTROLLER)" JSON ...$(NONE)";\  
117 - $(PYTHON) "$(CONTROLLER)" $(JSON)\  
118 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }  
119 -  
120 -recv:  
121 - @input="";\  
122 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
123 - do\  
124 - echo -n "$(GREEN)Receber dados alterados?$(NONE) (s/n): ";\  
125 - read input;\  
126 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
127 - done;\  
128 - if [ "$$input" = "s" ];\  
129 - then\  
130 - git pull;\  
131 - else\  
132 - exit 0;\  
133 - fi\  
134 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } 37 +.clscr:
  38 + @echo -n "\033c"
135 39
136 -send:  
137 - @input="";\  
138 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
139 - do\  
140 - echo -n "$(GREEN)Enviar alteracoes realizadas?$(NONE) (s/n): ";\  
141 - read input;\  
142 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
143 - done;\  
144 - if [ "$$input" = "s" ];\  
145 - then\  
146 - comment="";\  
147 - while [ -z "$$comment" ];\  
148 - do\  
149 - echo -n "$(GREEN)Digite o comentario das alteracoes:$(NONE) ";\  
150 - read comment;\  
151 - done;\  
152 - input="";\  
153 - while [ "$$input" != "s" ] && [ "$$input" != "n" ];\  
154 - do\  
155 - echo -n "$(GREEN)Enviar dados?$(NONE) (s/n): ";\  
156 - read input;\  
157 - input="`echo $$input | tr [:upper:] [:lower:]`";\  
158 - done;\  
159 - if [ "$$input" = "s" ];\  
160 - then\  
161 - git add .;\  
162 - git commit -m "$$comment";\  
163 - git push;\  
164 - else\  
165 - exit 0;\  
166 - fi;\  
167 - else\  
168 - exit 0;\  
169 - fi\  
170 - && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } 40 +clean: .clscr
  41 + @echo -n "\33[37;5mLimpando... \33[m "; rm -rf $(CACHE); echo "$(DONE)"
avatar_cartoon_v1.0.0.blend
No preview for this file type
avatar_cartoon_v2.70.blend 0 → 100755
No preview for this file type
@@ -8,15 +8,15 @@ getcwd = dirname(abspath(__file__)) @@ -8,15 +8,15 @@ getcwd = dirname(abspath(__file__))
8 8
9 from pyutil import printStackTrace 9 from pyutil import printStackTrace
10 10
11 -blend_path = join(getcwd, "avatar_cartoon_v1.0.0.blend") 11 +blend_path = join(getcwd, "avatar_cartoon_v2.70.blend")
12 main_path = join(getcwd, "libras.py") 12 main_path = join(getcwd, "libras.py")
13 -restult = 0 13 +result = 0
14 14
15 try: 15 try:
16 # Caso seja necessário gravar logs do blender utilizar a linha de código abaixo 16 # Caso seja necessário gravar logs do blender utilizar a linha de código abaixo
17 - # restult = call(['blender', '-b', blend_path, '-P', main_path, argv[1]], stdout = open( 'bpy.log', 'w'))  
18 - restult = call(['blender', '-b', blend_path, '-P', main_path, argv[1]]) 17 + # result = call(['blender', '-b', blend_path, '-P', main_path, argv[1]], stdout = open('bpy.log', 'w'))
  18 + result = call(['blender', '-b', blend_path, '-P', main_path, argv[1]])
19 except: 19 except:
20 - restult = printStackTrace(__file__) 20 + result = printStackTrace(__file__)
21 21
22 -exit(restult) 22 +exit(result)
@@ -43,8 +43,8 @@ def setHandConfiguration(actions, handParam, positionFrames, bones): @@ -43,8 +43,8 @@ def setHandConfiguration(actions, handParam, positionFrames, bones):
43 util.setPose(actions, handParam, positionFrames, bones) 43 util.setPose(actions, handParam, positionFrames, bones)
44 44
45 # Função responsável por setar a configuração da face 45 # Função responsável por setar a configuração da face
46 -def setFaceConfiguration(handParam, positionFrames, bones):  
47 - util.setPose([7], handParam, positionFrames, bones) 46 +def setFaceConfiguration(handParam, positionFrames, bones):
  47 + util.setPose(['007_Facial'], handParam, positionFrames, bones)
48 48
49 # Sugestao: Alguma forma de uniformizar o calculo do endFrame (atualizado aqui e no movimento circular) 49 # Sugestao: Alguma forma de uniformizar o calculo do endFrame (atualizado aqui e no movimento circular)
50 initialFrame, endFrame = 15, util.get_endFrame(json_input, util.hands_frames_retilineo) 50 initialFrame, endFrame = 15, util.get_endFrame(json_input, util.hands_frames_retilineo)
@@ -65,10 +65,10 @@ def configureHands(): @@ -65,10 +65,10 @@ def configureHands():
65 move = json_input[hands[i]][0] 65 move = json_input[hands[i]][0]
66 pose = util.armature.pose.bones[iks[i]] 66 pose = util.armature.pose.bones[iks[i]]
67 handParam = json_input[hands[i]][-3:] 67 handParam = json_input[hands[i]][-3:]
68 - 68 +
69 if(move in ["pontual", "circular", "semicircular", "retilineo", "senoidal"]): 69 if(move in ["pontual", "circular", "semicircular", "retilineo", "senoidal"]):
70 setHandConfiguration(actions[i], handParam, util.hands_default_frames, bones_[i]) 70 setHandConfiguration(actions[i], handParam, util.hands_default_frames, bones_[i])
71 - 71 +
72 if(move in ["circular", "semicircular"]): 72 if(move in ["circular", "semicircular"]):
73 orientation, direction, radius, laps = json_input[hands[i]][1:5] 73 orientation, direction, radius, laps = json_input[hands[i]][1:5]
74 endFrame = moves.circular_or_semiCircular(pose, orientation, direction, radius, laps, 5) 74 endFrame = moves.circular_or_semiCircular(pose, orientation, direction, radius, laps, 5)
@@ -87,7 +87,6 @@ def configureHands(): @@ -87,7 +87,6 @@ def configureHands():
87 def configureFace(): 87 def configureFace():
88 global endFrame 88 global endFrame
89 if(json_input["facialExp"] != []): 89 if(json_input["facialExp"] != []):
90 - # Set face  
91 setFaceConfiguration(json_input["facialExp"], [endFrame/4], util.faceBonesConf) 90 setFaceConfiguration(json_input["facialExp"], [endFrame/4], util.faceBonesConf)
92 91
93 poseDefault([1]) 92 poseDefault([1])
@@ -170,7 +170,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi @@ -170,7 +170,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi
170 pose.location[i_axis] = center[i_axis] + sqrt22 170 pose.location[i_axis] = center[i_axis] + sqrt22
171 pose.location[j_axis] = center[j_axis] + rad2 171 pose.location[j_axis] = center[j_axis] + rad2
172 pose.location[k_axis] = center[k_axis] + rad2 172 pose.location[k_axis] = center[k_axis] + rad2
173 - util.keyframe_insert(pose, 'location', initialPosition) 173 + util.keyframe_insert(pose, 'location', currentFrame)
174 currentFrame += frameJump 174 currentFrame += frameJump
175 if ((l % 8) == 2): 175 if ((l % 8) == 2):
176 pose.location[i_axis] = center[i_axis] 176 pose.location[i_axis] = center[i_axis]
@@ -182,7 +182,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi @@ -182,7 +182,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi
182 elif(turn == -1): 182 elif(turn == -1):
183 pose.location[j_axis] = center[j_axis] + sqrt22 183 pose.location[j_axis] = center[j_axis] + sqrt22
184 pose.location[k_axis] = center[k_axis] + sqrt22 184 pose.location[k_axis] = center[k_axis] + sqrt22
185 - util.keyframe_insert(pose, 'location', initialPosition) 185 + util.keyframe_insert(pose, 'location', currentFrame)
186 currentFrame += frameJump 186 currentFrame += frameJump
187 if ((l % 8) == 3): 187 if ((l % 8) == 3):
188 pose.location[i_axis] = center[i_axis] - sqrt22 188 pose.location[i_axis] = center[i_axis] - sqrt22
@@ -196,7 +196,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi @@ -196,7 +196,7 @@ def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPositi
196 pose.location[i_axis] = center[i_axis] - sqrt22 196 pose.location[i_axis] = center[i_axis] - sqrt22
197 pose.location[j_axis] = center[j_axis] + rad2 197 pose.location[j_axis] = center[j_axis] + rad2
198 pose.location[k_axis] = center[k_axis] + rad2 198 pose.location[k_axis] = center[k_axis] + rad2
199 - util.keyframe_insert(pose, 'location', initialPosition) 199 + util.keyframe_insert(pose, 'location', currentFrame)
200 currentFrame += frameJump 200 currentFrame += frameJump
201 201
202 if ((l % 8) == 4): 202 if ((l % 8) == 4):