Re: scripting Weights

2016-03-10 Thread Martin
Thanks Alok, that's more or less what I'm doing. I have my weights array with 
rounded numbers but when I put them back to the envelope, they get converted 
into floating point approximations.

In Maya, the rounded weights get stored in the ma file, I'm not sure how Maya 
deal with that internally though, I'm guessing it's similar.

Martin
Sent from my iPhone

> On 2016/03/11, at 2:57, Alok Gandhi  wrote:
> 
> In previous such situations I successfully used the ceil to int and the then 
> covert back to float. But I think I used this to display some text on the 
> viewport slates. In your case it might not work but give it a try.
> 
> N = some float with long series of numbers after decimal that you need to 
> round off.
> 
> n =  floor to int N
> 
> d = number of digits you care after decimal 
> 
> N' = floor to int[ (N-n) * 10^ d]
> 
> Final Number rounded = n + (N' / 10^ d)
> 
> Try this.
> 
> Sent from my iPhone
> 
>> On 10-Mar-2016, at 9:21 PM, Martin Yara  wrote:
>> 
>> I see, so it isn't possible.
>> Sometimes our clients ask us to round the weights to certain digits.
>> 
>> So far they've never complained when I used this old tool (that I was trying 
>> to update), so I guess this should be good enough then.
>> 
>> Thanks.
>> 
>>> On Fri, Mar 11, 2016 at 12:45 AM, Luc-Eric Rousseau  
>>> wrote:
>>> 0.3 can't be expressed exactly in floating point numbers.
>>> It's possible through manipulation that you can get it to a number
>>> that the code that the function which prints the number happens to
>>> neatly truncate back 0.3, but the value isn't actually ever stored as
>>> 0.3.
>>> 
>>> http://www.exploringbinary.com/floating-point-converter/
>>> Select Single Precision. which is what the weight maps use.
>>> 
>>> The sliders in XSI just convert the number to text and then truncates
>>> at a fix number of decimal, hiding the issue from you/
>>> 
>>> On 7 March 2016 at 06:01, Martin Yara  wrote:
>>> > I wrote a tool to round weights decimals but I'm still having decimals.
>>> >
>>> > I get the weighs with :
>>> >
>>> > Obj.Envelopes(0).Weights.Array
>>> >
>>> > Round them and put them back with
>>> >
>>> > myEnvelope.Weights.Array = roundedWeights
>>> >
>>> > But when I check my weights after that I'm still having decimals like:
>>> > 0.30011920929
>>> > 14.198092651
>>> > 58
>>> > 27.5
>>> >
>>> > And my roundedWeights array is just like I want them:
>>> > 0.3
>>> > 14.2
>>> > 58
>>> > 27.5
>>> >
>>> > I successfully did it in Maya disabling the Normalize property, but I 
>>> > can't
>>> > get it to work in Softimage. Is there any way to do this?
>>> >
>>> > Thanks
>>> >
>>> > Martin
>>> >
>>> > --
>>> > Softimage Mailing List.
>>> > To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com 
>>> > with
>>> > "unsubscribe" in the subject, and reply to confirm.
>>> --
>>> Softimage Mailing List.
>>> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
>>> "unsubscribe" in the subject, and reply to confirm.
>> 
>> --
>> Softimage Mailing List.
>> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
>> "unsubscribe" in the subject, and reply to confirm.
> --
> Softimage Mailing List.
> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
> "unsubscribe" in the subject, and reply to confirm.
--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Re: scripting Weights

2016-03-10 Thread Martin Yara
I see, so it isn't possible.
Sometimes our clients ask us to round the weights to certain digits.

So far they've never complained when I used this old tool (that I was
trying to update), so I guess this should be good enough then.

Thanks.

On Fri, Mar 11, 2016 at 12:45 AM, Luc-Eric Rousseau 
wrote:

