gp_interpolate/interpolate_strokes/properties.py

103 lines
3.5 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),
('OBJECT', 'Object Geometry', 'Same as Geometry mode, but target only a specific object, even if occluded (ignore all the others)', 1),
('BONE', 'Bone', 'Pick an armature bone and follow it', 2),
('TRI', 'Triangle', 'Interpolate based on triangle traced manually over geometry', 3),
),
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')
remove_occluded : BoolProperty(name='Remove Occluded Points',
default=False,
description='Remove point when occluded by geometry (works best in animation mode)')
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 step options', 0),
('GPKEY', 'GP Key', 'prev/next Grease pencil key', 1) ,
('RIGKEY', 'Rig Key', 'prev/next armatures keys in targeted collection (camera keys are included)', 2),
),
default='FRAME',
description='Select how the previous or next frame should be chosen'
)
step : IntProperty(name='Step',
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 get armature keyframes\
\nNothing = every armature in sccene',
)
target_rig : PointerProperty(
name='Rig',
description='Rig to use as target',
type=bpy.types.Object)
target_object : PointerProperty(
name='Object',
description='Object to interpolate on',
type=bpy.types.Object)
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()