diff --git a/avatar_Hozana_wikiLibras.blend b/avatar_Hozana_wikiLibras.blend index 6f314b6..dd7ea8f 100644 Binary files a/avatar_Hozana_wikiLibras.blend and b/avatar_Hozana_wikiLibras.blend differ diff --git a/libras.py b/libras.py index 7ed19c0..0f42242 100644 --- a/libras.py +++ b/libras.py @@ -65,45 +65,7 @@ def faceConfiguration(handParam, positionFrames, bones): # Função responsável por setar a configuração da face setPose([7], handParam, positionFrames, bones) -# Função que recupera o frame final do movimento -def get_endFrame(): - endsFrame = [18] - if(json_input["rightHand"] != []): - if(json_input["rightHand"][0] == "circular"): - endsFrame.append(int(json_input["rightHand"][4]*8*5+18)) - elif(json_input["rightHand"][0] == "semicircular"): - endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) - elif(json_input["rightHand"][0] == "retilineo"): - endsFrame.append(max(hands_frames_retilineo)) - if(json_input["leftHand"] != []): - if(json_input["leftHand"][0] == "circular"): - endsFrame.append(int(json_input["leftHand"][4]*8*5+18)) - elif(json_input["leftHand"][0] == "semicircular"): - endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) - elif(json_input["rightHand"][0] == "retilineo"): - endsFrame.append(max(hands_frames_retilineo)) - return(max(endsFrame)) - -initialFrame, endFrame = 15, get_endFrame() - -def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 5, initialFrame = 18, turn = None): - center = pose.location.x, pose.location.y, pose.location.z - if(orientation == 'perpendicular'): - if(direction == 'horario'): - endFrame = moves.locationCircular(center, radius, 1, 0, 2, pose, 0, laps, intensity, initialFrame,turn) - else: - endFrame = moves.locationCircular(center, radius, 0, 1, 2, pose, 0, laps, intensity, initialFrame,turn) - elif(orientation == 'paralelo'): - if(direction == 'horario'): - endFrame = moves.locationCircular(center, radius, 1, 2, 0, pose, 0, laps, intensity, initialFrame,turn) - else: - endFrame = moves.locationCircular(center, radius, 2, 1, 0, pose, 0, laps, intensity, initialFrame,turn) - elif(orientation == 'plano'): - if(direction == 'horario'): - endFrame = moves.locationCircular(center, radius, 2, 0, 1, pose, 0, laps, intensity, initialFrame,turn) - else: - endFrame = moves.locationCircular(center, radius, 0, 2, 1, pose, 0, laps, intensity, initialFrame,turn) - return endFrame +initialFrame, endFrame = 15, util.get_endFrame(json_input,hands_frames_retilineo) #------------------ Configurações------------------------------ diff --git a/moves.py b/moves.py index 90c3a80..8e68364 100644 --- a/moves.py +++ b/moves.py @@ -1,6 +1,25 @@ # -*- coding: UTF-8 -*- import math +def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 5, initialFrame = 18, turn = None): + center = pose.location.x, pose.location.y, pose.location.z + if(orientation == 'perpendicular'): + if(direction == 'horario'): + endFrame = moves.locationCircular(center, radius, 1, 0, 2, pose, 0, laps, intensity, initialFrame,turn) + else: + endFrame = moves.locationCircular(center, radius, 0, 1, 2, pose, 0, laps, intensity, initialFrame,turn) + elif(orientation == 'paralelo'): + if(direction == 'horario'): + endFrame = moves.locationCircular(center, radius, 1, 2, 0, pose, 0, laps, intensity, initialFrame,turn) + else: + endFrame = moves.locationCircular(center, radius, 2, 1, 0, pose, 0, laps, intensity, initialFrame,turn) + elif(orientation == 'plano'): + if(direction == 'horario'): + endFrame = moves.locationCircular(center, radius, 2, 0, 1, pose, 0, laps, intensity, initialFrame,turn) + else: + endFrame = moves.locationCircular(center, radius, 0, 2, 1, pose, 0, laps, intensity, initialFrame,turn) + return endFrame + def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPosition, laps, frameJump = 5, initialFrame = 18, turn = None): sqrt22 = radius * (math.sqrt(2) / 2) rad2 = (radius/2) diff --git a/util.py b/util.py index 9fafa67..25b8e21 100644 --- a/util.py +++ b/util.py @@ -32,39 +32,22 @@ def render_sign(userId, signName, beginFrame, endFrame): bpy.context.scene.frame_end = endFrame bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") bpy.ops.wm.quit_blender() - -""" -def flip(frame, lado): - print ("flipou Frame: " + str(frame) + " BONE: " + str(bones[lado])) - for i in range(0, 4, 1): - bpy.Object.Get("Armature.001").getAction().getChannelIpo(bones[lado]).getCurves()[i][frame]*=-1 - -def fixRots(lado): - keyFrames = bpy.Object.Get("Armature.001").getAction().getFrameNumbers() - rotFrames = [[]] - status = [True] * (len(keyFrames) + 1) - - for i in range(0, len(keyFrames), 1): - bpy.Set('curframe', keyFrames[i]) - rotFrames[-1] = bpy.Object.Get("Armature.001").getPose().bones[bones[lado]].quat.toEuler() - rotFrames.append( [] ) - - rotFrames.remove([]) - - for k in range(1, len(keyFrames), 1): - for i in range(0, 3, 1): - if (math.fabs(rotFrames[k][i] - rotFrames[k-1][i])) > 180 : - status[k] = False - - print (status[0:len(status)-1]) - - for k in range(1, len(keyFrames), 1): - if status[k] == False: - flip(keyFrames[k], lado) - if status[k+1] == True: - status[k+1] = False - else: - status[k+1] = True - print (status[0:len(status)-1]) -""" \ No newline at end of file +# Função que recupera o frame final do movimento +def get_endFrame(json_input,hands_frames_retilineo): + endsFrame = [18] + if(json_input["rightHand"] != []): + if(json_input["rightHand"][0] == "circular"): + endsFrame.append(int(json_input["rightHand"][4]*8*5+18)) + elif(json_input["rightHand"][0] == "semicircular"): + endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) + elif(json_input["rightHand"][0] == "retilineo"): + endsFrame.append(max(hands_frames_retilineo)) + if(json_input["leftHand"] != []): + if(json_input["leftHand"][0] == "circular"): + endsFrame.append(int(json_input["leftHand"][4]*8*5+18)) + elif(json_input["leftHand"][0] == "semicircular"): + endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) + elif(json_input["rightHand"][0] == "retilineo"): + endsFrame.append(max(hands_frames_retilineo)) + return(max(endsFrame)) -- libgit2 0.21.2