28 lines
841 B
C++
28 lines
841 B
C++
#pragma once
|
|
|
|
#include "../CommandHistory.h"
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace UsdLayerManager {
|
|
|
|
/// Type-agnostic attribute set command.
|
|
/// Stores execute and undo as std::function closures capturing the typed values.
|
|
class AttributeSetCommand : public ICommand {
|
|
public:
|
|
AttributeSetCommand(std::string description,
|
|
std::function<void()> executeFunc,
|
|
std::function<void()> undoFunc);
|
|
|
|
void Execute() override { if (m_executeFunc) m_executeFunc(); }
|
|
void Undo() override { if (m_undoFunc) m_undoFunc(); }
|
|
std::string GetDescription() const override { return m_description; }
|
|
|
|
private:
|
|
std::string m_description;
|
|
std::function<void()> m_executeFunc;
|
|
std::function<void()> m_undoFunc;
|
|
};
|
|
|
|
} // namespace UsdLayerManager
|