ADVANCED PLUGINS MODULES AND PLUGINS MODULES The Unreal

  • Slides: 15
Download presentation
ADVANCED PLUGINS

ADVANCED PLUGINS

MODULES AND PLUGINS

MODULES AND PLUGINS

MODULES The Unreal Engine is structured as modules, each compiled separately and dynamically loaded.

MODULES The Unreal Engine is structured as modules, each compiled separately and dynamically loaded. (Most) modules can be loaded, unloaded, or recompiled without needing to restart the engine. Each module has its own Build. cs file, an interface derived from IModule. Interface, and uses the IMPLEMENT_MODULE macro to declare the module name and add the necessary initialization code.

In Render. Interface. h: Interface derived from IModule. Interface In Render. Module. h: Module

In Render. Interface. h: Interface derived from IModule. Interface In Render. Module. h: Module class, including overrides for Startup. Module and Shutdown. Module MODULE DISCOVERY So. . . how does the other engine code know what is in a module? To explicitly use functions or classes in other modules, you must add the other module as a dependency in your Build. cs. • Look for a MODULE_API macro, #include of a module interface header, or Build. cs to find the module name. Many modules rely on automatic discovery. To register your plugin you can: • • • Register delegate functions on load. o A Default Object is constructed for every UObject. Registration code in the constructor will be run on load. o Can also do it in Startup. Module. Register directly with another module. Use Unreal. Build. Tool reflection macros, which generate registration code. In Renderer. cpp: Add module implementation code In Renderer. Build. cs: Module build code

MODULES AND PLUGINS Plugins are modules and add functionality in the same way as

MODULES AND PLUGINS Plugins are modules and add functionality in the same way as core engine modules. Plugins can: • Declare functions another module can call. • Declare types or functions that will be found through one of the engine discovery methods (Unreal. Build. Tool macros, new delegates, etc. ). Most plugins will either be a single module, or one for code only needed in the Editor, and a separate one for code needed at game runtime.

WHAT CAN PLUGINS DO?

WHAT CAN PLUGINS DO?

PLUGINS BY EXAMPLE The best way to see what is possible, and how to

