Commit 28995370fafb6225df3c0f4b6e52d11a376f0a03
1 parent
e3816f89
Exists in
master
Modificações na pose orientação da mão direita do avatar
Showing
4 changed files
with
38 additions
and
74 deletions
Show diff stats
avatar_Hozana_wikiLibras.blend
No preview for this file type
libras.py
| @@ -65,45 +65,7 @@ def faceConfiguration(handParam, positionFrames, bones): | @@ -65,45 +65,7 @@ def faceConfiguration(handParam, positionFrames, bones): | ||
| 65 | # Função responsável por setar a configuração da face | 65 | # Função responsável por setar a configuração da face |
| 66 | setPose([7], handParam, positionFrames, bones) | 66 | setPose([7], handParam, positionFrames, bones) |
| 67 | 67 | ||
| 68 | -# Função que recupera o frame final do movimento | ||
| 69 | -def get_endFrame(): | ||
| 70 | - endsFrame = [18] | ||
| 71 | - if(json_input["rightHand"] != []): | ||
| 72 | - if(json_input["rightHand"][0] == "circular"): | ||
| 73 | - endsFrame.append(int(json_input["rightHand"][4]*8*5+18)) | ||
| 74 | - elif(json_input["rightHand"][0] == "semicircular"): | ||
| 75 | - endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) | ||
| 76 | - elif(json_input["rightHand"][0] == "retilineo"): | ||
| 77 | - endsFrame.append(max(hands_frames_retilineo)) | ||
| 78 | - if(json_input["leftHand"] != []): | ||
| 79 | - if(json_input["leftHand"][0] == "circular"): | ||
| 80 | - endsFrame.append(int(json_input["leftHand"][4]*8*5+18)) | ||
| 81 | - elif(json_input["leftHand"][0] == "semicircular"): | ||
| 82 | - endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) | ||
| 83 | - elif(json_input["rightHand"][0] == "retilineo"): | ||
| 84 | - endsFrame.append(max(hands_frames_retilineo)) | ||
| 85 | - return(max(endsFrame)) | ||
| 86 | - | ||
| 87 | -initialFrame, endFrame = 15, get_endFrame() | ||
| 88 | - | ||
| 89 | -def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 5, initialFrame = 18, turn = None): | ||
| 90 | - center = pose.location.x, pose.location.y, pose.location.z | ||
| 91 | - if(orientation == 'perpendicular'): | ||
| 92 | - if(direction == 'horario'): | ||
| 93 | - endFrame = moves.locationCircular(center, radius, 1, 0, 2, pose, 0, laps, intensity, initialFrame,turn) | ||
| 94 | - else: | ||
| 95 | - endFrame = moves.locationCircular(center, radius, 0, 1, 2, pose, 0, laps, intensity, initialFrame,turn) | ||
| 96 | - elif(orientation == 'paralelo'): | ||
| 97 | - if(direction == 'horario'): | ||
| 98 | - endFrame = moves.locationCircular(center, radius, 1, 2, 0, pose, 0, laps, intensity, initialFrame,turn) | ||
| 99 | - else: | ||
| 100 | - endFrame = moves.locationCircular(center, radius, 2, 1, 0, pose, 0, laps, intensity, initialFrame,turn) | ||
| 101 | - elif(orientation == 'plano'): | ||
| 102 | - if(direction == 'horario'): | ||
| 103 | - endFrame = moves.locationCircular(center, radius, 2, 0, 1, pose, 0, laps, intensity, initialFrame,turn) | ||
| 104 | - else: | ||
| 105 | - endFrame = moves.locationCircular(center, radius, 0, 2, 1, pose, 0, laps, intensity, initialFrame,turn) | ||
| 106 | - return endFrame | 68 | +initialFrame, endFrame = 15, util.get_endFrame(json_input,hands_frames_retilineo) |
| 107 | 69 | ||
| 108 | #------------------ Configurações------------------------------ | 70 | #------------------ Configurações------------------------------ |
| 109 | 71 |
moves.py
| 1 | # -*- coding: UTF-8 -*- | 1 | # -*- coding: UTF-8 -*- |
| 2 | import math | 2 | import math |
| 3 | 3 | ||
| 4 | +def circular_or_semiCircular(pose, orientation, direction, radius, laps, intensity = 5, initialFrame = 18, turn = None): | ||
| 5 | + center = pose.location.x, pose.location.y, pose.location.z | ||
| 6 | + if(orientation == 'perpendicular'): | ||
| 7 | + if(direction == 'horario'): | ||
| 8 | + endFrame = moves.locationCircular(center, radius, 1, 0, 2, pose, 0, laps, intensity, initialFrame,turn) | ||
| 9 | + else: | ||
| 10 | + endFrame = moves.locationCircular(center, radius, 0, 1, 2, pose, 0, laps, intensity, initialFrame,turn) | ||
| 11 | + elif(orientation == 'paralelo'): | ||
| 12 | + if(direction == 'horario'): | ||
| 13 | + endFrame = moves.locationCircular(center, radius, 1, 2, 0, pose, 0, laps, intensity, initialFrame,turn) | ||
| 14 | + else: | ||
| 15 | + endFrame = moves.locationCircular(center, radius, 2, 1, 0, pose, 0, laps, intensity, initialFrame,turn) | ||
| 16 | + elif(orientation == 'plano'): | ||
| 17 | + if(direction == 'horario'): | ||
| 18 | + endFrame = moves.locationCircular(center, radius, 2, 0, 1, pose, 0, laps, intensity, initialFrame,turn) | ||
| 19 | + else: | ||
| 20 | + endFrame = moves.locationCircular(center, radius, 0, 2, 1, pose, 0, laps, intensity, initialFrame,turn) | ||
| 21 | + return endFrame | ||
| 22 | + | ||
| 4 | def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPosition, laps, frameJump = 5, initialFrame = 18, turn = None): | 23 | def locationCircular(center, radius, i_axis, j_axis, k_axis, pose, initialPosition, laps, frameJump = 5, initialFrame = 18, turn = None): |
| 5 | sqrt22 = radius * (math.sqrt(2) / 2) | 24 | sqrt22 = radius * (math.sqrt(2) / 2) |
| 6 | rad2 = (radius/2) | 25 | rad2 = (radius/2) |
util.py
| @@ -32,39 +32,22 @@ def render_sign(userId, signName, beginFrame, endFrame): | @@ -32,39 +32,22 @@ def render_sign(userId, signName, beginFrame, endFrame): | ||
| 32 | bpy.context.scene.frame_end = endFrame | 32 | bpy.context.scene.frame_end = endFrame |
| 33 | bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") | 33 | bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") |
| 34 | bpy.ops.wm.quit_blender() | 34 | bpy.ops.wm.quit_blender() |
| 35 | - | ||
| 36 | -""" | ||
| 37 | -def flip(frame, lado): | ||
| 38 | - print ("flipou Frame: " + str(frame) + " BONE: " + str(bones[lado])) | ||
| 39 | - for i in range(0, 4, 1): | ||
| 40 | - bpy.Object.Get("Armature.001").getAction().getChannelIpo(bones[lado]).getCurves()[i][frame]*=-1 | ||
| 41 | - | ||
| 42 | -def fixRots(lado): | ||
| 43 | - keyFrames = bpy.Object.Get("Armature.001").getAction().getFrameNumbers() | ||
| 44 | - rotFrames = [[]] | ||
| 45 | - status = [True] * (len(keyFrames) + 1) | ||
| 46 | - | ||
| 47 | - for i in range(0, len(keyFrames), 1): | ||
| 48 | - bpy.Set('curframe', keyFrames[i]) | ||
| 49 | - rotFrames[-1] = bpy.Object.Get("Armature.001").getPose().bones[bones[lado]].quat.toEuler() | ||
| 50 | - rotFrames.append( [] ) | ||
| 51 | - | ||
| 52 | - rotFrames.remove([]) | ||
| 53 | - | ||
| 54 | - for k in range(1, len(keyFrames), 1): | ||
| 55 | - for i in range(0, 3, 1): | ||
| 56 | - if (math.fabs(rotFrames[k][i] - rotFrames[k-1][i])) > 180 : | ||
| 57 | - status[k] = False | ||
| 58 | - | ||
| 59 | - print (status[0:len(status)-1]) | ||
| 60 | - | ||
| 61 | - for k in range(1, len(keyFrames), 1): | ||
| 62 | - if status[k] == False: | ||
| 63 | - flip(keyFrames[k], lado) | ||
| 64 | - if status[k+1] == True: | ||
| 65 | - status[k+1] = False | ||
| 66 | - else: | ||
| 67 | - status[k+1] = True | ||
| 68 | 35 | ||
| 69 | - print (status[0:len(status)-1]) | ||
| 70 | -""" | ||
| 71 | \ No newline at end of file | 36 | \ No newline at end of file |
| 37 | +# Função que recupera o frame final do movimento | ||
| 38 | +def get_endFrame(json_input,hands_frames_retilineo): | ||
| 39 | + endsFrame = [18] | ||
| 40 | + if(json_input["rightHand"] != []): | ||
| 41 | + if(json_input["rightHand"][0] == "circular"): | ||
| 42 | + endsFrame.append(int(json_input["rightHand"][4]*8*5+18)) | ||
| 43 | + elif(json_input["rightHand"][0] == "semicircular"): | ||
| 44 | + endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) | ||
| 45 | + elif(json_input["rightHand"][0] == "retilineo"): | ||
| 46 | + endsFrame.append(max(hands_frames_retilineo)) | ||
| 47 | + if(json_input["leftHand"] != []): | ||
| 48 | + if(json_input["leftHand"][0] == "circular"): | ||
| 49 | + endsFrame.append(int(json_input["leftHand"][4]*8*5+18)) | ||
| 50 | + elif(json_input["leftHand"][0] == "semicircular"): | ||
| 51 | + endsFrame.append(int(json_input["rightHand"][4]*5*5+18)) | ||
| 52 | + elif(json_input["rightHand"][0] == "retilineo"): | ||
| 53 | + endsFrame.append(max(hands_frames_retilineo)) | ||
| 54 | + return(max(endsFrame)) |