2026-02-16
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
bl_info = {
|
||||
"name": "AnimToolBox",
|
||||
"author": "Tal Hershkovich",
|
||||
"version" : (0, 0, 8),
|
||||
"version" : (0, 2, 3),
|
||||
"blender" : (3, 2, 0),
|
||||
"location": "View3D - Properties - Animation Panel",
|
||||
"description": "A set of animation tools",
|
||||
@@ -119,6 +119,11 @@ class TempCtrlsSceneSettings(bpy.types.PropertyGroup):
|
||||
add_ik_ctrl: bpy.props.BoolProperty(name = 'Add an Extra IK Ctrl Bone', description = "Adds an extra bone ctrl as the ik ctrl", default = False, update = TempCtrls.add_ik_prop)
|
||||
pole_target: bpy.props.BoolProperty(name = 'Add Pole Target', description = "Adding Pole Target to the IK Chain", default = True, update = TempCtrls.pole_prop)
|
||||
pole_offset: bpy.props.FloatProperty(name="Offset", description="Offset the bone in the axis direction", default=1.0, update = TempCtrls.pole_offset)
|
||||
pole_axis: bpy.props.EnumProperty(name = 'Axis Direction', description="Which direction should the pole bone point", default = 4, update = TempCtrls.update_axis_prop,
|
||||
items = [('+X', '+X','Target Bone the +X Axis', 0), ('+Y', '+Y', 'Target Bone the +Y Axis', 1),
|
||||
('-X', '-X','Target Bone the -X Axis', 2), ('-Y', '-Y', 'Target Bone the -Y Axis', 3),
|
||||
('AUTO', 'Auto','Select pole bone direction based on the current pose', 4)])
|
||||
|
||||
child: bpy.props.BoolProperty(name = 'Add extra child Ctrls', description = "Add an child control for an overlay control", default = False, update = TempCtrls.child_prop)
|
||||
orientation: bpy.props.BoolProperty(name = 'Use World Space Orientation', description = "Orient the bones to world space instead of to the original bones", default = True)
|
||||
|
||||
@@ -252,8 +257,9 @@ class AnimToolBoxGlobalSettings(bpy.types.PropertyGroup):
|
||||
#Copy/Pase Matrix
|
||||
range_type: bpy.props.EnumProperty(name = 'Paste to Frames', description="Paste to current frame or a range of frames.", update = Tools.bake_range_type,
|
||||
items = [('CURRENT', 'Current Frame','Paste Matrix to only current frame', 0),
|
||||
('SELECTED', 'Selected Keyframe','Paste Matrix to only selected keyframes', 1),
|
||||
('RANGE', 'Frame Range','Paste Matrix to a Frame Range', 2)])
|
||||
('SELECTED', 'Selected Keyframes','Paste Matrix only to the selected keyframes', 1),
|
||||
('RANGE', 'Frame Range','Paste Matrix to a Custom Frame Range', 2),
|
||||
('SELECTED_RANGE', 'Selected Keyframes Range','Paste Matrix to every frame within a selected keyframe range', 3)])
|
||||
bake_frame_start: bpy.props.IntProperty(name = "Bake Frame Start", description = "Define the start frame to paste the matrix", min = 0, update = Tools.bake_frame_start_limit)
|
||||
bake_frame_end: bpy.props.IntProperty(name = "Bake Frame End", description = "Define the end frame to paste the matrix", min = 0, update = Tools.bake_frame_end_limit)
|
||||
|
||||
@@ -298,6 +304,11 @@ class AnimToolBoxPreferences(bpy.types.AddonPreferences):
|
||||
mp_handle_selection_color: bpy.props.FloatVectorProperty(name="Handles Selection", subtype='COLOR', default=(0.8, 0.65, 0.6, 0.8), size=4, min=0.0, max=1.0, description="Handles selection color")
|
||||
mp_key_selection_color: bpy.props.FloatVectorProperty(name="Keyframe Selection", subtype='COLOR', default=(0.8, 0.8, 0.6, 0.8), size=4, min=0.0, max=1.0, description="Keyframe selection color")
|
||||
|
||||
# Motion Path brush colors
|
||||
mp_brush_disabled: bpy.props.FloatVectorProperty(name="Disabled", subtype='COLOR', default=(0.7, 0.7, 0.9, 0.75), size=4, min=0.0, max=1.0, description="Brush is disabled and have no influence")
|
||||
mp_brush_hover: bpy.props.FloatVectorProperty(name="Hover", subtype='COLOR', default=(0.8, 0.7, 0.2, 0.8), size=4, min=0.0, max=1.0, description="Brush is hovering and can be activated")
|
||||
mp_brush_active: bpy.props.FloatVectorProperty(name="Active", subtype='COLOR', default=(1.0, 1.0, 1.0, 0.9), size=4, min=0.0, max=1.0, description="Brush is activated")
|
||||
|
||||
# addon updater preferences from `__init__`, be sure to copy all of them
|
||||
auto_check_update: bpy.props.BoolProperty(
|
||||
name = "Auto-check for Update",
|
||||
@@ -371,6 +382,12 @@ class AnimToolBoxPreferences(bpy.types.AddonPreferences):
|
||||
row.prop(self, 'mp_hover_color')
|
||||
row.prop(self, 'mp_key_selection_color')
|
||||
row.prop(self, 'mp_handle_selection_color')
|
||||
col = box.row()
|
||||
col.label(text = 'Brush Colors')
|
||||
row = box.row()
|
||||
row.prop(self, 'mp_brush_disabled')
|
||||
row.prop(self, 'mp_brush_hover')
|
||||
row.prop(self, 'mp_brush_active')
|
||||
|
||||
layout.separator()
|
||||
col = layout.column()
|
||||
@@ -392,6 +409,8 @@ def loadanimtoolbox_pre(self, context):
|
||||
if 'mp_dh' in dns:
|
||||
bpy.types.SpaceView3D.draw_handler_remove(dns['mp_dh'], 'WINDOW')
|
||||
bpy.app.driver_namespace.pop('mp_dh')
|
||||
emp.remove_draw_circle()
|
||||
|
||||
bpy.context.scene.emp.selected_keyframes = '{}'
|
||||
|
||||
if 'markers_retimer_dh' in dns:
|
||||
@@ -401,20 +420,38 @@ def loadanimtoolbox_pre(self, context):
|
||||
#remove the motion path app handler if it's still inside
|
||||
if emp.mp_value_update in bpy.app.handlers.depsgraph_update_post:
|
||||
bpy.app.handlers.depsgraph_update_post.remove(emp.mp_value_update)
|
||||
if emp.mp_frame_change in bpy.app.handlers.frame_change_post:
|
||||
bpy.app.handlers.frame_change_post.remove(emp.mp_frame_change)
|
||||
if emp.mp_undo_update in bpy.app.handlers.undo_pre:
|
||||
bpy.app.handlers.undo_pre.remove(emp.mp_undo_update)
|
||||
|
||||
@persistent
|
||||
def loadanimtoolbox_post(self, context):
|
||||
scene = bpy.context.scene
|
||||
|
||||
def remove_markers(prop, marker_type, names):
|
||||
'''Remove Frame Range or Bake Range Markers if they were turned on'''
|
||||
if not getattr(prop, marker_type):
|
||||
return
|
||||
setattr(prop, marker_type, False)
|
||||
for marker_name in names:
|
||||
if marker_name in scene.timeline_markers:
|
||||
scene.timeline_markers.remove(scene.timeline_markers[marker_name])
|
||||
|
||||
dns = bpy.app.driver_namespace
|
||||
if scene.animtoolbox.isolate_pose_mode:
|
||||
if Display.isolate_pose_mode not in bpy.app.handlers.depsgraph_update_pre:
|
||||
bpy.app.handlers.depsgraph_update_pre.append(Display.isolate_pose_mode)
|
||||
|
||||
if scene.emp.motion_path:
|
||||
# In case motion path was active in the last save, make sure atb mp name property
|
||||
# Is not included inside the bones, for a proper cleanup
|
||||
for obj in bpy.context.view_layer.objects:
|
||||
if "atb_mp_name" in obj:
|
||||
del obj["atb_mp_name"]
|
||||
if obj.type == 'ARMATURE':
|
||||
for pbone in obj.pose.bones:
|
||||
if "atb_mp_name" in pbone:
|
||||
del pbone["atb_mp_name"]
|
||||
|
||||
scene.emp.motion_path = False
|
||||
bpy.context.workspace.status_text_set(None)
|
||||
if 'mp_dh' in dns:
|
||||
@@ -424,6 +461,10 @@ def loadanimtoolbox_post(self, context):
|
||||
# Because it is used for undo
|
||||
bpy.context.scene.emp.selected_keyframes = '{}'
|
||||
|
||||
remove_markers(scene.animtoolbox, 'marker_frame_range', {'Frame Start', 'Frame End'})
|
||||
remove_markers(scene.animtoolbox, 'bake_frame_range', {'Bake Start', 'Bake End'})
|
||||
remove_markers(scene.emp, 'marker_frame_range', {'MotionPath Start', 'MotionPath End'})
|
||||
|
||||
Tools.selection_order(self, context)
|
||||
|
||||
classes = (TempCtrlsItems, TempCtrlsOrgIds, TempCtrlsObjectSetups, TempCtrlsSceneSettings,TempCtrlsBoneSettings, MultikeyProperties,
|
||||
|
||||
Reference in New Issue
Block a user