PLUGINS BY EXAMPLE The best way to see what is possible, and how to do it, is to look at the many engine plugins in Engine/Plugins. Process: • Find a plugin that does what you want. • Look at its code to see what functions and/or UObject classes it uses or extends. • Search the rest of the plugins and core engine for more examples using the same. • Look for common code (and identify what code you don’t need). o Multiple examples help show what is necessary. • Look for simple examples, or ones closest to what you plan to do. Experimental/Apple. Vision Experimental/Chaos. Cloth Experimental/Stereo. Panorama Experimental/Code. Editor Experimental/Back. Channel Experimental/Blueprint. Stats Experimental/Shotgun Experimental/Skeletal. Reduction Experimental/Virtual. Production. Utilities Experimental/Python. Script. Plugin Experimental/Alembic. Importer Experimental/Chaos. Niagara Experimental/Field. System. Plugin Experimental/Chaos. Solver. Plugin Experimental/Phya Experimental/Image. Plate Experimental/Simple. HMD Experimental/Pixel. Streaming Experimental/Virtual. Camera Experimental/Proxy. LODPlugin Experimental/Control. Rig Experimental/AR Experimental/Blast. Plugin Experimental/Gauntlet Experimental/Platform. Crypto Experimental/Remote. Session Experimental/Apple. Image. Utils Experimental/Geometry. Cache Experimental/Character. AI Experimental/HTML 5 Networking Experimental/Raw. Input Experimental/Geometry. Collection. Plugin Experimental/Code. View Developer/Animation. Sharing Developer/Code. Lite. Source. Code. Access Developer/KDevelop. Source. Code. Access Developer/Concert Developer/Actor. Layer. Utilities Developer/Render. Doc. Plugin Developer/Blank. Plugin Developer/UObject. Plugin Developer/Visual. Studio. Code. Source. Code. Access Developer/Visual. Studio. Source. Code. Access Developer/Subversion. Source. Control Developer/CLion. Source. Code. Access Developer/One. Sky. Localization. Service Developer/XCode. Source. Code. Access Developer/Perforce. Source. Control Developer/Null. Source. Code. Access Developer/Git. Source. Control Blendables/Light. Propagation. Volume Portal/Launcher. Chunk. Installer Script. Generator. Plugin/Resources Movie. Scene/Actor. Sequence Movie. Scene/Matinee. To. Level. Sequence Movie. Scene/Sequencer. Scripting Movie. Scene/Level. Sequence. Editor Enterprise/Datasmith. Content Enterprise/Variant. Manager. Content Lumin/Magic. Leap. Camera Lumin/Magic. Leap. Screens Lumin/Magic. Leap. Media Importers/USDImporter Virtual. Production/Takes FX/Niagara FX/Houdini. Niagara FX/Niagara. Extras Runtime/Cable. Component Runtime/Runtime. Phys. XCooking Runtime/Leap. Motion Runtime/Database Runtime/Procedural. Mesh. Component Runtime/Windows. Mixed. Reality Runtime/Spatialization Runtime/Resonance. Audio Runtime/Web. MMovie. Player Runtime/Steam Runtime/Sun. Position Runtime/Mixed. Reality. Capture. Framework Runtime/Open. XR Runtime/Windows. Device. Profile. Selector Runtime/Location. Services. IOSImpl Runtime/Web. Browser. Widget Runtime/Android. Movie. Player Runtime/Apex. Destruction Runtime/Custom. Mesh. Component Runtime/Android. Permission Runtime/Oculus Runtime/Editable. Mesh Runtime/Synthesis Runtime/Replication. Graph Runtime/Sound. Utilities Runtime/Location. Services. Android. Impl Runtime/Mobile. Patching. Utils Runtime/Firebase Runtime/Sound. Mod Runtime/Nvidia Runtime/Windows. Movie. Player Runtime/Pre. Load. Screen. Movie. Player Runtime/HTTPChunk. Installer Runtime/Mesh. Reconstruction Runtime/n. Display Runtime/Audio. Capture Runtime/Optional. Mobile. Features. BPLibrary Runtime/Significance. Manager Runtime/AR Runtime/Advertising Runtime/Gameplay. Abilities Runtime/MIDIDevice Runtime/Anim. Distance. Matching Runtime/Example. Device. Profile. Selector Runtime/Sound. Visualizations Runtime/IOSDevice. Profile. Selector Runtime/Phys. XVehicles Runtime/Apple. Movie. Player Runtime/Android. Device. Profile. Selector Runtime/Linux. Device. Profile. Selector Runtime/Location. Services. BPLibrary Runtime/Arch. Vis. Character Runtime/Packet. Handlers Runtime/Google. VR Runtime/Google. Cloud. Messaging Runtime/Time. Synth Runtime/Analytics Runtime/Animation. Budget. Allocator Tests/Fbx. Automation. Test. Builder Tests/Screenshot. Tools Tests/Editor. Tests/Runtime. Tests/Functional. Testing. Editor Animation/Live. Link. Curve. Debug. UI Slate/Slate. Remote Netcode. Unit. Test/Netcode. Unit. Test/NUTUnreal. Engine 4 Compositing/Open. Color. IO Compositing/Composure Compositing/Lens. Distortion Compositing/Open. CVLens. Distortion Script. Plugin/Resources Script. Plugin/Source Script. Plugin/Binaries Script. Plugin/Intermediate AI/AISupport AI/HTNPlanner Online/Online. Subsystem. Oculus Online/Online. Subsystem. Google Online/Online. Subsystem. Amazon Online/IOS Online/Android Online/Online. Subsystem. Twitch Online/Online. Subsystem. Steam Online/Voice. Chat Online/Online. Framework Online/Online. Subsystem. Facebook Online/Online. Subsystem. Null Online/Online. Subsystem. Utils Performance/Performance. Monitor 2 D/Paper 2 D Messaging/Messaging. Debugger Messaging/Tcp. Messaging/Udp. Messaging Editor/Facial. Animation Editor/Sequence. Recorder Editor/Mobile. Launcher. Profile. Wizard Editor/Material. Analyzer Editor/Blueprint. Material. Texture. Nodes Editor/Asset. Manager. Editor/Gameplay. Tags. Editor/Editor. Scripting. Utilities Editor/Crypto. Keys Editor/Mesh. Editor/Mac. Graphics. Switching Editor/Plugin. Browser Editor/GLTFImporter Editor/Speed. Tree. Importer Editor/Data. Validation Media/Mf. Media/Android. Media/Media. Compositing Media/Timecode. Synchronizer Media/Media. Player. Editor Media/Media. Framework. Utilities Media/Audio. Capture. Timecode. Provider Media/Img. Media/Media. IOFramework Media/Linear. Timecode Media/Wmf. Media/Avf. Media/Web. MMedia/Android. Camera

