@ferdinand,
There is something weird going on. I intend to change several sliders accordingly to Parameters
, ID_X
and ID_Y
.
I adapted the code accordingly, but it seems that only DESC_MAXSLIDER
and DESC_MINSLIDER
are took into account while DESC_MIN
and DESC_MAX
stick to previous values. Could that be a bug?
I let in remarks the code that improve a bit better the result and allows ID_X
to be fully set (MIN/MAX as well as MINSLIDER/MAXSLIDER), but the problems remains on ID_Y
.
Here the whole code of GetDDescription()
,
global Parameters
Parameters = dict()
Parameters['Xmin'] = -360.0
Parameters['Xmax'] = 360.0
Parameters['Ymin'] = -25.0
Parameters['Ymax'] = 25.0
def GetDDescription(self, node, description, flags):
if not description.LoadDescription(node.GetType()):
return False
# Change Slider limits accordingly to Parameters values
# Sliders to modifiy ID_X, ID_Y
## SLIDER ID_X
if len(Parameters) > 0:
paramID_X: c4d.DescID = c4d.DescID(c4d.DescLevel(ID_X, c4d.DTYPE_REAL, 0))
single_X: c4d.DescID = description.GetSingleDescID()
# Bail when there is a to be evaluated parameter and our parameter is not part off or equal to the to be evaluated parameter.
if single_X and not paramID_X.IsPartOf(single_X):
return True, flags
# if singleId[0] == mAXIS_X: print (f"singleID found: {singleId} ")
# Get the description data container instance (GetParameter>I<) for the parameter we want to modify
desc_X: c4d.BaseContainer = description.GetParameterI(paramID_X)
if desc_X is None:
return True, flags
# if single_X and paramID_X.IsPartOf(single_X):
# if paramID_A1.IsPartOf(single_X)[0]:
# Write the MAX and MAXSLIDER values based on UserDatas
desc_X[c4d.DESC_MIN] = c4d.utils.DegToRad(Parameters["Xmin"])
desc_X[c4d.DESC_MINSLIDER] = c4d.utils.DegToRad(Parameters["Xmin"])
desc_X[c4d.DESC_MAX] = c4d.utils.DegToRad(Parameters["Xmax"])
desc_X[c4d.DESC_MAXSLIDER] = c4d.utils.DegToRad(Parameters["Xmax"])
# if single_X and paramID_X.IsPartOf(single_X):
# if paramID_X.IsPartOf(single_X)[0]:
# print (f"Found X: {paramID_X.IsPartOf(single_X)[0]} ")
# return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
## SLIDER ID_Y
paramID_Y: c4d.DescID = c4d.DescID(c4d.DescLevel(mAXIS_Y, c4d.DTYPE_REAL, 0))
single_Y: c4d.DescID = description.GetSingleDescID()
# Bail when there is a to be evaluated parameter and our parameter is not part off or equal to the to be evaluated parameter.
if single_Y and not paramID_Y.IsPartOf(single_Y):
return True, flags
# Get the description data container instance (GetParameter>I<) for the parameter we want to modify
desc_Y: c4d.BaseContainer = description.GetParameterI(paramID_Y)
if desc_Y is None:
return True, flags
# Write the MAX and MAXSLIDER values based on UserDatas
desc_Y[c4d.DESC_MIN] = c4d.utils.DegToRad(Parameters["Ymin"])
desc_Y[c4d.DESC_MINSLIDER] = c4d.utils.DegToRad(Parameters["Ymin"])
desc_Y[c4d.DESC_MAX] = c4d.utils.DegToRad(Parameters["Ymax"])
desc_Y[c4d.DESC_MAXSLIDER] = c4d.utils.DegToRad(Parameters["Ymax"])
# if single_Y and paramID_A2.IsPartOf(single_Y):
# if paramID_Y.IsPartOf(single_Y)[0]:
# print (f"Found Y: {paramID_Y.IsPartOf(single_Y)[0]} ")
# return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
Does this trick to change REALSLIDER MIN/MAX values intend to be associated to only on change, and not on several UI object?
Thanks in advance,
Cheers,
Christophe