Commit Graph

135 Commits

Author SHA1 Message Date
Sebastian
979903722a Moved the whole input handling from SImGuiWidget to UImGuiInputHandler:
- Moved responsibility for updating input state from the widget to the input handler.
- Changed the widget to fully delegate input events to the input handler and only manage its own input state.
- Changed the input handler interface to allow handling of all the necessary input events.
- Changed the input handler interface to use FReply as a response type and removed obsolete FImGuiInputResponse.
2019-06-30 18:25:58 +01:00
Sebastian
852a501022 Moved input state from SImGuiWidget to FImGuiContextProxy and modified implementation of FImGuiInputState reset functionality.
Moving input state to context proxy decouples it a bit from a particular input source and although not used right now, it allows multiple sources to send input in parallel.
2019-06-23 20:29:25 +01:00
Sebastian
22c5b42387 Cleanup in SImGuiWidget:
- Removed mouse status update.
- Removed mouse notifications.
- Removed unused function to copy modifier keys on mouse events (key down/up versions are still in use).
2019-06-23 15:21:43 +01:00
Sebastian
2d728f1f26 Removed from FImGuiModuleManager custom check for a game thread as both reasons to have it are not relevant any more.
Current implementation of the IsInGameThread() doesn't make exceptions for a loading thread and lazy initialization of the Unreal resources ensures that plugin doesn't do any work before the game starts.
2019-06-15 13:37:11 +01:00
Sebastian
59dc8decf8 Fixed issue with SImGuiLayout blocking mouse input for other Slate widgets, which was introduced by refactorization of widgets (version 1.14, commit c144658f):
- Changed visibility of widgets in ImGui layout from 'Visible' to 'SelfHitTestInvisible'.
2019-05-31 19:58:00 +01:00
segross
ca4001343e
Merge branch 'master' into master 2019-05-05 19:59:19 +01:00
Sebastian
4a9d66889b Added ImGui early debug events:
- Added to FImGuiDelegates interface early debug delegates called during world tick start.
- Delegates are called in fixed order: multi-context early debug, world early debug (called during world tick start), world debug, multi-context debug (called during world post actor tick or if not available, during world tick start).
- Removed from build script configuration of debug delegates.
2019-04-14 12:16:15 +01:00
Mantisis
dc516f052e Fix Name initialized after DrawEven in ImGuiContextProxy 2019-04-11 21:06:41 +02:00
Sebastian
867a34e640 Changed interface to register ImGui debug delegates:
- Added new FImGuiDelegates interface for ImGui debug delegates.
- Added FImGuiDelegatesContainer for ImGui delegates.
- Added code preserving delegates during hot-reloading and moving them to a new module.
- Depreciated old FImGuiModule delegates interface and FImGuiDelegateHandle.
- Delegates registered with depreciated interface are redirected and get benefit of being preserved during hot-reloading. This can be controlled with IMGUI_REDIRECT_OBSOLETE_DELEGATES.
- Added IMGUI_WITH_OBSOLETE_DELEGATES allowing to strip depreciated interface from builds.
- Modified context manager and context proxy to work with FImGuiDelegatesContainer.
2019-04-10 20:19:11 +01:00
Sebastian
c144658f37 Refactored ImGui widget and removed dependency on ImGui internal cursor data:
- Added SImGuiLayout to resets layout and house SImGuiWidget.
- Module manager creates SImGuiLayout instead of SImGuiWidget (eventually it should be replaced with a higher level object, like AHUD).
- Reworked ImGui canvas dragging and scaling and moved to SImGuiCanvasControl.
- Removed dependency on ImGui internal cursor data. New presentation is cleaner and doesn't use cursor data.
- Rendering code could be simplified after layout reset provided by SImGuiLayout.
- SImGuiWidget still handles input, rendering of ImGui draw data and activation of SImGuiCanvasControl.
- All widgets are in own subfolder.
2019-03-13 20:40:13 +00:00
Sebastian
6c6e766a20 Fixed mapping from FKey to ImGui key index to gracefully handle unsupported keys and work on platforms that does not support all the keys defined in ImGui key map.
Instead of throwing assertion unsupported keys are mapped to 0, what guarantees that ImGui key map is always initialized and unsupported keys mapped to index that cannot be reached from key input events that have non-zero key codes.
2019-03-11 19:39:11 +00:00
Sebastian
6643958586 Fixed non-unity compile errors and warnings. 2019-03-11 19:19:32 +00:00
Sebastian
eba312e20b Fixed UBT warning in UE 4.21. From 4.21 onward modules must specify an explicit precompiled header in build script file. 2019-02-05 21:01:05 +00:00
Sebastian
ffe532f6b3 Fixed restoring of the user focus to game viewport in UE 4.20+ 2019-02-05 20:48:19 +00:00
Sebastian
6eb66bf021 Renamed ImGuiSettings.h/cpp to ImGuiModuleSettings.h/cpp to keep it more consistent with conventions used in module. 2018-12-08 21:15:20 +00:00
Sebastian
09572a8ef9 Refactorization of ImGui settings:
- Divided ImGui settings into UImGuiSettings persistent object and FImGuiModuleSettings proxy that provides interface for other classes and handles delayed loading of UImGuiSettings.
- Removed from FImGuiModuleProperties and FImGuiModuleCommands direct dependencies on UImGuiSettings.
- Simplified FImGuiModuleProperties making it more robust when moving data after hot-reloading.
- Inverted binding logic by injecting FImGuiModuleProperties and FImGuiModuleCommands into FImGuiModuleSettings and letting it take care of synchronization. Dependencies are setup by module manager.
- Added to module manager FImGuiModuleSettings and interface to access it.
- Cleaned interface of FImGuiInputHandlerFactory and removed direct dependency on settings.
2018-12-08 21:03:18 +00:00
Sebastian
0bf940de81 Modified UImGuiInputHandler::OnKeyDown to only handle command bindings if keyboard input is not shared and to leave it for DebugExec if it is. 2018-12-04 19:41:22 +00:00
Sebastian
51031d7d86 Changed input sharing properties to be initialized and updated from ImGui settings. 2018-12-02 20:32:42 +00:00
Sebastian
f4718e404a Introduced input sharing properties:
- Added properties defining whether keyboard or gamepad input should be shared between ImGui and game.
- Added interface and commands to dynamically change introduced properties.
- Updated ImGui Input Handler to base default input responses on sharing properties.
2018-12-02 18:42:28 +00:00
Sebastian
0c69e6ddfc Changed how module properties are passed to lambda executed during hot-reloading as lambdas with mutable captures seems to be not always supported. 2018-11-27 21:17:06 +00:00
Sebastian
c662869820 Fixed duplicated registrations of ImGui Demo that were introduced in recent changes. 2018-11-27 20:56:02 +00:00
Sebastian
e05cea2789 Added to ImGui Context Manager an event raised when a new context proxy is created. 2018-11-27 20:54:26 +00:00
Sebastian
62d26f4ee5 Moved ImGui Module Properties to public directory and added to ImGui Module interface allowing access their instance. 2018-11-26 20:20:53 +00:00
Sebastian
a8ba10d074 Added code that moves module properties to hot-reloaded modules. 2018-11-25 21:26:06 +00:00
Sebastian
209a594616 Replaced module properties singleton with instance created as part of module manager:
- Removed ImGui Module Properties singleton interface and released construction constraints.
- Added ImGui Module Properties to ImGui Module Manager.
- Moved ImGui Demo to ImGui Module Manager.
- ImGui Demo and ImGui Module Commands keep reference to ImGui Module Manager that gives them access to properties.
2018-11-25 20:36:55 +00:00
Sebastian
70db3c7b20 Replaced console variables in FImGuiModuleProperties with plain variables. Added console commands to toggle states of those properties. 2018-11-25 19:11:48 +00:00
Sebastian
e00c1ff9e3 Renamed SwitchInputMode to ToggleInput command and interface to provide a better consistency with the engine and between module functions.
Note that this commit contains a minor breaking change for custom implementations of UImGuiInputHandler.
- Changed "ImGui.SwitchInputMode" command name to "ImGui.ToggleInput".
- Changed SwitchInputModeKey property in settings to ToggleInput.
- Added temporary mechanism protecting from losing data by moving it from SwitchInputModeKey to ToggleInput and removing deprecated entry from the default config file.
- Renamed UImGuiInputHandler protected function from IsSwitchInputModeEvent to IsToggleInputEvent, so custom implementations of that class may require update.
2018-11-24 21:16:25 +00:00
Sebastian
c5f3759664 Moved console variables and commands to wrapper objects:
- Moved property variables to ImGui Module Properties.
- Moved console command to ImGui Module Commands (one for now but more will be added).
- ImGui Module Commands is created by ImGui Module Manager, what means that commands are registered after module is loaded and unregistered when it is unloaded.
- Updated settings to allow more convenient use: Added global pointer to default object and event raised when it is loaded.
2018-11-24 19:54:01 +00:00
Sebastian
f67cabbe93 Fixed IntelliSense errors caused by wrongly formatted macro definitions in build script file. 2018-11-06 18:57:21 +00:00
Sebastian
fc6fd2e498 Clean-up in debug code:
- Added common debug config file for module-wide debug symbols and loggers.
- Added IMGUI_MODULE_DEVELOPER symbol to enable or disable module developer mode, that is intended to add additional module debug options hidden from normal usage.
- ImGui Widget debug is only available in developer mode because in normal usage it adds noise to ImGui console variables while not being very useful.
- Merged LogImGuiInputHandler and LogImGuiInputHandlerFactory loggers as they are part of the same feature.
- Renamed LogImGuiInputState to LogImGuiInput.
2018-10-30 22:25:48 +00:00
Sebastian
20d1490bd3 Replaced 'ImGui.DrawMouseCursor' console variable with a settings property. 2018-10-28 21:15:02 +00:00
Sebastian
b492932055 Replaced 'ImGui.DebugDrawOnWorldTick' console variable with conditional compilation switches and extended support to post actor tick event:
- Replaced 'ImGui.DebugDrawOnWorldTick' with DRAW_EVENTS_ON_WORLD_TICK_START switch to enforce consistency in project setup.
- Added DRAW_EVENTS_ON_POST_ACTOR_TICK to support post actor tick events (only for UE 4.18 or later).
- Added DRAW_EVENTS_ORDER_WORLD_BEFORE_MULTI_CONTEXT to allow explicitly define order between multi-context and world-context draw events.
- Rules can be configured in ImGui.Build.cs file.
2018-10-28 19:54:18 +00:00
Sebastian
b4e959ccd3 Changed module type to allow stripping it from selected builds:
- Changed module type to 'Developer'.
- Added runtime loader that handles automatic module loading in runtime builds (feature can be selectively enabled).
2018-10-17 23:16:28 +01:00
Sebastian
36cdd0c337 Updated to ImGui 1.65 2018-09-12 19:21:36 +01:00
Sebastian
590f0819ab Removed from ImGui.Build.cs reference to own public directory to fix UBT warning in UE 4.20. 2018-09-02 14:40:15 +01:00
Sebastian
588428507a Added missing UObject/WeakObjectPtr.h include to ImGuiInputHandler.h to improve backward compatibility. 2018-09-02 13:38:44 +01:00
Sebastian
dd06fcbbdf Added support for registering in module user textures to them in ImGui:
- Added ImGuiTextureHandle that is implicitly convertible to ImTextureID and can be used directly with ImGui interface.
- Added to ImGui Module interface allowing to register, update and release textures or find handles to existing resources.
- Refactored Texture Manager and added functions allowing create, update or release resources for user textures.
- Loosened resource verification policy in Texture Manager to work smoothly with external requests and to handle gracefully situations when invalid texture id is passed to ImGui.
- Introduced ‘error texture’ that is used for invalid resources.
2018-08-15 22:20:46 +01:00
Sebastian
9c181463ce Replaced in Texture Manager raw texture pointer with weak object pointer and removed explicit call to IsValidLowLevel. 2018-08-14 20:40:25 +01:00
Sebastian
d9220ad536 Fixed bad deallocation in Texture Manager and interface to create textures from raw data:
- Fixed rather embarrassing overlook in deallocation of data array passed from to CreateTexture from other function.
- Changed CreateTexture to use cleanup function passed with data (optional and only needed if data need to be released). Keeping data allocation and deallocation code together should make bugs like this easier to spot and avoid. Additionally this allows for more generic usage.
2018-08-14 20:28:25 +01:00
Sebastian
74c794b53e Fixed hot-reloading issues. Hot-reloading may be useful when developing this plug-in but it doesn't play well with free functions used in ImGui interface (limitation of the system I guess). Switched to a custom GImGui which after hot-reload can be redirected to a new module. This fixes a crash caused by GImGui in obsolete module pointing to released resources and guarantees that ImGui code remains functional. 2018-08-10 23:53:03 +01:00
Sebastian
20a7675787 Clean-up: Added a header file for backward compatibility symbols. Keeping rules in one place should help with tracking, help to maintain consistency and reduce clutter in implementation files. 2018-08-10 22:20:33 +01:00
Sebastian
9ab12850fb Added custom property type layout for FImGuiKeyInfo. 2018-07-31 22:09:01 +01:00
Sebastian
a90f217ab3 Added 'ImGui.SwitchInputMode' command and configurable key binding to DebugExecBindings. 2018-07-30 22:05:59 +01:00
Sebastian
eabff7b839 Replaced in ImGui Input Handler hard-coded assumptions about console open and stop play session shortcuts with values taken from input settings and input binding manager. Testing functions are available for inheriting classes. 2018-07-10 20:21:35 +01:00
Sebastian
daa18fcf25 Fixed warning about hiding 'ModuleManager' declaration. 2018-07-10 18:02:43 +01:00
Sebastian
5968c3ce84 Added ImGui Input Handler and ImGui Settings:
- Added ImGui Input Handler class that allows to customize handling of the keyboard and gamepad input.
- Added ImGui Settings to allow specify custom input handler implementation.
- Added editor support for ImGui Settings.
- Input handling in ImGui Widget is divided for querying the handler (more customizable) and actual input processing based on the handler’s response (fixed and simplified).
- Removed a need for checking console state in different input handling functions in ImGui Widget by suppressing keyboard focus support when console is opened.
2018-07-10 17:40:57 +01:00
Sebastian
f57a73b91b Improved plugin to initialize correctly even when started during earlier loading phases:
- Split tick and textures initializations.
- Supporting deferred tick initialization, if Slate application is not ready during module startup.
- Textures are lazy-loaded before the first use.
- ImGui Context Manager initializes font atlas to make sure that ImGui resources are always initialized.
2018-05-24 21:55:25 +01:00
Sebastian
ec5bc3e738 Fixed error caught with stricter compiler settings. 2018-05-18 19:06:37 +01:00
Sebastian
82729a12c8 Enabled experimental ImGui gamepad navigation feature:
- Updated InputNavigation CVar to support 1: keyboard navigation, 2: gamepad navigation and 3: keyboard + gamepad navigation simultaneously.
- Added ImGui interoperability utilities mapping gamepad input events to values in ImGui navigation inputs array.
- Added to ImGui Input State support for gamepad navigation inputs.
- Refactored ImGui Input State to keep consistent interface for keyboard, mouse and gamepad updates.
2018-05-17 23:25:47 +01:00
Sebastian
e83f37d518 Enabled experimental ImGui keyboard navigation feature. 2018-05-10 12:15:14 +01:00
Sebastian
413b4f407a Upgraded to ImGui 1.61:
- Upgraded ImGui framework to 1.61 WIP, which adds a few improvements to context management.
- Removed from plugin implementation all the references to default ImGui context.
- Removed from ImGui Context Proxy destructor code switching to default ImGui context (there is no default context and decision is left for a higher level manager when to switch and to what context).
- Added own font atlas that is shared by all contexts and used explicitly to create Slate resources.
- Removed from ImGui Context Proxy workaround that was previously needed for copying cursor data to dynamically created contexts.
- Removed explicit saving of context settings before its destruction as this is now handled in ImGui::DestroyContext().
- Reimplemented ImGuiImplementation::GetCursorData() to use new interface.
2018-05-09 20:22:48 +01:00
Sebastian
fa32fd95e3 Added to ImGui Widget a canvas map mode that allows to drag and change scale of the ImGui canvas.
Map mode allows to reach areas of the canvas that otherwise would be inaccessible (for instance modal windows positioned in the centre of the canvas) and to modify which part should be visible by default.
2018-04-21 22:43:15 +01:00
Sebastian
d152b4193c Added to ImGuiImplementation GetCursorData function allowing to access data associated with ImGui cursors (UVs and size). 2018-04-21 21:40:05 +01:00
Sebastian
cfc76ea286 Added to ImGui Context Proxy information about context display size. 2018-04-17 23:03:24 +01:00
Sebastian
f8e689561f Switched to FTransform2D when processing ImGui output before rendering it in Slate. This allows for more flexibility when transforming that data. Changed interface of FImGuiDrawList to enforce consistent transformation of vertices and clipping rectangle. 2018-04-17 20:28:29 +01:00
Sebastian
8c1c710646 Moved ImGui Draw events, so they are called during World Tick Start. Old behaviour, where those events were called during Post-Tick, can be restored by setting console variable ImGui.DebugDrawOnWorldTick to zero. 2018-03-20 23:24:03 +00:00
Sebastian
052ae0a201 Reduced lag between producing ImGui output and rendering it:
- ImGui Context Proxy Tick function has been split for Tick and Draw. Both functions may now be called separately from different places but they will be processed only once per frame. This opens possibility to define own mechanisms to trigger draw events and to independently update contexts.
- Multi-context draw event delegate is passed to ImGui Context Proxy during construction rather than as an argument of Tick function.
- To minimise lag between ending ImGui frame and rendering its output, ImGui Widget updates its own context just before painting.
- Contexts without widget (editor, dedicated server) are updated by manager during post-tick event.
- Instead of setting global CurrentContextIndex by ImGui Context Manager, information about context is passed to ImGui Demo as part of a closure.
- Fixed bug in ImGui Demo where inactive contexts were triggering multi-PIE warning.
2018-03-18 19:45:08 +00:00
Sebastian
f18e1f0b68 Changed to hardware cursor as a default cursor in input mode and added ImGui.DrawMouseCursor console variable to allow to switch to ImGui cursor.
Using ImGui to draw cursor helps to reduce visual error between mouse cursor and position in ImGui. But it has been reported that this works really bad when frame-rate drops and becomes unusable below ~20 FPS. Taking that into account hardware cursor seems like a better default option. Old behaviour can be enabled with ImGui.DrawMouseCursor console variable.
2018-03-13 23:42:37 +00:00
Mohammad S. Babaei
ab103ac65f
fix template unqualified lookup build errors on clang 2018-03-05 17:03:38 +03:30
Sebastian
2e994ac124 Fixed a few errors and warnings on PS4 and XBox platforms. 2018-02-02 23:14:17 +00:00
Sebastian
b2f4f43d7e Replaced static assert about TCHAR being not wider that ImWchar with a runtime check validating whether TCHAR values are in accepted range. Runtime check only happens on platforms where TCHAR is wider than ImWchar. 2018-02-02 22:50:55 +00:00
Sebastian
c260a3d824 Fixed missing inline keywords causing errors in non-unity or adaptive-unity builds. 2018-01-24 22:58:02 +00:00
Sebastian
f40efc265f Fixed input issues when application loses focus and added debug code for ImGui input state. 2018-01-15 23:48:51 +00:00
Sebastian
933b7f1b3b Added interface to modify from code console variables that control whether to enable ImGui Input Mode and show ImGui Demo. 2018-01-10 23:36:12 +00:00
Sebastian
f01cefc30f Changed ImGui Demo to allow selectively show demo window in chosen contexts and to fix problems with some of the examples. Added relevant warning message and description displayed when demo is opened in more than one context. 2018-01-09 19:36:52 +00:00
Josh Engebretson
c7d152cc22 Updating to ImGui 1.53 2018-01-01 21:13:15 -05:00
Sebastian
2b19b2108a Updated to Unreal Engine 4.18 (backward compatible). 2017-11-05 22:36:39 +00:00
Sebastian
9db4abcb0a Updated to Unreal Engine 4.17 (backward compatible):
- Removed usage of per-vertex ClipRect.
- Replaced usage of GSlateScissorRect with new FSlateWindowElementList::PushClip/PopClip functions.
- Defined WITH_OBSOLETE_CLIPPING_API to switch to old implementation for older engine versions.
2017-11-05 19:41:34 +00:00
Sebastian
865ade48c0 Updated to Unreal Engine 4.16 (backward compatible):
- Replaced obsolete module rules constructors with new versions forwarding read-only target rules to base constructors.
2017-11-05 16:10:03 +00:00
Sebastian
3f33545f8b Added automatic ImGui context switching when updating different editor and PIE worlds. Allows to use ImGui API during world update with controls being drawn in correct viewport. 2017-10-28 22:25:44 +01:00
Sebastian
8c46591488 Added ImGui.ShowDemo console variable to show/hide ImGui demo. 2017-10-03 21:26:59 +01:00
Sebastian
00ad746267 Added interface to register ImGui debug delegates. 2017-10-03 21:16:17 +01:00
Sebastian
1a6aa98f51 Added support for session reloading and updated contexts and widgets management:
- Added to ImGui Context Proxy a name that is mapped to ini file set in ImGui context.
- ImGui Context Manager generates unique context names from world type and context index.
- Refactored ImGui Context Manager to have a cleaner separation between editor and non-editor bits.
- Fixed context update rules in ImGui Context Manager.
- Changed widgets management in ImGui Module Manager to allow automatic garbage collection after viewports are closed and manual removal when module is shutting down.
- ImGui Widgets are in full control of communication with context proxies.
- Added basic world context utilities.
- Refactored world context index utilities and replaced ambiguous 'default context index' with 'editor' and 'game' ones.
2017-09-27 21:16:54 +01:00
Sebastian
7e756c7cb5 Small clean-up with fixes for few warnings. 2017-09-22 20:23:42 +01:00
Sebastian
9c62196cbb Using ImGui to draw mouse cursor. 2017-09-21 22:09:03 +01:00
Sebastian
5625365310 Added handling of special input cases:
- Different handling of 'Esc' key. If ImGui has active items then it is used to exit edit mode, otherwise it is passed to editor to cancel session.
- Suppressing keyboard input when console is opened and retaking it when it is closed.
- Fixed issue with losing input when console is closed.
2017-09-16 21:52:14 +01:00
Sebastian
c47d911f22 Fixed issues with passing input focus between viewport and ImGui Widget. 2017-09-10 21:05:37 +01:00
Sebastian
f696393089 Added debug code to ImGui Widget:
- Added ImGui.Debug.Widget console variable to enable/disable widget state debugging.
- Added ImGui ImGui debug for widget state.
- Added logging for widget state transitions.
2017-09-09 11:40:44 +01:00
Sebastian
f7816ee1fd Added ImGui.InputEnabled console variable to control when ImGui should receive inputs. 2017-09-02 18:42:41 +01:00
Sebastian
77bb73dbce Added Multi-PIE support:
- Added ImGui Context Manager to create and manage ImGui Context Proxies.
- Changed ImGui Context Proxy to dynamically create context and allow pairing with input state.
- Changed ImGui Module Manager to create one widget per context.
- Changed ImGui Widget to work in different input modes.
- Changed ImGui Input State to allow partial reset (only mouse or keyboard).
2017-08-28 20:29:07 +01:00
Sebastian
53387cf88b Changed modifier keys handling and cleaned ImGui Input State:
- Separate modifier keys interface and data from generic keys.
- Cleaned interface to better differentiate between full reset and clearing update data.
- Fixed bug in code clearing characters.
2017-08-19 21:19:38 +01:00
Sebastian
393460f330 Added input support:
- Added ImGui Input State to collect and store input updates.
- Changed Slate ImGui Widget to handle Slate input events and store them in input state.
- Changed ImGui Context Proxy to copy input state to its context.
2017-04-22 16:38:04 +01:00
Sebastian
35f2d342a0 Added support for ImGui context update and rendering:
- Added ImGui Module Manager that that implements module logic and manages other module resources.
- Added Texture Manager to manage texture resources and maps them to index that can be passed to ImGui context.
- Added Context Proxy that represents and manages a single ImGui context.
- Added Slate ImGui Widget to render ImGui output.
2017-03-26 21:32:57 +01:00
Sebastian
e74e3475d9 Integrated ImGui framework:
- Added ImGui framework source directory.
- Added to ImGui module include paths pointing to ImGui source directory.
- Added to ImGui module implementation file that includes ImGui source code to be built as part of the module.
2017-03-18 11:33:14 +00:00
Sebastian
cd98f86005 Initial commit:
- License file and initial readme file.
- Plugin and module base configuration.
- Repository configuration.
2017-03-17 23:22:13 +00:00