| Code: |
| def PaintVertices(me, vertIndList, paintAmt, group):
if paintAmt >= 0.1: # Prevents float rounding errors and so forth from potentially troubling us; we refuse to paint anything under 10%. for vertInd in vertIndList: try: currentState = me.getVertsFromGroup(group, 1, [vertInd]) if currentState and currentState[0][1]: curPaint = currentState[0][1] else: curPaint = 0.0 except AttributeError: curPaint = 0.0 except RuntimeError: curPaint = 0.0 if not curPaint: me.assignVertsToGroup(group, [vertInd], paintAmt, AssignModes.ADD) #print "Newly painting vert {0:d} to {1:.1%}.".format(vertInd, paintAmt) elif paintAmt > curPaint: me.assignVertsToGroup(group, [vertInd], paintAmt, AssignModes.REPLACE) #print "Repainting vert {0:d} from {2:.1%} to {1:.1%}.".format(vertInd, paintAmt, curPaint) else: #print "Declining to paint vert {0:d} to {1:.1%}, since it's already at {2:.1%}.".format(vertInd, paintAmt, curPaint) pass |
| Code: |
|
def PaintVertices(ob, vertIndList, paintAmt, group): if paintAmt >= 0.1: for vertInd in vertIndList: try: currentState = ob.vertex_groups[group] if currentState.index == vertInd: if currentState and currentState[0][1]: curPaint = currentState[0][1] else: curPaint = 0.0 except AttributeError: curPaint = 0.0 except RuntimeError: curPaint = 0.0 if not curPaint: ob.vertex_groups[group].add([vertInd], paintAmt, type='ADD') elif paintAmt > curPaint: ob.vertex_groups[group].add([vertInd], paintAmt, type='REPLACE' ) else: pass |