You don't need to use *Smooth* btw, *Add* 0% influence works just fine --
not that there's a difference, but just pointing it out.

Here's the Python snippet I use for normalizing my weights. You can select
meshes or envelope ops, or a mix of both:

Application.OpenUndo("Normalize envelope(s)")
frz = []for obj in Application.Selection:

    if obj.Type == 'envelopop':
        envelopes = [obj,]
        obj = obj.Parent3DObject
    else:
        envelopes = obj.Envelopes

    for env in envelopes:
        envCls = (p.Target2 for p in env.InputPorts \
            if p.Target2.Type == "envweights").next()

        # Add 0% influence for the first deformer.
        Application.SIModifyFlexEnvWght(
            envCls.FullName,
            env.Deformers(0).Name,
            obj.FullName+".pnt[*]",
            2, 0.0)

        # Find construction history and freeze any relevant ops:
        frz.extend([x for x in envCls.NestedObjects \
            if Application.ClassName(x) == 'Operator' and \
            x.Type == 'ModifyEnvWghtPropOp'])
if frz:
    Application.FreezeObj(frz)

Application.CloseUndo()





On Thu, Jun 20, 2013 at 1:54 PM, Matt Lind <[email protected]> wrote:

> Those specs sound eerily familiar ;-)****
>
> ** **
>
> I had to write a command to clamp the weights on our envelopes as a final
> step before exporting to our engine.  The only problem I ran into was
> Softimage insisting on modifying whatever data I insert into the envelope
> by a very small amount – enough to cause vertices to be flagged as being
> underweighted.  I had to add code to work around that problem by forcing a
> smooth with 0% influence.****
>
> ** **
>
> I cannot share the tool as it belongs to my employer.****
>
> ** **
>
> ** **
>
> Matt****
>
> ** **
>
> ** **
>
> ** **
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Jonny Grew
> *Sent:* Thursday, June 20, 2013 8:48 AM
> *To:* [email protected]
>
> *Subject:* Limiting deformer weights per vertex****
>
> ** **
>
> I'm working on a job that delivers an enveloped mesh for use with an
> online gaming engine. ****
>
> There's a list of specs that need to be considered... ie polygon count,
> number of envelope deformers etc.****
>
> ** **
>
> One of these limitations is that there can not be anymore than *4
> deformer weights per point*.  Does anyone know of a way of limiting this
> or a script that might remove all but 4 of the weights with the most
> influence on a point?! Smoothing the weights has a lovely result but could
> leave me with a very laborious task should I need to go through point by
> point over half the mesh before I mirror the weights. ****
>
> ** **
>
> Cheers****
>

Reply via email to