Core: Make sure that PropertyMaterialList cannot become empty

The PropertyMaterialList is supposed to guarantee that it always has at least one element
This commit is contained in:
wmayer
2024-06-15 18:31:24 -05:00
committed by Chris Hennes
parent 30f7f26889
commit 6623b60528
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -2651,6 +2651,18 @@ PropertyMaterialList::~PropertyMaterialList() = default;
//**************************************************************************
// Base class implementer
void PropertyMaterialList::setValues(const std::vector<App::Material>& newValues)
{
if (!newValues.empty()) {
PropertyListsT<Material>::setValues(newValues);
}
else {
aboutToSetValue();
setSize(1);
hasSetValue();
}
}
PyObject* PropertyMaterialList::getPyObject()
{
Py::Tuple tuple(getSize());
+1
View File
@@ -1118,6 +1118,7 @@ public:
{
PropertyListsT<Material>::setValue(materials);
}
void setValues(const std::vector<App::Material>& newValues = std::vector<App::Material>()) override;
void setValue(const Material& mat);
void setValue(int index, const Material& mat);