Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Blender 2.93 LTS #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
__pycache__
vendor/*

80 changes: 40 additions & 40 deletions AddonProps.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,150 +23,150 @@
]

class YerFaceBlenderProperties(bpy.types.PropertyGroup):
translationTargetObject = bpy.props.StringProperty(
translationTargetObject: bpy.props.StringProperty(
name = "Object",
default = "")
translationTargetBone = bpy.props.StringProperty(
translationTargetBone: bpy.props.StringProperty(
name = "Bone",
default = "")
translationShowAdvanced = bpy.props.BoolProperty(default=False)
translationScale = bpy.props.FloatProperty(
translationShowAdvanced: bpy.props.BoolProperty(default=False)
translationScale: bpy.props.FloatProperty(
name = "Scale",
default = 0.00328084, # millimeters to feet
min = 0.0)
translationScaleX = bpy.props.FloatProperty(
translationScaleX: bpy.props.FloatProperty(
name = "X",
default = 1.0,
min = 0.0)
translationScaleY = bpy.props.FloatProperty(
translationScaleY: bpy.props.FloatProperty(
name = "Y",
default = 1.0,
min = 0.0)
translationScaleZ = bpy.props.FloatProperty(
translationScaleZ: bpy.props.FloatProperty(
name = "Z",
default = 1.0,
min = 0.0)
translationAxisMapX = bpy.props.EnumProperty(
translationAxisMapX: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map X",
default = "p.x")
translationAxisMapY = bpy.props.EnumProperty(
translationAxisMapY: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Y",
default = "p.y")
translationAxisMapZ = bpy.props.EnumProperty(
translationAxisMapZ: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Z",
default = "p.z")
translationAnticipationFrames = bpy.props.IntProperty(
translationAnticipationFrames: bpy.props.IntProperty(
name = "Anticipate Motion N Frames Ago",
description = "If we're holding a property via deduplicated keyframes, but the property is about to change, how many frames ago should we anticipate this.",
min = 1,
default = 15)

rotationTargetObject = bpy.props.StringProperty(
rotationTargetObject: bpy.props.StringProperty(
name = "Object",
default = "")
rotationTargetBone = bpy.props.StringProperty(
rotationTargetBone: bpy.props.StringProperty(
name = "Bone",
default = "")
rotationShowAdvanced = bpy.props.BoolProperty(default=False)
rotationScale = bpy.props.FloatProperty(
rotationShowAdvanced: bpy.props.BoolProperty(default=False)
rotationScale: bpy.props.FloatProperty(
name = "Scale",
default = 1.0,
min = 0.0)
rotationScaleX = bpy.props.FloatProperty(
rotationScaleX: bpy.props.FloatProperty(
name = "X",
default = 1.0,
min = 0.0)
rotationScaleY = bpy.props.FloatProperty(
rotationScaleY: bpy.props.FloatProperty(
name = "Y",
default = 1.0,
min = 0.0)
rotationScaleZ = bpy.props.FloatProperty(
rotationScaleZ: bpy.props.FloatProperty(
name = "Z",
default = 1.0,
min = 0.0)
rotationAxisMapX = bpy.props.EnumProperty(
rotationAxisMapX: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map X",
default = "p.x")
rotationAxisMapY = bpy.props.EnumProperty(
rotationAxisMapY: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Y",
default = "p.y")
rotationAxisMapZ = bpy.props.EnumProperty(
rotationAxisMapZ: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Z",
default = "p.z")
rotationAnticipationFrames = bpy.props.IntProperty(
rotationAnticipationFrames: bpy.props.IntProperty(
name = "Anticipate Motion N Frames Ago",
description = "If we're holding a property via deduplicated keyframes, but the property is about to change, how many frames ago should we anticipate this.",
min = 1,
default = 15)

faceArmatureObject = bpy.props.StringProperty(
faceArmatureObject: bpy.props.StringProperty(
name = "Rig",
default = "")
faceBoneTranslationScale = bpy.props.FloatProperty(
faceBoneTranslationScale: bpy.props.FloatProperty(
name = "Scale",
default = 0.01,
min = 0.0)
faceShowAdvanced = bpy.props.BoolProperty(default=False)
faceBoneAxisMapX = bpy.props.EnumProperty(
faceShowAdvanced: bpy.props.BoolProperty(default=False)
faceBoneAxisMapX: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map X",
default = "p.x")
faceBoneAxisMapY = bpy.props.EnumProperty(
faceBoneAxisMapY: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Y",
default = "p.y")
faceBoneAxisMapZ = bpy.props.EnumProperty(
faceBoneAxisMapZ: bpy.props.EnumProperty(
items = yerFaceAxisMapEnumItems,
name = "Map Z",
default = "p.z")
faceAnticipationFrames = bpy.props.IntProperty(
faceAnticipationFrames: bpy.props.IntProperty(
name = "Anticipate Motion N Frames Ago",
description = "If we're holding a property via deduplicated keyframes, but the property is about to change, how many frames ago should we anticipate this.",
min = 1,
default = 15)

phonemesTargetObject = bpy.props.StringProperty(
phonemesTargetObject: bpy.props.StringProperty(
name = "Object",
default = "")
phonemesShowAdvanced = bpy.props.BoolProperty(default=False)
phonemesScale = bpy.props.FloatProperty(
phonemesShowAdvanced: bpy.props.BoolProperty(default=False)
phonemesScale: bpy.props.FloatProperty(
name = "Scale",
default = 1.0,
min = 0.0)
phonemesAnticipationFrames = bpy.props.IntProperty(
phonemesAnticipationFrames: bpy.props.IntProperty(
name = "Anticipate Motion N Frames Ago",
description = "If we're holding a property via deduplicated keyframes, but the property is about to change, how many frames ago should we anticipate this.",
min = 1,
default = 1)

tickCallback = bpy.props.StringProperty(
tickCallback: bpy.props.StringProperty(
name = "Tick Callback",
default = "")
tickUserData = bpy.props.StringProperty(
tickUserData: bpy.props.StringProperty(
name = "User Data",
default = "")

inputMode = bpy.props.EnumProperty(
inputMode: bpy.props.EnumProperty(
items = yerFaceInputModeItems,
name = "Active Input Mode",
default = "live")
samplingMode = bpy.props.EnumProperty(
samplingMode: bpy.props.EnumProperty(
items = yerFaceSamplingModeItems,
name = "Keyframe Sampling Mode",
default = "average")
websocketURI = bpy.props.StringProperty(
websocketURI: bpy.props.StringProperty(
name = "Websocket URI",
default = "ws://localhost:9002")
inputFilePath = bpy.props.StringProperty(
inputFilePath: bpy.props.StringProperty(
name="Perfcap JSON File",
description="Exported performance capture data from YerFace!",
subtype="FILE_PATH")
importStartFrame = bpy.props.IntProperty(
importStartFrame: bpy.props.IntProperty(
name = "Start Frame",
default = 1)
12 changes: 6 additions & 6 deletions ImportOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import bpy
import json

import yerface_blender.SceneUtilities
import yerface_blender.FIFOReader
from . import SceneUtilities
from . import FIFOReader

class YerFaceImportOperator(bpy.types.Operator):
class YERFACE_OT_ImportFromFile(bpy.types.Operator):
bl_idname = "yerface.do_import"
bl_label = "Do Import"
bl_description = "Imports YerFace performance capture data to keyframes."
Expand All @@ -17,8 +17,8 @@ def execute(self, context):
fps = context.scene.render.fps / context.scene.render.fps_base
print("Scene FPS is set to: ", fps)

myReader = yerface_blender.FIFOReader.YerFaceFIFOReader()
myUpdater = yerface_blender.SceneUtilities.YerFaceSceneUpdater(context, myReader, fps)
myReader = FIFOReader.YerFaceFIFOReader()
myUpdater = SceneUtilities.YerFaceSceneUpdater(context, myReader, fps)

if props.tickCallback != "":
tickProps = {
Expand All @@ -36,7 +36,7 @@ def execute(self, context):

print("Kicked off Yer-Face import with file: ", props.inputFilePath)
try:
f = open(props.inputFilePath, "r")
f = open(bpy.path.abspath(props.inputFilePath), "r")
except:
print("Failed to open Yer-Face data file!")
return {'CANCELLED'}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Alex Markley
Copyright (c) 2018-2022 Alex Markley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions PanelInterface.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

import bpy

import yerface_blender.PreviewModal
from yerface_blender.AddonProps import yerFaceInputModeItems
from . import PreviewModal
from .AddonProps import yerFaceInputModeItems

class ToolsPanel(bpy.types.Panel):
class YERFACE_PT_ToolsPanel(bpy.types.Panel):
bl_label = "YerFace! Performance Capture"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Animation"
bl_region_type = "UI"
bl_category = "YerFace!"

def draw(self, context):
layout = self.layout
Expand Down Expand Up @@ -105,7 +105,7 @@ def draw(self, context):
box.prop(props, "websocketURI")
row = box.row(align=False)
row.alignment = 'LEFT'
if yerface_blender.PreviewModal.YerFacePreviewStartOperator.isPreviewRunning(None):
if PreviewModal.YERFACE_OT_PreviewStartOperator.isPreviewRunning(None):
row.operator("wm.yerface_preview_stop")
else:
row.operator("wm.yerface_preview_start")
Expand Down
16 changes: 8 additions & 8 deletions PreviewModal.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

import bpy

import yerface_blender.SceneUtilities
import yerface_blender.WebsocketReader
from . import SceneUtilities
from . import WebsocketReader

isPreviewRunning = False
myPreviewTimer = None
myReader = None
myUpdater = None

class YerFacePreviewStartOperator(bpy.types.Operator):
class YERFACE_OT_PreviewStartOperator(bpy.types.Operator):
bl_idname = "wm.yerface_preview_start"
bl_label = "YerFace Preview Start"
bl_description = "Start previewing data from the Yer Face performance capture tool."
Expand All @@ -36,9 +36,9 @@ def execute(self, context):
time_step = 1/fps

isPreviewRunning = True
myReader = yerface_blender.WebsocketReader.YerFaceWebsocketReader(props.websocketURI)
myReader = WebsocketReader.YerFaceWebsocketReader(props.websocketURI)
myReader.openWebsocket()
myUpdater = yerface_blender.SceneUtilities.YerFaceSceneUpdater(context, myReader, fps)
myUpdater = SceneUtilities.YerFaceSceneUpdater(context, myReader, fps)

if props.tickCallback != "":
tickProps = {
Expand All @@ -56,7 +56,7 @@ def execute(self, context):

context.window_manager.modal_handler_add(self)

myPreviewTimer = context.window_manager.event_timer_add(time_step, context.window)
myPreviewTimer = context.window_manager.event_timer_add(time_step, window=context.window)
print("STARTED TIMER w/Time Step: ", time_step)

return {'RUNNING_MODAL'}
Expand All @@ -77,12 +77,12 @@ def isPreviewRunning(self):
global isPreviewRunning
return isPreviewRunning

class YerFacePreviewStopOperator(bpy.types.Operator):
class YERFACE_OT_PreviewStopOperator(bpy.types.Operator):
bl_idname = "wm.yerface_preview_stop"
bl_label = "YerFace Preview Stop"
bl_description = "Stop previewing data from the Yer Face performance capture tool."
bl_options = {'REGISTER'}

def execute(self, context):
YerFacePreviewStartOperator.cancel(None, context)
YERFACE_OT_PreviewStartOperator.cancel(None, context)
return {'FINISHED'}
2 changes: 1 addition & 1 deletion SceneUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
import bpy

import yerface_blender.DriverUtilities as dru
from . import DriverUtilities as dru

class YerFaceSceneUpdater:
def __init__(self, context, myReader, fps):
Expand Down
Loading