0
$\begingroup$

I have several physically based parameters for creating meshes and materials, that are often extremely small, but make sense in the context they are. For example, in my operator I have something like this:

poly_0: FloatProperty(
        name="POLY_0",
        description="Some description...",
        default=1.26587922531743e-20,
        precision=64
        min=-1000.0,
        max=+1000.0,
        )

The problem is that FloatProperty is just single precision (as opposed to python float type, which is double). The precision parameter effects only the display of the value in Blender GUI, and has no affect above a value of 6. Even the default value entered as parameter, will be automatically truncated here.

All this while Blender happily accepts the code, with no warning.

In my addon, I can currently load the parameters from a json file as well as putting the values in by the GUI. This truncates them as well.

While I would hope for an improvement for this in the future (where we could have both double precision and scientific notation in the GUI of the operators), right now what I really would like is feedback from the community: How do we work around this in the best way?

I am thinking of using multiple floatProperties to store the value, or maybe even a string. All such implementations should be invisible to the users, and a single floatProperty should then be available just for the GUI interfacing.

EDIT: an answer that covers this is found here

$\endgroup$
6
  • $\begingroup$ relevant discussion found here $\endgroup$ – Stefan Karlsson Dec 22 '20 at 12:33
  • $\begingroup$ Hello, if I may, what kind of physical properties are you working with that need both very small numbers and a very high amount of digits of precision ? $\endgroup$ – Gorgious Dec 22 '20 at 13:33
  • $\begingroup$ Its very particular use-case for me that I better not discuss. However, there could be man examples where this would be useful. For example (not my example) consider generating wave like phenomenon through the Fourier domain description. An addon might want to expose a few particular wave coefficients for the user to manipulate $\endgroup$ – Stefan Karlsson Dec 22 '20 at 13:53
  • $\begingroup$ Could make a scientific notation prop group $\endgroup$ – batFINGER Dec 22 '20 at 13:54
  • 1
    $\begingroup$ edited to put a link to your answer @batFINGER $\endgroup$ – Stefan Karlsson Dec 23 '20 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.