Skip to content

Instantly share code, notes, and snippets.

@cyaoeu
cyaoeu / fbx_batchexport_anims.py
Created August 29, 2017 17:57
Blender script: batch export anims
import bpy
path = bpy.path.abspath('//') #path of .blend
objname = bpy.context.active_object.name #select rig
singleanim = True
if singleanim == True:
action = bpy.context.active_object.animation_data.action
import bpy
bpy.ops.object.mode_set(mode='POSE', toggle=False)
bpy.ops.pose.select_all(action="SELECT")
selbones = bpy.context.selected_pose_bones
targetrig = bpy.data.objects["root"]
ignore = ("CS_thigh","CS_calf", "CS_upperarm","CS_lowerarm","CS_LegPoletarget","CS_ElboRoll","CS_foot_l","CS_foot_r","CS_FootRoolMain","CS_hand_l","CS_hand_r","CS_thumb_all","CS_middle_All","CS_index_all","CS_pinky_All","CS_ring_All")
import bpy
from math import pi, floor
rig = bpy.context.selected_objects[0]
def is_keyframe(ob, frame, data_path, array_index=-1):
if ob is not None and ob.animation_data is not None and ob.animation_data.action is not None:
for fcu in ob.animation_data.action.fcurves:
if fcu.data_path == data_path:
if array_index == -1 or fcu.array_index == array_index:
@cyaoeu
cyaoeu / import_multiple_fbx.py
Created September 27, 2017 13:10
Import multiple FBX files (hacky)
import bpy
import os
def listFiles(dir, ext):
fileList = []
for file in os.listdir(path):
if file[-len(ext):] == ext:
fileList.append(file)
@cyaoeu
cyaoeu / fbx_export_animation_with_shapekeyanimation.py
Created October 23, 2017 19:19
fbx_export_animation_with_shapekeyanimation.py
import bpy
path = bpy.path.abspath('//') #path of .blend
for object in bpy.context.selected_objects:
if object.type == "ARMATURE": #select both mesh and rig
rig = object
if object.type == "MESH":
mesh = object
riganimname = rig.animation_data.action.name
@cyaoeu
cyaoeu / cyaoeu.xml
Last active November 18, 2017 22:53
cyaoeu Blender theme (WIP!)
<bpy>
<Theme>
<user_interface>
<ThemeUserInterface menu_shadow_fac="0.5"
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
widget_emboss="#31313105"
axis_x="#dc0000"
axis_y="#00dc00"
@cyaoeu
cyaoeu / ImageFramesToImgurMp4.bat
Created November 19, 2017 15:04
ImageFramesToImgurMp4.bat (batch script)
@ECHO OFF
ECHO "%~1"
C:/ffmpeg/bin/ffmpeg.exe -i "%~d1%%04d.png" -r ntsc -movflags faststart -pix_fmt yuv420p -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 "%~n1.mp4"
set /p=
@cyaoeu
cyaoeu / ue4.xml
Last active November 27, 2018 01:41
Blender UE4 theme (WIP) - install using Install Theme from user preferences
<bpy>
<Theme>
<user_interface>
<ThemeUserInterface menu_shadow_fac="0.5"
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
widget_emboss="#31313105"
axis_x="#dc0000"
axis_y="#00dc00"
ffmpeg -y -hwaccel cuvid -i input.mkv -acodec copy -vcodec h264_nvenc -b:v 6M -vf "stereo3d=sbsl:abl, pad=width=3840:height=3840:x=960:y=0" input_fixed.mkv
@cyaoeu
cyaoeu / stroke_select_blender.py
Created March 24, 2018 14:56
stroke select addon (edited)
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the