//--------------------------------------------------------------------------------------
void begin()
{
- static int aTransactionID = 0;
+ static size_t aTransactionID = 0;
+ static size_t aNbTransactions = -1;
+ size_t aNbUndo = ModelAPI_Session::get()->undoList().size();
+ if (aNbUndo != aNbTransactions) {
+ // the last transaction was not empty, thus increase the ID
+ aNbTransactions = aNbUndo;
+ ++aTransactionID;
+ }
std::ostringstream aTransactionName;
- aTransactionName << "Operation_" << ++aTransactionID;
+ aTransactionName << "Operation_" << aTransactionID;
ModelAPI_Session::get()->startOperation(aTransactionName.str());
}
{
auto aSession = ModelAPI_Session::get();
aSession->finishOperation();
+ // start the next operation
begin();
}