Polyphase Game Engine
Loading...
Searching...
No Matches
PlayerInputEditor.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
6
7#include <stdint.h>
8#include <string>
9#include <vector>
10
12
13class PlayerInputEditor
14{
15public:
16 // Open the editor. If `asset` is non-null, its actions are loaded into
17 // PlayerInputSystem and Save/Reload buttons target THAT asset instead of
18 // the canonical Assets/InputActions.oct project file.
19 void Open(InputActionsAsset* asset = nullptr);
20 void Draw();
21 bool IsOpen() const;
22
23private:
24
25 bool mIsOpen = false;
26 // Empty = project-canonical mode (Save/Reload hit Assets/InputActions.oct).
27 // Non-empty = asset-specific mode (Save/Reload hit the named asset).
28 std::string mSourceAssetName;
29 int mSelectedActionIndex = -1;
30 char mNewCategory[64] = {};
31 char mNewActionName[64] = {};
32
33 // Capture state for binding
34 bool mCapturing = false;
35 int mCaptureBindingSlot = -1;
36 float mCaptureTimer = 0.0f;
37
38 // Rename/Move/DuplicateTo popup state
39 enum class PopupMode { None, Rename, DuplicateTo, MoveTo, DuplicateCategory };
40 PopupMode mPopupMode = PopupMode::None;
41 int mPopupActionIndex = -1;
42 char mPopupCategory[64] = {};
43 char mPopupName[64] = {};
44 std::string mPopupSourceCategory;
45
46 // Clipboard for copy/paste
47 bool mHasClipboard = false;
48 InputAction mClipboardAction;
49
50 void DrawActionList();
51 void DrawActionDetails();
52 void DrawCaptureOverlay();
53 void DrawActionContextMenu(int actionIndex);
54 void DrawCategoryContextMenu(const std::string& category);
55 void DrawPopupModal();
56 void DuplicateAction(int actionIndex, std::string toCategory, std::string newName);
57 void PasteAction(const std::string& toCategory, bool overrideExisting);
58};
59
60PlayerInputEditor* GetPlayerInputEditor();
61
62// Convenience entry point used by the Asset Panel double-click dispatch.
63void OpenInputActionsForEditing(InputActionsAsset* asset);
64
65#endif
Definition InputActionsAsset.h:7
Definition PlayerInputSystem.h:87