+ on rename of contraint make sure that new name is different, on swap constraint names make sure they have user-defined names

This commit is contained in:
wmayer
2016-03-12 20:02:18 +01:00
parent a17870c93c
commit b25ef6235d
3 changed files with 22 additions and 8 deletions

View File

@@ -355,11 +355,14 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args)
}
}
Constraint* copy = this->getSketchObjectPtr()->Constraints[Index]->clone();
copy->Name = Name;
this->getSketchObjectPtr()->Constraints.set1Value(Index, copy);
delete copy;
// only change the constraint item if the names are different
const Constraint* item = this->getSketchObjectPtr()->Constraints[Index];
if (item->Name != Name) {
Constraint* copy = item->clone();
copy->Name = Name;
this->getSketchObjectPtr()->Constraints.set1Value(Index, copy);
delete copy;
}
Py_Return;
}