Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
alignList : 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",
items = matchList, default = 'minX', description='First align criterion')
alignVal2 : EnumProperty(name="Value 2",
items = matchList, default = 'maxY', description='Second align criterion')
alignVal3 : EnumProperty(name="Value 3",
items = matchList, default = 'minZ', description='Third align criterion')
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 = "Assign Shape Keys"
bl_idname = "CURVE_PT_assign_shape_keys"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
Shrinivas Kulkarni
committed
bl_category = "Edit"
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
@classmethod
def poll(cls, context):
return context.mode in {'OBJECT', 'EDIT_CURVE'}
def draw(self, context):
layout = self.layout
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()
row.prop(params, "alignList")
if(params.alignList == 'vertCo'):
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
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
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",
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()