> 0.3 can't be expressed exactly in floating point numbers.
> It's possible through manipulation that you can get it to a number
> that the code that the function which prints the number happens to
> neatly truncate back 0.3, but the value isn't actually ever stored as
> 0.3.
>
> http://www.exploringbinary.com/floating-point-converter/
> Select Single Precision. which is what the weight maps use.
>
> The sliders in XSI just convert the number to text and then truncates
> at a fix number of decimal, hiding the issue from you/
>
> On 7 March 2016 at 06:01, Martin Yara  wrote:
> > I wrote a tool to round weights decimals but I'm still having decimals.
> >
> > I get the weighs with :
> >
> > Obj.Envelopes(0).Weights.Array
> >
> > Round them and put them back with
> >
> > myEnvelope.Weights.Array = roundedWeights
> >
> > But when I check my weights after that I'm still having decimals like:
> > 0.30011920929
> > 14.198092651
> > 58
> > 27.5
> >
> > And my roundedWeights array is just like I want them:
> > 0.3
> > 14.2
> > 58
> > 27.5
> >
> > I successfully did it in Maya disabling the Normalize property, but I
> can't
> > get it to work in Softimage. Is there any way to do this?
> >
> > Thanks
> >
> > Martin
> >
> > --
> > Softimage Mailing List.
> > To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com
> with
> > "unsubscribe" in the subject, and reply to confirm.
> --
> Softimage Mailing List.
> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com
> with "unsubscribe" in the subject, and reply to confirm.
>
--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Re: scripting Weights

2016-03-10 Thread Luc-Eric Rousseau
0.3 can't be expressed exactly in floating point numbers.
It's possible through manipulation that you can get it to a number
that the code that the function which prints the number happens to
neatly truncate back 0.3, but the value isn't actually ever stored as
0.3.

http://www.exploringbinary.com/floating-point-converter/
Select Single Precision. which is what the weight maps use.

The sliders in XSI just convert the number to text and then truncates
at a fix number of decimal, hiding the issue from you/

On 7 March 2016 at 06:01, Martin Yara  wrote:
> I wrote a tool to round weights decimals but I'm still having decimals.
>
> I get the weighs with :
>
> Obj.Envelopes(0).Weights.Array
>
> Round them and put them back with
>
> myEnvelope.Weights.Array = roundedWeights
>
> But when I check my weights after that I'm still having decimals like:
> 0.30011920929
> 14.198092651
> 58
> 27.5
>
> And my roundedWeights array is just like I want them:
> 0.3
> 14.2
> 58
> 27.5
>
> I successfully did it in Maya disabling the Normalize property, but I can't
> get it to work in Softimage. Is there any way to do this?
>
> Thanks
>
> Martin
>
> --
> Softimage Mailing List.
> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with
> "unsubscribe" in the subject, and reply to confirm.
--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.


Re: scripting Weights

2016-03-08 Thread Matt Lind
Don't freeze the envelope weights property until after you've kicked it with 
SIModifyFlexEnvWght().

Matt



Date: Mon, 7 Mar 2016 21:11:47 +0900
From: Martin Yara <furik...@gmail.com>
Subject: Re: scripting Weights
To: "softimage@listproc.autodesk.com"
<softimage@listproc.autodesk.com>

Hi Matt,
thanks for your response.

That trick didn't work for me.

I'm using 2014 and VBScript.

I'm doing something like this:

set myEnvelope = oObj.Envelopes.Item(0)
aWeights = myEnvelope.Weights.Array

' Round Weights in aWeights

myEnvelope.Weights.Array = aWeights
FreezeObj envelopeProperty

for each def in myEnvelope.Deformers
SIModifyFlexEnvWght envelopeProperty, def.name, oObj+ ".pnt[*]", 2,
0, False
next

But the weights are still the same.
Am I doing it wrong?

Martin 

--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.


Re: scripting Weights

2016-03-07 Thread Martin Yara
Hi Matt,
thanks for your response.

That trick didn't work for me.

I'm using 2014 and VBScript.

