disable (currently unused) addons, update

This commit is contained in:
Nathan
2026-07-16 12:41:53 -06:00
parent e3310263f3
commit 0f26db3345
76 changed files with 19896 additions and 6197 deletions
+45 -11
View File
@@ -574,7 +574,12 @@ def cursor_change_post(self, context):
new_matrices = [bone.matrix.copy() for bone in context.selected_pose_bones]
elif context.selected_objects:
new_matrices = [obj.matrix_world.copy() for obj in context.selected_objects]
else:
return
if 'last_matrices' not in globals():
last_matrices = []
#checking if the selection was moving and have different matrix
if last_matrices != new_matrices:
update_cursor_matrix(context)
@@ -606,7 +611,7 @@ def cursor_change_pre(self, context):
return
item = selected_items[0]
if 'relative_cursor' in item:
if 'relative_cursor' in item.animtoolbox:
update_cursor_matrix(context)
else:
assign_relative_cursor_prop(context)
@@ -639,7 +644,11 @@ def update_cursor_matrix(context):
else:
item = context.object
selected_items = context.selected_objects
# No Matrix All zeros
if not any (item.animtoolbox.relative_cursor):
return
# for bone in selected_bones:
if len(selected_items) > 1:
#multiple selection cursor is relative to the center of all the selections
@@ -651,11 +660,12 @@ def update_cursor_matrix(context):
item_matrix = item.matrix_world
if bpy.app.version < (5, 0, 0):
relative_matrix = Matrix(item['relative_cursor'])
matrix_4x4 = item.animtoolbox.relative_cursor
else:
# Since Blender 5 I need to reshape the array into a matrix using numpy
matrix_4x4 = np.array(item['relative_cursor']).reshape(4, 4).T
relative_matrix = Matrix(matrix_4x4)
matrix_4x4 = np.array(item.animtoolbox.relative_cursor).reshape(4, 4).T
relative_matrix = Matrix(matrix_4x4)
cursor.matrix = item_matrix @ relative_matrix.inverted()
cursor_matrix = cursor.matrix
@@ -681,8 +691,11 @@ def assign_relative_matrix(context, items, prop = 'relative_cursor'):
item_matrix = matrix_avg if len(items) > 1 else item_matrix
matrix_dist = cursor_matrix.inverted() @ item_matrix
item[prop] = matrix_dist
# item[prop] = matrix_dist
# Storing the matrix in a non animated float vector property instead of ID property
item.animtoolbox.relative_cursor = np.array(matrix_dist.transposed()).flatten() # [v for row in matrix_dist for v in row] #
return matrix_dist
def assign_relative_cursor_prop(context):
@@ -751,7 +764,7 @@ class RelativeCursor(bpy.types.Operator):
if items:
#if it's a single selection and already has a cursor assigned then don't re-assign
if len(items) != 1 or 'relative_cursor' not in items[0]:
if len(items) != 1 or not hasattr (items[0].animtoolbox, 'relative_cursor' ):
assign_relative_cursor_prop(context)
#appending all the handlers
@@ -1520,10 +1533,20 @@ def compatible_rotation(bone, bones_prevrot):
'''Make sure the bone is not flipping and is compatible with previous frame rotation'''
rotation_channel = rot_mode_to_channel(bone.rotation_mode)
if bone in bones_prevrot:
rot = getattr(bone, rotation_channel)
rot.make_compatible(bones_prevrot[bone])
bones_prevrot[bone] = getattr(bone, rotation_channel).copy()
# def compatible_matrix_rotation(prev_matrix, new_matrix):
# '''Make sure the bone is not flipping and is compatible with previous frame rotation'''
# prev_loc, prev_rot, prev_scale = prev_matrix.decompose()
# loc, rot, scale = new_matrix.decompose()
# rot.make_compatible(prev_rot)
# new_matrix = Matrix.LocRotScale(loc, rot, scale)
# return new_matrix
class CopyMatrix(bpy.types.Operator):
"""Copy the matrix of the selection and store it"""
bl_idname = "anim.copy_matrix"
@@ -1771,7 +1794,7 @@ class CopyRelativeMatrix(bpy.types.Operator):
def paste_keyframes_get_inbetweens(scene, target, inbetweens, frame, frame_range, fcu_inbetweens, locked_fcus, bones_prevrot):
#Make sure the rotation is compatible with the previous rotation
compatible_rotation(target, bones_prevrot)
# compatible_rotation(target, bones_prevrot)
#if autokey is turned on then add a keyframe
if (scene.tool_settings.use_keyframe_insert_auto or scene.animtoolbox.range_type != 'CURRENT') and 'target' in locals():
@@ -1885,6 +1908,7 @@ def paste_bone_matrix(bone, matrix_copied, constrained, bones = {}, x_filter = T
context = bpy.context
if x_filter : matrix_copied = filter_matrix_properties(context, getattr(bone, matrix_attr), matrix_copied)
# bone.matrix = bone.id_data.matrix_world.inverted() @ matrix_copied
# matrix_copied = compatible_matrix_rotation(getattr(bone, matrix_attr), matrix_copied)
setattr(bone, matrix_attr, matrix_copied) # bone.id_data.matrix_world.inverted() @
children = set(bone.children_recursive).intersection(bones)
@@ -1898,6 +1922,7 @@ def paste_bone_matrix(bone, matrix_copied, constrained, bones = {}, x_filter = T
matrix_copied = reverse_bone_constraints(context, bone, matrix_copied)
if x_filter : matrix_copied = filter_matrix_properties(context, bone.matrix, matrix_copied)
# bone.matrix = matrix_copied
setattr(bone, matrix_attr, matrix_copied)
#important to have the extra update
context.view_layer.update()
@@ -1907,8 +1932,16 @@ def paste_bones_matrices(bones_matrices, constrained, x_filter = True):
pasted_bones = set()
for bone, matrix_copied in bones_matrices.items():
#Get the rest of the bones to check if they are children of the current bone
old_rot = bone.rotation_quaternion.copy()
bones = set(bones_matrices.keys()).difference(pasted_bones)
paste_bone_matrix(bone, matrix_copied, constrained, bones, x_filter)
# Make sure rotation difference is compatible, no flipping
new_rot = bone.rotation_quaternion.copy()
new_rot.make_compatible(old_rot)
bone.rotation_quaternion = new_rot
pasted_bones.add(bone)
class PasteRelativeMatrix(bpy.types.Operator):
@@ -1986,6 +2019,8 @@ class PasteRelativeMatrix(bpy.types.Operator):
rig_offset = rig_offset @ source_rig.matrix_world
matrix_new = rig_offset @ matrix_source @ bone_matrix_dist
# matrix_new = compatible_matrix_rotation(matrix_source, matrix_new)
#Store the matrices for each bone that will use it
matrix_new = reverse_childof_constraint(bone, matrix_new, constrained)
@@ -2126,7 +2161,7 @@ def get_fcurves_frames(selection, fcurves, all_fcurves, frames, attr_index):
# transformations = ["rotation_quaternion","rotation_euler", "rotation_axis_angle", "location", "scale"]
for fcu in fcurves:
# print('fcu ', fcu)
if not bone_paths and not fcu.data_path.startswith('pose.bones'):
#in case it's just an object or data
all_fcurves.append(fcu)
@@ -2251,7 +2286,6 @@ class ShareKeys(bpy.types.Operator):
if obj.type in actions_data_types:
action_data = self.add_get_action(obj.data)
# print('udating objfcurves animation data')
obj_fcurves.update({obj.data: [fcu for fcu in all_fcurves if fcu.id_data == action_data]})
obj_fcurves[obj.data] = sharekeys_add_missing_fcurves(obj.data, attr_index_obj, obj_fcurves[obj.data])