App: add convenience methods to get minimum, maximum and step size of property constraints
This commit is contained in:
@@ -623,6 +623,29 @@ const PropertyIntegerConstraint::Constraints* PropertyIntegerConstraint::getCon
|
||||
return _ConstStruct;
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getMinimum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->LowerBound;
|
||||
// return the min of int, not long
|
||||
return std::numeric_limits<int>::min();
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getMaximum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->UpperBound;
|
||||
// return the max of int, not long
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getStepSize() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->StepSize;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PropertyIntegerConstraint::setPyObject(PyObject *value)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
@@ -1102,6 +1125,27 @@ const PropertyFloatConstraint::Constraints* PropertyFloatConstraint::getConstra
|
||||
return _ConstStruct;
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getMinimum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->LowerBound;
|
||||
return std::numeric_limits<double>::min();
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getMaximum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->UpperBound;
|
||||
return std::numeric_limits<double>::max();
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getStepSize() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->StepSize;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
void PropertyFloatConstraint::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyFloat_Check(value)) {
|
||||
|
||||
Reference in New Issue
Block a user