TOOLBAR BUTTONS Create new buttons in the top toolbar of the Editor. The easiest

TOOLBAR BUTTONS Create new buttons in the top toolbar of the Editor. The easiest way to get the basics is to look at the template code. To implement: • Derive a class from TCommands<FToolbar. Commands>. • Register it in Startup. Module.

EDITOR MODES Add a new Editor mode, like Foliage, etc. This one also has

EDITOR MODES Add a new Editor mode, like Foliage, etc. This one also has a template when creating a new plugin. To implement: • Derive class from FEd. Mode and FMode. Toolkit. Search for the following in Engine/Plugins to find other, more complete examples: • Mesh. Editor • Control. Rig • Steam. Audio • Paper 2 D

FILE IMPORTERS A file importer plugin will allow you to import files by dragging

FILE IMPORTERS A file importer plugin will allow you to import files by dragging them into the Content window or by using the Import button. To implement: • Derive class from UFactory. • Override UFactory import functions. • Register extensions supported in the constructor. There is no template for this one, but you can look for existing plugins that add new file importers. GLTF is one example. From that, look for other plugins with Factory. Create. File: • • Alembic. Importer Magic. Leap. Media USDImporter Several in Media

ASSET ACTIONS Plugins can add new operations on existing assets, available through the right-click

ASSET ACTIONS Plugins can add new operations on existing assets, available through the right-click context menu. To implement: • Create a new class derived from IAsset. Type. Actions or FAsset. Type. Actions_Base. • Override Get. Actions. How to find examples: • Find an example like Paper 2 D. • Search for the action name in the menu, with spaces removed (Create. Tile. Map). • This search leads to example at FTile. Set. Asset. Type. Actions. • Given that, search for Get. Actions for examples in other plugins.

NEW ASSET TYPES Plugins can create new asset types can appear in the Content

NEW ASSET TYPES Plugins can create new asset types can appear in the Content window and be used by Actors and components. To implement: • Derive from UObject. • Add UFactory class implementing Factory. Create. New and/or importer Factory. • Optional: Should. Show. In. New. Menu. • Add IAsset. Type. Actions class to customize name. • Add UThumbnail. Renderer class if you want a custom icon. How to find: • Paper 2 D is a good starting example again. • Once found, there are 50+ other plugin types.

ASSET EDITOR Any new asset gets a default asset editor window that just opens

ASSET EDITOR Any new asset gets a default asset editor window that just opens a Details window on any exposed UPROPERTY data. • Use the “hidecategories” UCLASS tag to hide properties you don’t want to show up, like parent class properties. You can make a new custom asset editor by extending FAsset. Editor. Toolkit. Building a new asset editor can be quite involved, essentially a mini-app for editing an asset, with its own window, tabs, and widgets.

DETAILS PANEL WIDGETS Instead of a full asset editor, for simple types you can

DETAILS PANEL WIDGETS Instead of a full asset editor, for simple types you can create a new Details panel widget. • Derive a new class from IProperty. Type. Customization. • Register by calling Register. Custom. Property. Type. Layout. Good examples can be found in Gameplay. Tags. Editor.

MORE. . . Look through the Plugins and Engine Modules for other things that

MORE. . . Look through the Plugins and Engine Modules for other things that can be extended with plugins: • New snapping modes • New viewport buttons • New windows/tabs • New components • Postprocessing • . . .