Newer
Older
description = "Remove shape key objects after assigning to target", \
default = True)
space : EnumProperty(name = "Space", \
items = [('worldspace', 'World Space', 'worldspace'),
('localspace', 'Local Space', 'localspace')], \
description = 'Space that shape keys are evluated in')
Shrinivas Kulkarni
committed
alignCos : EnumProperty(name="Vertex Alignment", items = \
[("-None-", 'Manual Alignment', "Align curve segments based on starting vertex"), \
('vertCo', 'Vertex Coordinates', 'Align curve segments based on vertex coordinates')], \
description = 'Start aligning the vertices of target and shape keys from',
default = '-None-')
alignVal1 : EnumProperty(name="Value 1",
Shrinivas Kulkarni
committed
items = alignList, default = 'minX', description='First align criterion')
alignVal2 : EnumProperty(name="Value 2",
Shrinivas Kulkarni
committed
items = alignList, default = 'maxY', description='Second align criterion')
alignVal3 : EnumProperty(name="Value 3",
Shrinivas Kulkarni
committed
items = alignList, default = 'minZ', description='Third align criterion')
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
matchParts : EnumProperty(name="Match Parts", items = \
[("-None-", 'None', "Don't match parts"), \
('default', 'Default', 'Use part (spline) order as in curve'), \
('custom', 'Custom', 'Use one of the custom criteria for part matching')], \
description='Match disconnected parts', default = 'default')
matchCri1 : EnumProperty(name="Value 1",
items = matchList, default = 'minX', description='First match criterion')
matchCri2 : EnumProperty(name="Value 2",
items = matchList, default = 'maxY', description='Second match criterion')
matchCri3 : EnumProperty(name="Value 3",
items = matchList, default = 'minZ', description='Third match criterion')
markVertex : BoolProperty(name="Mark Starting Vertices", \
description='Mark first vertices in all splines of selected curves', \
default = False, update = markVertHandler)
Shrinivas Kulkarni
committed
class AssignShapeKeysPanel(Panel):
bl_label = "Curve Shape Keys"
bl_idname = "CURVE_PT_assign_shape_keys"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Edit"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return context.mode in {'OBJECT', 'EDIT_CURVE'}
def draw(self, context):
layout = self.layout
layout.label(text='Morph Curves:')
col = layout.column()
params = context.window_manager.AssignShapeKeyParams
if(context.mode == 'OBJECT'):
row = col.row()
row.prop(params, "removeOriginal")
row = col.row()
row.prop(params, "space")
row = col.row()
Shrinivas Kulkarni
committed
row.prop(params, "alignCos")
Shrinivas Kulkarni
committed
if(params.alignCos == 'vertCo'):
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
row = col.row()
row.prop(params, "alignVal1")
row.prop(params, "alignVal2")
row.prop(params, "alignVal3")
row = col.row()
row.prop(params, "matchParts")
if(params.matchParts == 'custom'):
row = col.row()
row.prop(params, "matchCri1")
row.prop(params, "matchCri2")
row.prop(params, "matchCri3")
row = col.row()
row.operator("object.assign_shape_keys")
else:
col.prop(params, "markVertex", \
toggle = True)
Shrinivas Kulkarni
committed
def updatePanel(self, context):
try:
panel = AssignShapeKeysPanel
if "bl_rna" in panel.__dict__:
bpy.utils.unregister_class(panel)
panel.bl_category = context.preferences.addons[__name__].preferences.category
bpy.utils.register_class(panel)
except Exception as e:
print("Assign Shape Keys: Updating Panel locations has failed", e)
class AssignShapeKeysPreferences(AddonPreferences):
bl_idname = __name__
category: StringProperty(
name = "Tab Category",
description = "Choose a name for the category of the panel",
default = "Edit",
Shrinivas Kulkarni
committed
update = updatePanel
)
def draw(self, context):
layout = self.layout
row = layout.row()
col = row.column()
col.label(text="Tab Category:")
col.prop(self, "category", text="")
# registering and menu integration
def register():
bpy.utils.register_class(AssignShapeKeysPanel)
bpy.utils.register_class(AssignShapeKeysOp)
bpy.utils.register_class(AssignShapeKeyParams)
bpy.types.WindowManager.AssignShapeKeyParams = \
bpy.props.PointerProperty(type=AssignShapeKeyParams)
bpy.utils.register_class(ModalMarkSegStartOp)
Shrinivas Kulkarni
committed
bpy.utils.register_class(AssignShapeKeysPreferences)
updatePanel(None, bpy.context)
def unregister():
bpy.utils.unregister_class(AssignShapeKeysOp)
bpy.utils.unregister_class(AssignShapeKeysPanel)
del bpy.types.WindowManager.AssignShapeKeyParams
bpy.utils.unregister_class(AssignShapeKeyParams)
bpy.utils.unregister_class(ModalMarkSegStartOp)
Shrinivas Kulkarni
committed
bpy.utils.unregister_class(AssignShapeKeysPreferences)
if __name__ == "__main__":
register()