addAttr float precision

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  08 August 2012
addAttr float precision

I'm surprised I haven't been able to find this anywhere. How do I change the precision of a float attribute that I am adding? By default it is only precise to one decimal place, but for this attribute I need it to be two or three decimals.

Thanks.
 
  08 August 2012
Hmmm...never tried with addAttr command.
With other mel stuff I have just added the precision I needed in the base value.
float $test = 1.0000000

Maybe try that with the default value.
Donno.
 
  08 August 2012
you don't change precision. type precision is dictated by the computers processor. If you add a float attribute your precision is bound and unchangeable, the only thing you can do is round or print values at a different precision. If you want a numeric attribute that is MORE precise than a float, use a double, but a float should be more than enough for most applications (and a float still has about 13 places of precision (or thereabouts iirc))

I'm not sure why you think in this case your float is only precise to 1 decimal place, that's probably just a rounding error during printing (as MEL assumes most people don't care about displayed precision).
 
  08 August 2012
I haven't given enough information to properly describe my question. I'm looking for precision in the channel box, specifically when scrubbing the value. I am able to type in 0.998, of course, but when I scrub I only get precision to the tenths of a unit: .1, .2, .3, .4, etc. I am hoping for the ability to scrub hundredths of a unit, so .01, .02, .03, .04.
 
  08 August 2012
ah! well that's completely different... I think you just hold down CTRL or ALT when scrubbing for smaller increments don't you?
 
  08 August 2012
That does the trick (holding Ctrl). I thought there was some flag I had to set or something during the addAttr. Maybe there still is one I can set. This definitely gets the job done though. Thanks!
 
  08 August 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:06 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.