Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- object = bpy.context.object
- current_object_mode = bpy.context.active_object.mode
- if object.type == 'ARMATURE':
- armature = object.data
- print(" " + object.name + " is selected. \n \n")
- inputted_keywords = input(" Keyword(s) to filter for resetting limit distance (case insensitive): ")
- print("\n Scanning... \n")
- keyword_array_items = inputted_keywords.split()
- number_of_keywords = len(keyword_array_items)
- bone_names = []
- matched_bone_names = []
- for b in armature.bones:
- current_bone = b.name
- bone_names.append(current_bone)
- if any(words in b.name.casefold() for words in keyword_array_items):
- print(current_bone)
- matched_bone_names.append(current_bone)
- bpy.ops.object.mode_set(mode='POSE')
- pose_bone = object.pose.bones[current_bone]
- has_constraint = getattr(pose_bone, "constraints")
- temp = has_constraint[0].name
- print(temp)
- intersecting_bones = set.intersection(set(bone_names), set(matched_bone_names))
- if intersecting_bones:
- print("\n Intersecting bones: ", format(intersecting_bones))
- elif not intersecting_bones:
- print("\n Sorry, nothing found.")
- bpy.ops.object.mode_set(mode = str(current_object_mode))
- print ("\n Number of filter words used: " + str(number_of_keywords) + "\n")
- elif object.type != 'ARMATURE':
- print ("This object is not an armature.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement