Commit 2a8d0fcc003cef8d9e8eb6d0c5212ef8ae87b58a
1 parent
d5e23927
Exists in
master
corrigido movimentos de mãos individuais
Showing
5 changed files
with
57 additions
and
17 deletions
Show diff stats
.gitignore
NewFormat_Json
1 | 1 | '{"userId": 4,"rightHand": ["circular","perpendicular","horario",0.6,1,"conf_20","Ori_4","Pa_6"],"leftHand":["pontual","conf_10","Ori_3","Pa_3"],"facialExp": "Exp_6","signName":"Novis"}' |
2 | + | |
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 | + | |
5 | + | |
6 | + '{"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"}' | ... | ... |
avatar_Hozana_wikiLibras.blend
No preview for this file type
libras.py
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | import sys |
3 | +sys.path.append('/home/gtaaas/wikilibras/wikilibras-core') | |
3 | 4 | import json |
4 | 5 | import lbsObjects |
5 | 6 | import util |
6 | 7 | |
7 | -def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensity,initialFrame = 15): | |
8 | + | |
9 | +def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensity = 5,initialFrame = 15): | |
8 | 10 | center = pose.location.x,pose.location.y,pose.location.z |
9 | 11 | if(orientation == 'perpendicular'): |
10 | 12 | if(direction == 'horario'): |
... | ... | @@ -18,33 +20,60 @@ def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensi |
18 | 20 | endFrame = hand.rotationCircular(center,radius,2,1,0,pose,0,laps,intensity,initialFrame) |
19 | 21 | return endFrame |
20 | 22 | |
23 | +def get_endFrame(json_input): | |
24 | + endsFrame = [] | |
25 | + if(json_input["rightHand"][0] == "circular" or json_input["rightHand"][0] == "semicircular"): | |
26 | + endsFrame.append(int(json_input["rightHand"][4]*8*5+15)) | |
27 | + if(json_input["leftHand"][0] == "circular" or json_input["leftHand"][0] == "semicircular"): | |
28 | + endsFrame.append(int(json_input["leftHand"][4]*8*5+15)) | |
29 | + return(max(endsFrame)) | |
21 | 30 | |
22 | 31 | #Configurações gerais |
23 | 32 | json_input = json.loads(sys.argv[5]) # Load jason |
24 | 33 | util.outconf() |
25 | 34 | handPosFrame = {'loc':[15],'rot':[15]} |
26 | 35 | armature = lbsObjects.Armadura('Armature.001') |
27 | -initialFrame,endFrame = 18,25 | |
36 | +initialFrame,endFrame = 18,get_endFrame(json_input) | |
28 | 37 | |
29 | 38 | #Initial Pose |
30 | 39 | lbsObjects.Pose({'loc':[0], 'rot':[0]}, armature) #Set the default pose |
31 | 40 | |
32 | 41 | #ConfHandRight |
33 | 42 | if(json_input["rightHand"] != []): |
34 | - handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:], handPosFrame, armature) | |
35 | - if(json_input["rightHand"][0] == "circular"): | |
36 | - orientation,direction,radius,laps = json_input["rightHand"][1:5] | |
37 | - pose = armature.pose.bones['ik_FK.R'] | |
38 | - endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) | |
39 | - handRight.genConf({'loc':[endFrame],'rot':[endFrame]}) | |
40 | - handRight.genOri({'loc':[endFrame],'rot':[endFrame]}) | |
43 | + movRight = json_input["rightHand"][0] | |
44 | + pose = armature.pose.bones['ik_FK.R'] | |
45 | + if(movRight == "pontual"): | |
46 | + handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:],{'loc':[15,endFrame],'rot':[15,endFrame]}, armature) | |
47 | + else: | |
48 | + handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:],handPosFrame, armature) | |
49 | + if(movRight == "circular" or movRight == "semicircular"): | |
50 | + orientation,direction,radius,laps = json_input["rightHand"][1:5] | |
51 | + endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) | |
52 | + handRight.genConf({'loc':[endFrame],'rot':[endFrame]}) | |
53 | + handRight.genOri({'loc':[endFrame],'rot':[endFrame]}) | |
54 | + elif(json_input["rightHand"][0] == "retilineo"): | |
55 | + pass | |
41 | 56 | |
42 | 57 | #ConfLeftRight |
43 | 58 | if(json_input["leftHand"] != []): |
44 | - handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], handPosFrame, armature) | |
59 | + movLeft = json_input["leftHand"][0] | |
60 | + pose = armature.pose.bones['ik_FK.L'] | |
61 | + if(movLeft == "pontual"): | |
62 | + handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], {'loc':[15,endFrame],'rot':[15,endFrame]}, armature) | |
63 | + else: | |
64 | + handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], handPosFrame, armature) | |
65 | + if(movLeft == "circular" or movLeft == "semicircular"): | |
66 | + orientation,direction,radius,laps = json_input["leftHand"][1:5] | |
67 | + endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) | |
68 | + handLeft.genConf({'loc':[endFrame],'rot':[endFrame]}) | |
69 | + handLeft.genOri({'loc':[endFrame],'rot':[endFrame]}) | |
70 | + elif(json_input["leftHand"][0] == "retilineo"): | |
71 | + pass | |
72 | + | |
73 | +if(json_input["facialExp"] != []): | |
74 | + #confFace | |
75 | + lbsObjects.Face(json_input["facialExp"], armature, endFrame) # Set face | |
45 | 76 | |
46 | -#confFace | |
47 | -lbsObjects.Face(json_input["facialExp"], armature, endFrame) # Set face | |
48 | 77 | #confPoseEnd |
49 | 78 | lbsObjects.Pose({'loc':[1,endFrame+20],'rot':[1,endFrame+20]},armature) # Set the final pose |
50 | 79 | ... | ... |
util.py
1 | +# -*- coding: UTF-8 -*- | |
2 | + | |
1 | 3 | import bpy |
2 | 4 | import math as m |
3 | 5 | import subprocess as sub |
6 | +import sys | |
7 | +sys.path.append("./") | |
4 | 8 | |
5 | 9 | bones = ["BnMao.R", "BnMao.L"] |
6 | 10 | def sizeRadius(value): |
... | ... | @@ -12,8 +16,6 @@ def sizeRadius(value): |
12 | 16 | else: |
13 | 17 | return 0.3 |
14 | 18 | |
15 | -# 1600 x 1200 -> 00:01:25.158198 | |
16 | -# 640 x 480 -> 00:00:41.590239 | |
17 | 19 | def outconf(): |
18 | 20 | bpy.context.scene.render.resolution_x = 640 |
19 | 21 | bpy.context.scene.render.resolution_y = 480 |
... | ... | @@ -64,10 +66,11 @@ def get_calculo_mov(radius,orientation,sense): |
64 | 66 | ''' |
65 | 67 | |
66 | 68 | def render_sign(userId,signName,beginFrame,endFrame): |
67 | - bpy.context.scene.render.filepath = "//"+ str(userId)+ "//"+ signName + "_" | |
69 | + bpy.context.scene.render.filepath = "//Users//"+ str(userId)+ "//"+ signName + "_" | |
68 | 70 | bpy.context.scene.frame_start = beginFrame |
69 | 71 | bpy.context.scene.frame_end = endFrame |
70 | 72 | bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") |
73 | + | |
71 | 74 | bpy.ops.wm.quit_blender() |
72 | 75 | |
73 | 76 | """ | ... | ... |