예제 #1
0
def gear_SelectUnnormalizedPoints_Execute():

    if not xsi.Selection.Count:
        gear.log("No selection", gear.sev_error)
        return

    mesh = xsi.Selection(0)

    # Check input
    if mesh.Type not in ["polymsh", "crvlist", "surfmsh"]:
        gear.log("Invalid selection", gear.sev_error)
        return

    # Get Envelope
    envelope_op = ope.getOperatorFromStack(mesh, "envelopop")
    if not envelope_op:
        gear.log("There's no envelope on " + mesh.Fullname, gear.sev_error)
        return

    unNormPntId = env.getUnnormalizedPoints(envelope_op)

    # Select Pnt
    if unNormPntId:
        gear.log("There is " + str(len(unNormPntId)) +" unnormalized point(s)")
        gear.log(mesh.FullName+".pnt"+str(unNormPntId))
        xsi.SelectGeometryComponents(mesh.FullName+".pnt"+str(unNormPntId))
    else:
        gear.log("There is no unnormalized point", gear.sev_warning)
예제 #2
0
def gear_NormalizeWeights_Execute():

    if not xsi.Selection.Count:
        gear.log("No selection", gear.sev_error)
        return

    sel = xsi.Selection(0)

    if sel.Type in ["polymsh", "surfmsh", "crvlist"]:
        mesh = sel
        points = range(mesh.ActivePrimitive.Geometry.Points.Count)
    elif sel.Type == "pntSubComponent":
        mesh = sel.SubComponent.Parent3DObject
        points = sel.SubComponent.ElementArray
    else:
        gear.log("Invalid selection", gear.sev_error)
        return

    # Get Envelope from object
    envelope_op = ope.getOperatorFromStack(mesh, "envelopop")
    if not envelope_op:
        gear.log("There is no envelope on selected mesh", gear.sev_error)
        return

    # Process
    points = env.getUnnormalizedPoints(envelope_op, points)
    if not env.normalizeWeights(envelope_op, points):
        return

    env.freezeEnvelope(envelope_op)
    env.rebuiltEnvelope(envelope_op)
예제 #3
0
def gear_NormalizeWeights_Execute():

    if not xsi.Selection.Count:
        gear.log("No selection", gear.sev_error)
        return

    sel = xsi.Selection(0)

    if sel.Type in ["polymsh", "surfmsh", "crvlist"]:
        mesh = sel
        points = range(mesh.ActivePrimitive.Geometry.Points.Count)
    elif sel.Type == "pntSubComponent":
        mesh = sel.SubComponent.Parent3DObject
        points = sel.SubComponent.ElementArray
    else:
        gear.log("Invalid selection", gear.sev_error)
        return

    # Get Envelope from object
    envelope_op = ope.getOperatorFromStack(mesh, "envelopop")
    if not envelope_op:
        gear.log("There is no envelope on selected mesh", gear.sev_error)
        return

    # Process
    points = env.getUnnormalizedPoints(envelope_op, points)
    if not env.normalizeWeights(envelope_op, points):
        return

    env.freezeEnvelope(envelope_op)
    env.rebuiltEnvelope(envelope_op)
예제 #4
0
def gear_SelectUnnormalizedPoints_Execute():

    if not xsi.Selection.Count:
        gear.log("No selection", gear.sev_error)
        return

    mesh = xsi.Selection(0)

    # Check input
    if mesh.Type not in ["polymsh", "crvlist", "surfmsh"]:
        gear.log("Invalid selection", gear.sev_error)
        return

    # Get Envelope
    envelope_op = ope.getOperatorFromStack(mesh, "envelopop")
    if not envelope_op:
        gear.log("There's no envelope on " + mesh.Fullname, gear.sev_error)
        return

    unNormPntId = env.getUnnormalizedPoints(envelope_op)

    # Select Pnt
    if unNormPntId:
        gear.log("There is " + str(len(unNormPntId)) +
                 " unnormalized point(s)")
        gear.log(mesh.FullName + ".pnt" + str(unNormPntId))
        xsi.SelectGeometryComponents(mesh.FullName + ".pnt" + str(unNormPntId))
    else:
        gear.log("There is no unnormalized point", gear.sev_warning)