#pragma once enum class lcObjectType; enum class lcSelectionMode; class lcModelAction { public: lcModelAction() = default; virtual ~lcModelAction() = default; }; struct lcModelActionSelectionState { std::vector PieceSelection; std::vector CameraSelection; std::vector LightSelection; size_t FocusIndex = SIZE_MAX; uint32_t FocusSection = ~0U; lcObjectType FocusObjectType = static_cast(~0); bool operator!=(const lcModelActionSelectionState& Other) const { return PieceSelection != Other.PieceSelection || CameraSelection != Other.CameraSelection || LightSelection != Other.LightSelection || FocusIndex != Other.FocusIndex || FocusSection != Other.FocusSection || FocusObjectType != Other.FocusObjectType; } }; class lcModelActionSelection : public lcModelAction { public: lcModelActionSelection() = default; virtual ~lcModelActionSelection() = default; void SaveStartState(const lcModel* Model); void SaveEndState(const lcModel* Model); void LoadStartState(lcModel* Model) const; void LoadEndState(lcModel* Model) const; bool StateChanged() const; protected: static void SaveState(lcModelActionSelectionState& State, const lcModel* Model); static void LoadState(const lcModelActionSelectionState& State, lcModel* Model); lcModelActionSelectionState mStartState; lcModelActionSelectionState mEndState; }; enum class lcModelActionObjectEditMode { EditAllObjects, EditAllPieces, EditSelectedObjects, EditSelectedPieces, EditUnselectedPieces, EditCamera, CreatePieces, CreateCamera, CreateLight }; class lcModelActionObjectEdit: public lcModelAction { public: lcModelActionObjectEdit(lcModelActionObjectEditMode Mode); virtual ~lcModelActionObjectEdit() = default; bool SaveStartState(const lcModel* Model, const lcCamera* Camera); bool SaveEndState(const lcModel* Model, std::vector&& ObjectIndices, std::vector&& GroupIndices); void LoadStartState(lcModel* Model) const; void LoadEndState(lcModel* Model) const; lcModelActionObjectEditMode GetMode() const { return mMode; } protected: bool SaveHistoryBuffer(QByteArray& Buffer, const lcModel* Model); bool LoadHistoryBuffer(const QByteArray& Buffer, lcModel* Model, bool CreateObjects) const; std::vector mGroupIndices; std::vector mPieceIndices; std::vector mCameraIndices; std::vector mLightIndices; lcModelActionObjectEditMode mMode; QByteArray mStartBuffer; QByteArray mEndBuffer; }; enum class lcModelActionGroupPiecesMode { Group, Ungroup }; class lcModelActionGroupPieces : public lcModelAction { public: lcModelActionGroupPieces(lcModelActionGroupPiecesMode Mode, const QString& GroupName); virtual ~lcModelActionGroupPieces() = default; lcModelActionGroupPiecesMode GetMode() const { return mMode; } const QString& GetGroupName() const { return mGroupName; } protected: lcModelActionGroupPiecesMode mMode; QString mGroupName; };