1
This commit is contained in:
commit
a85391509d
211 files changed
+28903
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import bpy,math,json
|
||||
from mathutils import Vector,Matrix
|
||||
s=bpy.context.scene;r=next(o for o in s.objects if o.type=='ARMATURE' and o.name.startswith('Armature'))
|
||||
r.animation_data_clear()
|
||||
if r.parent:r.parent.location=(-1.9,0,-4.9)
|
||||
bpy.context.view_layer.update()
|
||||
def control(name,target,direction):
|
||||
p=r.pose.bones[name]
|
||||
for con in p.constraints:con.mute=True
|
||||
rot=Vector(direction).to_track_quat('Y','Z').to_matrix().to_4x4()
|
||||
rot.translation=Vector(target)
|
||||
p.matrix=r.matrix_world.inverted()@rot
|
||||
def pole(name,point):
|
||||
p=r.pose.bones[name];m=p.matrix.copy();m.translation=r.matrix_world.inverted()@Vector(point);p.matrix=m
|
||||
control('hand_IK_L.L',(1.05,-.12,-.38),(0,1,.25))
|
||||
control('hand_IK_L.R',(-2.95,.15,-1.05),(.25,-.1,1))
|
||||
pole('elbow_IK_L.L',(-.6,-1.8,-1.7));pole('elbow_IK_L.R',(-3.8,1.3,-1.9))
|
||||
for p in r.pose.bones:
|
||||
if any(p.name.startswith(k) for k in ('index','middle','ring','pink','thumb')):
|
||||
p.rotation_mode='XYZ';p.rotation_euler=(0,0,0)
|
||||
if not p.name.startswith('thumb'):
|
||||
p.rotation_euler.x=math.radians(38 if '.' in p.name.split('_')[1] else 20)
|
||||
if p.name.startswith('index') and p.name.endswith('.R'):p.rotation_euler.x=math.radians(15)
|
||||
else:p.rotation_euler.z=math.radians(15 if p.name.endswith('.L') else -15)
|
||||
bpy.context.view_layer.update()
|
||||
print(json.dumps({n:list(r.matrix_world@r.pose.bones[n].head) for n in ('hand_L.L','hand_L.R')}))
|
||||
s.render.filepath=r'C:\roblox\hunter\3D models\hands_grip_preview.png';s.cycles.samples=16
|
||||
bpy.ops.wm.save_as_mainfile(filepath=r'C:\roblox\hunter\3D models\sniper_reference_v10_grip.blend')
|
||||
bpy.ops.render.render(write_still=True)
|
||||
Reference in new issue
Block a user