osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trying to connect the setarrange and blendshape input target weight while running the script am getting error in the 8th line. (for each in lip_val_list: )


lf_main_attr = "head_icon.Lf_Sticky_Lips" 
rt_main_attr = "head_icon.Rt_Sticky_Lips" 
lip_val_list = [18, 14] 
lip_name_list = ['upperLip', 'lowerLip']

name_counter = 0
 for each in lip_val_list: 
 half_val = (each / 2) + 1 
 total_val = each + 1 
 div_val = 10.0 / half_val 
 counter = 0 
 while(counter<half_val):
     lip_sr = pm.shadingNode( 'setRange', asUtility=True, n='lf_' + lip_name_list[name_counter] + str(counter+1) + '_setRange')
         pm.setAttr(lip_sr + '.oldMaxX', (div_val * (counter+1)))
         pm.setAttr(lip_sr + '.oldMinX', (div_val * counter))
         pm.setAttr(lip_sr + '.maxX', 0)
         pm.setAttr(lip_sr + '.minX', 1)
         if counter == (half_val - 1):
             pm.setAttr(lip_sr + '.minX', 0.5)
             pm.connectAttr(lf_main_attr, lip_sr + '.valueX', f=True)
       lip_flip_sr = pm.shadingNode( 'setRange', asUtility=True, n='lf_' + lip_name_list[name_counter] + '_flip' + str(counter+1) + '_setRange')
           pm.setAttr(lip_flip_sr + '.oldMaxX', 1)
           if counter == (half_val - 1):
               pm.setAttr(lip_flip_sr + '.oldMaxX', 0.5)
               pm.setAttr(lip_flip_sr + '.oldMinX', 0)
               pm.setAttr(lip_flip_sr + '.maxX', 0)
               pm.setAttr(lip_flip_sr + '.minX', 1)
               if counter == (half_val - 1):
                   pm.setAttr(lip_flip_sr + '.minX', 0.5)
                   pm.connectAttr(lip_sr + '.outValueX', lip_flip_sr + '.valueX', f=True)
                    if counter == (half_val - 1):
                        mid_pma = pm.shadingNode( 'plusMinusAverage', asUtility=True, n='ct_' + lip_name_list[name_counter] + str(counter+1) + '_plusMinusAverage')
                        pm.connectAttr(lip_sr + '.outValueX', mid_pma + '.input2D[0].input2Dx', f=True)
                        pm.connectAttr(lip_flip_sr + '.outValueX', mid_pma + '.input2D[0].input2Dy', f=True)
                        else:
                        pm.connectAttr(lip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(counter) + ']', f=True)
                        pm.connectAttr(lip_flip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(counter) + ']', f=True)
                        counter = counter + 1
                         #div_val = 10.0 / 39
                         counter = half_val - 1
                          rev_counter = half_val
                          while(counter<total_val):
                              lip_sr = pm.shadingNode( 'setRange', asUtility=True, n='rt_' + lip_name_list[name_counter] + str(counter+1) + '_setRange')
                              pm.setAttr(lip_sr + '.oldMaxX', (div_val * rev_counter))
                               pm.setAttr(lip_sr + '.oldMinX', (div_val * (rev_counter-1)))
                               pm.setAttr(lip_sr + '.maxX', 0)
                               pm.setAttr(lip_sr + '.minX', 1)
                               if counter == (half_val - 1):
                                   pm.setAttr(lip_sr + '.minX', 0.5)
                                   pm.connectAttr(rt_main_attr, lip_sr + '.valueX', f=True)
                                    lip_flip_sr = pm.shadingNode( 'setRange', asUtility=True, n='rt_' + lip_name_list[name_counter] + '_flip' + str(counter+1) + '_setRange')
                                     pm.setAttr(lip_flip_sr + '.oldMaxX', 1)
                                      if counter == (half_val - 1):
                                           pm.setAttr(lip_flip_sr + '.oldMaxX', 0.5)
                                           pm.setAttr(lip_flip_sr + '.oldMinX', 0)
                                           pm.setAttr(lip_flip_sr + '.maxX', 0)
                                           pm.setAttr(lip_flip_sr + '.minX', 1)
                                           if counter == (half_val - 1):
                                               pm.setAttr(lip_flip_sr + '.minX', 0.5)
                                               pm.connectAttr(lip_sr + '.outValueX', lip_flip_sr + '.valueX', f=True)
              if counter == (half_val - 1):
                  pm.connectAttr(lip_sr + '.outValueX', mid_pma + '.input2D[1].input2Dx', f=True)
                  pm.connectAttr(lip_flip_sr + '.outValueX', mid_pma + '.input2D[1].input2Dy', f=True)
                pm.connectAttr(mid_pma + '.output2Dx', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(counter) + ']', f=True)
                 pm.connectAttr(mid_pma + '.output2Dy', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(counter) + ']', f=True)
                  else:
                       pm.connectAttr(lip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(counter) + ']', f=True)
                       pm.connectAttr(lip_flip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(counter) + ']', f=True)
                       counter = counter + 1
                       rev_counter = rev_counter - 1
                        name_counter = name_counter + 1?