Added undo when using the properties widget.

This commit is contained in:
Leonardo Zide
2026-03-07 14:03:59 -08:00
parent d14b8e3d93
commit e1dab3286e
5 changed files with 22 additions and 36 deletions
+6 -13
View File
@@ -3876,16 +3876,13 @@ void lcModel::SetCameraProjection(lcCamera* Camera, lcCameraProjection CameraPro
gMainWindow->UpdateSelectedObjects(false);
}
void lcModel::SetObjectsProperty(const std::vector<lcObject*>& Objects, lcObjectPropertyId PropertyId, QVariant Value, bool AddUndo)
void lcModel::SetObjectsProperty(const std::vector<lcObject*>& Objects, lcObjectPropertyId PropertyId, QVariant Value)
{
BeginActionSequence();
BeginObjectEditAction(static_cast<lcModelActionEditMerge>(static_cast<uint32_t>(lcModelActionEditMerge::PropertiesEdit) | static_cast<uint32_t>(PropertyId)));
bool Modified = false;
if (AddUndo)
{
BeginActionSequence();
BeginObjectEditAction(lcModelActionEditMerge::None);
}
for (lcObject* Object : Objects)
{
bool ObjectModified = Object->SetPropertyValue(PropertyId, mCurrentStep, gMainWindow->GetAddKeys(), Value);
@@ -3904,14 +3901,10 @@ void lcModel::SetObjectsProperty(const std::vector<lcObject*>& Objects, lcObject
return;
}
if (AddUndo)
{
EndObjectEditAction();
EndActionSequence(lcObject::GetCheckpointString(PropertyId));
}
EndObjectEditAction();
EndActionSequence(lcObject::GetCheckpointString(PropertyId));
gMainWindow->UpdateSelectedObjects(false);
UpdateAllViews();
// todo: fix hacky timeline update
if (PropertyId == lcObjectPropertyId::PieceId || PropertyId == lcObjectPropertyId::PieceColor)