Re: fixing normalised envelope weights.
| Date : Mon, 02 Oct 2006 14:11:45 +0200 |
| To : XSI(at)Softimage.COM |
| From : Juan Lara <j.lara(at)bren.es> |
| Subject : Re: fixing normalised envelope weights. |
|
Hi, You try it with this other script. Juan Lara. VBScript: ' option explicit NormalizeWeight Sub NormalizeWeight() Dim oEnvelope Dim oDeformer, oDeformers Dim aWeights Dim oSkin, oSkins Dim oDeformWeight() logmessage "NormalizeWeights" selectChildNodes set oSkins = getValue("SelectionList") for each oSkin in oSkins LogMessage "Comprobando pesos de " & oSkin if (oSkin.envelopes.count<>0) then set oEnvelope = oSkin.envelopes(0) set oDeformers = oEnvelope.Deformers ReDim oDeformWeight(oDeformers.count) aWeights = oEnvelope.Weights.Array Dim iPnt, iDeformer, ContadorPnt Dim Contador, Total, Subtotal for iPnt = LBound(aWeights,2) to ubound(aWeights, 2) ContadorPnt = ContadorPnt + 1 Total = 0 Contador = 0 'BProgreso 1, oSkin.ActivePrimitive.Geometry.Points.Count, ContadorPnt ' Compruebo el total del peso ' Pongo a cero los pesos negativos y redondeo a un decimal For iDeformer=0 to oDeformers.Count-1 if aWeights(iDeformer, iPnt) < 0.1 then aWeights(iDeformer, iPnt) = 0 aWeights(iDeformer, iPnt) = Round(aWeights(iDeformer, iPnt),1) Next ' Sumo los pesos de todos los deformadores For iDeformer=0 to oDeformers.Count-1 Total = total + aWeights(iDeformer, iPnt) Next ' Guardo los deformadores que llevan el peso If Total <> 100 Then For iDeformer=0 to oDeformers.Count-1 If aWeights(iDeformer, iPnt) > 0 Then oDeformWeight(Contador)= iDeformer Contador = Contador + 1 End If Next if Total > 0 then ' Normalizo la Matriz de Pesos Subtotal = Round(((100 - Total) / Contador),1) For iDeformer = 0 to Contador - 1 aWeights(oDeformWeight(iDeformer),iPnt)= aWeights(oDeformWeight(iDeformer),iPnt) + SubTotal Next Total = 0 For iDeformer=0 to oDeformers.Count-1 Total = total + aWeights(iDeformer, iPnt) Next if total <> 100 then Subtotal = 100 - total aWeights(oDeformWeight(0),iPnt)= aWeights(oDeformWeight(0),iPnt) + SubTotal end if end if End If Next oEnvelope.Weights.Array = aWeights end if next End sub Sub BProgreso (Inicio, Total, Parcial) Dim SubTotal, i, Texto SubTotal = Round((((Total-Inicio) - (Total-Parcial))*100)/(Total-Inicio)) For i = 0 to (Subtotal / 4) Texto = Texto & ">" Next LogMessage "OK " & Texto & Subtotal & "% " End Sub '*********************************************************************************** Matt Lowery wrote:
--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi |
- References:
- RE: fixing normalised envelope weights.
- From: "Matt Lowery" <matt(at)3dcharacter.co.za>
- RE: fixing normalised envelope weights.
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: UV toolset
- Next by Date: Re: UV toolset
- Previous by Thread: Re: UV toolset
- Next by Thread: Re: UV toolset
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |