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: )

Gary Herron gherron at digipen.edu
Thu Sep 13 04:52:21 EDT 2018


Your indentation of that line is incorrect.

You also have indentation errors on lines 14 and 21.  (Possibly more, 
that's all the further I checked.)  Do you understand Python's 
indentation rules?


In the future, you can do a lot better to help us help you. First, tell 
us the error you got instead of just saying you got an error.  (Copy and 
paste the full error message.)  Also tell us what version of Python (2 
or 3), and what platform, in case any of that matters.   Your subject 
line contains lots of meaningless distractions:  What's a setarrange, 
what's a blendshape, what's an input target weight,  what does it mean 
to connect them?  Either none of that is important (as is the case in 
this simple indentation error), so don't include such distractions, or 
it does matter, so take the time to define those terms.


Gary Herron



On 09/13/2018 12:11 AM, christysonia at gmail.com wrote:
> 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
>                                
>                 
>        

-- 
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418




More information about the Python-list mailing list