Commit 057c3361 authored by Bob Obara's avatar Bob Obara

ENH: Changing ReferenceItem::RemoveValue Behavior

Previous if you attempted to remove a value whose location was below the item's numberOfRequiredValues,
the method would **unset** instead of removing the value.  With this change, the value will be removed as long
as the remaining NumberOfValues is >= NumberOfRequiredValues
parent 2f84282e
......@@ -121,6 +121,9 @@ Added a class for utility methods. The current ones include:
* Added Methods
* isValueValid - the validity of the item now factors in the state of the instance. This is needed to support Unique Constraints
* removeInvalidValues() - will remove all values that are considered invalid - meaning that the resource of the associated object is loaded but the object no longer exists.
* **Behavior Changes**
* removedValue() - will now remove a value regardless of what it's index is. Previously, if the index was less than the NumberOfRequiredValues it would not be removed but simply unset. Now, as long as the resulting number of values is greater than or equal to the number of required values, it will be removed.
Else it will be unset.
### Custom attribute item and definition types
SMTK's attribute system now supports the registration of user-defined attribute items and definitions by overloading `smtk::attribute::CustomItem` and `smtk::attribute::CustomItemDefinition`, respectively. The registration of custom item definition types must occur before the attribute is serialized. Custom item definitions can be listed in plugins' Registrar implementations as follows:
......
......@@ -568,9 +568,9 @@ bool ReferenceItem::removeValue(std::size_t i)
{
return false;
}
// If i < the required number of values this is the same as unset - else if
// its extensible remove it completely
if (i < def->numberOfRequiredValues())
// If removing the value would still satisfy the item's number of required
// values then just remove it. Else unset the value instead
if (m_keys.size() <= def->numberOfRequiredValues())
{
this->unset(i);
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment