Hi,
The OverFlow error is thrown when SetInt32()
is called from a SubDialog
(used for Tool plugins settings).
I'm afraid a regression was introduced in R20. It will be fixed in the next update.
The workaround in R20 is to perform in Python what GeDialog::SetInt32()
does in the C++ API (see cinema.framework/source/c4d_gui.cpp).
import sys
def StringToID(str):
return int('0x'+hex(ord(str[0]))[2:4]+hex(ord(str[1]))[2:4]+hex(ord(str[2]))[2:4]+hex(ord(str[3]))[2:4], 16)
CM_TYPE_INT = StringToID('vint')
CM_VALUE_VAL = StringToID('valu')
CM_VALUE_FORMAT = StringToID('frmt')
CM_VALUE_MIN = StringToID('mini')
CM_VALUE_MAX = StringToID('maxi')
CM_VALUE_MIN2 = StringToID('min2')
CM_VALUE_MAX2 = StringToID('max2')
CM_VALUE_STEP = StringToID('step')
CM_VALUE_TRISTATE = StringToID('tris')
def SetInt32(dlg, id, value, min=-sys.maxint-1, max=sys.maxint, step=1, tristate=0, min2=-sys.maxint-1, max2=sys.maxint):
msg = c4d.BaseContainer(CM_TYPE_INT)
msg[CM_VALUE_VAL] = value
msg[CM_VALUE_FORMAT] = c4d.FORMAT_INT
msg[CM_VALUE_MIN] = min
msg[CM_VALUE_MAX] = max
msg[CM_VALUE_STEP] = step
msg[CM_VALUE_TRISTATE] = tristate
if min2 != -sys.maxint-1 or max2 != sys.maxint:
msg[CM_VALUE_MIN2] = min2
msg[CM_VALUE_MAX2] = max2
return dlg.SendMessage(id, msg) != 0
Call this SetInt32() from the subdialog to initialize any integer value.
Note c4d.MINLONGl
and c4d.MAXLONGl
are no longer used internally. The documentation has to be updated.