<s> """<STR_LIT>""" <EOL> __version__ = "<STR_LIT>" <EOL> import pymel . core as pm <EOL> def UI ( ) : <EOL> """<STR_LIT>""" <EOL> window_width = <NUM_LIT> <EOL> window_height = <NUM_LIT> <EOL> window_name = "<STR_LIT>" <EOL> if pm . window ( window_name , ex = True ) : <EOL> pm . deleteUI ( window_name , window = True ) <EOL> window = pm . window ( <EOL> window_name , <EOL> tlb = True , <EOL> title = "<STR_LIT>" + __version__ , <EOL> widthHeight = ( window_width , window_height ) <EOL> ) <EOL> pm . columnLayout ( "<STR_LIT>" , adj = True ) <EOL> pm . checkBox ( <EOL> "<STR_LIT>" , <EOL> l = "<STR_LIT>" , <EOL> al = "<STR_LIT:left>" , <EOL> v = <NUM_LIT:1> <EOL> ) <EOL> pm . checkBox ( <EOL> "<STR_LIT>" , <EOL> l = "<STR_LIT>" , <EOL> al = "<STR_LIT:left>" <EOL> ) <EOL> pm . button ( <EOL> "<STR_LIT>" , <EOL> l = "<STR_LIT>" , <EOL> c = get_check_box_states_and_run <EOL> ) <EOL> pm . setParent ( ) <EOL> window . show ( ) <EOL> window . setWidthHeight ( val = ( window_width , window_height ) ) <EOL> def get_check_box_states_and_run ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> freeze = pm . checkBox ( "<STR_LIT>" , q = True , v = True ) <EOL> apply_to_children = pm . checkBox ( "<STR_LIT>" , q = True , v = True ) <EOL> selection_list = pm . ls ( sl = <NUM_LIT:1> , type = "<STR_LIT>" ) <EOL> do_fix ( selection_list , freeze , apply_to_children ) <EOL> pm . select ( selection_list ) <EOL> def do_fix ( joints , freeze = True , apply_to_children = False ) : <EOL> """<STR_LIT>""" <EOL> new_selection_list = joints <EOL> if apply_to_children : <EOL> pm . select ( joints , hi = True ) <EOL> new_selection_list = pm . ls ( sl = <NUM_LIT:1> , type = "<STR_LIT>" ) <EOL> for joint in new_selection_list : <EOL> connections = joint . worldMatrix . outputs ( <EOL> c = <NUM_LIT:1> , <EOL> p = <NUM_LIT:1> , <EOL> t = "<STR_LIT>" , <EOL> et = True <EOL> ) <EOL> if freeze : <EOL> freeze_joint ( joint ) <EOL> matrix = joint . worldInverseMatrix . get ( ) <EOL> for attribute_data in connections : <EOL> skinCluster_attribute = attribute_data [ <NUM_LIT:1> ] <EOL> skinCluster_node = skinCluster_attribute . node ( ) <EOL> index = skinCluster_attribute . index ( ) <EOL> skinCluster_node . bindPreMatrix [ index ] . set ( matrix ) <EOL> def freeze_joint ( joint ) : <EOL> """<STR_LIT>""" <EOL> dup_joint = pm . duplicate ( joint , rc = <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> pm . delete ( dup_joint . getChildren ( ) ) <EOL> dup_joint . rotateX . unlock ( ) <EOL> dup_joint . rotateY . unlock ( ) <EOL> dup_joint . rotateZ . unlock ( ) <EOL> pm . makeIdentity ( dup_joint , apply = <NUM_LIT:1> , r = <NUM_LIT:1> ) <EOL> if not joint . rotateX . isLocked ( ) : <EOL> joint . rotateX . set ( <NUM_LIT:0> ) <EOL> else : <EOL> joint . rotateX . unlock ( ) <EOL> joint . rotateX . set ( <NUM_LIT:0> ) <EOL> joint . rotateX . lock ( ) <EOL> if not joint . rotateY . isLocked ( ) : <EOL> joint . rotateY . set ( <NUM_LIT:0> ) <EOL> else : <EOL> joint . rotateY . unlock ( ) <EOL> joint . rotateY . set ( <NUM_LIT:0> ) <EOL> joint . rotateY . lock ( ) <EOL> if not joint . rotateZ . isLocked ( ) : <EOL> joint . rotateZ . set ( <NUM_LIT:0> ) <EOL> else : <EOL> joint . rotateZ . unlock ( ) <EOL> joint . rotateZ . set ( <NUM_LIT:0> ) <EOL> joint . rotateZ . lock ( ) <EOL> joint . jointOrient . set ( dup_joint . jointOrient . get ( ) ) <EOL> pm . delete ( dup_joint ) </s>
