Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 05/06/2016 at 07:49, xxxxxxxx wrote:
User Information: Cinema 4D Version: R17 Platform: Windows ; Language(s) :
---------
When writing out and reading floats I noticed a difference between write/read float32 and write/read float64. I have included code using the 32 variant. The double precision seems to work OK, but I would expect that while less precise, the 32 bit variant to "closely" match the expected value.
Write/Read Float32 writing -> version: 0.4 reading -> version: -1.58818683921e-23
Write/Read Float64 writing -> version: 0.4 reading -> version: 0.4
def WritePreset(self) : testversion = 0.4 folder, filename = os.path.split(__file__) fn = os.path.join(folder, 'preset') hf = c4d.storage.HyperFile() if hf.Open(ident=12345, filename=fn, mode=c4d.FILEOPEN_WRITE, error_dialog=c4d.FILEDIALOG_NONE) : print 'writing -> version:', testversion if not hf.WriteFloat32(testversion) : print 'Failed writing' hf.Close() else: print 'Failed open hyperfile', hf.GetError() return def ReadPreset(self) : folder, filename = os.path.split(__file__) fn = os.path.join(folder, 'preset') hf = c4d.storage.HyperFile() if os.path.isfile(fn) and hf.Open(ident=12345, filename=fn, mode=c4d.FILEOPEN_READ, error_dialog=c4d.FILEDIALOG_NONE) : ver = hf.ReadFloat32() print 'reading -> version:', ver hf.Close()
On 13/06/2016 at 06:34, xxxxxxxx wrote:
Hi,
you have found a bug in the argument parsing of WriteFloat32(). Sorry! The only workaround I have for now is to use WriteFloat64() instead. The bug will be fixed in one of the next releases.
On 15/06/2016 at 12:19, xxxxxxxx wrote:
Thank you Andreas