2023-11-30 15:02:05 +01:00
|
|
|
import bpy
|
|
|
|
from bpy.types import PropertyGroup
|
2023-11-30 19:03:20 +01:00
|
|
|
from bpy.props import (EnumProperty,
|
|
|
|
IntProperty,
|
|
|
|
FloatProperty,
|
|
|
|
BoolProperty,
|
|
|
|
PointerProperty,
|
|
|
|
StringProperty)
|
2023-11-30 15:02:05 +01:00
|
|
|
|
|
|
|
class GP_PG_interpolate_settings(PropertyGroup):
|
|
|
|
|
|
|
|
# check_only : BoolProperty(
|
|
|
|
# name="Dry run mode (Check only)",
|
|
|
|
# description="Do not change anything, just print the messages",
|
|
|
|
# default=False, options={'HIDDEN'})
|
2023-11-30 19:03:20 +01:00
|
|
|
|
|
|
|
method : EnumProperty(
|
|
|
|
name='Method',
|
|
|
|
items= (
|
|
|
|
('BONE', 'Bone', 'Pick an armature bone and follow it', 0),
|
|
|
|
('GEOMETRY', 'Geometry', 'Directly follow underlying geometry', 1) ,
|
|
|
|
),
|
|
|
|
default='BONE',
|
|
|
|
description='Select method for interpolating strokes'
|
|
|
|
)
|
2023-11-30 15:02:05 +01:00
|
|
|
|
|
|
|
search_range : FloatProperty(
|
|
|
|
name="Search Range",
|
|
|
|
description="Search range size when points are out of mesh",
|
|
|
|
default=0.05, precision=2, step=3, options={'HIDDEN'})
|
|
|
|
|
2023-11-30 19:03:20 +01:00
|
|
|
|
2023-11-30 15:02:05 +01:00
|
|
|
mode : EnumProperty(
|
|
|
|
name='Mode',
|
|
|
|
# Combined ?markers ?
|
|
|
|
items= (
|
|
|
|
('FRAME', 'Frame', 'prev/next scene frame depending on the padding options', 0),
|
|
|
|
('GPKEY', 'GP Key', 'prev/next Grease pencil key', 1) ,
|
|
|
|
('RIGKEY', 'Rig Key', 'prev/next armatures keys in targeted collection', 2),
|
|
|
|
),
|
|
|
|
default='FRAME',
|
|
|
|
description='Select how the previous or next frame should be chosen'
|
|
|
|
)
|
|
|
|
|
|
|
|
padding : IntProperty(name='Padding',
|
|
|
|
description='Number of frame to jump backward or forward',
|
|
|
|
default=2,
|
|
|
|
min=1)
|
|
|
|
|
|
|
|
target_collection : PointerProperty(
|
2023-11-30 19:03:20 +01:00
|
|
|
name='Collection',
|
2023-11-30 15:02:05 +01:00
|
|
|
type=bpy.types.Collection,
|
|
|
|
description='Target collection to check armature keyframes from',
|
|
|
|
# placeholder='Collection'
|
|
|
|
)
|
2023-11-30 19:03:20 +01:00
|
|
|
|
|
|
|
target_rig : PointerProperty(
|
|
|
|
name='Rig',
|
|
|
|
description='Rig to use as target',
|
|
|
|
type=bpy.types.Object)
|
|
|
|
|
|
|
|
# target_rig : StringProperty(
|
|
|
|
# name='Rig',
|
|
|
|
# description='Rig to use as target')
|
2023-11-30 15:02:05 +01:00
|
|
|
|
2023-11-30 19:03:20 +01:00
|
|
|
target_bone : StringProperty(
|
|
|
|
name='Bone',
|
|
|
|
description='Bone of the rig to follow when interpolating') # Bone
|
2023-11-30 15:02:05 +01:00
|
|
|
|
2023-12-05 11:27:48 +01:00
|
|
|
use_bone_rotation : BoolProperty(
|
|
|
|
name='Use Bone Rotation',
|
|
|
|
default=True,
|
|
|
|
description='Apply rotation of the bone') # Bone
|
|
|
|
|
2023-11-30 15:02:05 +01:00
|
|
|
classes = (
|
|
|
|
GP_PG_interpolate_settings,
|
|
|
|
)
|
|
|
|
|
|
|
|
def register():
|
|
|
|
for c in classes:
|
|
|
|
bpy.utils.register_class(c)
|
|
|
|
bpy.types.Scene.gp_interpo_settings = bpy.props.PointerProperty(type=GP_PG_interpolate_settings)
|
|
|
|
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
for c in reversed(classes):
|
|
|
|
bpy.utils.unregister_class(c)
|
|
|
|
del bpy.types.Scene.gp_interpo_settings
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
register()
|