add variadic template ctor for TAction
This commit is contained in:
@@ -61,10 +61,10 @@ namespace Nz
|
|||||||
ActionStack(ActionStack&&) = delete;
|
ActionStack(ActionStack&&) = delete;
|
||||||
ActionStack& operator=(ActionStack&&) = delete;
|
ActionStack& operator=(ActionStack&&) = delete;
|
||||||
|
|
||||||
template <typename TAction>
|
template <typename TAction, typename... TArgs>
|
||||||
void RegisterAction(const EditorAction::Properties& properties)
|
void RegisterAction(const EditorAction::Properties& properties, TArgs&&... args)
|
||||||
{
|
{
|
||||||
m_availableActions.push_back(std::make_unique<TAction>(properties));
|
m_availableActions.push_back(std::make_unique<TAction>(properties, std::forward<TArgs...>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t m_currentIndex;
|
int64_t m_currentIndex;
|
||||||
|
|||||||
@@ -67,11 +67,11 @@ namespace Nz
|
|||||||
m_windows.push_back(std::make_unique<T>(this));
|
m_windows.push_back(std::make_unique<T>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TAction>
|
template <typename TAction, typename... TArgs>
|
||||||
void RegisterAction(EditorAction::Properties properties)
|
void RegisterAction(EditorAction::Properties properties, TArgs&&... args)
|
||||||
{
|
{
|
||||||
properties.className = TAction::GetClassName();
|
properties.className = TAction::GetClassName();
|
||||||
m_actionStack.RegisterAction<TAction>(properties);
|
m_actionStack.RegisterAction<TAction>(properties, std::forward<TArgs...>(args)...);
|
||||||
OnActionRegistered(properties);
|
OnActionRegistered(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user