diff --git a/.gitignore b/.gitignore index 58ad360..98d855b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ -*.avi *~ +*.avi +*.blend +*.blend1 +*.mp4 *.pyc +textures/ __pycache__ -*.mp4 diff --git a/NewFormat_Json b/NewFormat_Json index 9f39cf1..9bb0828 100644 --- a/NewFormat_Json +++ b/NewFormat_Json @@ -1 +1,6 @@ '{"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"}' + + '{"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"}' + + + '{"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"}' diff --git a/avatar_Hozana_wikiLibras.blend b/avatar_Hozana_wikiLibras.blend index 4f1eaac..363553b 100644 Binary files a/avatar_Hozana_wikiLibras.blend and b/avatar_Hozana_wikiLibras.blend differ diff --git a/libras.py b/libras.py index c65ed74..d56b4e8 100644 --- a/libras.py +++ b/libras.py @@ -1,10 +1,12 @@ # -*- coding: UTF-8 -*- import sys +sys.path.append('/home/gtaaas/wikilibras/wikilibras-core') import json import lbsObjects import util -def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensity,initialFrame = 15): + +def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensity = 5,initialFrame = 15): center = pose.location.x,pose.location.y,pose.location.z if(orientation == 'perpendicular'): if(direction == 'horario'): @@ -18,33 +20,60 @@ def circular_or_semiCircular(hand,pose,orientation,direction,radius,laps,intensi endFrame = hand.rotationCircular(center,radius,2,1,0,pose,0,laps,intensity,initialFrame) return endFrame +def get_endFrame(json_input): + endsFrame = [] + if(json_input["rightHand"][0] == "circular" or json_input["rightHand"][0] == "semicircular"): + endsFrame.append(int(json_input["rightHand"][4]*8*5+15)) + if(json_input["leftHand"][0] == "circular" or json_input["leftHand"][0] == "semicircular"): + endsFrame.append(int(json_input["leftHand"][4]*8*5+15)) + return(max(endsFrame)) #Configurações gerais json_input = json.loads(sys.argv[5]) # Load jason util.outconf() handPosFrame = {'loc':[15],'rot':[15]} armature = lbsObjects.Armadura('Armature.001') -initialFrame,endFrame = 18,25 +initialFrame,endFrame = 18,get_endFrame(json_input) #Initial Pose lbsObjects.Pose({'loc':[0], 'rot':[0]}, armature) #Set the default pose #ConfHandRight if(json_input["rightHand"] != []): - handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:], handPosFrame, armature) - if(json_input["rightHand"][0] == "circular"): - orientation,direction,radius,laps = json_input["rightHand"][1:5] - pose = armature.pose.bones['ik_FK.R'] - endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) - handRight.genConf({'loc':[endFrame],'rot':[endFrame]}) - handRight.genOri({'loc':[endFrame],'rot':[endFrame]}) + movRight = json_input["rightHand"][0] + pose = armature.pose.bones['ik_FK.R'] + if(movRight == "pontual"): + handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:],{'loc':[15,endFrame],'rot':[15,endFrame]}, armature) + else: + handRight = lbsObjects.MaoDireita(json_input["rightHand"][-3:],handPosFrame, armature) + if(movRight == "circular" or movRight == "semicircular"): + orientation,direction,radius,laps = json_input["rightHand"][1:5] + endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) + handRight.genConf({'loc':[endFrame],'rot':[endFrame]}) + handRight.genOri({'loc':[endFrame],'rot':[endFrame]}) + elif(json_input["rightHand"][0] == "retilineo"): + pass #ConfLeftRight if(json_input["leftHand"] != []): - handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], handPosFrame, armature) + movLeft = json_input["leftHand"][0] + pose = armature.pose.bones['ik_FK.L'] + if(movLeft == "pontual"): + handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], {'loc':[15,endFrame],'rot':[15,endFrame]}, armature) + else: + handLeft = lbsObjects.MaoEsquerda(json_input["leftHand"][-3:], handPosFrame, armature) + if(movLeft == "circular" or movLeft == "semicircular"): + orientation,direction,radius,laps = json_input["leftHand"][1:5] + endFrame = circular_or_semiCircular(handRight,pose,orientation,direction,radius,laps,5) + handLeft.genConf({'loc':[endFrame],'rot':[endFrame]}) + handLeft.genOri({'loc':[endFrame],'rot':[endFrame]}) + elif(json_input["leftHand"][0] == "retilineo"): + pass + +if(json_input["facialExp"] != []): + #confFace + lbsObjects.Face(json_input["facialExp"], armature, endFrame) # Set face -#confFace -lbsObjects.Face(json_input["facialExp"], armature, endFrame) # Set face #confPoseEnd lbsObjects.Pose({'loc':[1,endFrame+20],'rot':[1,endFrame+20]},armature) # Set the final pose diff --git a/util.py b/util.py index 141c651..f12f438 100644 --- a/util.py +++ b/util.py @@ -1,6 +1,10 @@ +# -*- coding: UTF-8 -*- + import bpy import math as m import subprocess as sub +import sys +sys.path.append("./") bones = ["BnMao.R", "BnMao.L"] def sizeRadius(value): @@ -12,8 +16,6 @@ def sizeRadius(value): else: return 0.3 -# 1600 x 1200 -> 00:01:25.158198 -# 640 x 480 -> 00:00:41.590239 def outconf(): bpy.context.scene.render.resolution_x = 640 bpy.context.scene.render.resolution_y = 480 @@ -64,10 +66,11 @@ def get_calculo_mov(radius,orientation,sense): ''' def render_sign(userId,signName,beginFrame,endFrame): - bpy.context.scene.render.filepath = "//"+ str(userId)+ "//"+ signName + "_" + bpy.context.scene.render.filepath = "//Users//"+ str(userId)+ "//"+ signName + "_" bpy.context.scene.frame_start = beginFrame bpy.context.scene.frame_end = endFrame bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") + bpy.ops.wm.quit_blender() """ -- libgit2 0.21.2