Download this Python file or just copy/paste the code below:
#Created by AnimatorsJourney.com
import maya.cmds as cmds
def toggle_joint_draw_style():
# Get all joints in the scene
joints = cmds.ls(type="joint")
# Toggle draw style for each joint
for joint in joints:
draw_style = cmds.getAttr(joint + ".drawStyle")
if draw_style == 2: # Joint draw style
cmds.setAttr(joint + ".drawStyle", 0) # None draw style
else:
cmds.setAttr(joint + ".drawStyle", 2) # Joint draw style
# Run the toggle function
toggle_joint_draw_style()