gp_interpolate/interpolate_strokes/properties.py

97 lines
3.0 KiB
Python

import bpy
from bpy.types import PropertyGroup
from bpy.props import (EnumProperty,
IntProperty,
FloatProperty,
BoolProperty,
PointerProperty,
StringProperty)
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'})
method : EnumProperty(
name='Method',
items= (
('GEOMETRY', 'Geometry', 'Directly follow underlying geometry', 0),
('BONE', 'Bone', 'Pick an armature bone and follow it', 1),
),
default='GEOMETRY',
description='Select method for interpolating strokes'
)
use_animation : BoolProperty(name='Animation',
default=False,
description='Apply the interpolation on the all keys forward or backward')
search_range : FloatProperty(
name="Search Range",
description="Search range size when points are out of mesh\
\nThe value is as percentage of the camera width",
default=0.05, precision=2, step=3, options={'HIDDEN'})
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(
name='Collection',
type=bpy.types.Collection,
description='Target collection to check armature keyframes from',
# placeholder='Collection'
)
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')
target_bone : StringProperty(
name='Bone',
description='Bone of the rig to follow when interpolating') # Bone
use_bone_rotation : BoolProperty(
name='Use Bone Rotation',
default=True,
description='Apply rotation of the bone') # Bone
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()