forked from scaredyfish/blender-rhubarb-lipsync
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprops.py
82 lines (68 loc) · 2.36 KB
/
props.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import bpy
from .core import (
prop_list,
)
# Generate list of items from target's props
def enum_items_generator(self, context):
enum_items = []
for index, prop in enumerate(prop_list):
# Enum items order(key, name, description, position)
enum_items.append((prop[0], prop[0], prop[2], index))
return enum_items
def mode_options_generator(self, context):
obj_enum = (
"obj",
"Object",
"Keyframe a custom integer or float property on the active object's data",
"OBJECT_DATA",
1,
)
bone_enum = (
"bone",
"Bone",
"Keyframe a custom integer or float property on the active pose bone in Pose Mode",
"BONE_DATA",
2,
)
timeoffset_enum = (
"timeoffset",
"TimeOffset",
"Directly keyframe time offset modifier",
"MOD_TIME",
3,
)
return obj_enum, timeoffset_enum, bone_enum
class Rhubarb_Panel_Settings(bpy.types.PropertyGroup):
"""definitions for rhubarb properties"""
mouth_a: bpy.props.IntProperty(name="moutha")
mouth_b: bpy.props.IntProperty(name="mouthb")
mouth_c: bpy.props.IntProperty(name="mouthc")
mouth_d: bpy.props.IntProperty(name="mouthd")
mouth_e: bpy.props.IntProperty(name="mouthe")
mouth_f: bpy.props.IntProperty(name="mouthf")
mouth_g: bpy.props.IntProperty(name="mouthg")
mouth_h: bpy.props.IntProperty(name="mouthh")
mouth_x: bpy.props.IntProperty(name="mouthx")
# rhubarb executable dependcies
sound_file: bpy.props.StringProperty(name="sound_file", subtype="FILE_PATH")
dialog_file: bpy.props.StringProperty(name="dialog_file", subtype="FILE_PATH")
start_frame: bpy.props.IntProperty(name="start_frame")
presets: bpy.props.EnumProperty(
items=enum_items_generator, name="Select Target Property"
)
obj_modes: bpy.props.EnumProperty(
name="Select mode",
items=mode_options_generator,
description="Run Rhubarb Lipsync in",
)
classes = (Rhubarb_Panel_Settings,)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.WindowManager.rhubarb_panel_settings = bpy.props.PointerProperty(
type=Rhubarb_Panel_Settings
)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
del bpy.types.WindowManager.rhubarb_panel_settings