I'm doing something like this:

set myEnvelope = oObj.Envelopes.Item(0)
aWeights = myEnvelope.Weights.Array

' Round Weights in aWeights

myEnvelope.Weights.Array = aWeights
FreezeObj envelopeProperty

for each def in myEnvelope.Deformers
SIModifyFlexEnvWght envelopeProperty, def.name, oObj+ ".pnt[*]", 2,
0, False
next

But the weights are still the same.
Am I doing it wrong?

Martin


On Mon, Mar 7, 2016 at 8:12 PM, Matt Lind <speye...@hotmail.com> wrote:

> You've uncovered a known bug that exists in the last several versions of
> Softimage.  At least 2012 and later.
>
> You have to make a 2nd pass over the weights by iterating over the
> deformers
> and calling SIModifyFlexEnvWght() and add 0% weight value.  This will kick
> Softimage to wake up and honor the values you set.
>
>
> Matt
>
>
>
>
> Date: Mon, 7 Mar 2016 20:01:47 +0900
> From: Martin Yara <furik...@gmail.com>
> Subject: scripting Weights
> To: "softimage@listproc.autodesk.com"
> <softimage@listproc.autodesk.com>
> Message-ID:
> <caexmsffu6mzcjagtdrifnkfeopf-0e4dv_ypz4bctxgdue_...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I wrote a tool to round weights decimals but I'm still having decimals.
>
> I get the weighs with :
>
> Obj.Envelopes(0).Weights.Array
>
> Round them and put them back with
>
> myEnvelope.Weights.Array = roundedWeights
>
> But when I check my weights after that I'm still having decimals like:
> 0.30011920929
> 14.198092651
> 58
> 27.5
>
> And my roundedWeights array is just like I want them:
> 0.3
> 14.2
> 58
> 27.5
>
> I successfully did it in Maya disabling the Normalize property, but I can't
> get it to work in Softimage. Is there any way to do this?
>
> Thanks
>
> Martin
>
> --
> Softimage Mailing List.
> To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com
> with "unsubscribe" in the subject, and reply to confirm.
>
--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Re: scripting Weights

2016-03-07 Thread Matt Lind
You've uncovered a known bug that exists in the last several versions of 
Softimage.  At least 2012 and later.

You have to make a 2nd pass over the weights by iterating over the deformers 
and calling SIModifyFlexEnvWght() and add 0% weight value.  This will kick 
Softimage to wake up and honor the values you set.


Matt




Date: Mon, 7 Mar 2016 20:01:47 +0900
From: Martin Yara <furik...@gmail.com>
Subject: scripting Weights
To: "softimage@listproc.autodesk.com"
<softimage@listproc.autodesk.com>
Message-ID:
<caexmsffu6mzcjagtdrifnkfeopf-0e4dv_ypz4bctxgdue_...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I wrote a tool to round weights decimals but I'm still having decimals.

I get the weighs with :

Obj.Envelopes(0).Weights.Array

Round them and put them back with

myEnvelope.Weights.Array = roundedWeights

But when I check my weights after that I'm still having decimals like:
0.30011920929
14.198092651
58
27.5

And my roundedWeights array is just like I want them:
0.3
14.2
58
27.5

I successfully did it in Maya disabling the Normalize property, but I can't
get it to work in Softimage. Is there any way to do this?

Thanks

Martin

--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.


scripting Weights

2016-03-07 Thread Martin Yara
I wrote a tool to round weights decimals but I'm still having decimals.

I get the weighs with :

Obj.Envelopes(0).Weights.Array

Round them and put them back with

myEnvelope.Weights.Array = roundedWeights

But when I check my weights after that I'm still having decimals like:
0.30011920929
14.198092651
58
27.5

And my roundedWeights array is just like I want them:
0.3
14.2
58
27.5

I successfully did it in Maya disabling the Normalize property, but I can't
get it to work in Softimage. Is there any way to do this?

Thanks

Martin
--
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.