I have an armature that has some bones with custom properties that I don't need. The fact that the armature has a lot of bones and that there a separate properties for edit and pose mode, it would be very difficult to do this manually. Is there any way I can delete all these custom properties all at once?
Asked
Active
Viewed 652 times
0
-
With a Python script, you should be able to get rid of the custom properties. You just need to store the properties in a variable before you delete them in a loop, Have a look here: https://blender.stackexchange.com/a/253047/107598 – Blunder Oct 06 '22 at 20:05
-
Sorry, but I'm gonna need a bit more of a walkthrough for this. I have no idea how to work with python. – Ethan Oct 10 '22 at 02:22
1 Answers
1
Try the following script. It removes all custom properties that you can define in Edit and in Pose mode of all bones of the selected armature.
How to run a script is described here.
import bpy
def ShowMessageBox(message = "", title = "Message Box", icon = 'INFO'):
def draw(self, context):
self.layout.label(text=message)
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
arm = bpy.context.active_object
if arm.type == 'ARMATURE':
n = 0
for bone in arm.data.bones: # Iterate over all bones
props = [*bone.keys()] # Retrieve custom props names
for prop in props:
print(f"deleting BONE property {prop}")
n += 1
del bone[prop]
for bone in arm.pose.bones: # Iterate over all bones
props = [*bone.keys()] # Retrieve custom props names
for prop in props:
print(f"deleting POSE BONE property {prop}")
n += 1
del bone[prop]
ShowMessageBox(f"deleted {n} custom properties", "INFO", 'INFO')
else:
ShowMessageBox("Please select an armature!", "ERROR", 'ERROR')
Blunder
- 13,925
- 4
- 13
- 36