├── .gitattributes ├── .gitignore ├── Config └── DefaultHeart.ini ├── Content ├── Actions │ ├── BP_NodeNavigator.uasset │ ├── BP_SelectNode.uasset │ └── BP_SpawnNodeAtMouse.uasset ├── LayoutHelpers │ └── BP_Layout_AutoGrid.uasset ├── Macros │ └── ML_HeartObjectMacros.uasset └── UI │ ├── BindingAssets │ ├── IBA_DefaultGraphEditor.uasset │ ├── IBA_DefaultGraphViewer.uasset │ ├── IBA_DefaultHistory.uasset │ ├── IBA_DefaultPalette.uasset │ ├── IH_ConnectPins.uasset │ ├── IH_DeleteNode.uasset │ ├── IH_DisconnectPins.uasset │ ├── IH_MoveNode.uasset │ ├── IH_NodeNavigation.uasset │ ├── IH_PaletteDragClass.uasset │ ├── IH_PanGraphView.uasset │ ├── IH_Redo.uasset │ ├── IH_SelectNode.uasset │ ├── IH_Undo.uasset │ └── IH_ZoomGraphView.uasset │ └── DefaultCanvas │ ├── BP_DefaultCanvasConnectionVisualizer.uasset │ ├── BP_DefaultSchema.uasset │ ├── Registrar_DefaultVisualizers.uasset │ ├── T_Icon_Math_Add.uasset │ ├── T_Icon_Math_Subtract.uasset │ ├── W_DefaultAddPinButton.uasset │ ├── W_DefaultCanvas.uasset │ ├── W_DefaultComment.uasset │ ├── W_DefaultComment_Image.uasset │ ├── W_DefaultConnectionStatus.uasset │ ├── W_DefaultConnectionVisualizer.uasset │ ├── W_DefaultNodeClassVisualizer.uasset │ ├── W_DefaultNodeVisualizer.uasset │ ├── W_DefaultPinBox.uasset │ └── W_DefaultPinVisualizer.uasset ├── Heart.uplugin ├── LICENSE ├── README.md ├── Resources ├── Icon128.png └── Icons │ ├── HeartAsset_16x.png │ ├── HeartAsset_64x.png │ ├── HeartNode_Body.png │ ├── HeartNode_Shadow.png │ ├── HeartNode_Shadow_Active.png │ ├── HeartNode_Shadow_WasActive.png │ ├── HeartNode_Title.png │ └── Refresh.png └── Source ├── Blood ├── Blood.Build.cs ├── Private │ ├── BloodContainer.cpp │ ├── BloodFProperty.cpp │ ├── BloodLog.h │ ├── BloodModule.cpp │ ├── BloodPrecomputedMaps.cpp │ ├── BloodPrecomputedMaps.h │ ├── BloodValue.cpp │ ├── Blueprint │ │ ├── BloodBlueprintLibrary.cpp │ │ └── BloodBlueprintLibrary.h │ └── Tests │ │ ├── BloodContainerTest.cpp │ │ └── BloodValueTest.cpp └── Public │ ├── BloodContainer.h │ ├── BloodData.h │ ├── BloodFProperty.h │ ├── BloodModule.h │ ├── BloodProperty.h │ ├── BloodValue.h │ └── Concepts │ └── VariantStructureProvider.h ├── Heart ├── Heart.Build.cs ├── Private │ ├── GraphRegistry │ │ ├── GraphNodeRegistrar.cpp │ │ ├── HeartGraphNodeRegistry.cpp │ │ ├── HeartRegistryQuery.cpp │ │ └── HeartRegistryRuntimeSubsystem.cpp │ ├── HeartGraphSettings.cpp │ ├── HeartModule.cpp │ ├── Model │ │ ├── HeartExtensionQuery.cpp │ │ ├── HeartGraph.cpp │ │ ├── HeartGraphBlueprint.cpp │ │ ├── HeartGraphComponentBase.cpp │ │ ├── HeartGraphExtension.cpp │ │ ├── HeartGraphInterface.cpp │ │ ├── HeartGraphNode.cpp │ │ ├── HeartGraphNode3D.cpp │ │ ├── HeartGraphNodeBlueprint.cpp │ │ ├── HeartGraphNodeComponent.cpp │ │ ├── HeartGraphUtils.cpp │ │ ├── HeartNodeEdit.cpp │ │ ├── HeartNodeQuery.cpp │ │ ├── HeartPinConnectionEdit.cpp │ │ ├── HeartPinData.cpp │ │ ├── HeartPinQuery.cpp │ │ └── HeartQueryObject.cpp │ ├── ModelView │ │ ├── Actions │ │ │ ├── HeartAction_AutoLayout.cpp │ │ │ ├── HeartAction_DeleteNode.cpp │ │ │ ├── HeartAction_DisconnectPins.cpp │ │ │ ├── HeartAction_MoveNodeProxy.cpp │ │ │ ├── HeartAction_MultiUndoEnd.cpp │ │ │ ├── HeartAction_MultiUndoStart.cpp │ │ │ ├── HeartAction_PinsEditProxy.cpp │ │ │ ├── HeartGraphAction.cpp │ │ │ ├── HeartHistoryActions.cpp │ │ │ └── HeartMultiUndoHelper.cpp │ │ ├── HeartActionHistory.cpp │ │ ├── HeartGraphSchema.cpp │ │ ├── HeartLayoutHelper.cpp │ │ ├── HeartNodeLocationModifier.cpp │ │ ├── HeartNodeLocationProxy.cpp │ │ ├── HeartNodeSortingLibrary.cpp │ │ ├── Layouts │ │ │ ├── HeartLayout_FruchtermanReingold.cpp │ │ │ ├── HeartLayout_KamadaKawai.cpp │ │ │ └── HeartLayout_TestSpinner.cpp │ │ └── LocationModifiers │ │ │ ├── HeartNodeLocationModifier_CartesianToPolar.cpp │ │ │ ├── HeartNodeLocationModifier_SnapToGrid.cpp │ │ │ └── HeartNodeLocationModifier_SnapToHex.cpp │ ├── Nodes │ │ ├── HeartAnnotationBase.cpp │ │ └── HeartGraphNodeAnnotation.cpp │ └── View │ │ ├── HeartVisualizerInterfaces.cpp │ │ └── PinConnectionStatusInterface.cpp └── Public │ ├── GraphRegistry │ ├── GraphNodeRegistrar.h │ ├── HeartGraphNodeRegistry.h │ ├── HeartNodeSource.h │ ├── HeartRegistryQuery.h │ ├── HeartRegistryRuntimeSubsystem.h │ └── HeartRegistryStructs.h │ ├── HeartGraphSettings.h │ ├── HeartModule.h │ ├── Model │ ├── HeartExtensionQuery.h │ ├── HeartGraph.h │ ├── HeartGraphBlueprint.h │ ├── HeartGraphComponentBase.h │ ├── HeartGraphExtension.h │ ├── HeartGraphInterface.h │ ├── HeartGraphNode.h │ ├── HeartGraphNode3D.h │ ├── HeartGraphNodeBlueprint.h │ ├── HeartGraphNodeComponent.h │ ├── HeartGraphNodeInterface.h │ ├── HeartGraphPinDesc.h │ ├── HeartGraphPinInterface.h │ ├── HeartGraphPinMetadata.h │ ├── HeartGraphPinReference.h │ ├── HeartGraphPinTag.h │ ├── HeartGraphTypes.h │ ├── HeartGraphUtils.h │ ├── HeartGuids.h │ ├── HeartNodeEdit.h │ ├── HeartNodeQuery.h │ ├── HeartPinConnectionEdit.h │ ├── HeartPinData.h │ ├── HeartPinDirection.h │ ├── HeartPinQuery.h │ ├── HeartQueries.h │ └── HeartQueryObject.h │ ├── ModelView │ ├── Actions │ │ ├── HeartAction_AutoLayout.h │ │ ├── HeartAction_DeleteNode.h │ │ ├── HeartAction_DisconnectPins.h │ │ ├── HeartAction_MoveNodeProxy.h │ │ ├── HeartAction_MultiUndoEnd.h │ │ ├── HeartAction_MultiUndoStart.h │ │ ├── HeartAction_PinsEditProxy.h │ │ ├── HeartGraphAction.h │ │ ├── HeartHistoryActions.h │ │ └── HeartMultiUndoHelper.h │ ├── HeartActionHistory.h │ ├── HeartGraphSchema.h │ ├── HeartLayoutHelper.h │ ├── HeartNodeLocationModifier.h │ ├── HeartNodeLocationProxy.h │ ├── HeartNodeSortingLibrary.h │ ├── Layouts │ │ ├── HeartLayout_FruchtermanReingold.h │ │ ├── HeartLayout_KamadaKawai.h │ │ └── HeartLayout_TestSpinner.h │ └── LocationModifiers │ │ ├── HeartNodeLocationModifier_CartesianToPolar.h │ │ ├── HeartNodeLocationModifier_SnapToGrid.h │ │ └── HeartNodeLocationModifier_SnapToHex.h │ ├── Nodes │ ├── HeartAnnotationBase.h │ └── HeartGraphNodeAnnotation.h │ └── View │ ├── HeartVisualizerInterfaces.h │ └── PinConnectionStatusInterface.h ├── HeartCanvas ├── HeartCanvas.Build.cs ├── Private │ ├── Actions │ │ ├── HeartCanvasAction_Zoom.cpp │ │ ├── HeartCanvasDragViewDragDropOperation.cpp │ │ ├── HeartCanvasNodeMoveDragDropOperation.cpp │ │ ├── HeartGraphCanvasAction.cpp │ │ ├── HeartGraphSlateAction.cpp │ │ └── HeartPinConnectionDragDropOperation.cpp │ ├── HeartCanvasConnectionVisualizer.cpp │ ├── HeartCanvasExtension.cpp │ ├── HeartCanvasLog.h │ ├── HeartCanvasModule.cpp │ ├── HeartCanvasPaletteCategory.h │ ├── HeartCanvasPrivate.h │ ├── HeartWidgetUtilsLibrary.cpp │ ├── Input │ │ ├── HeartCanvasActionDragDropOperation.cpp │ │ ├── HeartCanvasDragDropOperation.cpp │ │ ├── HeartCanvasInputHandler_HeartDDO.cpp │ │ ├── HeartSlateInputLinker.cpp │ │ ├── HeartSlateReplyWrapper.cpp │ │ ├── HeartWidgetInputBindingContainer.cpp │ │ ├── HeartWidgetInputLinker.cpp │ │ └── SlatePointerWrappers.cpp │ ├── Slate │ │ └── SHeartGraphWidgetBase.cpp │ └── UMG │ │ ├── HeartGraphCanvas.cpp │ │ ├── HeartGraphCanvasConnection.cpp │ │ ├── HeartGraphCanvasNode.cpp │ │ ├── HeartGraphCanvasPanel.cpp │ │ ├── HeartGraphCanvasPin.cpp │ │ ├── HeartGraphWidgetBase.cpp │ │ ├── HeartNodePalette.cpp │ │ ├── HeartWidgetFactory.cpp │ │ └── HeartWidgetFactory_Class.cpp └── Public │ ├── Actions │ ├── HeartCanvasAction_Zoom.h │ ├── HeartCanvasDragViewDragDropOperation.h │ ├── HeartCanvasNodeMoveDragDropOperation.h │ ├── HeartGraphCanvasAction.h │ ├── HeartGraphSlateAction.h │ └── HeartPinConnectionDragDropOperation.h │ ├── HeartCanvasConnectionVisualizer.h │ ├── HeartCanvasExtension.h │ ├── HeartCanvasModule.h │ ├── HeartWidgetUtilsLibrary.h │ ├── Input │ ├── HeartCanvasDragDropOperation.h │ ├── HeartCanvasInputHandler_DDO_Action.h │ ├── HeartCanvasInputHandler_HeartDDO.h │ ├── HeartDragDropOperation.h │ ├── HeartSlateInputLinker.h │ ├── HeartSlateReplyWrapper.h │ ├── HeartWidgetInputBindingContainer.h │ ├── HeartWidgetInputLinker.h │ └── SlatePointerWrappers.h │ ├── Slate │ └── SHeartGraphWidgetBase.h │ └── UMG │ ├── HeartGraphCanvas.h │ ├── HeartGraphCanvasConnection.h │ ├── HeartGraphCanvasNode.h │ ├── HeartGraphCanvasPanel.h │ ├── HeartGraphCanvasPin.h │ ├── HeartGraphWidgetBase.h │ ├── HeartNodePalette.h │ ├── HeartWidgetFactory.h │ └── HeartWidgetFactory_Class.h ├── HeartCanvasEditor ├── HeartCanvasEditor.Build.cs ├── Private │ ├── HeartCanvasEditor.cpp │ └── Preview │ │ ├── ApplicationMode_PreviewCanvas.cpp │ │ ├── TabSpawners.cpp │ │ └── TabSpawners.h └── Public │ ├── HeartCanvasEditorModule.h │ └── Preview │ └── ApplicationMode_PreviewCanvas.h ├── HeartCore ├── HeartCore.Build.cs ├── Private │ ├── Algorithms │ │ ├── FruchtermanReingold.cpp │ │ ├── KamadaKawai.cpp │ │ ├── Layout.cpp │ │ └── Nodesoup.cpp │ ├── General │ │ ├── HeartGeneralUtils.cpp │ │ └── ObjectTree.cpp │ ├── HeartCoreModule.cpp │ ├── HeartCorePrivate.h │ └── Input │ │ ├── Blueprint │ │ ├── HeartInputActivationLibrary.cpp │ │ └── HeartInputActivationLibrary.h │ │ ├── HeartActionBase.cpp │ │ ├── HeartCoreInputPreprocessor.cpp │ │ ├── HeartEvent.cpp │ │ ├── HeartInputEventSubsystem.cpp │ │ ├── HeartInputHandler_Action.cpp │ │ ├── HeartInputHandler_Immediate.cpp │ │ ├── HeartInputHandler_Script.cpp │ │ ├── HeartInputLinkerBase.cpp │ │ ├── HeartInputTrigger.cpp │ │ └── HeartInputUtilsLibrary.cpp └── Public │ ├── Algorithms │ ├── FruchtermanReingold.h │ ├── KamadaKawai.h │ ├── Layout.h │ └── Nodesoup.h │ ├── General │ ├── CountedPtr.h │ ├── DoOnce.h │ ├── GameplayTagChildImplementerCopy.h │ ├── HeartContextObject.h │ ├── HeartGeneralUtils.h │ ├── HeartHex.h │ ├── HeartMath.h │ ├── ObjectTree.h │ ├── Vector2DBounds.h │ └── VectorBounds.h │ ├── HeartCoreModule.h │ └── Input │ ├── HeartActionBase.h │ ├── HeartCoreInputPreprocessor.h │ ├── HeartEvent.h │ ├── HeartInputActivation.h │ ├── HeartInputBindingAsset.h │ ├── HeartInputEventSubsystem.h │ ├── HeartInputHandlerAssetBase.h │ ├── HeartInputHandler_Action.h │ ├── HeartInputHandler_Immediate.h │ ├── HeartInputHandler_Script.h │ ├── HeartInputLinkerBase.h │ ├── HeartInputLinkerInterface.h │ ├── HeartInputTrigger.h │ ├── HeartInputTrip.h │ ├── HeartInputTypes.h │ └── HeartInputUtilsLibrary.h ├── HeartCoreEditor ├── HeartCoreEditor.Build.cs ├── Private │ ├── Assets │ │ ├── AssetDefinition_HeartInputHandlerAsset.cpp │ │ ├── HeartDefaultClassFilter.cpp │ │ └── HeartInputHandlerAssetFactory.cpp │ ├── Customizations │ │ └── ItemsArrayCustomization.cpp │ ├── HeartCoreEditorModule.cpp │ └── HeartEditorShared.cpp └── Public │ ├── Assets │ ├── AssetDefinition_HeartInputHandlerAsset.h │ ├── HeartDefaultClassFilter.h │ └── HeartInputHandlerAssetFactory.h │ ├── Customizations │ └── ItemsArrayCustomization.h │ ├── HeartCoreEditorModule.h │ └── HeartEditorShared.h ├── HeartEditor ├── HeartEditor.Build.cs ├── Private │ ├── AssetEditor │ │ ├── ApplicationMode_Editor.cpp │ │ ├── TabSpawners.cpp │ │ └── TabSpawners.h │ ├── Customizations │ │ ├── HeartGuidCustomization.cpp │ │ └── HeartGuidCustomization.h │ ├── Graph │ │ ├── AssetDefinition_HeartGraph.cpp │ │ ├── AssetDefinition_HeartGraphBlueprint.cpp │ │ ├── HeartEdGraph.cpp │ │ ├── HeartEdGraphSchema.cpp │ │ ├── HeartEdGraphSchema_Actions.cpp │ │ ├── HeartEdGraphUtils.cpp │ │ ├── HeartGraphAssetEditor.cpp │ │ ├── HeartGraphAssetToolbar.cpp │ │ ├── HeartGraphBlueprintFactory.cpp │ │ ├── HeartGraphFactory.cpp │ │ ├── HeartGraphSchemaCustomization.cpp │ │ ├── HeartGraphSchemaCustomization.h │ │ └── Widget │ │ │ ├── ConnectionDrawingPolicies │ │ │ ├── DebugConnectionDrawingPolicy.cpp │ │ │ └── DebugConnectionDrawingPolicy.h │ │ │ ├── Nodes │ │ │ ├── SHeartGraphNodeBase.cpp │ │ │ ├── SHeartGraphNode_Horizontal.cpp │ │ │ └── SHeartGraphNode_Vertical.cpp │ │ │ ├── Pins │ │ │ └── SHeartGraphPin.cpp │ │ │ ├── SHeartDetailsPanel.cpp │ │ │ └── SHeartPalette.cpp │ ├── HeartEditorCommands.cpp │ ├── HeartEditorModule.cpp │ ├── HeartEditorStyle.cpp │ ├── HeartGraphStatics.h │ ├── HeartRegistryEditorSubsystem.cpp │ ├── Input │ │ ├── EdGraphPointerWrappers.cpp │ │ └── EdGraphPointerWrappers.h │ └── Nodes │ │ ├── AssetTypeActions_HeartGraphNodeBlueprint.cpp │ │ ├── HeartBreakpoint.cpp │ │ ├── HeartEdGraphNode.cpp │ │ ├── HeartGraphNodeBlueprintFactory.cpp │ │ ├── HeartGraphNodeCustomization.cpp │ │ └── HeartGraphNodeCustomization.h └── Public │ ├── AssetEditor │ └── ApplicationMode_Editor.h │ ├── Graph │ ├── AssetDefinition_HeartGraph.h │ ├── AssetDefinition_HeartGraphBlueprint.h │ ├── HeartEdGraph.h │ ├── HeartEdGraphSchema.h │ ├── HeartEdGraphSchema_Actions.h │ ├── HeartEdGraphUtils.h │ ├── HeartGraphAssetEditor.h │ ├── HeartGraphAssetToolbar.h │ ├── HeartGraphBlueprintFactory.h │ ├── HeartGraphFactory.h │ └── Widgets │ │ ├── Nodes │ │ ├── SHeartGraphNodeBase.h │ │ ├── SHeartGraphNode_Horizontal.h │ │ └── SHeartGraphNode_Vertical.h │ │ ├── Pins │ │ └── SHeartGraphPin.h │ │ ├── SHeartDetailsPanel.h │ │ └── SHeartPalette.h │ ├── HeartEditorCommands.h │ ├── HeartEditorModule.h │ ├── HeartEditorStyle.h │ ├── HeartRegistryEditorSubsystem.h │ └── Nodes │ ├── AssetTypeActions_HeartGraphNodeBlueprint.h │ ├── HeartBreakpoint.h │ ├── HeartEdGraphNode.h │ └── HeartGraphNodeBlueprintFactory.h ├── HeartNet ├── HeartNet.Build.cs ├── Private │ ├── Actions │ │ └── HeartRemoteActionLog.cpp │ ├── GraphProxy │ │ ├── HeartGraphNetProxy.cpp │ │ ├── HeartNetClient.cpp │ │ └── HeartReplicatedData.cpp │ ├── HeartNetModule.cpp │ ├── HeartNetUtils.cpp │ └── LogHeartNet.h └── Public │ ├── Actions │ └── HeartRemoteActionLog.h │ ├── GraphProxy │ ├── HeartGraphNetProxy.h │ ├── HeartNetClient.h │ ├── HeartNetExtensionInterface.h │ ├── HeartNetNodeInterface.h │ ├── HeartNetReplicationTypes.h │ └── HeartReplicatedData.h │ ├── HeartNetModule.h │ └── HeartNetUtils.h ├── HeartScene ├── HeartScene.Build.cs ├── Private │ ├── HeartSceneActor.cpp │ ├── HeartSceneExtension.cpp │ ├── HeartSceneGenerator.cpp │ ├── HeartSceneModule.cpp │ ├── HeartSceneModule.h │ ├── HeartSceneNode.cpp │ └── Input │ │ ├── HeartPlayerInput.cpp │ │ ├── HeartSceneInputBindingContainer.cpp │ │ └── HeartSceneInputLinker.cpp └── Public │ ├── HeartSceneActor.h │ ├── HeartSceneExtension.h │ ├── HeartSceneGenerator.h │ ├── HeartSceneModule.h │ ├── HeartSceneNode.h │ └── Input │ ├── HeartPlayerInput.h │ ├── HeartSceneInputBindingContainer.h │ └── HeartSceneInputLinker.h └── HeartSceneEditor ├── HeartSceneEditor.Build.cs ├── Private ├── HeartSceneEditorModule.cpp └── Preview │ ├── ApplicationMode_PreviewScene.cpp │ ├── HeartPreviewScene.cpp │ ├── PreviewSceneCommands.cpp │ ├── PreviewSceneConfig.cpp │ ├── PreviewSceneViewportClient.cpp │ ├── SPreviewSceneViewport.cpp │ ├── TabSpawners.cpp │ └── TabSpawners.h └── Public ├── HeartSceneEditorModule.h └── Preview ├── ApplicationMode_PreviewScene.h ├── HeartPreviewScene.h ├── PreviewSceneCommands.h ├── PreviewSceneConfig.h ├── PreviewSceneViewportClient.h └── SPreviewSceneViewport.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.uasset filter=lfs diff=lfs merge=lfs -text 2 | *.umap filter=lfs diff=lfs merge=lfs -text 3 | *.png filter=lfs diff=lfs merge=lfs -text 4 | *.krita filter=lfs diff=lfs merge=lfs -text 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2015 user specific files 2 | .vs/ 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | 22 | # Compiled Static libraries 23 | *.lai 24 | *.la 25 | *.a 26 | *.lib 27 | 28 | # Executables 29 | *.exe 30 | *.out 31 | *.app 32 | *.ipa 33 | 34 | # These project files can be generated by the engine 35 | *.xcodeproj 36 | *.xcworkspace 37 | *.sln 38 | *.suo 39 | *.opensdf 40 | *.sdf 41 | *.VC.db 42 | *.VC.opendb 43 | 44 | # Precompiled Assets 45 | SourceArt/**/*.png 46 | SourceArt/**/*.tga 47 | 48 | # Binary Files 49 | Binaries/* 50 | Plugins/*/Binaries/* 51 | Plugins/*/*/Binaries/* 52 | 53 | # Builds 54 | Build/* 55 | 56 | # Whitelist PakBlacklist-.txt files 57 | !Build/*/ 58 | Build/*/** 59 | !Build/*/PakBlacklist*.txt 60 | 61 | # Don't ignore icon files in Build 62 | !Build/**/*.ico 63 | 64 | # Built data for maps 65 | *_BuiltData.uasset 66 | 67 | # Configuration files generated by the Editor 68 | Saved/* 69 | 70 | # Compiled source files for the engine to use 71 | Intermediate/* 72 | Plugins/*/Intermediate/* 73 | Plugins/*/*/Intermediate/* 74 | 75 | # Cache files for the editor to use 76 | DerivedDataCache/* 77 | 78 | # Miscellaneous Content to Skip 79 | Plugins/Developer 80 | .idea 81 | *.DotSettings 82 | *.user 83 | Config/HoloLens 84 | Plugins/EasyMultiSave 85 | -------------------------------------------------------------------------------- /Content/Actions/BP_NodeNavigator.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a530c107331972c0bc486c0ca9716e057a836eb198388002bcad4173d4f308ba 3 | size 116401 4 | -------------------------------------------------------------------------------- /Content/Actions/BP_SelectNode.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/Actions/BP_SelectNode.uasset -------------------------------------------------------------------------------- /Content/Actions/BP_SpawnNodeAtMouse.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e1d45353ebe37cccd74494a17f34491d3c0fb126bdcfda43232b9b81059ed4cf 3 | size 135239 4 | -------------------------------------------------------------------------------- /Content/LayoutHelpers/BP_Layout_AutoGrid.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:4a5959ae6e0769f08a38a0fe453c9b7e388fde1b1c740a254f0df50abc4967d3 3 | size 88198 4 | -------------------------------------------------------------------------------- /Content/Macros/ML_HeartObjectMacros.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/Macros/ML_HeartObjectMacros.uasset -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IBA_DefaultGraphEditor.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c18f57a8623e43a7bb0e2b7864e49abd14d0c97039a47ab7ba4e86e008549c27 3 | size 4347 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IBA_DefaultGraphViewer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:4083f5852c59e0c001960b6d51a7c4a4fda47705c0a87b57c0024e63e1f5e4b6 3 | size 3385 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IBA_DefaultHistory.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c4b2c1c83b80c1c0d54cf80ef439e886d424a3081fb33c0c0da8d077e30578ae 3 | size 3344 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IBA_DefaultPalette.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:39a90ab39fb03fa468602b2592c69b8d146de88e38c8e82b5dd95b3cdd94061b 3 | size 2320 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_ConnectPins.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:69597aed591ef8bd01ab48d8bc856a5c604097a62e030d5382466357d73eca27 3 | size 1888 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_DeleteNode.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:3f1049c7a6684f37c3f2e21de82c1bc7635a6157f21a91f5b6e41431c72302b1 3 | size 1497 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_DisconnectPins.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:d330a1bbe98eb9c30ced755b33b933872d1c2d516835afcdbfaf6dba8a69a1f0 3 | size 1559 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_MoveNode.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:17fdfeabd4663242f0db3722de31b9d8deac406406d1af4507a5abf030b5119f 3 | size 1470 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_NodeNavigation.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:61668e75d6af23a40ed551d7406e64271dabb3dbb2e8f071a384174530bfd958 3 | size 1586 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_PaletteDragClass.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:768dd580525bf33e3b27a467fabbd2cf8496b2ac6dfd5db007c0ddc12886777a 3 | size 2046 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_PanGraphView.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:df507387b532de748b250c4cb264fdabaad32b57351b2be4874ef31195c92f21 3 | size 1490 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_Redo.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:82871820ad3d01bd3bc4ba92a0462c44d0ba761a103b80fd16b62cd749c09060 3 | size 1460 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_SelectNode.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:f7e5703f37d25e6889aa489a29888fdca9983470c9b5e2d6f10e33b6b7a8ab5e 3 | size 1560 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_Undo.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a05ed76c283c09810935eadc2511a494315ef3887d3624c1c3e53d83bbf06e4f 3 | size 1460 4 | -------------------------------------------------------------------------------- /Content/UI/BindingAssets/IH_ZoomGraphView.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:2af8b49569e9e40b2706c94bdf946ab12b12bcf5228a234c870bcfa0129c4994 3 | size 1518 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/BP_DefaultCanvasConnectionVisualizer.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/BP_DefaultCanvasConnectionVisualizer.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/BP_DefaultSchema.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5bddbf8aa013c9b6b7882805760c361c2a0de72852125b05c20bbee9505200ab 3 | size 69257 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/Registrar_DefaultVisualizers.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:80ebc563e4d8e4b888fac710aeb4e33df4b367737fb4022ec762d4e52a5eb90e 3 | size 3780 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/T_Icon_Math_Add.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/T_Icon_Math_Add.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/T_Icon_Math_Subtract.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/T_Icon_Math_Subtract.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultAddPinButton.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/W_DefaultAddPinButton.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultCanvas.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/W_DefaultCanvas.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultComment.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e767c78d2856c8f7d59f36ab506cb1d9a31db567a44270b8e8b6361fdf1197af 3 | size 48699 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultComment_Image.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e3ba05bc2b2935f12c0711863b8b33b8d870b5c2c9c5b1dd0c5a2478010b6e14 3 | size 49030 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultConnectionStatus.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/W_DefaultConnectionStatus.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultConnectionVisualizer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:59b65b6da03054a97648be669b0a9c15a638c98731bca1527dcd403fac2c4954 3 | size 229765 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultNodeClassVisualizer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:0d53025957f2a8b25152309b40f96321a5ba7ea168d536abe6b93876768a87dc 3 | size 89328 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultNodeVisualizer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:33f2218a9c022636e1251082016f2841e48df6e1ef1816482efa7f793397a26e 3 | size 145921 4 | -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultPinBox.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Content/UI/DefaultCanvas/W_DefaultPinBox.uasset -------------------------------------------------------------------------------- /Content/UI/DefaultCanvas/W_DefaultPinVisualizer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:d7f8b5e94776946c87123246624cf1b376cf1afa9e7fa9e6e6a84dd72d7a1ca2 3 | size 182087 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Guy Lundvall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icon128.png -------------------------------------------------------------------------------- /Resources/Icons/HeartAsset_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartAsset_16x.png -------------------------------------------------------------------------------- /Resources/Icons/HeartAsset_64x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartAsset_64x.png -------------------------------------------------------------------------------- /Resources/Icons/HeartNode_Body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartNode_Body.png -------------------------------------------------------------------------------- /Resources/Icons/HeartNode_Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartNode_Shadow.png -------------------------------------------------------------------------------- /Resources/Icons/HeartNode_Shadow_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartNode_Shadow_Active.png -------------------------------------------------------------------------------- /Resources/Icons/HeartNode_Shadow_WasActive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartNode_Shadow_WasActive.png -------------------------------------------------------------------------------- /Resources/Icons/HeartNode_Title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/HeartNode_Title.png -------------------------------------------------------------------------------- /Resources/Icons/Refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drakynfly/HeartGraph/c4de9455565f9ee9508163f45adf75abb364823f/Resources/Icons/Refresh.png -------------------------------------------------------------------------------- /Source/Blood/Blood.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class Blood : ModuleRules 6 | { 7 | public Blood(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | ApplySharedModuleSetup(this, Target); 10 | 11 | // IDK, something about this module is broken, and if Unity is enabled it blows up :? 12 | bUseUnity = false; 13 | 14 | PublicDependencyModuleNames.AddRange( 15 | new [] 16 | { 17 | "Core" 18 | }); 19 | 20 | PrivateDependencyModuleNames.AddRange( 21 | new [] 22 | { 23 | "CoreUObject", 24 | "Engine" 25 | }); 26 | 27 | PublicDefinitions.Add("ALLOCATE_BLOOD_STATICS=0"); 28 | } 29 | 30 | public static void ApplySharedModuleSetup(ModuleRules Module, ReadOnlyTargetRules Target) 31 | { 32 | Module.PCHUsage = PCHUsageMode.NoPCHs; 33 | Module.DefaultBuildSettings = BuildSettingsVersion.Latest; 34 | Module.IncludeOrderVersion = EngineIncludeOrderVersion.Latest; 35 | 36 | // This is to emulate engine installation and verify includes during development 37 | if (Target.Configuration == UnrealTargetConfiguration.DebugGame 38 | || Target.Configuration == UnrealTargetConfiguration.Debug) 39 | { 40 | Module.bUseUnity = false; 41 | Module.bTreatAsEngineModule = true; 42 | Module.bEnableNonInlinedGenCppWarnings = true; 43 | Module.UnsafeTypeCastWarningLevel = WarningLevel.Warning; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Source/Blood/Private/BloodLog.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | DEFINE_LOG_CATEGORY_STATIC(LogBlood, Log, All) -------------------------------------------------------------------------------- /Source/Blood/Private/BloodModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "BloodModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "BloodModule" 6 | 7 | void FBloodModule::StartupModule() 8 | { 9 | } 10 | 11 | void FBloodModule::ShutdownModule() 12 | { 13 | } 14 | 15 | #undef LOCTEXT_NAMESPACE 16 | 17 | IMPLEMENT_MODULE(FBloodModule, Blood) -------------------------------------------------------------------------------- /Source/Blood/Private/BloodPrecomputedMaps.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Field.h" 6 | #include "Containers/Map.h" 7 | 8 | struct FBloodValue; 9 | 10 | namespace Blood 11 | { 12 | using FFPropertyReadFunc = TFunction; 13 | 14 | class FPrecomputedMaps 15 | { 16 | FPrecomputedMaps(); 17 | 18 | public: 19 | static const FPrecomputedMaps& Get(); 20 | 21 | TMap ReaderMap; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Source/Blood/Public/BloodModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FBloodModule : public IModuleInterface 8 | { 9 | public: 10 | virtual void StartupModule() override; 11 | virtual void ShutdownModule() override; 12 | }; 13 | -------------------------------------------------------------------------------- /Source/Blood/Public/Concepts/VariantStructureProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | class UScriptStruct; 6 | 7 | template 8 | struct TVariantStructure; 9 | 10 | /** 11 | * Describes a type for which TVariantStructure::Get() returning a UScriptStruct* is defined. 12 | */ 13 | struct CVariantStructureProvider 14 | { 15 | template 16 | auto Requires(UScriptStruct*& StructRef) -> decltype( 17 | StructRef = TVariantStructure::Get() 18 | ); 19 | }; -------------------------------------------------------------------------------- /Source/Heart/Heart.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class Heart : ModuleRules 6 | { 7 | public Heart(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | // Engine dependencies 12 | PublicDependencyModuleNames.AddRange( 13 | new [] 14 | { 15 | "Core", 16 | "DeveloperSettings", 17 | "GameplayTags", 18 | "InputCore" 19 | }); 20 | 21 | // Plugin dependencies 22 | PublicDependencyModuleNames.AddRange( 23 | new [] 24 | { 25 | "Blood", 26 | "Flakes", 27 | "HeartCore" 28 | }); 29 | 30 | PrivateDependencyModuleNames.AddRange( 31 | new [] 32 | { 33 | "CoreUObject", 34 | "Engine", 35 | "AssetRegistry" 36 | }); 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Heart/Private/HeartGraphSettings.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartGraphSettings.h" 4 | 5 | #include "GraphRegistry/HeartRegistryRuntimeSubsystem.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphSettings) 8 | 9 | #if WITH_EDITOR 10 | void UHeartGraphSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) 11 | { 12 | Super::PostEditChangeProperty(PropertyChangedEvent); 13 | 14 | if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(ThisClass, FallbackVisualizerRegistrar)) 15 | { 16 | GEngine->GetEngineSubsystem()->LoadFallbackRegistrar(); 17 | } 18 | } 19 | #endif -------------------------------------------------------------------------------- /Source/Heart/Private/HeartModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "HeartModule" 6 | 7 | void FHeartModule::StartupModule() 8 | { 9 | } 10 | 11 | void FHeartModule::ShutdownModule() 12 | { 13 | } 14 | 15 | #undef LOCTEXT_NAMESPACE 16 | 17 | IMPLEMENT_MODULE(FHeartModule, Heart) -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartExtensionQuery.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartExtensionQuery.h" 4 | #include "Model/HeartGraph.h" 5 | #include "Model/HeartGraphExtension.h" 6 | 7 | namespace Heart::Query 8 | { 9 | TExtensionQueryResult::TExtensionQueryResult(const TConstArrayView>& Src) 10 | : Reference([Src]() 11 | { 12 | TMap> Loose; 13 | 14 | for (auto Element : Src) 15 | { 16 | Loose.Add(Element->GetGuid(), Element); 17 | } 18 | 19 | return Loose; 20 | }()) {} 21 | 22 | TExtensionQueryResult::TExtensionQueryResult(const UHeartGraph* Src) 23 | : Reference(Src) {} 24 | 25 | const FExtensionMap& TExtensionQueryResult::SimpleData() const { return Reference->GetExtensions(); } 26 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphBlueprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphBlueprint.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphBlueprint) 6 | 7 | UHeartGraphBlueprint::UHeartGraphBlueprint(const FObjectInitializer& ObjectInitializer) 8 | : Super(ObjectInitializer) 9 | { 10 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphComponentBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphComponentBase.h" 4 | 5 | void UHeartGraphComponentBase::PostInitProperties() 6 | { 7 | Super::PostInitProperties(); 8 | if (!Guid.IsValid()) 9 | { 10 | Guid = FHeartExtensionGuid::New(); 11 | } 12 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphExtension.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphExtension.h" 4 | #include "Model/HeartGraph.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphExtension) 7 | 8 | UHeartGraph* UHeartGraphExtension::GetGraph() const 9 | { 10 | return GetTypedOuter(); 11 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphNode3D.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphNode3D.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphNode3D) 6 | 7 | FVector UHeartGraphNode3D::GetLocation3D() const 8 | { 9 | return FVector(Location, Height); 10 | } 11 | 12 | void UHeartGraphNode3D::SetLocation3D(const FVector& NewLocation) 13 | { 14 | SetLocation(FVector2D(NewLocation)); 15 | Height = NewLocation.Z; 16 | OnNodeLocation3DChanged.Broadcast(this, FVector(Location, Height)); 17 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphNodeBlueprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphNodeBlueprint.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphNodeBlueprint) 6 | 7 | UHeartGraphNodeBlueprint::UHeartGraphNodeBlueprint(const FObjectInitializer& ObjectInitializer) 8 | : Super(ObjectInitializer) 9 | { 10 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartGraphNodeComponent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartGraphNodeComponent.h" 4 | 5 | UHeartGraph* UHeartGraphNodeComponent::GetGraph() const 6 | { 7 | return GetOuterUHeartGraph(); 8 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartNodeQuery.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartNodeQuery.h" 4 | #include "Model/HeartGraph.h" 5 | #include "Model/HeartGraphNode.h" 6 | 7 | namespace Heart::Query 8 | { 9 | TNodeQueryResult::TNodeQueryResult(const TConstArrayView>& Src) 10 | : Reference([Src]() 11 | { 12 | TMap> Loose; 13 | 14 | for (auto Element : Src) 15 | { 16 | Loose.Add(Element->GetGuid(), Element); 17 | } 18 | 19 | return Loose; 20 | }()) {} 21 | 22 | TNodeQueryResult::TNodeQueryResult(const UHeartGraph* Src) 23 | : Reference(Src) {} 24 | 25 | const FNodeMap& TNodeQueryResult::SimpleData() const { return Reference->GetNodes(); } 26 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartPinQuery.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartPinQuery.h" 4 | #include "Model/HeartPinData.h" 5 | 6 | namespace Heart::Query 7 | { 8 | FPinQueryResult::FPinQueryResult(const FHeartNodePinData& Src) 9 | : Reference(Src) {} 10 | 11 | FPinQueryResult& FPinQueryResult::CustomSort() 12 | { 13 | return SortBy([this](const FHeartPinGuid& Key) 14 | { 15 | return Reference.PinOrder[Key]; 16 | }); 17 | } 18 | 19 | const TMap& FPinQueryResult::SimpleData() const 20 | { 21 | return Reference.PinDescriptions; 22 | } 23 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Model/HeartQueryObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Model/HeartQueryObject.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartQueryObject) -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/Actions/HeartAction_PinsEditProxy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/Actions/HeartAction_PinsEditProxy.h" 4 | #include "BloodContainer.h" 5 | #include "Model/HeartGraph.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartAction_PinsEditProxy) 8 | 9 | const FLazyName UHeartAction_PinsEditProxy::MementosStorage("proxy_mementos"); 10 | 11 | FHeartEvent UHeartAction_PinsEditProxy::ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, 12 | UObject* ContextObject, FBloodContainer& UndoData) const 13 | { 14 | checkfSlow(Activation.IsRedoAction(), TEXT("UHeartAction_PinsEditProxy should only be executed as a Redo!")) 15 | 16 | auto&& MementoData = UndoData.Get(MementosStorage); 17 | 18 | Graph->EditConnections().RestoreMementos(MementoData.New); 19 | 20 | return FHeartEvent::Handled; 21 | } 22 | 23 | bool UHeartAction_PinsEditProxy::Undo(UObject* Target, const FBloodContainer& UndoData) const 24 | { 25 | auto&& MementoData = UndoData.Get(MementosStorage); 26 | 27 | UHeartGraph* Graph = CastChecked(Target); 28 | 29 | Graph->EditConnections().RestoreMementos(MementoData.Original); 30 | 31 | return true; 32 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/Actions/HeartMultiUndoHelper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/Actions/HeartMultiUndoHelper.h" 4 | #include "Model/HeartGraph.h" 5 | #include "ModelView/HeartActionHistory.h" 6 | #include "ModelView/Actions/HeartAction_MultiUndoEnd.h" 7 | #include "ModelView/Actions/HeartAction_MultiUndoStart.h" 8 | 9 | namespace Heart::Action::History::MultiUndo 10 | { 11 | void Start(IHeartGraphInterface* Graph) 12 | { 13 | check(Graph) 14 | UHeartGraph* HeartGraph = Graph->GetHeartGraph(); 15 | if (!ensure(IsValid(HeartGraph))) 16 | { 17 | return; 18 | } 19 | 20 | if (UHeartActionHistory* History = HeartGraph->GetExtension(); 21 | IsValid(History)) 22 | { 23 | FHeartActionRecord Record; 24 | Record.Action = UHeartAction_MultiUndoStart::StaticClass(); 25 | Record.Arguments.Target = HeartGraph; 26 | History->AddRecord(Record); 27 | } 28 | } 29 | 30 | void End(IHeartGraphInterface* Graph) 31 | { 32 | check(Graph) 33 | UHeartGraph* HeartGraph = Graph->GetHeartGraph(); 34 | if (!ensure(IsValid(HeartGraph))) 35 | { 36 | return; 37 | } 38 | 39 | if (UHeartActionHistory* History = Graph->GetHeartGraph()->GetExtension(); 40 | IsValid(History)) 41 | { 42 | FHeartActionRecord Record; 43 | Record.Action = UHeartAction_MultiUndoEnd::StaticClass(); 44 | Record.Arguments.Target = HeartGraph; 45 | History->AddRecord(Record); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/HeartNodeLocationModifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/HeartNodeLocationModifier.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartNodeLocationModifier) 6 | 7 | FVector2D UHeartNodeLocationModifierStack::LocationToProxy(const FVector2D& Location) const 8 | { 9 | FVector2D Proxy = Location; 10 | 11 | for (int32 i = 0; i < Modifiers.Num(); ++i) 12 | { 13 | Proxy = Modifiers[i]->LocationToProxy(Proxy); 14 | } 15 | 16 | return Proxy; 17 | } 18 | 19 | FVector2D UHeartNodeLocationModifierStack::ProxyToLocation(const FVector2D& Proxy) const 20 | { 21 | FVector2D Location = Proxy; 22 | 23 | for (int32 i = Modifiers.Num() - 1; i >= 0; --i) 24 | { 25 | Location = Modifiers[i]->ProxyToLocation(Location); 26 | } 27 | 28 | return Location; 29 | } 30 | 31 | FVector UHeartNodeLocationModifierStack::LocationToProxy3D(const FVector& Location) const 32 | { 33 | FVector Proxy = Location; 34 | 35 | for (int32 i = 0; i < Modifiers.Num(); ++i) 36 | { 37 | Proxy = Modifiers[i]->LocationToProxy3D(Proxy); 38 | } 39 | 40 | return Proxy; 41 | } 42 | 43 | FVector UHeartNodeLocationModifierStack::ProxyToLocation3D(const FVector& Proxy) const 44 | { 45 | FVector Location = Proxy; 46 | 47 | for (int32 i = Modifiers.Num() - 1; i >= 0; --i) 48 | { 49 | Location = Modifiers[i]->ProxyToLocation3D(Location); 50 | } 51 | 52 | return Location; 53 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/Layouts/HeartLayout_FruchtermanReingold.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/Layouts/HeartLayout_FruchtermanReingold.h" 4 | #include "Model/HeartGraphInterface.h" 5 | #include "Model/HeartGuids.h" 6 | #include "Algorithms/FruchtermanReingold.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartLayout_FruchtermanReingold) 9 | 10 | bool UHeartLayout_FruchtermanReingold::Layout(IHeartGraphInterface* Interface, 11 | const TArray& Nodes, const float DeltaTime) 12 | { 13 | TArray Positions; 14 | Positions.Reserve(Nodes.Num()); 15 | Algo::Transform(Nodes, Positions, 16 | [Interface](const FHeartNodeGuid& Node) 17 | { 18 | return Interface->GetNodeLocation(Node); 19 | }); 20 | 21 | //if (!Algorithm.IsSet()) 22 | { 23 | // @todo rebuild this when graph changes! 24 | AdjacencyList = GetGraphAdjacencyList(Interface, Nodes); 25 | Algorithm = Nodesoup::FruchtermanReingold(AdjacencyList.AdjacencyList, Strength); 26 | } 27 | 28 | Accum += DeltaTime; 29 | const float IterationInterval = 1.f / IterationsPerSecond; 30 | while (Accum > IterationInterval) 31 | { 32 | Algorithm.GetValue()(Positions); 33 | Accum -= IterationInterval; 34 | } 35 | 36 | ApplyNewPositions(Interface->_getUObject(), Nodes, Positions); 37 | 38 | return true; 39 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/Layouts/HeartLayout_KamadaKawai.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/Layouts/HeartLayout_KamadaKawai.h" 4 | #include "Model/HeartGraphInterface.h" 5 | #include "Algorithms/Nodesoup.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartLayout_KamadaKawai) 8 | 9 | bool UHeartLayout_KamadaKawai::Layout(IHeartGraphInterface* Interface, const TArray& Nodes) 10 | { 11 | const FHeartGraphAdjacencyList GraphAdjacencyList = GetGraphAdjacencyList(Interface, Nodes); 12 | 13 | const TArray NewPositions = Nodesoup::kamada_kawai(GraphAdjacencyList.AdjacencyList, Width, Height, Strength, EnergyThreshold); 14 | 15 | ApplyNewPositions(Interface->_getUObject(), Nodes, NewPositions); 16 | 17 | return true; 18 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/Layouts/HeartLayout_TestSpinner.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/Layouts/HeartLayout_TestSpinner.h" 4 | #include "Model/HeartGraphInterface.h" 5 | #include "Model/HeartGuids.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartLayout_TestSpinner) 8 | 9 | bool UHeartLayout_TestSpinner::Layout(IHeartGraphInterface* Interface, 10 | const TArray& Nodes, const float DeltaTime) 11 | { 12 | TArray Positions; 13 | Positions.Reserve(Nodes.Num()); 14 | Algo::Transform(Nodes, Positions, 15 | [Interface](const FHeartNodeGuid& Node) 16 | { 17 | return Interface->GetNodeLocation(Node); 18 | }); 19 | 20 | for (auto& Position : Positions) 21 | { 22 | Position = Position.GetRotated(360.0 * DeltaTime); 23 | } 24 | 25 | ApplyNewPositions(Interface->_getUObject(), Nodes, Positions); 26 | 27 | return true; 28 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/LocationModifiers/HeartNodeLocationModifier_CartesianToPolar.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/LocationModifiers/HeartNodeLocationModifier_CartesianToPolar.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartNodeLocationModifier_CartesianToPolar) 6 | 7 | FVector2D UHeartNodeLocationModifier_CartesianToPolar::LocationToProxy(const FVector2D& Location) const 8 | { 9 | double Radius; 10 | double Angle; 11 | FMath::CartesianToPolar(Location.X, Location.Y, Radius, Angle); 12 | return FVector2D::UnitX().GetRotated(Angle) * Radius; 13 | } 14 | 15 | FVector2D UHeartNodeLocationModifier_CartesianToPolar::ProxyToLocation(const FVector2D& Proxy) const 16 | { 17 | const double Radius = Proxy.Length(); 18 | const double Angle = FMath::RadiansToDegrees(FMath::Atan2(Proxy.Y, Proxy.X)); 19 | FVector2D OutCartesian; 20 | FMath::PolarToCartesian(Radius, Angle, OutCartesian.X, OutCartesian.Y); 21 | return OutCartesian; 22 | } 23 | 24 | FVector UHeartNodeLocationModifier_CartesianToPolar::LocationToProxy3D(const FVector& Location) const 25 | { 26 | double Radius; 27 | double Angle; 28 | FMath::CartesianToPolar(Location.X, Location.Y, Radius, Angle); 29 | return FVector::ForwardVector.RotateAngleAxis(Angle, FVector::UpVector) * Radius; 30 | } 31 | 32 | FVector UHeartNodeLocationModifier_CartesianToPolar::ProxyToLocation3D(const FVector& Proxy) const 33 | { 34 | const double Radius = Proxy.Length(); 35 | const double Angle = FMath::RadiansToDegrees(FMath::Atan2(Proxy.Y, Proxy.X)); 36 | FVector OutCartesian; 37 | FMath::PolarToCartesian(Radius, Angle, OutCartesian.X, OutCartesian.Y); 38 | OutCartesian.Z = Proxy.Z; 39 | return OutCartesian; 40 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToGrid.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToGrid.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartNodeLocationModifier_SnapToGrid) 6 | 7 | template 8 | static T Snap(T Value, T Grid) 9 | { 10 | return Grid * FMath::RoundHalfToEven(Value / Grid); 11 | } 12 | 13 | FVector2D UHeartNodeLocationModifier_SnapToGrid::LocationToProxy(const FVector2D& Location) const 14 | { 15 | FVector2D Proxy; 16 | Proxy.X = SnapOnX ? Snap(Location.X, GridX) : Location.X; 17 | Proxy.Y = SnapOnY ? Snap(Location.Y, GridY) : Location.Y; 18 | return Proxy; 19 | } 20 | 21 | FVector2D UHeartNodeLocationModifier_SnapToGrid::ProxyToLocation(const FVector2D& Proxy) const 22 | { 23 | // Snapping is destructive. Original location is lost, just return proxy. 24 | return Proxy; 25 | } 26 | 27 | FVector UHeartNodeLocationModifier_SnapToGrid::LocationToProxy3D(const FVector& Location) const 28 | { 29 | FVector Proxy; 30 | Proxy.X = SnapOnX ? Snap(Location.X, GridX) : Location.X; 31 | Proxy.Y = SnapOnY ? Snap(Location.Y, GridY) : Location.Y; 32 | Proxy.Z = SnapOnZ ? Snap(Location.Z, GridZ) : Location.Z; 33 | return Proxy; 34 | } 35 | 36 | FVector UHeartNodeLocationModifier_SnapToGrid::ProxyToLocation3D(const FVector& Proxy) const 37 | { 38 | // Snapping is destructive. Original location is lost, just return proxy. 39 | return Proxy; 40 | } -------------------------------------------------------------------------------- /Source/Heart/Private/ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToHex.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToHex.h" 4 | #include "General/HeartHex.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartNodeLocationModifier_SnapToHex) 7 | 8 | FVector2D UHeartNodeLocationModifier_SnapToHex::LocationToProxy(const FVector2D& Location) const 9 | { 10 | switch (Orientation) 11 | { 12 | default: 13 | case EHeartHexOrientation::FlatTop: 14 | return Heart::Hex::SnapToNearestHex_Flat(Location, GridSize); 15 | case EHeartHexOrientation::PointyTop: 16 | return Heart::Hex::SnapToNearestHex_Pointy(Location, GridSize); 17 | } 18 | } 19 | 20 | FVector2D UHeartNodeLocationModifier_SnapToHex::ProxyToLocation(const FVector2D& Proxy) const 21 | { 22 | // Snapping is destructive. Original location is lost, just return proxy. 23 | return Proxy; 24 | } 25 | 26 | FVector UHeartNodeLocationModifier_SnapToHex::LocationToProxy3D(const FVector& Location) const 27 | { 28 | switch (Orientation) 29 | { 30 | default: 31 | case EHeartHexOrientation::FlatTop: 32 | return FVector(Heart::Hex::SnapToNearestHex_Flat(FVector2D(Location.X, Location.Y), GridSize), Location.Z); 33 | case EHeartHexOrientation::PointyTop: 34 | return FVector(Heart::Hex::SnapToNearestHex_Pointy(FVector2D(Location.X, Location.Y), GridSize), Location.Z); 35 | } 36 | } 37 | 38 | FVector UHeartNodeLocationModifier_SnapToHex::ProxyToLocation3D(const FVector& Proxy) const 39 | { 40 | // Snapping is destructive. Original location is lost, just return proxy. 41 | return Proxy; 42 | } -------------------------------------------------------------------------------- /Source/Heart/Private/Nodes/HeartAnnotationBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Nodes/HeartAnnotationBase.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartAnnotationBase) 6 | 7 | FText UHeartComment_Text::GetCommentText() const 8 | { 9 | return CommentText; 10 | } 11 | 12 | void UHeartComment_Text::SetCommentText(const FText& Text) 13 | { 14 | CommentText = Text; 15 | } 16 | 17 | TSoftObjectPtr UHeartComment_Image::GetCommentImage() const 18 | { 19 | return CommentImage; 20 | } 21 | 22 | void UHeartComment_Image::SetCommentImage(const TSoftObjectPtr& Image) 23 | { 24 | CommentImage = Image; 25 | } -------------------------------------------------------------------------------- /Source/Heart/Private/View/HeartVisualizerInterfaces.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "View/HeartVisualizerInterfaces.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartVisualizerInterfaces) -------------------------------------------------------------------------------- /Source/Heart/Private/View/PinConnectionStatusInterface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "View/PinConnectionStatusInterface.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(PinConnectionStatusInterface) -------------------------------------------------------------------------------- /Source/Heart/Public/HeartGraphSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Engine/DeveloperSettings.h" 6 | #include "HeartGraphSettings.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS(config = Plugins, defaultconfig, DisplayName = "Heart Graph") 12 | class HEART_API UHeartGraphSettings : public UDeveloperSettings 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | #if WITH_EDITOR 18 | virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; 19 | #endif 20 | 21 | //~ Begin UDeveloperSettings 22 | virtual FName GetCategoryName() const override { return FName("Plugins"); } 23 | //~ End UDeveloperSettings 24 | 25 | // Enables creation of the Heart Registry Runtime Subsystem outside the editor. Imposes a small performance hit 26 | // during startup, and a small memory footprint, but is required for using the Node Registries during gameplay. 27 | UPROPERTY(config, EditAnywhere, Category = "Registry|Runtime") 28 | bool CreateRuntimeRegistrySubsystem = false; 29 | 30 | // Visualizers to use when none other can be found via the Heart Registries 31 | UPROPERTY(config, EditAnywhere, Category = "Registry|Runtime", meta = (AllowedClasses = "/Script/Heart.GraphNodeRegistrar")) 32 | FSoftObjectPath FallbackVisualizerRegistrar; 33 | 34 | #if WITH_EDITORONLY_DATA 35 | // If this is enabled, the error message to add UGraphNodeRegistrar to the AssetRegistry will not be displayed. 36 | // This should only be enabled if Registrars are not being used, or are being registered manually by game code. 37 | UPROPERTY(config, EditAnywhere, Category = "Registry|Editor") 38 | bool DisableAssetRegistryError = false; 39 | #endif 40 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/HeartModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartModule : public IModuleInterface 8 | { 9 | public: 10 | /** IModuleInterface implementation */ 11 | virtual void StartupModule() override; 12 | virtual void ShutdownModule() override; 13 | }; 14 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartExtensionQuery.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGuids.h" 6 | #include "HeartQueries.h" 7 | 8 | class UHeartGraph; 9 | class UHeartGraphExtension; 10 | 11 | namespace Heart::Query 12 | { 13 | // Data-type queries by extension queries 14 | using FExtensionMap = TMap>; 15 | 16 | // Stub for extension query templates 17 | template 18 | class TExtensionQueryResult 19 | { 20 | }; 21 | 22 | // Specialization for loose arrays of extensions. May be from multiple graphs, or a subset of just one. 23 | template<> 24 | class HEART_API TExtensionQueryResult : public 25 | TMapQueryBase, FHeartExtensionGuid, TObjectPtr> 26 | { 27 | friend TMapQueryBase; 28 | 29 | public: 30 | TExtensionQueryResult(const TConstArrayView>& Src); 31 | 32 | const FExtensionMap& SimpleData() const { return Reference; } 33 | 34 | private: 35 | const FExtensionMap Reference; 36 | }; 37 | 38 | // Specialization for querying all extensions in a graph 39 | template<> 40 | class HEART_API TExtensionQueryResult : public 41 | TMapQueryBase, FHeartExtensionGuid, TObjectPtr> 42 | { 43 | friend TMapQueryBase; 44 | 45 | public: 46 | TExtensionQueryResult(const UHeartGraph* Src); 47 | 48 | const FExtensionMap& SimpleData() const; 49 | 50 | private: 51 | const UHeartGraph* Reference; 52 | }; 53 | } -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphBlueprint.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Engine/Blueprint.h" 6 | #include "HeartGraphBlueprint.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEART_API UHeartGraphBlueprint : public UBlueprint 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | UHeartGraphBlueprint(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); 18 | 19 | #if WITH_EDITOR 20 | //~ UBlueprint 21 | virtual bool SupportedByDefaultBlueprintFactory() const override { return false; } 22 | //~ UBlueprint 23 | #endif 24 | }; 25 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphComponentBase.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "HeartGuids.h" 7 | #include "HeartGraphComponentBase.generated.h" 8 | 9 | /** 10 | * Base class for component objects that can be added to Graphs or Nodes. 11 | */ 12 | UCLASS(Abstract) 13 | class HEART_API UHeartGraphComponentBase : public UObject 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | virtual void PostInitProperties() override; 19 | 20 | virtual void PostComponentAdded() {} 21 | virtual void PreComponentRemoved() {} 22 | 23 | FHeartExtensionGuid GetGuid() const { return Guid; } 24 | 25 | protected: 26 | UPROPERTY(BlueprintReadOnly, Category = "Extension") 27 | FHeartExtensionGuid Guid; 28 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphExtension.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphComponentBase.h" 6 | #include "HeartGraphExtension.generated.h" 7 | 8 | class UHeartGraph; 9 | 10 | /** 11 | * Extensions are the HeartGraph equivalent to 'ActorComponents'. They are added to graphs by their schema, or manually 12 | * at runtime. 13 | */ 14 | UCLASS(Abstract, BlueprintType, Blueprintable, EditInlineNew) 15 | class HEART_API UHeartGraphExtension : public UHeartGraphComponentBase 16 | { 17 | GENERATED_BODY() 18 | 19 | friend UHeartGraph; 20 | 21 | public: 22 | // Get the owning Heart Graph 23 | UFUNCTION(BlueprintCallable, Category = "Heart|Extension") 24 | UHeartGraph* GetGraph() const; 25 | 26 | virtual void PostComponentAdded() override 27 | { 28 | PRAGMA_DISABLE_DEPRECATION_WARNINGS 29 | PostExtensionAdded(); 30 | PRAGMA_ENABLE_DEPRECATION_WARNINGS 31 | } 32 | 33 | virtual void PreComponentRemoved() override 34 | { 35 | PRAGMA_DISABLE_DEPRECATION_WARNINGS 36 | PreExtensionRemove(); 37 | PRAGMA_ENABLE_DEPRECATION_WARNINGS 38 | } 39 | 40 | protected: 41 | UE_DEPRECATED(5.5, "Renamed to PostComponentAdded") 42 | virtual void PostExtensionAdded() {} 43 | 44 | UE_DEPRECATED(5.5, "Renamed to PreComponentRemove") 45 | virtual void PreExtensionRemove() {} 46 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphNode3D.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphNode.h" 6 | #include "HeartGraphNode3D.generated.h" 7 | 8 | DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnGraphNodeLocation3DChanged, class UHeartGraphNode3D*, Node, const FVector&, Location); 9 | 10 | /** 11 | * Base class for nodes that are represented in 3 dimensions. 12 | */ 13 | UCLASS(Abstract) 14 | class HEART_API UHeartGraphNode3D : public UHeartGraphNode 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | UFUNCTION(BlueprintCallable, Category = "Heart|GraphNode3D") 20 | FVector GetLocation3D() const; 21 | 22 | UFUNCTION(BlueprintCallable, Category = "Heart|GraphNode3D") 23 | void SetLocation3D(const FVector& NewLocation); 24 | 25 | UPROPERTY(BlueprintAssignable, Transient, Category = "Events") 26 | FOnGraphNodeLocation3DChanged OnNodeLocation3DChanged; 27 | 28 | private: 29 | UPROPERTY() 30 | double Height; 31 | }; 32 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphNodeBlueprint.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Engine/Blueprint.h" 6 | #include "HeartGraphNodeBlueprint.generated.h" 7 | 8 | /** 9 | * A specialized blueprint class required for customizing Asset Type Actions 10 | */ 11 | UCLASS(BlueprintType) 12 | class HEART_API UHeartGraphNodeBlueprint : public UBlueprint 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | UHeartGraphNodeBlueprint(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); 18 | 19 | #if WITH_EDITOR 20 | //~ UBlueprint 21 | virtual bool SupportedByDefaultBlueprintFactory() const override { return false; } 22 | virtual bool SupportsDelegates() const override { return false; } 23 | //~ UBlueprint 24 | #endif 25 | }; 26 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphNodeComponent.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphComponentBase.h" 6 | #include "HeartGraphNodeComponent.generated.h" 7 | 8 | class UHeartGraph; 9 | 10 | /** 11 | * 12 | */ 13 | UCLASS(Abstract, BlueprintType, Blueprintable, Within = HeartGraph) 14 | class HEART_API UHeartGraphNodeComponent : public UHeartGraphComponentBase 15 | { 16 | GENERATED_BODY() 17 | 18 | friend class UHeartGraph; 19 | 20 | public: 21 | UFUNCTION(BlueprintCallable, Category = "Heart|GraphNodeComponent") 22 | UHeartGraph* GetGraph() const; 23 | }; 24 | 25 | 26 | USTRUCT() 27 | struct FHeartGraphNodeComponentMap 28 | { 29 | GENERATED_BODY() 30 | 31 | UPROPERTY(VisibleAnywhere, Category = "NodeComponents") 32 | TMap> Components; 33 | 34 | TObjectPtr Find(const FHeartNodeGuid& Node) const 35 | { 36 | if (auto&& NodePtr = Components.Find(Node)) 37 | { 38 | return *NodePtr; 39 | } 40 | return nullptr; 41 | } 42 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphNodeInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartGraphNodeInterface.generated.h" 7 | 8 | class UHeartGraphNode; 9 | 10 | UINTERFACE(NotBlueprintable) 11 | class HEART_API UHeartGraphNodeInterface : public UInterface 12 | { 13 | GENERATED_BODY() 14 | }; 15 | 16 | class HEART_API IHeartGraphNodeInterface 17 | { 18 | GENERATED_BODY() 19 | 20 | public: 21 | UFUNCTION(BlueprintCallable, Category = "Heart|Node") 22 | virtual UHeartGraphNode* GetHeartGraphNode() const PURE_VIRTUAL(IHeartGraphNodeInterface::GetHeartGraphNode, return nullptr; ) 23 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphPinInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartGuids.h" 7 | #include "HeartGraphPinInterface.generated.h" 8 | 9 | class UHeartGraphNode; 10 | 11 | UINTERFACE(NotBlueprintable) 12 | class HEART_API UHeartGraphPinInterface : public UInterface 13 | { 14 | GENERATED_BODY() 15 | }; 16 | 17 | class HEART_API IHeartGraphPinInterface 18 | { 19 | GENERATED_BODY() 20 | 21 | public: 22 | UFUNCTION(BlueprintCallable, Category = "Heart|Pin") 23 | virtual UHeartGraphNode* GetHeartGraphNode() const PURE_VIRTUAL(IHeartGraphPinInterface::GetGraphNode, return nullptr; ) 24 | 25 | UFUNCTION(BlueprintCallable, Category = "Heart|Pin") 26 | virtual FHeartPinGuid GetPinGuid() const PURE_VIRTUAL(IHeartGraphPinInterface::GetPinGuid, return FHeartPinGuid(); ) 27 | }; 28 | 29 | UINTERFACE() 30 | class HEART_API UHeartGraphPinInterfaceBP : public UHeartGraphPinInterface 31 | { 32 | GENERATED_BODY() 33 | }; 34 | 35 | class HEART_API IHeartGraphPinInterfaceBP : public IHeartGraphPinInterface 36 | { 37 | GENERATED_BODY() 38 | 39 | protected: 40 | // Defer to Blueprint implementations 41 | 42 | virtual UHeartGraphNode* GetHeartGraphNode() const override final 43 | { 44 | return Execute_GetNode_BP(_getUObject()); 45 | } 46 | 47 | virtual FHeartPinGuid GetPinGuid() const override final 48 | { 49 | return Execute_GetPinGuid_BP(_getUObject()); 50 | } 51 | 52 | public: 53 | UFUNCTION(BlueprintNativeEvent, Category = "Heart|Pin") 54 | UHeartGraphNode* GetNode_BP(); 55 | 56 | UFUNCTION(BlueprintNativeEvent, Category = "Heart|Pin") 57 | FHeartPinGuid GetPinGuid_BP() const; 58 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphPinMetadata.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "HeartGraphPinMetadata.generated.h" 7 | 8 | /** 9 | * Base class for per-pin instanced metadata. 10 | */ 11 | UCLASS(Blueprintable, BlueprintType, Abstract, DefaultToInstanced) 12 | class HEART_API UHeartGraphPinMetadata : public UObject 13 | { 14 | GENERATED_BODY() 15 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartGraphPinTag.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "GameplayTagContainer.h" 6 | 7 | #include "General/GameplayTagChildImplementerCopy.h" 8 | 9 | #include "HeartGraphPinTag.generated.h" 10 | 11 | /** 12 | * Tag to use to identify types of Heart Graph pins. 13 | */ 14 | USTRUCT(BlueprintType, meta = (Categories = "Heart.Pin")) 15 | struct HEART_API FHeartGraphPinTag : public FGameplayTag 16 | { 17 | GENERATED_BODY() 18 | 19 | FORCEINLINE friend uint32 GetTypeHash(const FHeartGraphPinTag& Tag) 20 | { 21 | return GetTypeHash(Tag.TagName); 22 | } 23 | 24 | END_HEART_TAG_DECL(FHeartGraphPinTag, TEXT("Heart.Pin")) 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartNodeQuery.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGuids.h" 6 | #include "HeartQueries.h" 7 | 8 | class UHeartGraph; 9 | class UHeartGraphNode; 10 | 11 | namespace Heart::Query 12 | { 13 | // Data-type queries by node queries 14 | using FNodeMap = TMap>; 15 | 16 | // Stub for node query templates 17 | template 18 | class TNodeQueryResult 19 | { 20 | }; 21 | 22 | // Specialization for loose arrays of nodes. May be from multiple graphs, or a subset of just one. 23 | template<> 24 | class HEART_API TNodeQueryResult : public 25 | TMapQueryBase, FHeartNodeGuid, TObjectPtr> 26 | { 27 | friend TMapQueryBase; 28 | 29 | public: 30 | TNodeQueryResult(const TConstArrayView>& Src); 31 | 32 | const FNodeMap& SimpleData() const { return Reference; } 33 | 34 | private: 35 | const FNodeMap Reference; 36 | }; 37 | 38 | // Specialization for querying all nodes in a graph 39 | template<> 40 | class HEART_API TNodeQueryResult : public 41 | TMapQueryBase, FHeartNodeGuid, TObjectPtr> 42 | { 43 | friend TMapQueryBase; 44 | 45 | public: 46 | TNodeQueryResult(const UHeartGraph* Src); 47 | 48 | const FNodeMap& SimpleData() const; 49 | 50 | private: 51 | const UHeartGraph* Reference; 52 | }; 53 | 54 | using FGraphNodeQuery = TNodeQueryResult; 55 | } -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartPinDirection.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartPinDirection.generated.h" 6 | 7 | /** 8 | * 9 | */ 10 | UENUM(BlueprintType) 11 | enum class EHeartPinDirection : uint8 12 | { 13 | None = 0 UMETA(Hidden), 14 | Input = 1 << 0, 15 | Output = 1 << 1, 16 | 17 | Bidirectional = Input | Output 18 | }; 19 | 20 | ENUM_CLASS_FLAGS(EHeartPinDirection) 21 | -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartPinQuery.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphPinDesc.h" 6 | #include "HeartGuids.h" 7 | #include "HeartQueries.h" 8 | 9 | struct FHeartNodePinData; 10 | 11 | namespace Heart::Query 12 | { 13 | class HEART_API FPinQueryResult : public TMapQueryBase 14 | { 15 | friend TMapQueryBase; 16 | 17 | public: 18 | FPinQueryResult(const FHeartNodePinData& Src); 19 | 20 | // Sort the results by their Pin Order 21 | FPinQueryResult& CustomSort(); 22 | 23 | const TMap& SimpleData() const; 24 | 25 | private: 26 | const FHeartNodePinData& Reference; 27 | }; 28 | } -------------------------------------------------------------------------------- /Source/Heart/Public/Model/HeartQueryObject.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "HeartQueryObject.generated.h" 7 | 8 | namespace Heart::Query 9 | { 10 | class IMapQuery; 11 | } 12 | 13 | /** 14 | * A UObject wrapper around Heart Map Queries 15 | */ 16 | UCLASS() 17 | class HEART_API UHeartQueryObject : public UObject 18 | { 19 | GENERATED_BODY() 20 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_AutoLayout.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/Actions/HeartGraphAction.h" 6 | #include "HeartAction_AutoLayout.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEART_API UHeartAction_AutoLayout : public UHeartGraphAction 13 | { 14 | GENERATED_BODY() 15 | 16 | protected: 17 | virtual bool CanExecute(const UObject* Target) const override; 18 | virtual FHeartEvent ExecuteOnGraph(IHeartGraphInterface* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 19 | virtual bool CanUndo(const UObject* Target) const override { return true; } 20 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 21 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_DeleteNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphAction.h" 6 | #include "Model/HeartPinConnectionEdit.h" 7 | #include "HeartAction_DeleteNode.generated.h" 8 | 9 | USTRUCT() 10 | struct FHeartDeleteNodeUndoData 11 | { 12 | GENERATED_BODY() 13 | 14 | UPROPERTY() 15 | TObjectPtr DeletedNode; 16 | 17 | TMap Mementos; 18 | 19 | bool Serialize(FArchive& Ar); 20 | }; 21 | 22 | template<> 23 | struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 24 | { 25 | enum 26 | { 27 | WithSerializer = true, 28 | }; 29 | }; 30 | 31 | /** 32 | * 33 | */ 34 | UCLASS() 35 | class HEART_API UHeartAction_DeleteNode : public UHeartGraphAction 36 | { 37 | GENERATED_BODY() 38 | 39 | protected: 40 | virtual bool CanExecute(const UObject* Object) const override; 41 | virtual FHeartEvent ExecuteOnNode(UHeartGraphNode* Node, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 42 | virtual bool CanUndo(const UObject* Target) const override { return true; } 43 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 44 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_DisconnectPins.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphAction.h" 6 | #include "Model/HeartPinConnectionEdit.h" 7 | #include "HeartAction_DisconnectPins.generated.h" 8 | 9 | class IHeartGraphPinInterface; 10 | 11 | USTRUCT() 12 | struct FHeartDisconnectPinsUndoData 13 | { 14 | GENERATED_BODY() 15 | 16 | TSoftObjectPtr TargetNode; 17 | TMap Mementos; 18 | 19 | bool Serialize(FArchive& Ar); 20 | }; 21 | 22 | template<> 23 | struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 24 | { 25 | enum 26 | { 27 | WithSerializer = true, 28 | }; 29 | }; 30 | 31 | /** 32 | * 33 | */ 34 | UCLASS() 35 | class HEART_API UHeartAction_DisconnectPins : public UHeartGraphAction 36 | { 37 | GENERATED_BODY() 38 | 39 | protected: 40 | virtual bool CanExecute(const UObject* Object) const override; 41 | virtual FHeartEvent ExecuteOnPin(const TScriptInterface&, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 42 | virtual FHeartEvent ExecuteOnNode(UHeartGraphNode* Node, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 43 | virtual bool CanUndo(const UObject* Target) const override { return true; } 44 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 45 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_MoveNodeProxy.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphAction.h" 6 | #include "Model/HeartGuids.h" 7 | #include "HeartAction_MoveNodeProxy.generated.h" 8 | 9 | USTRUCT() 10 | struct FHeartMoveNodeProxyLocationPair 11 | { 12 | GENERATED_BODY() 13 | 14 | UPROPERTY() 15 | FVector2D Original = FVector2D::ZeroVector; 16 | 17 | UPROPERTY() 18 | FVector2D New = FVector2D::ZeroVector; 19 | }; 20 | 21 | USTRUCT() 22 | struct FHeartMoveNodeProxyUndoData 23 | { 24 | GENERATED_BODY() 25 | 26 | UPROPERTY() 27 | TMap Locations; 28 | }; 29 | 30 | /** 31 | * 32 | */ 33 | UCLASS(Hidden) 34 | class HEART_API UHeartAction_MoveNodeProxy final : public UHeartGraphAction 35 | { 36 | GENERATED_BODY() 37 | 38 | public: 39 | static const FLazyName LocationStorage; 40 | 41 | protected: 42 | virtual FText GetDescription(const UObject* Target) const override; 43 | virtual bool CanExecute(const UObject* Target) const override { return true; } 44 | virtual FHeartEvent ExecuteOnGraph(IHeartGraphInterface* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 45 | virtual bool CanUndo(const UObject* Target) const override { return true; } 46 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 47 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_MultiUndoEnd.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartActionBase.h" 6 | #include "HeartAction_MultiUndoEnd.generated.h" 7 | 8 | /** 9 | * This action class is a scope marker for collapsing multiple actions into a single undo/redo group. 10 | * This the is "End" scope, and is only ever ran as an Undo. 11 | */ 12 | UCLASS(MinimalAPI) 13 | class UHeartAction_MultiUndoEnd final : public UHeartActionBase 14 | { 15 | GENERATED_BODY() 16 | 17 | protected: 18 | virtual FText GetDescription(const UObject* Target) const override; 19 | virtual bool CanExecute(const UObject* Target) const override { return false; } 20 | virtual bool CanUndo(const UObject* Target) const override { return true; } 21 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 22 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_MultiUndoStart.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartActionBase.h" 6 | #include "HeartAction_MultiUndoStart.generated.h" 7 | 8 | /** 9 | * This action class is a scope marker for collapsing multiple actions into a single undo/redo group. 10 | * This the is "Start" scope, and is only ever ran as a Redo. 11 | */ 12 | UCLASS(MinimalAPI) 13 | class UHeartAction_MultiUndoStart final : public UHeartActionBase 14 | { 15 | GENERATED_BODY() 16 | 17 | protected: 18 | virtual FText GetDescription(const UObject* Target) const override; 19 | virtual bool CanExecute(const UObject* Target) const override { return true; } 20 | virtual FHeartEvent Execute(const Heart::Action::FArguments& Arguments) const override; 21 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartAction_PinsEditProxy.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphAction.h" 6 | #include "Model/HeartPinConnectionEdit.h" 7 | #include "HeartAction_PinsEditProxy.generated.h" 8 | 9 | USTRUCT() 10 | struct FHeartPinsEditProxyUndoData 11 | { 12 | GENERATED_BODY() 13 | 14 | TMap Original; 15 | TMap New; 16 | 17 | bool Serialize(FArchive& Ar) 18 | { 19 | return !(Ar << Original << New).IsError(); 20 | } 21 | }; 22 | 23 | template<> 24 | struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 25 | { 26 | enum 27 | { 28 | WithSerializer = true, 29 | }; 30 | }; 31 | 32 | /** 33 | * 34 | */ 35 | UCLASS(Hidden) 36 | class HEART_API UHeartAction_PinsEditProxy : public UHeartGraphAction 37 | { 38 | GENERATED_BODY() 39 | 40 | public: 41 | static const FLazyName MementosStorage; 42 | 43 | protected: 44 | virtual bool CanExecute(const UObject* Target) const override { return true; } 45 | virtual FHeartEvent ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 46 | virtual bool CanUndo(const UObject* Target) const override { return true; } 47 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 48 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartHistoryActions.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphAction.h" 6 | #include "HeartHistoryActions.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEART_API UHeartUndoAction : public UHeartGraphAction 13 | { 14 | GENERATED_BODY() 15 | 16 | protected: 17 | virtual bool CanExecute(const UObject* Target) const override { return true; } 18 | virtual FHeartEvent ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 19 | virtual FHeartEvent ExecuteOnNode(UHeartGraphNode* Node, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 20 | virtual FHeartEvent ExecuteOnPin(const TScriptInterface& Pin, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 21 | }; 22 | 23 | /** 24 | * 25 | */ 26 | UCLASS() 27 | class HEART_API UHeartRedoAction : public UHeartGraphAction 28 | { 29 | GENERATED_BODY() 30 | 31 | protected: 32 | virtual bool CanExecute(const UObject* Target) const override { return true; } 33 | virtual FHeartEvent ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 34 | virtual FHeartEvent ExecuteOnNode(UHeartGraphNode* Node, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 35 | virtual FHeartEvent ExecuteOnPin(const TScriptInterface& Pin, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 36 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Actions/HeartMultiUndoHelper.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | class IHeartGraphInterface; 6 | 7 | // Utilities for creating a grouped set of actions that get undone/redone together 8 | namespace Heart::Action::History::MultiUndo 9 | { 10 | HEART_API void Start(IHeartGraphInterface* Graph); 11 | HEART_API void End(IHeartGraphInterface* Graph); 12 | } -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/HeartNodeLocationModifier.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "HeartNodeLocationModifier.generated.h" 7 | 8 | 9 | UCLASS(Abstract, const, EditInlineNew, CollapseCategories) 10 | class HEART_API UHeartNodeLocationModifier : public UObject 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual FVector2D LocationToProxy(const FVector2D& Location) const PURE_VIRTUAL(UHeartNodeLocationProxyLayer::LocationToProxy, return FVector2D(); ) 16 | virtual FVector2D ProxyToLocation(const FVector2D& Proxy) const PURE_VIRTUAL(UHeartNodeLocationProxyLayer::ProxyToLocation, return FVector2D(); ) 17 | 18 | virtual FVector LocationToProxy3D(const FVector& Location) const PURE_VIRTUAL(UHeartNodeLocationProxyLayer::LocationToProxy3D, return FVector(); ) 19 | virtual FVector ProxyToLocation3D(const FVector& Proxy) const PURE_VIRTUAL(UHeartNodeLocationProxyLayer::ProxyToLocation3D, return FVector(); ) 20 | }; 21 | 22 | 23 | UCLASS(NotEditInlineNew) 24 | class HEART_API UHeartNodeLocationModifierStack : public UHeartNodeLocationModifier 25 | { 26 | GENERATED_BODY() 27 | 28 | public: 29 | virtual FVector2D LocationToProxy(const FVector2D& Location) const override final; 30 | virtual FVector2D ProxyToLocation(const FVector2D& Proxy) const override final; 31 | 32 | virtual FVector LocationToProxy3D(const FVector& Location) const override final; 33 | virtual FVector ProxyToLocation3D(const FVector& Proxy) const override final; 34 | 35 | protected: 36 | UPROPERTY(Instanced, EditInstanceOnly, Category = "Config", NoClear, meta = (ShowInnerProperties)) 37 | TArray> Modifiers; 38 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Layouts/HeartLayout_FruchtermanReingold.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Algorithms/FruchtermanReingold.h" 6 | #include "ModelView/HeartLayoutHelper.h" 7 | #include "HeartLayout_FruchtermanReingold.generated.h" 8 | 9 | /** 10 | * An iterative layout implementation of Fruchterman-Reingold that runs on tick. 11 | */ 12 | UCLASS(DisplayName = "Heart Layout Fruchterman-Reingold") 13 | class HEART_API UHeartLayout_FruchtermanReingold : public UHeartLayoutHelper 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | virtual bool Layout(IHeartGraphInterface* Interface, const TArray& Nodes, float DeltaTime) override; 19 | 20 | protected: 21 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") 22 | double Strength = 300.0; 23 | 24 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config", meta = (UIMin = 1, UIMax = 300)) 25 | int32 IterationsPerSecond = 60; 26 | 27 | FHeartGraphAdjacencyList AdjacencyList; 28 | 29 | TOptional Algorithm; 30 | 31 | float Accum = 0; 32 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Layouts/HeartLayout_KamadaKawai.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/HeartLayoutHelper.h" 6 | #include "HeartLayout_KamadaKawai.generated.h" 7 | 8 | /** 9 | * A simple layout implementation for a one-shot Kamada-Kawai run. 10 | */ 11 | UCLASS(DisplayName = "Heart Layout Kamada-Kawai") 12 | class HEART_API UHeartLayout_KamadaKawai : public UHeartLayoutHelper 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual bool Layout(IHeartGraphInterface* Interface, const TArray& Nodes) override; 18 | 19 | protected: 20 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") 21 | int32 Width = 200; 22 | 23 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") 24 | int32 Height = 200; 25 | 26 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") 27 | double Strength = 300.0; 28 | 29 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") 30 | double EnergyThreshold = 0.01; 31 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/Layouts/HeartLayout_TestSpinner.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/HeartLayoutHelper.h" 6 | #include "HeartLayout_TestSpinner.generated.h" 7 | 8 | /** 9 | * This just spins nodes around. No real point, it's just to test layout ticking. 10 | */ 11 | UCLASS() 12 | class HEART_API UHeartLayout_TestSpinner : public UHeartLayoutHelper 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual bool Layout(IHeartGraphInterface* Interface, const TArray& Nodes, float DeltaTime) override; 18 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/LocationModifiers/HeartNodeLocationModifier_CartesianToPolar.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/HeartNodeLocationModifier.h" 6 | #include "HeartNodeLocationModifier_CartesianToPolar.generated.h" 7 | 8 | /** 9 | * Convert cartesian locations to polar 10 | */ 11 | UCLASS(DisplayName = "Modifier - Cartesian to Polar") 12 | class HEART_API UHeartNodeLocationModifier_CartesianToPolar : public UHeartNodeLocationModifier 13 | { 14 | GENERATED_BODY() 15 | 16 | protected: 17 | virtual FVector2D LocationToProxy(const FVector2D& Location) const override; 18 | virtual FVector2D ProxyToLocation(const FVector2D& Proxy) const override; 19 | 20 | virtual FVector LocationToProxy3D(const FVector& Location) const override; 21 | virtual FVector ProxyToLocation3D(const FVector& Proxy) const override; 22 | }; 23 | -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToGrid.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/HeartNodeLocationModifier.h" 6 | #include "HeartNodeLocationModifier_SnapToGrid.generated.h" 7 | 8 | /** 9 | * Rounds locations to snap to a grid 10 | */ 11 | UCLASS(DisplayName = "Modifier - Snap to Grid") 12 | class HEART_API UHeartNodeLocationModifier_SnapToGrid : public UHeartNodeLocationModifier 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual FVector2D LocationToProxy(const FVector2D& Location) const override; 18 | virtual FVector2D ProxyToLocation(const FVector2D& Proxy) const override; 19 | 20 | virtual FVector LocationToProxy3D(const FVector& Location) const override; 21 | virtual FVector ProxyToLocation3D(const FVector& Proxy) const override; 22 | 23 | protected: 24 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (InlineEditConditionToggle)) 25 | bool SnapOnX = false; 26 | 27 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (InlineEditConditionToggle)) 28 | bool SnapOnY = false; 29 | 30 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (InlineEditConditionToggle)) 31 | bool SnapOnZ = false; 32 | 33 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (EditCondition = "SnapOnX", ClampMin = 0.01, UIMin = 1.0)) 34 | double GridX = 1.0; 35 | 36 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (EditCondition = "SnapOnY", ClampMin = 0.01, UIMin = 1.0)) 37 | double GridY = 1.0; 38 | 39 | UPROPERTY(EditAnywhere, Category = "SnapToGrid", meta = (EditCondition = "SnapOnZ", ClampMin = 0.01, UIMin = 1.0)) 40 | double GridZ = 1.0; 41 | }; 42 | -------------------------------------------------------------------------------- /Source/Heart/Public/ModelView/LocationModifiers/HeartNodeLocationModifier_SnapToHex.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/HeartNodeLocationModifier.h" 6 | #include "HeartNodeLocationModifier_SnapToHex.generated.h" 7 | 8 | UENUM() 9 | enum class EHeartHexOrientation : uint8 10 | { 11 | FlatTop, 12 | PointyTop 13 | }; 14 | 15 | /** 16 | * Rounds locations to snap to a hex grid 17 | */ 18 | UCLASS(DisplayName = "Modifier - Snap to Hex") 19 | class HEART_API UHeartNodeLocationModifier_SnapToHex : public UHeartNodeLocationModifier 20 | { 21 | GENERATED_BODY() 22 | 23 | public: 24 | virtual FVector2D LocationToProxy(const FVector2D& Location) const override; 25 | virtual FVector2D ProxyToLocation(const FVector2D& Proxy) const override; 26 | 27 | virtual FVector LocationToProxy3D(const FVector& Location) const override; 28 | virtual FVector ProxyToLocation3D(const FVector& Proxy) const override; 29 | 30 | protected: 31 | UPROPERTY(EditAnywhere, Category = "SnapToHex", meta = (ClampMin = 1.0)) 32 | double GridSize = 50; 33 | 34 | UPROPERTY(EditAnywhere, Category = "SnapToHex") 35 | EHeartHexOrientation Orientation; 36 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Nodes/HeartAnnotationBase.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartAnnotationBase.generated.h" 6 | 7 | /** 8 | * Base class for annotation objects 9 | */ 10 | UCLASS(Abstract, BlueprintType) 11 | class HEART_API UHeartAnnotationBase : public UObject 12 | { 13 | GENERATED_BODY() 14 | }; 15 | 16 | /** 17 | * Default implementation for a Text Comment. Can be added to any graph type 18 | */ 19 | UCLASS() 20 | class HEART_API UHeartComment_Text : public UHeartAnnotationBase 21 | { 22 | GENERATED_BODY() 23 | 24 | public: 25 | UFUNCTION(BlueprintCallable, Category = "Heart|TextComment") 26 | FText GetCommentText() const; 27 | 28 | UFUNCTION(BlueprintCallable, Category = "Heart|TextComment") 29 | void SetCommentText(const FText& Text); 30 | 31 | protected: 32 | UPROPERTY(EditInstanceOnly, Category = "TextComment") 33 | FText CommentText; 34 | }; 35 | 36 | 37 | /** 38 | * Default implementation for a comment that displays a textures. Can be added to any graph type 39 | */ 40 | UCLASS() 41 | class HEART_API UHeartComment_Image : public UHeartAnnotationBase 42 | { 43 | GENERATED_BODY() 44 | 45 | public: 46 | UFUNCTION(BlueprintCallable, Category = "Heart|ImageComment") 47 | TSoftObjectPtr GetCommentImage() const; 48 | 49 | UFUNCTION(BlueprintCallable, Category = "Heart|ImageComment") 50 | void SetCommentImage(const TSoftObjectPtr& Image); 51 | 52 | protected: 53 | UPROPERTY(EditInstanceOnly, Category = "ImageComment") 54 | TSoftObjectPtr CommentImage; 55 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/Nodes/HeartGraphNodeAnnotation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Model/HeartGraphNode.h" 6 | #include "HeartGraphNodeAnnotation.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEART_API UHeartGraphNodeAnnotation : public UHeartGraphNode 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual FText GetNodeTitle_Implementation(const UObject* Node) const override; 18 | virtual FText GetPreviewNodeTitle_Implementation(FHeartNodeSource NodeSource, EHeartPreviewNodeNameContext Context) const override; 19 | virtual FText GetNodeCategory_Implementation(const UObject* Node) const override; 20 | }; 21 | 22 | /** 23 | * 24 | */ 25 | UCLASS() 26 | class HEART_API UHeartGraphNodeAnnotation_Image : public UHeartGraphNodeAnnotation 27 | { 28 | GENERATED_BODY() 29 | 30 | public: 31 | UHeartGraphNodeAnnotation_Image(); 32 | 33 | virtual bool CanCreate_Implementation() const override; 34 | }; -------------------------------------------------------------------------------- /Source/Heart/Public/View/PinConnectionStatusInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "ModelView/HeartGraphSchema.h" 7 | #include "PinConnectionStatusInterface.generated.h" 8 | 9 | UINTERFACE() 10 | class HEART_API UPinConnectionStatusInterface : public UInterface 11 | { 12 | GENERATED_BODY() 13 | }; 14 | 15 | /** 16 | * A generic interface to receive notifications about an attempt to connect pins from a schema. 17 | */ 18 | class HEART_API IPinConnectionStatusInterface 19 | { 20 | GENERATED_BODY() 21 | 22 | public: 23 | UFUNCTION(BlueprintImplementableEvent, Category = "Heart|PinConnectionStatusInterface") 24 | void SetConnectionResponse(const FHeartConnectPinsResponse& Response); 25 | }; 26 | -------------------------------------------------------------------------------- /Source/HeartCanvas/HeartCanvas.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartCanvas : ModuleRules 6 | { 7 | public HeartCanvas(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | PublicDependencyModuleNames.AddRange( 12 | new [] 13 | { 14 | "Core", 15 | "InputCore", 16 | "GameplayTags", 17 | "UMG" 18 | } 19 | ); 20 | 21 | PublicDependencyModuleNames.AddRange( 22 | new [] 23 | { 24 | "Blood", 25 | "HeartCore", 26 | "Heart" 27 | } 28 | ); 29 | 30 | PrivateDependencyModuleNames.AddRange( 31 | new [] 32 | { 33 | "CoreUObject", 34 | "Engine", 35 | "Slate", 36 | "SlateCore" 37 | } 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/Actions/HeartCanvasAction_Zoom.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Actions/HeartCanvasAction_Zoom.h" 4 | 5 | #include "UMG/HeartGraphCanvas.h" 6 | #include "UMG/HeartGraphCanvasNode.h" 7 | #include "UMG/HeartGraphCanvasPin.h" 8 | 9 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartCanvasAction_Zoom) 10 | 11 | FReply UHeartCanvasAction_Zoom::ExecuteOnGraph(UHeartGraphCanvas* CanvasGraph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const 12 | { 13 | HandleAddZoom(CanvasGraph, Activation); 14 | return FReply::Handled(); 15 | } 16 | 17 | FReply UHeartCanvasAction_Zoom::ExecuteOnNode(UHeartGraphCanvasNode* CanvasNode, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const 18 | { 19 | HandleAddZoom(CanvasNode->GetCanvas(), Activation); 20 | return FReply::Handled(); 21 | } 22 | 23 | FReply UHeartCanvasAction_Zoom::ExecuteOnPin(UHeartGraphCanvasPin* CanvasPin, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const 24 | { 25 | HandleAddZoom(CanvasPin->GetCanvas(), Activation); 26 | return FReply::Handled(); 27 | } 28 | 29 | void UHeartCanvasAction_Zoom::HandleAddZoom(UHeartGraphCanvas* CanvasGraph, const FHeartInputActivation& Activation) 30 | { 31 | if (const TOptional PointerEvent = Activation.As(); 32 | PointerEvent.IsSet()) 33 | { 34 | CanvasGraph->AddToZoom(PointerEvent.GetValue().GetWheelDelta(), true); 35 | } 36 | else if (const TOptional ManualEvent = Activation.As(); 37 | ManualEvent.IsSet()) 38 | { 39 | CanvasGraph->AddToZoom(static_cast(ManualEvent.GetValue().EventValue), true); 40 | } 41 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/Actions/HeartCanvasDragViewDragDropOperation.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Actions/HeartCanvasDragViewDragDropOperation.h" 4 | #include "UMG/HeartGraphCanvas.h" 5 | 6 | #include "Blueprint/SlateBlueprintLibrary.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartCanvasDragViewDragDropOperation) 9 | 10 | bool UHeartCanvasDragViewDragDropOperation::CanRunOnWidget(const UWidget* Widget) const 11 | { 12 | return Widget && Widget->IsA(); 13 | } 14 | 15 | bool UHeartCanvasDragViewDragDropOperation::SetupDragDropOperation() 16 | { 17 | if (UHeartGraphCanvas* SummonedByAsCanvas = Cast(SummonedBy)) 18 | { 19 | Canvas = SummonedByAsCanvas; 20 | DeltaMousePosition = FSlateApplication::IsInitialized() ? FSlateApplication::Get().GetCursorPos() : FVector2f::ZeroVector; 21 | return true; 22 | } 23 | 24 | return false; 25 | } 26 | 27 | void UHeartCanvasDragViewDragDropOperation::Dragged_Implementation(const FPointerEvent& PointerEvent) 28 | { 29 | Super::Dragged_Implementation(PointerEvent); 30 | 31 | if (Canvas.IsValid() && FSlateApplication::IsInitialized()) 32 | { 33 | const FVector2f MousePosition = FSlateApplication::Get().GetCursorPos(); 34 | const FVector2f ScreenOffset = MousePosition - DeltaMousePosition; 35 | 36 | FVector2D ViewportOffset; 37 | USlateBlueprintLibrary::ScreenToViewport(Canvas.Get(), FVector2D(ScreenOffset), ViewportOffset); 38 | 39 | Canvas->AddToViewCorner(FVector2f(ViewportOffset) / Canvas->GetZoom(), true); 40 | 41 | DeltaMousePosition = MousePosition; 42 | } 43 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/HeartCanvasExtension.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartCanvasExtension.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartCanvasExtension) -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/HeartCanvasLog.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | DEFINE_LOG_CATEGORY_STATIC(LogHeartCanvas, Log, All) -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/HeartCanvasModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartCanvasModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "HeartCanvasModule" 6 | 7 | void FHeartCanvasModule::StartupModule() 8 | { 9 | } 10 | 11 | void FHeartCanvasModule::ShutdownModule() 12 | { 13 | } 14 | 15 | #undef LOCTEXT_NAMESPACE 16 | 17 | IMPLEMENT_MODULE(FHeartCanvasModule, HeartCanvas) -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/HeartCanvasPaletteCategory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #if WITH_EDITOR 6 | namespace Heart::Canvas::PaletteCategory 7 | { 8 | const FText Default = NSLOCTEXT("HeartCanvas", "HeartCanvasPaletteCategory", "Heart Canvas"); 9 | } 10 | #endif -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/HeartCanvasPrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | DECLARE_STATS_GROUP(TEXT("HeartCanvas"), STATGROUP_HeartCanvas, STATCAT_Advanced); 6 | -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/Input/HeartWidgetInputBindingContainer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartWidgetInputBindingContainer.h" 4 | #include "Input/HeartInputBindingAsset.h" 5 | #include "Input/HeartWidgetInputLinker.h" 6 | #include "Components/Widget.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartWidgetInputBindingContainer) 9 | 10 | void FHeartWidgetInputBindingContainer::SetupLinker(UWidget* InOuter) 11 | { 12 | check(InOuter); 13 | 14 | // Unbind everything from the current linker 15 | if (IsValid(Linker)) 16 | { 17 | for (auto&& BindingAsset : BindingAssets) 18 | { 19 | if (!IsValid(BindingAsset)) continue; 20 | 21 | Linker->RemoveBindings(BindingAsset->BindingData); 22 | } 23 | 24 | Linker = nullptr; 25 | } 26 | 27 | if (IsValid(DefaultLinkerClass)) 28 | { 29 | Linker = NewObject(InOuter, DefaultLinkerClass); 30 | 31 | // Rebind everything to the new linker 32 | for (auto&& BindingAsset : BindingAssets) 33 | { 34 | if (!IsValid(BindingAsset)) continue; 35 | 36 | Linker->AddBindings(BindingAsset->BindingData); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/Slate/SHeartGraphWidgetBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Slate/SHeartGraphWidgetBase.h" 4 | 5 | #include "Model/HeartGraph.h" 6 | #include "Model/HeartGraphNode.h" 7 | 8 | namespace Heart::Canvas 9 | { 10 | FLinkerMetadata::FLinkerMetadata(UHeartSlateInputLinker* Linker, const ESlateWidgetType WidgetType) 11 | : Linker(Linker), 12 | WidgetType(WidgetType) {} 13 | 14 | FGraphAndLinkerMetadata::FGraphAndLinkerMetadata(UHeartGraph* Graph, UHeartSlateInputLinker* Linker) 15 | : FLinkerMetadata(Linker, ESlateWidgetType::Graph), 16 | Graph(Graph) {} 17 | 18 | FNodeAndLinkerMetadata::FNodeAndLinkerMetadata(UHeartGraphNode* Node, UHeartSlateInputLinker* Linker) 19 | : FLinkerMetadata(Linker, ESlateWidgetType::Node), 20 | Node(Node) {} 21 | 22 | FPinAndLinkerMetadata::FPinAndLinkerMetadata(UHeartGraphNode* Node, const FHeartPinGuid Pin, UHeartSlateInputLinker* Linker) 23 | : FLinkerMetadata(Linker, ESlateWidgetType::Pin), 24 | Node(Node), 25 | Pin(Pin) {} 26 | 27 | HEART_SLATE_INPUT_LINKER_BODY(SGraphWidgetBase) 28 | 29 | void SGraphCanvasWidget::Construct(const FArguments& InArgs) 30 | { 31 | AddMetadata(MakeShared(InArgs._Graph, InArgs._Linker)); 32 | } 33 | 34 | void SGraphNodeWidget::Construct(const FArguments& InArgs) 35 | { 36 | AddMetadata(MakeShared(InArgs._GraphNode, InArgs._Linker)); 37 | } 38 | 39 | void SGraphPinWidget::Construct(const FArguments& InArgs) 40 | { 41 | AddMetadata(MakeShared(InArgs._GraphNode, InArgs._PinGuid, InArgs._Linker)); 42 | } 43 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartGraphCanvasConnection.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartGraphCanvasConnection.h" 4 | #include "UMG/HeartGraphCanvas.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphCanvasConnection) 7 | 8 | UHeartInputLinkerBase* UHeartGraphCanvasConnection::ResolveLinker_Implementation() const 9 | { 10 | return Execute_ResolveLinker(GraphCanvas.Get()); 11 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartGraphCanvasPanel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartGraphCanvasPanel.h" 4 | #include "HeartCanvasPaletteCategory.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphCanvasPanel) 7 | 8 | UHeartGraphCanvasPanel::UHeartGraphCanvasPanel() 9 | { 10 | // Canvas graph panels should always intercept input 11 | SetVisibilityInternal(ESlateVisibility::Visible); 12 | 13 | // Canvas nodes should be clipped to the canvas 14 | SetClipping(EWidgetClipping::ClipToBoundsAlways); 15 | } 16 | 17 | #if WITH_EDITOR 18 | const FText UHeartGraphCanvasPanel::GetPaletteCategory() 19 | { 20 | return Heart::Canvas::PaletteCategory::Default; 21 | } 22 | #endif -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartGraphCanvasPin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartGraphCanvasPin.h" 4 | #include "UMG/HeartGraphCanvasNode.h" 5 | #include "Model/HeartGraphNode.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphCanvasPin) 8 | 9 | UHeartInputLinkerBase* UHeartGraphCanvasPin::ResolveLinker_Implementation() const 10 | { 11 | return Execute_ResolveLinker(GraphCanvasNode.Get()); 12 | } 13 | 14 | UHeartGraphNode* UHeartGraphCanvasPin::GetHeartGraphNode() const 15 | { 16 | return GraphCanvasNode.IsValid() ? GraphCanvasNode->GetGraphNode() : nullptr; 17 | } 18 | 19 | FHeartPinGuid UHeartGraphCanvasPin::GetPinGuid() const 20 | { 21 | return GraphPin; 22 | } 23 | 24 | void UHeartGraphCanvasPin::SetIsPreviewConnectionTarget(const bool IsTarget, const bool CanConnect) 25 | { 26 | DisplayPreviewConnectionTarget(IsTarget, CanConnect); 27 | } 28 | 29 | FHeartGraphPinReference UHeartGraphCanvasPin::GetPinReference() const 30 | { 31 | return { GraphCanvasNode->GetGraphNode()->GetGuid(), GraphPin }; 32 | } 33 | 34 | UHeartGraphCanvas* UHeartGraphCanvasPin::GetCanvas() const 35 | { 36 | if (GraphCanvasNode.IsValid()) 37 | { 38 | return GraphCanvasNode.Get()->GetCanvas(); 39 | } 40 | 41 | return nullptr; 42 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartGraphWidgetBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartGraphWidgetBase.h" 4 | #include "HeartCanvasPaletteCategory.h" 5 | #include "Input/HeartDragDropOperation.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartGraphWidgetBase) 8 | 9 | UHeartGraphWidgetBase::UHeartGraphWidgetBase(const FObjectInitializer& ObjectInitializer) 10 | : Super(ObjectInitializer) 11 | { 12 | // Allow keyboard to trigger input on all graph widgets. (This can always be turned off when not desired) 13 | SetIsFocusable(true); 14 | } 15 | 16 | HEART_UMG_INPUT_LINKER_BODY(UHeartGraphWidgetBase) 17 | 18 | #if WITH_EDITOR 19 | const FText UHeartGraphWidgetBase::GetPaletteCategory() 20 | { 21 | return Heart::Canvas::PaletteCategory::Default; 22 | } 23 | #endif 24 | 25 | UHeartInputLinkerBase* UHeartGraphWidgetBase::ResolveLinker_Implementation() const 26 | { 27 | // Assume that something up our parent chain will be able to handle this. 28 | return Heart::Input::TLinkerType::FindLinker(GetTypedOuter()); 29 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartWidgetFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartWidgetFactory.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartWidgetFactory) 6 | 7 | TSubclassOf UHeartWidgetFactory::FindWidgetClassForData_Implementation(const UObject* Data) const 8 | { 9 | return TSubclassOf(); 10 | } 11 | 12 | TSubclassOf FHeartWidgetFactoryRules::GetWidgetClass(const UObject* Data) const 13 | { 14 | for (const UHeartWidgetFactory* Rule : FactoryRules) 15 | { 16 | if (IsValid(Rule)) 17 | { 18 | if (const TSubclassOf EntryClass = Rule->FindWidgetClassForData(Data)) 19 | { 20 | return EntryClass; 21 | } 22 | } 23 | } 24 | 25 | return nullptr; 26 | } 27 | 28 | TSubclassOf UHeartWidgetFactoryLibrary::GetWidgetClass(const FHeartWidgetFactoryRules& Rules, const UObject* Data) 29 | { 30 | return Rules.GetWidgetClass(Data); 31 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Private/UMG/HeartWidgetFactory_Class.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "UMG/HeartWidgetFactory_Class.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartWidgetFactory_Class) 6 | 7 | TSubclassOf UHeartWidgetFactory_Class::FindWidgetClassForData_Implementation(const UObject* Data) const 8 | { 9 | if (auto&& StartingClass = Cast(Data)) 10 | { 11 | // Starting with the current class, work backwards to see if there are any construction rules for this class. 12 | for (const UClass* Class = StartingClass; Class; Class = Class->GetSuperClass()) 13 | { 14 | TSoftClassPtr ClassPtr(Class); 15 | if (const TSubclassOf EntryWidgetClassPtr = EntryWidgetForClass.FindRef(ClassPtr)) 16 | { 17 | return EntryWidgetClassPtr; 18 | } 19 | } 20 | } 21 | 22 | return TSubclassOf(); 23 | } -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Actions/HeartCanvasAction_Zoom.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphCanvasAction.h" 6 | #include "HeartCanvasAction_Zoom.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartCanvasAction_Zoom : public UHeartGraphCanvasAction 13 | { 14 | GENERATED_BODY() 15 | 16 | protected: 17 | virtual FReply ExecuteOnGraph(UHeartGraphCanvas* CanvasGraph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 18 | virtual FReply ExecuteOnNode(UHeartGraphCanvasNode* CanvasNode, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 19 | virtual FReply ExecuteOnPin(UHeartGraphCanvasPin* CanvasPin, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 20 | 21 | static void HandleAddZoom(UHeartGraphCanvas* CanvasGraph, const FHeartInputActivation& Activation); 22 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Actions/HeartCanvasDragViewDragDropOperation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartCanvasDragDropOperation.h" 6 | #include "HeartCanvasDragViewDragDropOperation.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartCanvasDragViewDragDropOperation : public UHeartCanvasDragDropOperation 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual bool CanRunOnWidget(const UWidget* Widget) const override; 18 | 19 | virtual bool SetupDragDropOperation() override; 20 | 21 | virtual void Dragged_Implementation(const FPointerEvent& PointerEvent) override; 22 | 23 | private: 24 | TWeakObjectPtr Canvas; 25 | 26 | // Mouse position last frame 27 | FVector2f DeltaMousePosition = FVector2f::ZeroVector; 28 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Actions/HeartCanvasNodeMoveDragDropOperation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartCanvasDragDropOperation.h" 6 | #include "HeartCanvasNodeMoveDragDropOperation.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartCanvasNodeMoveDragDropOperation : public UHeartCanvasDragDropOperation 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual bool CanRunOnWidget(const UWidget* Widget) const override; 18 | 19 | virtual bool SetupDragDropOperation() override; 20 | 21 | virtual void Dragged_Implementation(const FPointerEvent& PointerEvent) override; 22 | 23 | virtual void Drop_Implementation(const FPointerEvent& PointerEvent) override; 24 | 25 | protected: 26 | FVector2f ClampToBorder(const FVector2f& Value) const; 27 | 28 | private: 29 | TWeakObjectPtr Node; 30 | TOptional OriginalLocation; 31 | 32 | // Offset between node location and mouse. This is the point on the widget we clicked on, relative to the widget's top left. 33 | FVector2f MouseOffset = FVector2f::ZeroVector; 34 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Actions/HeartPinConnectionDragDropOperation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartCanvasDragDropOperation.h" 6 | #include "ModelView/HeartGraphSchema.h" 7 | #include "HeartPinConnectionDragDropOperation.generated.h" 8 | 9 | UCLASS() 10 | class HEARTCANVAS_API UHeartPinConnectionDragDropOperation : public UHeartCanvasDragDropOperation 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual bool CanRunOnWidget(const UWidget* Widget) const override; 16 | virtual bool SetupDragDropOperation() override; 17 | virtual bool OnDropOnWidget(UWidget* Widget) override; 18 | 19 | virtual void Drop_Implementation(const FPointerEvent& PointerEvent) override; 20 | virtual void DragCancelled_Implementation(const FPointerEvent& PointerEvent) override; 21 | virtual void Dragged_Implementation(const FPointerEvent& PointerEvent) override; 22 | 23 | virtual bool OnHoverPin(UHeartGraphCanvasPin* CanvasPin) override; 24 | virtual void OnHoverCleared() override; 25 | 26 | protected: 27 | UPROPERTY() 28 | TWeakObjectPtr Canvas; 29 | 30 | UPROPERTY() 31 | TWeakObjectPtr DraggedPin; 32 | 33 | UPROPERTY() 34 | TWeakObjectPtr HoveredPin; 35 | 36 | FHeartConnectPinsResponse Response; 37 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/HeartCanvasExtension.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Model/HeartGraphExtension.h" 6 | #include "HeartCanvasExtension.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartCanvasExtension : public UHeartGraphExtension 13 | { 14 | GENERATED_BODY() 15 | }; 16 | -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/HeartCanvasModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartCanvasModule : public IModuleInterface 8 | { 9 | public: 10 | virtual void StartupModule() override; 11 | virtual void ShutdownModule() override; 12 | }; 13 | -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Input/HeartCanvasDragDropOperation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartDragDropOperation.h" 6 | #include "HeartCanvasDragDropOperation.generated.h" 7 | 8 | class UHeartGraphCanvas; 9 | class UHeartGraphCanvasNode; 10 | class UHeartGraphCanvasPin; 11 | 12 | /** 13 | * 14 | */ 15 | UCLASS(Abstract) 16 | class HEARTCANVAS_API UHeartCanvasDragDropOperation : public UHeartDragDropOperation 17 | { 18 | GENERATED_BODY() 19 | 20 | public: 21 | virtual bool OnHoverWidget(UWidget* Widget) override; 22 | 23 | protected: 24 | UWidget* GetHoveredWidget() const { return LastHovered.IsValid() ? LastHovered.Get() : nullptr; } 25 | 26 | virtual bool OnHoverGraph(UHeartGraphCanvas* Canvas) { return false; } 27 | virtual bool OnHoverNode(UHeartGraphCanvasNode* CanvasNode) { return false; } 28 | virtual bool OnHoverPin(UHeartGraphCanvasPin* CanvasPin) { return false; } 29 | virtual void OnHoverCleared() {} 30 | 31 | // Is the OnHoverWidget function allowed to cache the result when called on repeat widget. 32 | UPROPERTY(EditAnywhere, Category = "DragDropOperation") 33 | bool CacheOnHoverWidgetResult = true; 34 | 35 | private: 36 | TWeakObjectPtr LastHovered; 37 | bool LastHoveredResult = false; 38 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Input/HeartCanvasInputHandler_HeartDDO.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartInputHandlerAssetBase.h" 6 | #include "HeartCanvasInputHandler_HeartDDO.generated.h" 7 | 8 | enum class EDragPivot : uint8; 9 | class UHeartDragDropOperation; 10 | 11 | /** 12 | * A heart input handler that can launch a Drag Drop Operation 13 | */ 14 | UCLASS(meta = (DisplayName = "Drag Drop Operation")) 15 | class HEARTCANVAS_API UHeartCanvasInputHandler_HeartDDO : public UHeartInputHandlerAssetBase 16 | { 17 | GENERATED_BODY() 18 | 19 | protected: 20 | virtual Heart::Input::EExecutionOrder GetExecutionOrder() const override { return Heart::Input::Deferred; } 21 | virtual bool PassCondition(const UObject* TestTarget) const override; 22 | virtual FHeartEvent OnTriggered(UObject* Target, const FHeartInputActivation& Activation) const override; 23 | 24 | UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Canvas DDO", meta = (AllowAbstract = "false")) 25 | TSubclassOf OperationClass; 26 | 27 | UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Visual", meta = (AllowAbstract = "false")) 28 | TSubclassOf VisualClass; 29 | 30 | UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Visual", meta = (EditCondition = "VisualClass != nullptr", HideEditConditionToggle)) 31 | EDragPivot Pivot; 32 | 33 | UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Visual", meta = (EditCondition = "VisualClass != nullptr", HideEditConditionToggle)) 34 | FVector2D Offset; 35 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Input/HeartDragDropOperation.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Blueprint/DragDropOperation.h" 6 | #include "Input/HeartEvent.h" 7 | #include "HeartDragDropOperation.generated.h" 8 | 9 | namespace Heart 10 | { 11 | // A heart native drag drop operation 12 | class FNativeDragDropOperation : public FDragDropOperation 13 | { 14 | public: 15 | DRAG_DROP_OPERATOR_TYPE(FNativeDragDropOperation, FDragDropOperation) 16 | 17 | virtual bool SetupDragDropOperation() PURE_VIRTUAL(UHeartDragDropOperation::SetupDragDropOperation, return false; ) 18 | 19 | virtual FReply OnDropOnWidget(const TSharedRef& Widget) { return FReply::Handled(); } 20 | virtual FReply OnHoverWidget(const TSharedRef& Widget) { return FReply::Unhandled(); } 21 | 22 | // The widget that created this drag drop operation 23 | TSharedPtr SummonedBy; 24 | }; 25 | } 26 | 27 | /** 28 | * A heart UMG drag drop operation 29 | */ 30 | UCLASS(Abstract) 31 | class HEARTCANVAS_API UHeartDragDropOperation : public UDragDropOperation, public IHeartDeferredEventHandler 32 | { 33 | GENERATED_BODY() 34 | 35 | public: 36 | virtual bool CanRunOnWidget(const UWidget* Widget) const { return true; } 37 | 38 | virtual bool SetupDragDropOperation() PURE_VIRTUAL(UHeartDragDropOperation::SetupDragDropOperation, return false; ) 39 | 40 | virtual bool OnDropOnWidget(UWidget* Widget) { return true; } 41 | 42 | virtual bool OnHoverWidget(UWidget* Widget) { return false; } 43 | 44 | // The widget that created this drag drop operation 45 | UPROPERTY() 46 | TObjectPtr SummonedBy; 47 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Input/HeartSlateReplyWrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Components/SlateWrapperTypes.h" 6 | #include "Input/HeartEvent.h" 7 | #include "Kismet/BlueprintFunctionLibrary.h" 8 | #include "HeartSlateReplyWrapper.generated.h" 9 | 10 | // Enable using wrapped slate Replies as Heart Events 11 | template <> struct TIsHeartEventType { static constexpr bool Value = true; }; 12 | 13 | namespace Heart::Input 14 | { 15 | // Make a slate-compatible Reply from a HeartEvent 16 | FReply HeartEventToReply(const FHeartEvent& Event); 17 | 18 | // Make a HeartEvent into a slate-compatible Reply 19 | FHeartEvent ReplyToHeartEvent(const FHeartEvent& Base, const FReply& Reply); 20 | } 21 | 22 | /** 23 | * 24 | */ 25 | UCLASS() 26 | class HEARTCANVAS_API UHeartSlateReplyWrapper : public UBlueprintFunctionLibrary 27 | { 28 | GENERATED_BODY() 29 | 30 | public: 31 | UFUNCTION(BlueprintPure, Category = "Heart|SlateReplyWrapper") 32 | static FEventReply HeartEventToEventReply(const FHeartEvent& Event); 33 | 34 | UFUNCTION(BlueprintPure, Category = "Heart|SlateReplyWrapper") 35 | static FHeartEvent ReplyEventToHeartEvent(const FHeartEvent& Event, const FEventReply& EventReply); 36 | 37 | UFUNCTION(BlueprintPure, Category = "Heart|SlateReplyWrapper") 38 | static bool IsAnEventReply(const FHeartEvent& Event); 39 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/Input/HeartWidgetInputBindingContainer.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartWidgetInputLinker.h" 6 | 7 | #include "HeartWidgetInputBindingContainer.generated.h" 8 | 9 | class UWidget; 10 | class UHeartInputBindingAsset; 11 | class UHeartWidgetInputLinker; 12 | 13 | /** 14 | * 15 | */ 16 | USTRUCT(BlueprintType) 17 | struct HEARTCANVAS_API FHeartWidgetInputBindingContainer 18 | { 19 | GENERATED_BODY() 20 | 21 | public: 22 | void SetupLinker(UWidget* InOuter); 23 | UHeartWidgetInputLinker* GetLinker() const { return Linker; } 24 | 25 | protected: 26 | // Binding assets applied by default to linker 27 | UPROPERTY(EditAnywhere, Category = "InputBindingConfig") 28 | TArray> BindingAssets; 29 | 30 | // Class of linker to spawn 31 | UPROPERTY(EditAnywhere, Category = "InputBindingConfig") 32 | TSubclassOf DefaultLinkerClass = UHeartWidgetInputLinker::StaticClass(); 33 | 34 | UPROPERTY(BlueprintReadOnly, meta = (NoResetToDefault), Category = "InputBindingContainer") 35 | TObjectPtr Linker = nullptr; 36 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/UMG/HeartGraphCanvasConnection.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartGraphWidgetBase.h" 6 | #include "Model/HeartGraphPinReference.h" 7 | #include "View/HeartVisualizerInterfaces.h" 8 | #include "HeartGraphCanvasConnection.generated.h" 9 | 10 | class UHeartGraphCanvasPin; 11 | 12 | /** 13 | * A widget representing a connection between two pins 14 | */ 15 | UCLASS(Abstract) 16 | class HEARTCANVAS_API UHeartGraphCanvasConnection : public UHeartGraphWidgetBase, public IGraphConnectionVisualizerInterface 17 | { 18 | GENERATED_BODY() 19 | 20 | friend class UHeartGraphCanvas; 21 | friend class UHeartGraphCanvasNode; 22 | 23 | public: 24 | /** IHeartInputLinkerInterface */ 25 | virtual UHeartInputLinkerBase* ResolveLinker_Implementation() const override final; 26 | /** IHeartInputLinkerInterface */ 27 | 28 | protected: 29 | UPROPERTY(BlueprintReadOnly, Category = "Widgets") 30 | TWeakObjectPtr GraphCanvas; 31 | 32 | // The Output pin we are connected to. 33 | UPROPERTY(BlueprintReadOnly, Category = "Pins") 34 | FHeartGraphPinReference FromPin; 35 | 36 | // The Input pin we are connected to. 37 | UPROPERTY(BlueprintReadOnly, Category = "Pins") 38 | FHeartGraphPinReference ToPin; 39 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/UMG/HeartGraphCanvasPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Components/CanvasPanel.h" 6 | #include "HeartGraphCanvasPanel.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartGraphCanvasPanel : public UCanvasPanel 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | UHeartGraphCanvasPanel(); 18 | 19 | /** UWidget */ 20 | #if WITH_EDITOR 21 | virtual const FText GetPaletteCategory() override; 22 | #endif 23 | /** UWidget */ 24 | }; 25 | -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/UMG/HeartGraphWidgetBase.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Blueprint/UserWidget.h" 6 | #include "Input/HeartInputLinkerInterface.h" 7 | #include "Input/HeartWidgetInputLinker.h" 8 | #include "HeartGraphWidgetBase.generated.h" 9 | 10 | /** 11 | * 12 | */ 13 | UCLASS(Abstract) 14 | class HEARTCANVAS_API UHeartGraphWidgetBase : public UUserWidget, public IHeartInputLinkerInterface 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | UHeartGraphWidgetBase(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); 20 | 21 | HEART_UMG_INPUT_LINKER_HEADER() 22 | 23 | /** UWidget */ 24 | #if WITH_EDITOR 25 | virtual const FText GetPaletteCategory() override; 26 | #endif 27 | /** UWidget */ 28 | 29 | // Unless overriden with custom behavior, this will walk up the widget tree looking for something that implements this 30 | virtual UHeartInputLinkerBase* ResolveLinker_Implementation() const override; 31 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/UMG/HeartWidgetFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Blueprint/UserWidget.h" 6 | #include "Templates/SubclassOf.h" 7 | 8 | #include "HeartWidgetFactory.generated.h" 9 | 10 | // Shamelessly adapted from Lyra. Its just so useful :) 11 | 12 | 13 | UCLASS(Abstract, Blueprintable, BlueprintType, EditInlineNew, CollapseCategories) 14 | class HEARTCANVAS_API UHeartWidgetFactory : public UObject 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | UFUNCTION(BlueprintNativeEvent, Category = "Heart|WidgetFactory") 20 | TSubclassOf FindWidgetClassForData(const UObject* Data) const; 21 | }; 22 | 23 | USTRUCT(BlueprintType) 24 | struct HEARTCANVAS_API FHeartWidgetFactoryRules 25 | { 26 | GENERATED_BODY() 27 | 28 | TSubclassOf GetWidgetClass(const UObject* Data) const; 29 | 30 | protected: 31 | UPROPERTY(EditAnywhere, Instanced, Category = "WidgetFactoryRules") 32 | TArray> FactoryRules; 33 | }; 34 | 35 | UCLASS() 36 | class HEARTCANVAS_API UHeartWidgetFactoryLibrary : public UBlueprintFunctionLibrary 37 | { 38 | GENERATED_BODY() 39 | 40 | public: 41 | UFUNCTION(BlueprintCallable, Category = "Heart|WidgetFactoryLibrary") 42 | static TSubclassOf GetWidgetClass(const FHeartWidgetFactoryRules& Rules, const UObject* Data); 43 | }; -------------------------------------------------------------------------------- /Source/HeartCanvas/Public/UMG/HeartWidgetFactory_Class.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartWidgetFactory.h" 6 | #include "HeartWidgetFactory_Class.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTCANVAS_API UHeartWidgetFactory_Class : public UHeartWidgetFactory 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual TSubclassOf FindWidgetClassForData_Implementation(const UObject* Data) const override; 18 | 19 | protected: 20 | UPROPERTY(EditAnywhere, Category = "WidgetFactoryClass", meta = (AllowAbstract)) 21 | TMap, TSubclassOf> EntryWidgetForClass; 22 | }; -------------------------------------------------------------------------------- /Source/HeartCanvasEditor/HeartCanvasEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartCanvasEditor : ModuleRules 6 | { 7 | public HeartCanvasEditor(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | PublicDependencyModuleNames.AddRange( 12 | new [] 13 | { 14 | "Core", 15 | "Heart", 16 | "HeartCanvas", 17 | "HeartEditor" 18 | } 19 | ); 20 | 21 | PrivateDependencyModuleNames.AddRange( 22 | new [] 23 | { 24 | "CoreUObject", 25 | "Engine", 26 | "Slate", 27 | "SlateCore", 28 | "UnrealEd" 29 | } 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /Source/HeartCanvasEditor/Private/Preview/TabSpawners.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "WorkflowOrientedApp/WorkflowTabFactory.h" 6 | 7 | // 8 | // SCENE PREVIEW TABS 9 | // 10 | 11 | namespace Heart::AssetEditor 12 | { 13 | class FHeartGraphEditor; 14 | 15 | struct FPreviewCanvasSummoner : public FWorkflowTabFactory 16 | { 17 | static const FLazyName TabId; 18 | 19 | FPreviewCanvasSummoner(const TSharedPtr& AssetEditor); 20 | 21 | virtual TSharedRef CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override; 22 | virtual FText GetTabToolTipText(const FWorkflowTabSpawnInfo& Info) const override; 23 | }; 24 | 25 | using FOnDetailsCreated = TDelegate&)>; 26 | 27 | struct FPreviewCanvasDetailsPanelSummoner : public FWorkflowTabFactory 28 | { 29 | static const FLazyName TabId; 30 | 31 | FPreviewCanvasDetailsPanelSummoner(const TSharedPtr& AssetEditor, const FOnDetailsCreated& OnDetailsCreated); 32 | 33 | virtual TSharedRef CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override; 34 | virtual FText GetTabToolTipText(const FWorkflowTabSpawnInfo& Info) const override; 35 | 36 | private: 37 | FOnDetailsCreated Callback; 38 | }; 39 | } -------------------------------------------------------------------------------- /Source/HeartCanvasEditor/Public/HeartCanvasEditorModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartCanvasEditorModule : public IModuleInterface 8 | { 9 | public: 10 | virtual void StartupModule() override; 11 | virtual void ShutdownModule() override; 12 | }; 13 | -------------------------------------------------------------------------------- /Source/HeartCanvasEditor/Public/Preview/ApplicationMode_PreviewCanvas.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 4 | 5 | #pragma once 6 | 7 | #include "WorkflowOrientedApp/ApplicationMode.h" 8 | #include "WorkflowOrientedApp/WorkflowTabManager.h" 9 | 10 | namespace Heart::AssetEditor 11 | { 12 | class FHeartGraphEditor; 13 | 14 | class FApplicationMode_PreviewCanvas : public FApplicationMode 15 | { 16 | public: 17 | static const FLazyName ModeID; 18 | 19 | FApplicationMode_PreviewCanvas(TSharedRef AssetEditor); 20 | 21 | /** FApplicationMode interface */ 22 | virtual void RegisterTabFactories(TSharedPtr InTabManager) override; 23 | 24 | virtual void PreDeactivateMode() override {} 25 | virtual void PostActivateMode() override {} 26 | 27 | private: 28 | void OnDetailsCreated(const TSharedRef& InDetailsView); 29 | 30 | protected: 31 | /** The hosting app */ 32 | TWeakPtr HeartGraphAssetEditorPtr; 33 | 34 | /** The tab factories we support */ 35 | FWorkflowAllowedTabSet TabFactories; 36 | 37 | private: 38 | TSharedPtr DetailsView; 39 | }; 40 | } -------------------------------------------------------------------------------- /Source/HeartCore/Private/HeartCoreModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartCoreModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "HeartCoreModule" 6 | 7 | const static FLazyName ModuleName("HeartCore"); 8 | 9 | FHeartCoreModule& FHeartCoreModule::Get() 10 | { 11 | return FModuleManager::Get().GetModuleChecked(ModuleName); 12 | } 13 | 14 | void FHeartCoreModule::StartupModule() 15 | { 16 | } 17 | 18 | void FHeartCoreModule::ShutdownModule() 19 | { 20 | } 21 | 22 | #undef LOCTEXT_NAMESPACE 23 | 24 | IMPLEMENT_MODULE(FHeartCoreModule, HeartCore) -------------------------------------------------------------------------------- /Source/HeartCore/Private/HeartCorePrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | DECLARE_STATS_GROUP(TEXT("HeartCore"), STATGROUP_HeartCore, STATCAT_Advanced); 6 | -------------------------------------------------------------------------------- /Source/HeartCore/Private/Input/HeartCoreInputPreprocessor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartCoreInputPreprocessor.h" 4 | #include "Input/HeartInputEventSubsystem.h" 5 | 6 | bool FHeartCoreInputPreprocessor::HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent) 7 | { 8 | return InputSubsystem.HandleKeyDownEvent(SlateApp, InKeyEvent); 9 | } 10 | 11 | bool FHeartCoreInputPreprocessor::HandleKeyUpEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent) 12 | { 13 | return InputSubsystem.HandleKeyUpEvent(SlateApp, InKeyEvent); 14 | } 15 | 16 | bool FHeartCoreInputPreprocessor::HandleMouseButtonDownEvent(FSlateApplication& SlateApp, const FPointerEvent& MouseEvent) 17 | { 18 | return InputSubsystem.HandleMouseButtonDownEvent(SlateApp, MouseEvent); 19 | } 20 | 21 | bool FHeartCoreInputPreprocessor::HandleMouseButtonUpEvent(FSlateApplication& SlateApp, const FPointerEvent& MouseEvent) 22 | { 23 | return InputSubsystem.HandleMouseButtonUpEvent(SlateApp, MouseEvent); 24 | } 25 | -------------------------------------------------------------------------------- /Source/HeartCore/Private/Input/HeartInputHandler_Action.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartInputHandler_Action.h" 4 | #include "Input/HeartActionBase.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartInputHandler_Action) 7 | 8 | FText UHeartInputHandler_Action::GetDescription(const UObject* TestTarget) const 9 | { 10 | if (IsValid(ActionClass)) 11 | { 12 | return Heart::Action::GetDescription(ActionClass, TestTarget); 13 | } 14 | 15 | return Super::GetDescription(TestTarget); 16 | } 17 | 18 | bool UHeartInputHandler_Action::PassCondition(const UObject* TestTarget) const 19 | { 20 | bool Failed = !Super::PassCondition(TestTarget); 21 | 22 | if (IsValid(ActionClass)) 23 | { 24 | Failed |= !Heart::Action::CanExecute(ActionClass, TestTarget); 25 | } 26 | 27 | return !Failed; 28 | } 29 | 30 | FHeartEvent UHeartInputHandler_Action::OnTriggered(UObject* Target, const FHeartInputActivation& Activation) const 31 | { 32 | if (!ensure(IsValid(Target))) 33 | { 34 | // Target is null, how did we get here? 35 | return FHeartEvent::Invalid; 36 | } 37 | 38 | return Heart::Action::Execute(ActionClass, Target, Activation); 39 | } -------------------------------------------------------------------------------- /Source/HeartCore/Private/Input/HeartInputHandler_Immediate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartInputHandler_Immediate.h" 4 | #include "Input/HeartInputTrigger.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartInputHandler_Immediate) -------------------------------------------------------------------------------- /Source/HeartCore/Private/Input/HeartInputHandler_Script.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartInputHandler_Script.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartInputHandler_Script) 6 | 7 | FHeartEvent UHeartInputHandler_Script::OnTriggered(UObject* Target, const FHeartInputActivation& Trip) const 8 | { 9 | return HandleEvent(Target, Trip); 10 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/Algorithms/FruchtermanReingold.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Nodesoup.h" 6 | 7 | namespace Nodesoup 8 | { 9 | class HEARTCORE_API FruchtermanReingold 10 | { 11 | public: 12 | FruchtermanReingold(FGraphView InGraph, double InStrength = 15.0); 13 | 14 | void operator()(TArray& Positions); 15 | 16 | private: 17 | FGraphView Graph; 18 | const double Strength; 19 | const double StrengthSqr; 20 | double Temperature; 21 | TArray Movements; 22 | }; 23 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/Algorithms/KamadaKawai.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Nodesoup.h" 6 | 7 | namespace Nodesoup 8 | { 9 | // https://gist.github.com/terakun/b7eff90c889c1485898ec9256ca9f91d 10 | class KamadaKawai 11 | { 12 | public: 13 | KamadaKawai(FGraphView InGraph, double Strength = 300.0, double InEnergyThreshold = 1e-2); 14 | 15 | void operator()(TArray& Positions) const; 16 | 17 | private: 18 | struct FSpring 19 | { 20 | double Length = 0.0; 21 | double Strength = 0.0; 22 | }; 23 | 24 | FGraphView Graph; 25 | const double EnergyThreshold; 26 | TArray> Springs; 27 | 28 | static FTwoDimIntArray FloydWarshall(FGraphView Graph); 29 | 30 | double FindMaxVertexEnergy(TConstArrayView Positions, int32& MaxEnergyVertex) const; 31 | 32 | double ComputeVertexEnergy(int32 Vertex, TConstArrayView Positions) const; 33 | 34 | FVector2D ComputeNextVertexPosition(int32 Vertex, TConstArrayView Positions) const; 35 | }; 36 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/Algorithms/Layout.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | namespace Nodesoup 6 | { 7 | /** Distribute vertices equally on a 1.0 radius circle */ 8 | void HEARTCORE_API Circle(TArray& Positions); 9 | 10 | /** Center and scale vertices so the graph fits on a canvas of given dimensions */ 11 | void HEARTCORE_API CenterAndScale(uint32 Width, uint32 Height, TArray& Positions); 12 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/Algorithms/Nodesoup.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | namespace Nodesoup 6 | { 7 | /** Simple adjacency list graph structure */ 8 | 9 | using FTwoDimIntArray = TArray>; 10 | 11 | using FGraphView = const FTwoDimIntArray&; 12 | 13 | /** Main library functions */ 14 | 15 | using FGraphIterationCallback = TFunctionRef, int32)>; 16 | 17 | /** 18 | * Applies the Freuchterman-Reingold algorithm to layout graph @p in a frame of dimensions 19 | * @p width and @p height, in @p iter-count iterations 20 | */ 21 | HEARTCORE_API TArray fruchterman_reingold( 22 | FGraphView Graph, 23 | const FGraphIterationCallback& Callback, 24 | uint32 Width, 25 | uint32 Height, 26 | uint32 Iterations = 300, 27 | double Strength = 15.0); 28 | 29 | HEARTCORE_API TArray kamada_kawai( 30 | FGraphView Graph, 31 | uint32 Width, 32 | uint32 Height, 33 | double Strength = 300.0, 34 | double EnergyThreshold = 1e-2); 35 | 36 | /** Assigns diameters to vertices based on their degree */ 37 | HEARTCORE_API TArray SizeRadii(FGraphView Graph, double MinRadius = 4.0, double Strength = 300.0); 38 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/General/DoOnce.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | namespace DoOnceSupport 6 | { 7 | /** 8 | * Not meant for direct consumption: use DO_ONCE instead. 9 | * 10 | * RAII class that calls a lambda the first time it is created. 11 | * 12 | * Based on Runtime/Core/Public/Misc/ScopeExit.h 13 | */ 14 | template 15 | class TScopeGuard 16 | { 17 | TScopeGuard(TScopeGuard&&) = delete; 18 | TScopeGuard(const TScopeGuard&) = delete; 19 | TScopeGuard& operator=(TScopeGuard&&) = delete; 20 | TScopeGuard& operator=(const TScopeGuard&) = delete; 21 | 22 | public: 23 | // Given a lambda, constructs an RAII scope guard. 24 | explicit TScopeGuard(FuncType&& InFunc) 25 | { 26 | if (!bHasRan) 27 | { 28 | InFunc(); 29 | } 30 | bHasRan = true; 31 | } 32 | 33 | private: 34 | static inline bool bHasRan = false; 35 | }; 36 | 37 | struct FScopeGuardSyntaxSupport 38 | { 39 | template 40 | TScopeGuard operator+(FuncType&& InFunc) 41 | { 42 | return TScopeGuard((FuncType&&)InFunc); 43 | } 44 | }; 45 | } 46 | 47 | #define UE_PRIVATE_DO_ONCE_JOIN(A, B) UE_PRIVATE_DO_ONCE_JOIN_INNER(A, B) 48 | #define UE_PRIVATE_DO_ONCE_JOIN_INNER(A, B) A##B 49 | 50 | #define DO_ONCE const auto UE_PRIVATE_DO_ONCE_JOIN(ScopeGuard_, __LINE__) = ::DoOnceSupport::FScopeGuardSyntaxSupport() + [&]() -------------------------------------------------------------------------------- /Source/HeartCore/Public/General/HeartContextObject.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartContextObject.generated.h" 7 | 8 | // This class does not need to be modified. 9 | UINTERFACE() 10 | class HEARTCORE_API UHeartContextObject : public UInterface 11 | { 12 | GENERATED_BODY() 13 | }; 14 | 15 | /** 16 | * A simple interface to communicate with any class that uses a context object. 17 | */ 18 | class HEARTCORE_API IHeartContextObject 19 | { 20 | GENERATED_BODY() 21 | 22 | public: 23 | UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Context Object") 24 | void SetContextObject(UObject* Object); 25 | 26 | UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Context Object") 27 | UObject* GetContextObject() const; 28 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/General/ObjectTree.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ObjectTree.generated.h" 6 | 7 | namespace Heart 8 | { 9 | struct FObjectNode : TSharedFromThis 10 | { 11 | using FKeyType = TWeakObjectPtr; 12 | 13 | TSharedPtr FindChildNode(FKeyType Class) const; 14 | TSharedRef FindOrAddChildNode(FKeyType Class); 15 | 16 | TMap> Children; 17 | TArray> ObjectList; 18 | }; 19 | 20 | /** 21 | * An object tree is composed of nodes that represent UClasses, and stores a list of objects of that class. 22 | * Only the objects added by calling AddObject will exist in the tree. 23 | * This type can be used to build custom asset filters that only display from a list of manually authored objects. 24 | */ 25 | struct HEARTCORE_API FObjectTree : FObjectNode 26 | { 27 | static TSharedRef MakeTree(); 28 | 29 | void AddObject(UObject* Obj); 30 | void RemoveObject(const UObject* Obj); 31 | void RemoveNode(const UClass* Class); 32 | 33 | TArray> GetObjects(TWeakObjectPtr Class) const; 34 | }; 35 | } 36 | 37 | 38 | UCLASS(BlueprintType) 39 | class HEARTCORE_API UHeartObjectTree : public UObject 40 | { 41 | GENERATED_BODY() 42 | 43 | public: 44 | virtual void PostInitProperties() override; 45 | 46 | UFUNCTION(BlueprintCallable, Category = "Heart|ObjectTree") 47 | void AddObjectToTree(UObject* Object); 48 | 49 | UFUNCTION(BlueprintCallable, Category = "Heart|ObjectTree", meta = (DeterminesOutputType = "Class")) 50 | TArray GetObjectsInTree(const UClass* Class) const; 51 | 52 | private: 53 | TSharedPtr Tree = nullptr; 54 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/General/Vector2DBounds.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Vector2DBounds.generated.h" 6 | 7 | USTRUCT(BlueprintType) 8 | struct FVector2DBounds 9 | { 10 | GENERATED_BODY() 11 | 12 | FVector2DBounds() = default; 13 | 14 | FVector2DBounds(const FVector2D& Min, const FVector2D& Max) 15 | : Min(Min), 16 | Max(Max) {} 17 | 18 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vector2DBounds") 19 | FVector2D Min = FVector2D::ZeroVector; 20 | 21 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vector2DBounds") 22 | FVector2D Max = FVector2D::ZeroVector; 23 | }; 24 | -------------------------------------------------------------------------------- /Source/HeartCore/Public/General/VectorBounds.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "VectorBounds.generated.h" 6 | 7 | /** 8 | * 9 | */ 10 | USTRUCT(BlueprintType) 11 | struct HEARTCORE_API FVectorBounds 12 | { 13 | GENERATED_BODY() 14 | 15 | FVectorBounds() = default; 16 | 17 | FVectorBounds(const FVector& Min, const FVector& Max) 18 | : Min(Min), 19 | Max(Max) {} 20 | 21 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VectorBounds") 22 | FVector Min = FVector::ZeroVector; 23 | 24 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VectorBounds") 25 | FVector Max = FVector::ZeroVector; 26 | }; 27 | 28 | /** 29 | * 30 | */ 31 | USTRUCT(BlueprintType) 32 | struct HEARTCORE_API FVector3fBounds 33 | { 34 | GENERATED_BODY() 35 | 36 | FVector3fBounds() = default; 37 | 38 | FVector3fBounds(const FVector3f& Min, const FVector3f& Max) 39 | : Min(Min), 40 | Max(Max) {} 41 | 42 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vector3fBounds") 43 | FVector3f Min = FVector3f::ZeroVector; 44 | 45 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vector3fBounds") 46 | FVector3f Max = FVector3f::ZeroVector; 47 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/HeartCoreModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartCoreModule : public IModuleInterface 8 | { 9 | public: 10 | HEARTCORE_API static FHeartCoreModule& Get(); 11 | 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputBindingAsset.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "StructUtils/InstancedStruct.h" 6 | #include "Engine/DataAsset.h" 7 | #include "HeartInputBindingAsset.generated.h" 8 | 9 | class UHeartInputHandlerAssetBase; 10 | 11 | USTRUCT(BlueprintType) 12 | struct FHeartBoundInput 13 | { 14 | GENERATED_BODY() 15 | 16 | UPROPERTY(EditAnywhere, meta = (NoResetToDefault, DisplayThumbnail = false)) 17 | TObjectPtr InputHandler; 18 | 19 | UPROPERTY(EditAnywhere, meta = (BaseStruct = "/Script/HeartCore.HeartInputTrigger", ExcludeBaseStruct)) 20 | TArray Triggers; 21 | }; 22 | 23 | /** 24 | * 25 | */ 26 | UCLASS(const, BlueprintType, CollapseCategories) 27 | class HEARTCORE_API UHeartInputBindingAsset : public UDataAsset 28 | { 29 | GENERATED_BODY() 30 | 31 | public: 32 | UPROPERTY(EditAnywhere, Category = "InputBindingAsset") 33 | TArray BindingData; 34 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputHandlerAssetBase.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "Input/HeartInputTypes.h" 7 | #include "Input/HeartEvent.h" 8 | #include "HeartInputHandlerAssetBase.generated.h" 9 | 10 | struct FHeartInputActivation; 11 | class UHeartInputLinkerBase; 12 | 13 | /** 14 | * Base class for all Input Handler assets. 15 | */ 16 | UCLASS(Abstract, Const) 17 | class HEARTCORE_API UHeartInputHandlerAssetBase : public UObject 18 | { 19 | GENERATED_BODY() 20 | 21 | public: 22 | virtual FText GetDescription(const UObject* TestTarget) const 23 | { 24 | return FText::GetEmpty(); 25 | } 26 | 27 | virtual bool PassCondition(const UObject* TestTarget) const 28 | { 29 | return true; 30 | } 31 | 32 | virtual Heart::Input::EExecutionOrder GetExecutionOrder() const 33 | PURE_VIRTUAL(UHeartInputHandlerAssetBase::GetExecutionOrder, return Heart::Input::None; ) 34 | 35 | virtual FHeartEvent OnTriggered(UObject* Target, const FHeartInputActivation& Activation) const 36 | PURE_VIRTUAL(UHeartInputHandlerAssetBase::OnTriggered, return FHeartEvent::Invalid; ) 37 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputHandler_Action.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartInputHandler_Immediate.h" 6 | #include "HeartInputHandler_Action.generated.h" 7 | 8 | class UHeartActionBase; 9 | 10 | UCLASS(meta = (DisplayName = "Graph Action")) 11 | class HEARTCORE_API UHeartInputHandler_Action : public UHeartInputHandler_Immediate 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | virtual FText GetDescription(const UObject* TestTarget) const override; 17 | virtual bool PassCondition(const UObject* TestTarget) const override; 18 | virtual FHeartEvent OnTriggered(UObject* Target, const FHeartInputActivation& Activation) const override; 19 | 20 | void SetAction(const TSubclassOf Class) 21 | { 22 | ActionClass = Class; 23 | } 24 | 25 | protected: 26 | UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (AllowAbstract = "false")) 27 | TSubclassOf ActionClass; 28 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputHandler_Immediate.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartInputHandlerAssetBase.h" 6 | #include "HeartInputTypes.h" 7 | #include "HeartInputHandler_Immediate.generated.h" 8 | 9 | /** 10 | * Base class for simple handlers 11 | */ 12 | UCLASS(Abstract) 13 | class HEARTCORE_API UHeartInputHandler_Immediate : public UHeartInputHandlerAssetBase 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | //~ UHeartInputHandlerAssetBase 19 | virtual Heart::Input::EExecutionOrder GetExecutionOrder() const override 20 | { 21 | return HandleInput ? Heart::Input::Event : Heart::Input::Listener; 22 | } 23 | //~ UHeartInputHandlerAssetBase 24 | 25 | bool GetHandleInput() const { return HandleInput; } 26 | void SetHandleInput(const bool InHandleInput) 27 | { 28 | HandleInput = InHandleInput; 29 | } 30 | 31 | protected: 32 | // Does this handler block input from bubbling (a capture), or allow other handlers to also respond to it? 33 | UPROPERTY(EditAnywhere, Category = "Trigger") 34 | bool HandleInput = true; 35 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputHandler_Script.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartInputHandler_Immediate.h" 6 | #include "HeartInputHandler_Script.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS(Blueprintable, Abstract) 12 | class HEARTCORE_API UHeartInputHandler_Script : public UHeartInputHandler_Immediate 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual FHeartEvent OnTriggered(UObject* Target, const FHeartInputActivation& Trip) const override; 18 | 19 | protected: 20 | UFUNCTION(BlueprintImplementableEvent, Category = "Heart|InputHandlerScript") 21 | FHeartEvent HandleEvent(UObject* Widget, const FHeartInputActivation& Trip) const; 22 | }; -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputLinkerInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartInputLinkerInterface.generated.h" 7 | 8 | // This class does not need to be modified. 9 | UINTERFACE() 10 | class HEARTCORE_API UHeartInputLinkerInterface : public UInterface 11 | { 12 | GENERATED_BODY() 13 | }; 14 | 15 | /** 16 | * Add this to widgets that don't have their own UHeartWidgetInputLinker, but know how to get one, and want to route 17 | * their input through it. 18 | */ 19 | class HEARTCORE_API IHeartInputLinkerInterface 20 | { 21 | GENERATED_BODY() 22 | 23 | public: 24 | /** 25 | * Get the Input Linker for this widget, or null if it doesn't have one. 26 | * It is supported and, in fact, encouraged to implement this by deferring to another widget's implementation: 27 | * 28 | * { 29 | * return Execute_ResolveLinker(SomeWidget); 30 | * } 31 | */ 32 | UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Heart|WidgetInputLinkerRedirector") 33 | class UHeartInputLinkerBase* ResolveLinker() const; 34 | }; 35 | 36 | namespace Heart::Input 37 | { 38 | template 39 | THeartInputLinker* TryFindLinker(const UObject* Target) 40 | { 41 | if (!ensure(IsValid(Target))) return nullptr; 42 | 43 | for (auto&& Test = Target; IsValid(Test); Test = Test->GetOuter()) 44 | { 45 | if (Test->Implements()) 46 | { 47 | if (THeartInputLinker* Linker = Cast(IHeartInputLinkerInterface::Execute_ResolveLinker(Test))) 48 | { 49 | return Linker; 50 | } 51 | } 52 | } 53 | 54 | return nullptr; 55 | } 56 | } -------------------------------------------------------------------------------- /Source/HeartCore/Public/Input/HeartInputTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | struct FHeartEvent; 6 | struct FHeartInputActivation; 7 | 8 | class UHeartInputHandlerAssetBase; 9 | 10 | namespace Heart::Input 11 | { 12 | template 13 | struct TLinkerType 14 | { 15 | static constexpr bool Supported = false; 16 | }; 17 | 18 | enum EExecutionOrder 19 | { 20 | None, // Blank layer. Do not use. 21 | Event, // Default layer. Handlers can capture input or bubble it. 22 | Deferred, // Layer for events that handle event at the moment, but continue to have effects for multiple frames. 23 | Listener, // Interception layer. Handlers can intercept, but cannot stop it from bubbling. 24 | 25 | HighestHandlingPriority = Deferred 26 | }; 27 | 28 | struct FSortableCallback 29 | { 30 | TObjectPtr Handler; 31 | 32 | // Determines the order that callback handler runs in, and whether they bubble the input callstack 33 | const EExecutionOrder Priority = None; 34 | 35 | friend bool operator<(const FSortableCallback& A, const FSortableCallback& B) 36 | { 37 | // Sort in reverse. Higher priorities should be ordered first, lower after. 38 | return A.Priority > B.Priority; 39 | } 40 | }; 41 | } -------------------------------------------------------------------------------- /Source/HeartCoreEditor/HeartCoreEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartCoreEditor : ModuleRules 6 | { 7 | public HeartCoreEditor(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | PublicDependencyModuleNames.AddRange( 12 | new [] 13 | { 14 | "Core", 15 | "HeartCore" 16 | } 17 | ); 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new [] 21 | { 22 | "AssetDefinition", 23 | "CoreUObject", 24 | "Engine", 25 | "InputCore", 26 | "PropertyEditor", 27 | "Slate", 28 | "SlateCore", 29 | "SharedSettingsWidgets", 30 | "UnrealEd", 31 | } 32 | ); 33 | } 34 | } -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Private/Assets/AssetDefinition_HeartInputHandlerAsset.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Assets/AssetDefinition_HeartInputHandlerAsset.h" 4 | 5 | #include "Input/HeartInputHandlerAssetBase.h" 6 | 7 | #include "HeartEditorShared.h" 8 | 9 | #include UE_INLINE_GENERATED_CPP_BY_NAME(AssetDefinition_HeartInputHandlerAsset) 10 | 11 | #define LOCTEXT_NAMESPACE "AssetDefinition_HeartInputHandlerAsset" 12 | 13 | FText UAssetDefinition_HeartInputHandlerAsset::GetAssetDisplayName() const 14 | { 15 | return LOCTEXT("AssetDisplayName", "Heart Input Handler Asset"); 16 | } 17 | 18 | FLinearColor UAssetDefinition_HeartInputHandlerAsset::GetAssetColor() const 19 | { 20 | return FColor(155, 24, 155); 21 | } 22 | 23 | TSoftClassPtr<> UAssetDefinition_HeartInputHandlerAsset::GetAssetClass() const 24 | { 25 | return UHeartInputHandlerAssetBase::StaticClass(); 26 | } 27 | 28 | TConstArrayView UAssetDefinition_HeartInputHandlerAsset::GetAssetCategories() const 29 | { 30 | return Heart::EditorShared::GetAssetCategories(); 31 | } 32 | 33 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Private/Assets/HeartDefaultClassFilter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Assets/HeartDefaultClassFilter.h" 4 | 5 | bool FHeartDefaultClassFilter::IsClassAllowed(const FClassViewerInitializationOptions& InInitOptions, 6 | const UClass* InClass, 7 | const TSharedRef InFilterFuncs) 8 | { 9 | bool Passes = InFilterFuncs->IfInChildOfClassesSet(AllowedChildrenOfClasses, InClass) != EFilterReturn::Failed; 10 | 11 | if (Passes) 12 | { 13 | Passes = !InClass->HasAnyClassFlags(DisallowedClassFlags); 14 | } 15 | 16 | return Passes; 17 | } 18 | 19 | bool FHeartDefaultClassFilter::IsUnloadedClassAllowed(const FClassViewerInitializationOptions& InInitOptions, 20 | const TSharedRef InUnloadedClassData, 21 | const TSharedRef InFilterFuncs) 22 | { 23 | bool Passes = InFilterFuncs->IfInChildOfClassesSet(AllowedChildrenOfClasses, InUnloadedClassData) != EFilterReturn::Failed; 24 | 25 | if (Passes) 26 | { 27 | Passes = !InUnloadedClassData->HasAnyClassFlags(DisallowedClassFlags); 28 | } 29 | 30 | return Passes; 31 | } 32 | -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Private/HeartCoreEditorModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartCoreEditorModule.h" 4 | 5 | DEFINE_LOG_CATEGORY(LogHeartCoreEditor); 6 | 7 | #define LOCTEXT_NAMESPACE "HeartCoreEditorModule" 8 | 9 | void FHeartCoreEditorModule::StartupModule() 10 | { 11 | } 12 | 13 | void FHeartCoreEditorModule::ShutdownModule() 14 | { 15 | } 16 | 17 | #undef LOCTEXT_NAMESPACE 18 | 19 | IMPLEMENT_MODULE(FHeartCoreEditorModule, HeartCoreEditor) -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/Assets/AssetDefinition_HeartInputHandlerAsset.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "AssetDefinitionDefault.h" 6 | 7 | #include "AssetDefinition_HeartInputHandlerAsset.generated.h" 8 | 9 | UCLASS() 10 | class UAssetDefinition_HeartInputHandlerAsset : public UAssetDefinitionDefault 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual FText GetAssetDisplayName() const override; 16 | virtual FLinearColor GetAssetColor() const override; 17 | virtual TSoftClassPtr<> GetAssetClass() const override; 18 | virtual TConstArrayView GetAssetCategories() const override; 19 | }; -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/Assets/HeartDefaultClassFilter.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ClassViewerFilter.h" 6 | 7 | class HEARTCOREEDITOR_API FHeartDefaultClassFilter : public IClassViewerFilter 8 | { 9 | public: 10 | FHeartDefaultClassFilter() = default; 11 | 12 | virtual bool IsClassAllowed(const FClassViewerInitializationOptions& InInitOptions, const UClass* InClass, 13 | TSharedRef InFilterFuncs) override; 14 | 15 | virtual bool IsUnloadedClassAllowed(const FClassViewerInitializationOptions& InInitOptions, 16 | const TSharedRef InUnloadedClassData, 17 | TSharedRef InFilterFuncs) override; 18 | 19 | /** All children of these classes will be included unless filtered out by another setting. */ 20 | TSet AllowedChildrenOfClasses; 21 | 22 | /** Disallowed class flags. */ 23 | EClassFlags DisallowedClassFlags = CLASS_Abstract | CLASS_Deprecated | CLASS_NewerVersionExists | CLASS_HideDropDown; 24 | }; 25 | -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/Assets/HeartInputHandlerAssetFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Factories/Factory.h" 6 | #include "HeartInputHandlerAssetFactory.generated.h" 7 | 8 | UCLASS(hidecategories = Object, MinimalAPI) 9 | class UHeartInputHandlerAssetFactory : public UFactory 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | UHeartInputHandlerAssetFactory(const FObjectInitializer& ObjectInitializer); 15 | 16 | // UFactory 17 | virtual bool ConfigureProperties() override; 18 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext) override; 19 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; 20 | // -- 21 | 22 | // The class of the created asset to create 23 | UPROPERTY(EditAnywhere, Category = "HeartInputHandlerAssetFactory") 24 | TSubclassOf AssetClass; 25 | }; -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/Customizations/ItemsArrayCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | namespace Heart 6 | { 7 | /** 8 | * Utility customization for any struct that should appear as an array. 9 | */ 10 | class HEARTCOREEDITOR_API FItemsArrayCustomization final : public IPropertyTypeCustomization 11 | { 12 | public: 13 | struct FArgs 14 | { 15 | FName HeaderProp = NAME_None; 16 | FName ArrayProp = NAME_None; 17 | }; 18 | 19 | private: 20 | friend SharedPointerInternals::TIntrusiveReferenceController; 21 | 22 | FItemsArrayCustomization(const FArgs& Args) 23 | : Customization(Args) {} 24 | 25 | public: 26 | static TSharedRef MakeInstance(); 27 | static TSharedRef MakeInstance(FArgs Args); 28 | 29 | virtual void CustomizeHeader(TSharedRef PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils) override; 30 | virtual void CustomizeChildren(TSharedRef StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 31 | 32 | void OnGenerateElement(TSharedRef ElementProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder); 33 | 34 | private: 35 | FArgs Customization; 36 | }; 37 | } -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/HeartCoreEditorModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHeartCoreEditor, Log, All) 8 | 9 | class FHeartCoreEditorModule : public IModuleInterface 10 | { 11 | public: 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | }; 15 | -------------------------------------------------------------------------------- /Source/HeartCoreEditor/Public/HeartEditorShared.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Misc/AssetCategoryPath.h" 6 | 7 | namespace Heart::EditorShared 8 | { 9 | static FLinearColor HeartColor(FColor(255, 24, 44)); 10 | static FLinearColor HeartColorDark(FColor(155, 24, 84)); 11 | 12 | HEARTCOREEDITOR_API TConstArrayView GetAssetCategories(); 13 | 14 | HEARTCOREEDITOR_API bool CheckOutFile(const FString& FileName, bool ShowNotification); 15 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Customizations/HeartGuidCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "IPropertyTypeCustomization.h" 6 | 7 | class IPropertyHandle; 8 | 9 | struct FHeartGuidCustomization : public IPropertyTypeCustomization 10 | { 11 | static TSharedRef MakeInstance(); 12 | 13 | // IPropertyTypeCustomization interface 14 | virtual void CustomizeHeader(TSharedRef StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 15 | virtual void CustomizeChildren(TSharedRef StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 16 | virtual bool ShouldInlineKey() const override { return true; } 17 | 18 | private: 19 | FText HandleTextBoxText() const; 20 | 21 | TSharedPtr PropertyHandle; 22 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/AssetDefinition_HeartGraphBlueprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Graph/AssetDefinition_HeartGraphBlueprint.h" 4 | #include "Model/HeartGraphBlueprint.h" 5 | #include "HeartEditorShared.h" 6 | 7 | #define LOCTEXT_NAMESPACE "AssetDefinition_HeartGraphBlueprint" 8 | 9 | FText UAssetDefinition_HeartGraphBlueprint::GetAssetDisplayName() const 10 | { 11 | return LOCTEXT("DisplayName", "Heart Graph Blueprint"); 12 | } 13 | 14 | FText UAssetDefinition_HeartGraphBlueprint::GetAssetDescription(const FAssetData& AssetData) const 15 | { 16 | return LOCTEXT("Description", "New Blueprint for a Heart Graph class"); 17 | } 18 | 19 | FLinearColor UAssetDefinition_HeartGraphBlueprint::GetAssetColor() const 20 | { 21 | return Heart::EditorShared::HeartColorDark; 22 | } 23 | 24 | TSoftClassPtr UAssetDefinition_HeartGraphBlueprint::GetAssetClass() const 25 | { 26 | return UHeartGraphBlueprint::StaticClass(); 27 | } 28 | 29 | TConstArrayView UAssetDefinition_HeartGraphBlueprint::GetAssetCategories() const 30 | { 31 | return Heart::EditorShared::GetAssetCategories(); 32 | } 33 | 34 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/HeartGraphSchemaCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "IDetailCustomization.h" 6 | 7 | class FHeartGraphSchemaCustomization : public IDetailCustomization 8 | { 9 | public: 10 | /** Makes a new instance of this detail layout class for a specific detail view requesting it */ 11 | static TSharedRef MakeInstance(); 12 | 13 | FHeartGraphSchemaCustomization(); 14 | 15 | /** IDetailCustomization interface */ 16 | virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override; 17 | 18 | private: 19 | void OnStyleSelectionChanged(FName Name, ESelectInfo::Type SelectInfo); 20 | FText GetSelectedStyle() const; 21 | 22 | void OnPolicySelectionChanged(FName Name, ESelectInfo::Type SelectInfo); 23 | FText GetSelectedPolicy() const; 24 | 25 | static FText NameToText(FName Name); 26 | TSharedRef OnGenerateNameWidget(FName Style); 27 | 28 | TSharedPtr SlateStyleProp; 29 | TSharedPtr DrawingPolicyProp; 30 | 31 | TArray StyleOptions; 32 | TArray PolicyOptions; 33 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/Widget/ConnectionDrawingPolicies/DebugConnectionDrawingPolicy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "DebugConnectionDrawingPolicy.h" 4 | 5 | namespace Heart::Editor 6 | { 7 | FDebugConnectionDrawingPolicy::FDebugConnectionDrawingPolicy(const int32 InBackLayerID, const int32 InFrontLayerID, 8 | const float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements, UEdGraph* InGraph) 9 | : FConnectionDrawingPolicy(InBackLayerID, InFrontLayerID, InZoomFactor, InClippingRect, InDrawElements), 10 | EdGraph(InGraph) 11 | { 12 | } 13 | 14 | void FDebugConnectionDrawingPolicy::DetermineWiringStyle(UEdGraphPin* OutputPin, UEdGraphPin* InputPin, 15 | FConnectionParams& Params) 16 | { 17 | FConnectionDrawingPolicy::DetermineWiringStyle(OutputPin, InputPin, Params); 18 | Params.WireColor = FColor::Red; 19 | } 20 | 21 | FVector2D FDebugConnectionDrawingPolicy::ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const 22 | { 23 | const FVector2D Delta = End - Start; 24 | const FVector2D NormDelta = Delta.GetSafeNormal(); 25 | 26 | return NormDelta; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/Widget/ConnectionDrawingPolicies/DebugConnectionDrawingPolicy.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ConnectionDrawingPolicy.h" 6 | 7 | namespace Heart::Editor 8 | { 9 | class FDebugConnectionDrawingPolicy : public FConnectionDrawingPolicy 10 | { 11 | public: 12 | FDebugConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements, UEdGraph* InGraph); 13 | UEdGraph* EdGraph; 14 | 15 | virtual void DetermineWiringStyle(UEdGraphPin* OutputPin, UEdGraphPin* InputPin, FConnectionParams& Params) override; 16 | virtual FVector2D ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const override; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/Widget/Pins/SHeartGraphPin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Graph/Widgets/Pins/SHeartGraphPin.h" 4 | #include "Model/HeartGraphNode.h" 5 | #include "Nodes/HeartEdGraphNode.h" 6 | #include "Slate/SHeartGraphWidgetBase.h" 7 | 8 | SHeartGraphPin::SHeartGraphPin() 9 | { 10 | } 11 | 12 | void SHeartGraphPin::Construct(const FArguments& InArgs, UEdGraphPin* InPin) 13 | { 14 | SGraphPin::Construct(SGraphPin::FArguments(), InPin); 15 | 16 | UHeartGraphNode* GraphNode = Cast(GraphPinObj->GetOwningNode())->GetHeartGraphNode(); 17 | FHeartPinGuid PinGuid; 18 | 19 | if (IsValid(GraphNode)) 20 | { 21 | if (auto Option = GraphNode->QueryPins().Find( 22 | [&InPin](const FHeartGraphPinDesc& Desc) 23 | { 24 | return Desc.Name == InPin->PinName; 25 | }); 26 | Option.IsSet()) 27 | { 28 | PinGuid = Option.GetValue(); 29 | } 30 | } 31 | 32 | AddMetadata(MakeShared(GraphNode, PinGuid, InArgs._Linker)); 33 | 34 | // @todo expose setting this from the schema 35 | //bUsePinColorForText = true; 36 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Graph/Widget/SHeartDetailsPanel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Graph/Widgets/SHeartDetailsPanel.h" 4 | 5 | #include "Model/HeartGraph.h" 6 | 7 | #include "SlateOptMacros.h" 8 | #include "Graph/HeartGraphAssetEditor.h" 9 | 10 | BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION 11 | 12 | namespace Heart::AssetEditor 13 | { 14 | void SDetailsPanel::Construct(const FArguments& InArgs, const TSharedPtr& AssetEditor) 15 | { 16 | FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); 17 | 18 | FDetailsViewArgs Args; 19 | Args.bHideSelectionTip = true; 20 | Args.bShowPropertyMatrixButton = false; 21 | Args.DefaultsOnlyVisibility = EEditDefaultsOnlyNodeVisibility::Hide; 22 | Args.NotifyHook = AssetEditor.Get(); 23 | 24 | FIsPropertyEditingEnabled CanEditDelegate; 25 | CanEditDelegate.BindSP(AssetEditor.ToSharedRef(), &FHeartGraphEditor::CanEdit); 26 | 27 | DetailsView_Graph = PropertyModule.CreateDetailView(Args); 28 | DetailsView_Graph->SetIsPropertyEditingEnabledDelegate(CanEditDelegate); 29 | DetailsView_Graph->SetObject(AssetEditor->GetHeartGraph()); 30 | 31 | DetailsView_Object = PropertyModule.CreateDetailView(Args); 32 | DetailsView_Object->SetIsPropertyEditingEnabledDelegate(CanEditDelegate); 33 | DetailsView_Object->SetObject(nullptr); 34 | 35 | ChildSlot 36 | [ 37 | SNew(SSplitter) 38 | .Orientation(Orient_Vertical) 39 | + SSplitter::Slot() 40 | [ 41 | DetailsView_Graph.ToSharedRef() 42 | ] 43 | + SSplitter::Slot() 44 | [ 45 | DetailsView_Object.ToSharedRef() 46 | ] 47 | ]; 48 | } 49 | } 50 | 51 | END_SLATE_FUNCTION_BUILD_OPTIMIZATION 52 | -------------------------------------------------------------------------------- /Source/HeartEditor/Private/HeartGraphStatics.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | namespace Heart::Graph 6 | { 7 | #if WITH_EDITOR 8 | // Metadata added to UProperties on children of UHeartGraphNode to trigger reconstruction of pins on the node 9 | // in the editor. 10 | static const FLazyName Metadata_TriggersReconstruct("TriggersReconstruct"); 11 | #endif 12 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Input/EdGraphPointerWrappers.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "EdGraphPointerWrappers.h" 4 | #include "Model/HeartGraphNode.h" 5 | #include "Nodes/HeartEdGraphNode.h" 6 | #include "Slate/SHeartGraphWidgetBase.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(EdGraphPointerWrappers) 9 | 10 | UHeartEdGraphPin* UHeartEdGraphPin::Wrap(const UEdGraphPin* Pin) 11 | { 12 | UHeartEdGraphPin* NewWrapper = NewObject(); 13 | NewWrapper->EdGraphPin = Pin; 14 | if (auto Node = NewWrapper->GetHeartGraphNode(); 15 | IsValid(Node)) 16 | { 17 | if (auto Option = Node->QueryPins().Find( 18 | [&Pin](const FHeartGraphPinDesc& Desc) 19 | { 20 | return Desc.Name == Pin->PinName; 21 | }); 22 | Option.IsSet()) 23 | { 24 | NewWrapper->PinGuid = Option.GetValue(); 25 | } 26 | } 27 | 28 | return NewWrapper; 29 | } 30 | 31 | UHeartGraphNode* UHeartEdGraphPin::GetHeartGraphNode() const 32 | { 33 | if (EdGraphPin) 34 | { 35 | return Cast(EdGraphPin->GetOwningNode())->GetHeartGraphNode(); 36 | } 37 | return nullptr; 38 | } 39 | 40 | FHeartPinGuid UHeartEdGraphPin::GetPinGuid() const 41 | { 42 | return PinGuid; 43 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Input/EdGraphPointerWrappers.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Object.h" 6 | #include "View/HeartVisualizerInterfaces.h" 7 | #include "EdGraphPointerWrappers.generated.h" 8 | 9 | /** 10 | * This object is a wrapper around an UEdGraphPin pointer, to allow it to be passed through heart linkers 11 | */ 12 | UCLASS() 13 | class UHeartEdGraphPin : public UObject, public IGraphPinVisualizerInterface 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | static UHeartEdGraphPin* Wrap(const UEdGraphPin* Pin); 19 | 20 | virtual UHeartGraphNode* GetHeartGraphNode() const override; 21 | virtual FHeartPinGuid GetPinGuid() const override; 22 | 23 | protected: 24 | const UEdGraphPin* EdGraphPin = nullptr; 25 | FHeartPinGuid PinGuid; 26 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Nodes/AssetTypeActions_HeartGraphNodeBlueprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Nodes/AssetTypeActions_HeartGraphNodeBlueprint.h" 4 | #include "Model/HeartGraphNodeBlueprint.h" 5 | #include "HeartEditorShared.h" 6 | 7 | #define LOCTEXT_NAMESPACE "AssetDefinition_HeartGraphNodeBlueprint" 8 | 9 | FText UAssetDefinition_HeartGraphNodeBlueprint::GetAssetDisplayName() const 10 | { 11 | return LOCTEXT("DisplayName", "Heart Graph Node Blueprint"); 12 | } 13 | 14 | FText UAssetDefinition_HeartGraphNodeBlueprint::GetAssetDescription(const FAssetData& AssetData) const 15 | { 16 | return LOCTEXT("Description", "New Blueprint for a Heart Graph Node class"); 17 | } 18 | 19 | FLinearColor UAssetDefinition_HeartGraphNodeBlueprint::GetAssetColor() const 20 | { 21 | return Heart::EditorShared::HeartColorDark; 22 | } 23 | 24 | TSoftClassPtr UAssetDefinition_HeartGraphNodeBlueprint::GetAssetClass() const 25 | { 26 | return UHeartGraphNodeBlueprint::StaticClass(); 27 | } 28 | 29 | TConstArrayView UAssetDefinition_HeartGraphNodeBlueprint::GetAssetCategories() const 30 | { 31 | return Heart::EditorShared::GetAssetCategories(); 32 | } 33 | 34 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Nodes/HeartBreakpoint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Nodes/HeartBreakpoint.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartBreakpoint) 6 | 7 | void FHeartBreakpoint::AddBreakpoint() 8 | { 9 | if (!bHasBreakpoint) 10 | { 11 | bHasBreakpoint = true; 12 | bBreakpointEnabled = true; 13 | } 14 | } 15 | 16 | void FHeartBreakpoint::RemoveBreakpoint() 17 | { 18 | if (bHasBreakpoint) 19 | { 20 | bHasBreakpoint = false; 21 | bBreakpointEnabled = false; 22 | } 23 | } 24 | 25 | bool FHeartBreakpoint::HasBreakpoint() const 26 | { 27 | return bHasBreakpoint; 28 | } 29 | 30 | void FHeartBreakpoint::EnableBreakpoint() 31 | { 32 | if (bHasBreakpoint && !bBreakpointEnabled) 33 | { 34 | bBreakpointEnabled = true; 35 | } 36 | } 37 | 38 | bool FHeartBreakpoint::CanEnableBreakpoint() const 39 | { 40 | return bHasBreakpoint && !bBreakpointEnabled; 41 | } 42 | 43 | void FHeartBreakpoint::DisableBreakpoint() 44 | { 45 | if (bHasBreakpoint && bBreakpointEnabled) 46 | { 47 | bBreakpointEnabled = false; 48 | } 49 | } 50 | 51 | bool FHeartBreakpoint::IsBreakpointEnabled() const 52 | { 53 | return bHasBreakpoint && bBreakpointEnabled; 54 | } 55 | 56 | void FHeartBreakpoint::ToggleBreakpoint() 57 | { 58 | if (bHasBreakpoint) 59 | { 60 | bHasBreakpoint = false; 61 | bBreakpointEnabled = false; 62 | } 63 | else 64 | { 65 | bHasBreakpoint = true; 66 | bBreakpointEnabled = true; 67 | } 68 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Private/Nodes/HeartGraphNodeCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "IDetailCustomization.h" 6 | 7 | class FHeartGraphNodeCustomization : public IDetailCustomization 8 | { 9 | public: 10 | /** Makes a new instance of this detail layout class for a specific detail view requesting it */ 11 | static TSharedRef MakeInstance(); 12 | 13 | FHeartGraphNodeCustomization(); 14 | 15 | /** IDetailCustomization interface */ 16 | virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override; 17 | 18 | private: 19 | void OnStyleSelectionChanged(FName Name, ESelectInfo::Type SelectInfo); 20 | TSharedRef OnGenerateStyleWidget(FName Style); 21 | FText GetSelectedStyle() const; 22 | 23 | TSharedPtr StyleProp; 24 | 25 | TArray StyleOptions; 26 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/AssetEditor/ApplicationMode_Editor.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "WorkflowOrientedApp/ApplicationMode.h" 6 | #include "WorkflowOrientedApp/WorkflowTabManager.h" 7 | 8 | namespace Heart::AssetEditor 9 | { 10 | class FHeartGraphEditor; 11 | 12 | class FApplicationMode_Editor : public FApplicationMode 13 | { 14 | public: 15 | static const FLazyName ModeID; 16 | 17 | FApplicationMode_Editor(TSharedRef AssetEditor); 18 | 19 | /** FApplicationMode interface */ 20 | virtual void RegisterTabFactories(TSharedPtr InTabManager) override; 21 | 22 | protected: 23 | /** The hosting app */ 24 | TWeakPtr HeartGraphAssetEditorPtr; 25 | 26 | /** The tab factories we support */ 27 | FWorkflowAllowedTabSet TabFactories; 28 | }; 29 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/AssetDefinition_HeartGraph.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "AssetDefinitionDefault.h" 6 | 7 | #include "AssetDefinition_HeartGraph.generated.h" 8 | 9 | UCLASS() 10 | class UAssetDefinition_HeartGraph : public UAssetDefinitionDefault 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual FText GetAssetDisplayName() const override; 16 | virtual FLinearColor GetAssetColor() const override; 17 | virtual TConstArrayView GetAssetCategories() const override; 18 | virtual TSoftClassPtr<> GetAssetClass() const override; 19 | 20 | virtual EAssetCommandResult OpenAssets(const FAssetOpenArgs& OpenArgs) const override; 21 | virtual EAssetCommandResult PerformAssetDiff(const FAssetDiffArgs& DiffArgs) const override; 22 | }; 23 | -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/AssetDefinition_HeartGraphBlueprint.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Script/AssetDefinition_Blueprint.h" 6 | #include "AssetDefinition_HeartGraphBlueprint.generated.h" 7 | 8 | UCLASS() 9 | class HEARTEDITOR_API UAssetDefinition_HeartGraphBlueprint : public UAssetDefinition_Blueprint 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | // UAssetDefinition Begin 15 | virtual FText GetAssetDisplayName() const override; 16 | virtual FText GetAssetDescription(const FAssetData& AssetData) const override; 17 | virtual FLinearColor GetAssetColor() const override; 18 | virtual TSoftClassPtr GetAssetClass() const override; 19 | virtual TConstArrayView GetAssetCategories() const override; 20 | // UAssetDefinition End 21 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/HeartEdGraphUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | class UHeartGraph; 6 | 7 | namespace Heart 8 | { 9 | namespace AssetEditor 10 | { 11 | class FHeartGraphEditor; 12 | } 13 | 14 | namespace GraphUtils 15 | { 16 | static const FLazyName DefaultStyle("GraphDefault"); 17 | 18 | bool JumpToClassDefinition(const UClass* Class); 19 | 20 | bool CheckForLoop(UEdGraphNode* A, UEdGraphNode* B); 21 | 22 | TSharedPtr CreateHeartGraphAssetEditor(const EToolkitMode::Type Mode, const TSharedPtr& InitToolkitHost, UHeartGraph* HeartGraph); 23 | 24 | TSharedPtr GetHeartGraphAssetEditor(const UObject* ObjectToFocusOn); 25 | } 26 | } -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/HeartGraphBlueprintFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Factories/Factory.h" 6 | #include "HeartGraphBlueprintFactory.generated.h" 7 | 8 | UCLASS(hidecategories = Object, MinimalAPI) 9 | class UHeartGraphBlueprintFactory : public UFactory 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | UHeartGraphBlueprintFactory(const FObjectInitializer& ObjectInitializer); 15 | 16 | // UFactory 17 | virtual bool ConfigureProperties() override; 18 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext) override; 19 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; 20 | // -- 21 | 22 | // The parent class of the created blueprint 23 | UPROPERTY(EditAnywhere, Category = "HeartGraphBlueprintFactory") 24 | TSubclassOf ParentClass; 25 | }; 26 | -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/HeartGraphFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Factories/Factory.h" 6 | #include "HeartGraphFactory.generated.h" 7 | 8 | UCLASS(HideCategories = Object) 9 | class HEARTEDITOR_API UHeartGraphFactory : public UFactory 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | UHeartGraphFactory(const FObjectInitializer& ObjectInitializer); 15 | 16 | virtual bool ConfigureProperties() override; 17 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; 18 | 19 | protected: 20 | UPROPERTY(EditAnywhere, Category = Asset) 21 | TSubclassOf AssetClass; 22 | 23 | // @todo set this up in ConfigureProperties 24 | UPROPERTY(EditAnywhere, Category = Asset) 25 | TSubclassOf SchemaClass; 26 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/Widgets/Nodes/SHeartGraphNode_Horizontal.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "SHeartGraphNodeBase.h" 6 | 7 | class SHeartGraphNode_Horizontal : public SHeartGraphNodeBase 8 | { 9 | public: 10 | SLATE_BEGIN_ARGS(SHeartGraphNode_Horizontal) {} 11 | SLATE_END_ARGS() 12 | 13 | void Construct(const FArguments& InArgs, UHeartEdGraphNode* InNode); 14 | 15 | virtual TSharedRef CreateNodeContentArea() override; 16 | 17 | // Variant of SGraphNode::AddPinButtonContent 18 | virtual void AddPinButton(TSharedPtr OutputBox, TSharedRef ButtonContent, const EEdGraphPinDirection Direction, FString DocumentationExcerpt = FString(), TSharedPtr CustomTooltip = nullptr); 19 | 20 | protected: 21 | virtual void UpdateGraphNode() override; 22 | }; 23 | -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/Widgets/Nodes/SHeartGraphNode_Vertical.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "SHeartGraphNodeBase.h" 6 | 7 | class SHeartGraphNode_Vertical : public SHeartGraphNodeBase 8 | { 9 | public: 10 | SLATE_BEGIN_ARGS(SHeartGraphNode_Vertical) {} 11 | SLATE_END_ARGS() 12 | 13 | void Construct(const FArguments& InArgs, UHeartEdGraphNode* InNode); 14 | 15 | virtual TSharedRef CreateNodeContentArea() override; 16 | 17 | virtual void AddPin(const TSharedRef& PinToAdd) override; 18 | 19 | // Variant of SGraphNode::AddPinButtonContent 20 | virtual void AddPinButton(TSharedPtr OutputBox, TSharedRef ButtonContent, const EEdGraphPinDirection Direction, FString DocumentationExcerpt = FString(), TSharedPtr CustomTooltip = nullptr); 21 | 22 | protected: 23 | virtual void UpdateGraphNode() override; 24 | 25 | /** The area where input pins reside */ 26 | TSharedPtr TopNodeBox; 27 | 28 | /** The area where the node title resides */ 29 | TSharedPtr CenterNodeBox; 30 | 31 | /** The area where output pins reside */ 32 | TSharedPtr BottomNodeBox; 33 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/Widgets/Pins/SHeartGraphPin.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "SGraphPin.h" 6 | #include "Input/HeartSlateInputLinker.h" 7 | 8 | class HEARTEDITOR_API SHeartGraphPin : public SGraphPin 9 | { 10 | public: 11 | SHeartGraphPin(); 12 | 13 | SLATE_BEGIN_ARGS(SHeartGraphPin) 14 | {} 15 | SLATE_ARGUMENT( UHeartSlateInputLinker*, Linker ) 16 | SLATE_END_ARGS() 17 | 18 | void Construct(const FArguments& InArgs, UEdGraphPin* InPin); 19 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Graph/Widgets/SHeartDetailsPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Widgets/SCompoundWidget.h" 6 | 7 | namespace Heart::AssetEditor 8 | { 9 | class FHeartGraphEditor; 10 | 11 | /** 12 | * A split details panel showing two detail views, one for the Graph / GraphNode and one for the NodeObject 13 | */ 14 | class HEARTEDITOR_API SDetailsPanel : public SCompoundWidget 15 | { 16 | public: 17 | SLATE_BEGIN_ARGS(SDetailsPanel) 18 | { 19 | } 20 | SLATE_END_ARGS() 21 | 22 | /** Constructs this widget with InArgs */ 23 | void Construct(const FArguments& InArgs, const TSharedPtr& AssetEditor); 24 | 25 | TSharedPtr DetailsView_Graph; 26 | TSharedPtr DetailsView_Object; 27 | }; 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /Source/HeartEditor/Public/HeartEditorStyle.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Styling/SlateStyle.h" 6 | 7 | class HEARTEDITOR_API FHeartEditorStyle 8 | { 9 | public: 10 | static TSharedPtr Get() { return StyleSet; } 11 | static FName GetStyleSetName(); 12 | 13 | static void Initialize(); 14 | static void Shutdown(); 15 | 16 | static const FSlateBrush* GetBrush(const FName PropertyName, const ANSICHAR* Specifier = nullptr) 17 | { 18 | return Get()->GetBrush(PropertyName, Specifier); 19 | } 20 | 21 | private: 22 | static TSharedPtr StyleSet; 23 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Nodes/AssetTypeActions_HeartGraphNodeBlueprint.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Script/AssetDefinition_Blueprint.h" 6 | #include "AssetTypeActions_HeartGraphNodeBlueprint.generated.h" 7 | 8 | UCLASS() 9 | class HEARTEDITOR_API UAssetDefinition_HeartGraphNodeBlueprint : public UAssetDefinition_Blueprint 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | // UAssetDefinition Begin 15 | virtual FText GetAssetDisplayName() const override; 16 | virtual FText GetAssetDescription(const FAssetData& AssetData) const override; 17 | virtual FLinearColor GetAssetColor() const override; 18 | virtual TSoftClassPtr GetAssetClass() const override; 19 | virtual TConstArrayView GetAssetCategories() const override; 20 | // UAssetDefinition End 21 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Nodes/HeartBreakpoint.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartBreakpoint.generated.h" 6 | 7 | // @todo revisit breakpoint system. it isn't really even being used. either remove, or expand usability 8 | 9 | USTRUCT() 10 | struct HEARTEDITOR_API FHeartBreakpoint 11 | { 12 | GENERATED_BODY() 13 | 14 | FHeartBreakpoint() 15 | { 16 | bHasBreakpoint = false; 17 | bBreakpointEnabled = false; 18 | bBreakpointHit = false; 19 | } 20 | 21 | UPROPERTY() 22 | bool bHasBreakpoint; 23 | 24 | bool bBreakpointEnabled; 25 | bool bBreakpointHit; 26 | 27 | void AddBreakpoint(); 28 | void RemoveBreakpoint(); 29 | bool HasBreakpoint() const; 30 | 31 | void EnableBreakpoint(); 32 | bool CanEnableBreakpoint() const; 33 | 34 | void DisableBreakpoint(); 35 | bool IsBreakpointEnabled() const; 36 | 37 | void ToggleBreakpoint(); 38 | }; -------------------------------------------------------------------------------- /Source/HeartEditor/Public/Nodes/HeartGraphNodeBlueprintFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Factories/Factory.h" 6 | #include "HeartGraphNodeBlueprintFactory.generated.h" 7 | 8 | UCLASS(hidecategories = Object, MinimalAPI) 9 | class UHeartGraphNodeBlueprintFactory : public UFactory 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | UHeartGraphNodeBlueprintFactory(const FObjectInitializer& ObjectInitializer); 15 | 16 | // UFactory 17 | virtual bool ConfigureProperties() override; 18 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext) override; 19 | virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; 20 | // -- 21 | 22 | // The parent class of the created blueprint 23 | UPROPERTY(EditAnywhere, Category = "HeartGraphNodeBlueprintFactory") 24 | TSubclassOf ParentClass; 25 | }; 26 | -------------------------------------------------------------------------------- /Source/HeartNet/HeartNet.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartNet : ModuleRules 6 | { 7 | public HeartNet(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | // Engine dependencies 12 | PublicDependencyModuleNames.AddRange( 13 | new [] 14 | { 15 | "Core", 16 | "GameplayTags", 17 | "NetCore" 18 | } 19 | ); 20 | 21 | // Plugin dependencies 22 | PublicDependencyModuleNames.AddRange( 23 | new [] 24 | { 25 | "Blood", 26 | "Flakes", 27 | "Heart", 28 | "HeartCore" 29 | }); 30 | 31 | PrivateDependencyModuleNames.AddRange( 32 | new [] 33 | { 34 | "CoreUObject", 35 | "Engine" 36 | } 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /Source/HeartNet/Private/Actions/HeartRemoteActionLog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Actions/HeartRemoteActionLog.h" 4 | #include "BloodContainer.h" 5 | #include "GraphProxy/HeartGraphNetProxy.h" 6 | #include "ModelView/HeartActionHistory.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartRemoteActionLog) 9 | 10 | #define LOCTEXT_NAMESPACE "HeartRemoveActionLog" 11 | 12 | const FLazyName UHeartRemoteActionLog::LogStorage("rpc_log"); 13 | 14 | FText UHeartRemoteActionLog::GetDescription(const UObject* Target) const 15 | { 16 | return FText::Format(LOCTEXT("DescriptionFormat", "Remote Action on '{0}'"), 17 | { FText::FromString(Target->GetName()) }); 18 | } 19 | 20 | FHeartEvent UHeartRemoteActionLog::ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, 21 | UObject* ContextObject, FBloodContainer& UndoData) const 22 | { 23 | checkfSlow(Activation.IsRedoAction(), TEXT("UHeartRemoteActionLog should only be executed as a Redo!")) 24 | 25 | auto&& Data = UndoData.Get(LogStorage); 26 | Data.NetProxy->ExecuteRedoOnServer(); 27 | 28 | return FHeartEvent::Handled; 29 | } 30 | 31 | bool UHeartRemoteActionLog::Undo(UObject* Target, const FBloodContainer& UndoData) const 32 | { 33 | auto&& Data = UndoData.Get(LogStorage); 34 | Data.NetProxy->ExecuteUndoOnServer(); 35 | return true; 36 | } 37 | 38 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/HeartNet/Private/HeartNetModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartNetModule.h" 4 | #include "FlakesModule.h" 5 | #include "Providers/FlakesNetBinarySerializer.h" 6 | 7 | #define LOCTEXT_NAMESPACE "HeartNetModule" 8 | 9 | void FHeartNetModule::StartupModule() 10 | { 11 | FFlakesModule::Get().AddSerializationProvider(MakeUnique()); 12 | } 13 | 14 | void FHeartNetModule::ShutdownModule() 15 | { 16 | FFlakesModule::Get().RemoveSerializationProvider(Flakes::NetBinary::ProviderName); 17 | } 18 | 19 | #undef LOCTEXT_NAMESPACE 20 | 21 | IMPLEMENT_MODULE(FHeartNetModule, HeartNet) -------------------------------------------------------------------------------- /Source/HeartNet/Private/HeartNetUtils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartNetUtils.h" 4 | #include "LogHeartNet.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartNetUtils) 7 | 8 | bool UHeartNetUtils::IsObjectInActorReplicateSubObjectList(const AActor* Actor, const UObject* Object) 9 | { 10 | if (IsValid(Object) && IsValid(Actor)) 11 | { 12 | return Actor->IsReplicatedSubObjectRegistered(Object); 13 | } 14 | return false; 15 | } 16 | 17 | bool UHeartNetUtils::AddObjectToActorReplicateSubObjectList(AActor* Actor, UObject* Object) 18 | { 19 | if (IsValid(Object) && IsValid(Actor)) 20 | { 21 | if (Object->GetTypedOuter() != Actor) 22 | { 23 | UE_LOG(LogHeartNet, Warning, 24 | TEXT("AddObjectToActorReplicateSubObjectList: Should not register Object to Actor that does not own it." 25 | " GivenActor: '%s', Object: '%s' DirectOuter: '%s', FirstActorOuter: '%s'"), 26 | *Actor->GetName(), *Object->GetName(), *Object->GetOuter()->GetName(), 27 | *Object->GetTypedOuter()->GetName()) 28 | return false; 29 | } 30 | 31 | Actor->AddReplicatedSubObject(Object); 32 | return Actor->IsReplicatedSubObjectRegistered(Object); 33 | } 34 | return false; 35 | } 36 | 37 | bool UHeartNetUtils::RemoveObjectFromActorReplicateSubObjectList(AActor* Actor, UObject* Object) 38 | { 39 | if (IsValid(Object) && IsValid(Actor)) 40 | { 41 | if (Actor->IsReplicatedSubObjectRegistered(Object)) 42 | { 43 | Actor->RemoveReplicatedSubObject(Object); 44 | return true; 45 | } 46 | } 47 | return false; 48 | } -------------------------------------------------------------------------------- /Source/HeartNet/Private/LogHeartNet.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | DEFINE_LOG_CATEGORY_STATIC(LogHeartNet, Log, All) -------------------------------------------------------------------------------- /Source/HeartNet/Public/Actions/HeartRemoteActionLog.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "ModelView/Actions/HeartGraphAction.h" 6 | #include "HeartRemoteActionLog.generated.h" 7 | 8 | class UHeartGraphNetProxy; 9 | 10 | USTRUCT() 11 | struct FHeartRemoteActionLogUndoData 12 | { 13 | GENERATED_BODY() 14 | 15 | UPROPERTY() 16 | TObjectPtr NetProxy; 17 | }; 18 | 19 | /** 20 | * A clientside log of a Heart Action that was RPC'd to the server. 21 | */ 22 | UCLASS(Hidden) 23 | class HEARTNET_API UHeartRemoteActionLog : public UHeartGraphAction 24 | { 25 | GENERATED_BODY() 26 | 27 | public: 28 | static const FLazyName LogStorage; 29 | 30 | protected: 31 | virtual FText GetDescription(const UObject* Target) const override; 32 | virtual bool CanExecute(const UObject* Target) const override { return true; } 33 | virtual FHeartEvent ExecuteOnGraph(UHeartGraph* Graph, const FHeartInputActivation& Activation, UObject* ContextObject, FBloodContainer& UndoData) const override; 34 | virtual bool CanUndo(const UObject* Target) const override { return true; } 35 | virtual bool Undo(UObject* Target, const FBloodContainer& UndoData) const override; 36 | }; -------------------------------------------------------------------------------- /Source/HeartNet/Public/GraphProxy/HeartNetExtensionInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartNetExtensionInterface.generated.h" 7 | 8 | UINTERFACE() 9 | class UHeartNetExtensionInterface : public UInterface 10 | { 11 | GENERATED_BODY() 12 | }; 13 | 14 | /** 15 | * Optional interface that UHeartGraphExtensions can implement to customize behavior over the network. 16 | */ 17 | class HEARTNET_API IHeartNetExtensionInterface 18 | { 19 | GENERATED_BODY() 20 | 21 | public: 22 | UFUNCTION(BlueprintNativeEvent, Category = "Heart|NetExtension") 23 | bool ShouldReplicate(); 24 | }; -------------------------------------------------------------------------------- /Source/HeartNet/Public/GraphProxy/HeartNetNodeInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "HeartNetNodeInterface.generated.h" 7 | 8 | UINTERFACE() 9 | class UHeartNetNodeInterface : public UInterface 10 | { 11 | GENERATED_BODY() 12 | }; 13 | 14 | /** 15 | * Optional interface that UHeartGraphNodes can implement to customize behavior over the network. 16 | */ 17 | class HEARTNET_API IHeartNetNodeInterface 18 | { 19 | GENERATED_BODY() 20 | 21 | public: 22 | UFUNCTION(BlueprintNativeEvent, Category = "Heart|NetNode") 23 | bool ShouldReplicate(); 24 | }; -------------------------------------------------------------------------------- /Source/HeartNet/Public/HeartNetModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartNetModule : public IModuleInterface 8 | { 9 | public: 10 | virtual void StartupModule() override; 11 | virtual void ShutdownModule() override; 12 | }; -------------------------------------------------------------------------------- /Source/HeartNet/Public/HeartNetUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Kismet/BlueprintFunctionLibrary.h" 6 | #include "HeartNetUtils.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTNET_API UHeartNetUtils : public UBlueprintFunctionLibrary 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | // NOTE: these SubObjectList utils will likely be added to UE engine eventually. 18 | 19 | // Is an object replicated by this actor. 20 | UFUNCTION(BlueprintPure, Category = "Heart|Utils|Net", meta = (DefaultToSelf = Actor)) 21 | static bool IsObjectInActorReplicateSubObjectList(const AActor* Actor, const UObject* Object); 22 | 23 | // Adds an object to the actor's SubObjectList, so it can be replicated. 24 | // The actor must be somewhere up the objects outer chain, and have ReplicateUsingRegisteredSubObjectList enabled 25 | UFUNCTION(BlueprintCallable, Category = "Heart|Utils|Net", meta = (DefaultToSelf = Actor)) 26 | static bool AddObjectToActorReplicateSubObjectList(AActor* Actor, UObject* Object); 27 | 28 | // Removes an object from the actor's SubObjectList. 29 | UFUNCTION(BlueprintCallable, Category = "Heart|Utils|Net", meta = (DefaultToSelf = Actor)) 30 | static bool RemoveObjectFromActorReplicateSubObjectList(AActor* Actor, UObject* Object); 31 | }; -------------------------------------------------------------------------------- /Source/HeartScene/HeartScene.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartScene : ModuleRules 6 | { 7 | public HeartScene(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | PublicDependencyModuleNames.AddRange( 12 | new [] 13 | { 14 | "Core", 15 | "Heart", 16 | "HeartCore", 17 | "EnhancedInput" 18 | } 19 | ); 20 | 21 | PrivateDependencyModuleNames.AddRange( 22 | new [] 23 | { 24 | "CoreUObject", 25 | "Engine", 26 | "GameplayTags", 27 | "Slate", 28 | "SlateCore" 29 | } 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /Source/HeartScene/Private/HeartSceneActor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartSceneActor.h" 4 | #include "HeartSceneGenerator.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartSceneActor) 7 | 8 | namespace Heart 9 | { 10 | const FLazyName SceneGeneratorClass("SceneGenerator"); 11 | } 12 | 13 | AHeartSceneActor::AHeartSceneActor() 14 | { 15 | PrimaryActorTick.bCanEverTick = false; 16 | 17 | // @note: This crashes if overriden in BP with a Blueprint component, defeating the purpose entirely. Revert back 18 | // if/when Epic fixes this. 19 | //SceneGenerator = CreateDefaultSubobject(Heart::SceneGeneratorClass); 20 | } 21 | 22 | void AHeartSceneActor::BeginPlay() 23 | { 24 | SceneGenerator = FindComponentByClass(); 25 | if (!IsValid(SceneGenerator)) 26 | { 27 | UE_LOG(LogTemp, Warning, TEXT("HeartSceneActor '%s' does not have a Scene Generate component. Please add one!"), *GetName()) 28 | } 29 | Super::BeginPlay(); 30 | } 31 | -------------------------------------------------------------------------------- /Source/HeartScene/Private/HeartSceneExtension.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartSceneExtension.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartSceneExtension) -------------------------------------------------------------------------------- /Source/HeartScene/Private/HeartSceneModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartSceneModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "HeartSceneModule" 6 | 7 | DEFINE_LOG_CATEGORY(LogHeartGraphScene) 8 | 9 | void FHeartSceneModule::StartupModule() 10 | { 11 | } 12 | 13 | void FHeartSceneModule::ShutdownModule() 14 | { 15 | } 16 | 17 | #undef LOCTEXT_NAMESPACE 18 | 19 | IMPLEMENT_MODULE(FHeartSceneModule, HeartScene) -------------------------------------------------------------------------------- /Source/HeartScene/Private/HeartSceneModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHeartGraphScene, Log, All) 8 | 9 | class FHeartSceneModule : public IModuleInterface 10 | { 11 | public: 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | }; 15 | -------------------------------------------------------------------------------- /Source/HeartScene/Private/HeartSceneNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartSceneNode.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartSceneNode) 6 | 7 | UHeartSceneNode::UHeartSceneNode() 8 | { 9 | PrimaryComponentTick.bCanEverTick = false; 10 | } 11 | 12 | UHeartGraphNode* UHeartSceneNode::GetHeartGraphNode() const 13 | { 14 | return GraphNode.Get(); 15 | } 16 | 17 | void UHeartSceneNode::NativeOnCreated() 18 | { 19 | OnCreated(); 20 | } -------------------------------------------------------------------------------- /Source/HeartScene/Private/Input/HeartPlayerInput.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartPlayerInput.h" 4 | #include "Input/HeartInputLinkerBase.h" 5 | #include "Input/HeartSceneInputLinker.h" 6 | 7 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartPlayerInput) 8 | 9 | bool UHeartPlayerInput::InputKey(const FInputKeyEventArgs& Params) 10 | { 11 | class AStupidHackPlayerController : APlayerController 12 | { 13 | friend UHeartPlayerInput; // :) 14 | }; 15 | 16 | bool bResult = Super::InputKey(Params); 17 | 18 | UPrimitiveComponent* Target = reinterpret_cast 19 | (GetOuterAPlayerController())->CurrentClickablePrimitive.Get(); 20 | 21 | if (IsValid(Target)) 22 | { 23 | bResult = Heart::Input::InvokeLinker(Target, &UHeartSceneInputLinker::InputKey, Params); 24 | } 25 | 26 | return bResult; 27 | } -------------------------------------------------------------------------------- /Source/HeartScene/Private/Input/HeartSceneInputBindingContainer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartSceneInputBindingContainer.h" 4 | #include "Input/HeartInputBindingAsset.h" 5 | 6 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartSceneInputBindingContainer) 7 | 8 | void FHeartSceneInputBindingContainer::SetupLinker(UObject* InOuter) 9 | { 10 | check(InOuter); 11 | 12 | // Unbind everything from the current linker 13 | if (IsValid(Linker)) 14 | { 15 | for (auto&& BindingAsset : BindingAssets) 16 | { 17 | if (!IsValid(BindingAsset)) continue; 18 | 19 | Linker->RemoveBindings(BindingAsset->BindingData); 20 | } 21 | 22 | Linker = nullptr; 23 | } 24 | 25 | if (IsValid(DefaultLinkerClass)) 26 | { 27 | Linker = NewObject(InOuter, DefaultLinkerClass); 28 | 29 | // Rebind everything to the new linker 30 | for (auto&& BindingAsset : BindingAssets) 31 | { 32 | if (!IsValid(BindingAsset)) continue; 33 | 34 | Linker->AddBindings(BindingAsset->BindingData); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/HeartScene/Private/Input/HeartSceneInputLinker.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Input/HeartSceneInputLinker.h" 4 | #include "Input/HeartInputActivation.h" 5 | #include "Input/HeartEvent.h" 6 | #include "Input/HeartInputLinkerInterface.h" 7 | 8 | #include UE_INLINE_GENERATED_CPP_BY_NAME(HeartSceneInputLinker) 9 | 10 | bool UHeartSceneInputLinker::InputKey(USceneComponent* Target, const FInputKeyEventArgs& Params) 11 | { 12 | return QuickTryCallbacks(Heart::Input::FInputTrip(Params), Target, FHeartInputActivation(Params)).WasEventCaptured(); 13 | } 14 | 15 | namespace Heart::Input 16 | { 17 | UHeartSceneInputLinker* TLinkerType::FindLinker(const USceneComponent* Component) 18 | { 19 | return TryFindLinker(Component); 20 | } 21 | } -------------------------------------------------------------------------------- /Source/HeartScene/Public/HeartSceneActor.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "GameFramework/Actor.h" 6 | #include "HeartSceneActor.generated.h" 7 | 8 | class UHeartSceneGenerator; 9 | 10 | namespace Heart 11 | { 12 | extern const FLazyName SceneGeneratorClass; 13 | } 14 | 15 | /* 16 | * @todo In 5.5 overriding an actor component with a Blueprint component crashes on level load, due to creating a subobject on a async loading thread. 17 | * Workaround is to require the blueprint child to add a component themselves. 18 | * Crash only occurs with Game Target. 19 | */ 20 | UCLASS(Abstract) 21 | class HEARTSCENE_API AHeartSceneActor : public AActor 22 | { 23 | GENERATED_BODY() 24 | 25 | public: 26 | AHeartSceneActor(); 27 | 28 | virtual void BeginPlay() override; 29 | 30 | UHeartSceneGenerator* GetGenerator() const { return SceneGenerator; } 31 | 32 | protected: 33 | UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Heart") 34 | TObjectPtr SceneGenerator; 35 | }; -------------------------------------------------------------------------------- /Source/HeartScene/Public/HeartSceneExtension.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Model/HeartGraphExtension.h" 6 | #include "HeartSceneActor.h" 7 | 8 | #include "HeartSceneExtension.generated.h" 9 | 10 | /** 11 | * 12 | */ 13 | UCLASS() 14 | class HEARTSCENE_API UHeartSceneExtension : public UHeartGraphExtension 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | #if WITH_EDITOR 20 | UClass* GetConfigClass() const { return DefaultConfigClass.TryLoadClass(); } 21 | #endif 22 | 23 | TSubclassOf GetSceneClass() const { return DefaultSceneClass.LoadSynchronous(); } 24 | 25 | protected: 26 | #if WITH_EDITORONLY_DATA 27 | // #todo kinda weird place to store this, but it'll do for now 28 | UPROPERTY(EditAnywhere, Category = "Editor", meta = (MetaClass = "/Script/HeartSceneEditor.PreviewSceneConfig")) 29 | FSoftClassPath DefaultConfigClass; 30 | #endif 31 | 32 | UPROPERTY(EditAnywhere, Category = "Config") 33 | TSoftClassPtr DefaultSceneClass; 34 | }; -------------------------------------------------------------------------------- /Source/HeartScene/Public/HeartSceneModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHeartGraphScene, Log, All) 8 | 9 | class FHeartSceneModule : public IModuleInterface 10 | { 11 | public: 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | }; 15 | -------------------------------------------------------------------------------- /Source/HeartScene/Public/HeartSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Components/ActorComponent.h" 6 | #include "View/HeartVisualizerInterfaces.h" 7 | 8 | #include "HeartSceneNode.generated.h" 9 | 10 | class UHeartGraphNode; 11 | class UHeartSceneGenerator; 12 | 13 | /** 14 | * Base class for a 3D representation of a Heart node in a graph visualizer. 15 | */ 16 | UCLASS(Abstract, Blueprintable, BlueprintType, ClassGroup = ("Heart")) 17 | class HEARTSCENE_API UHeartSceneNode : public USceneComponent, public IGraphNodeVisualizerInterface 18 | { 19 | GENERATED_BODY() 20 | 21 | friend UHeartSceneGenerator; 22 | 23 | public: 24 | UHeartSceneNode(); 25 | 26 | /** IHeartGraphNodeInterface */ 27 | virtual UHeartGraphNode* GetHeartGraphNode() const override; 28 | /** IHeartGraphNodeInterface */ 29 | 30 | protected: 31 | virtual void NativeOnCreated(); 32 | 33 | UFUNCTION(BlueprintImplementableEvent, Category = "Heart|SceneNode") 34 | void OnCreated(); 35 | 36 | protected: 37 | UPROPERTY() 38 | TWeakObjectPtr GraphNode; 39 | 40 | UPROPERTY() 41 | TWeakObjectPtr Generator; 42 | }; 43 | -------------------------------------------------------------------------------- /Source/HeartScene/Public/Input/HeartPlayerInput.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "EnhancedPlayerInput.h" 6 | 7 | #include "HeartPlayerInput.generated.h" 8 | 9 | /** 10 | * A simple override of UEnhancedPlayerInput to defer input to an input linker if one is able to be found. 11 | */ 12 | UCLASS() 13 | class HEARTSCENE_API UHeartPlayerInput : public UEnhancedPlayerInput 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | virtual bool InputKey(const FInputKeyEventArgs& Params) override; 19 | }; -------------------------------------------------------------------------------- /Source/HeartScene/Public/Input/HeartSceneInputBindingContainer.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HeartSceneInputLinker.h" 6 | 7 | #include "HeartSceneInputBindingContainer.generated.h" 8 | 9 | class UHeartInputBindingAsset; 10 | 11 | /** 12 | * 13 | */ 14 | USTRUCT(BlueprintType) 15 | struct HEARTSCENE_API FHeartSceneInputBindingContainer 16 | { 17 | GENERATED_BODY() 18 | 19 | void SetupLinker(UObject* InOuter); 20 | UHeartSceneInputLinker* GetLinker() const { return Linker; } 21 | 22 | protected: 23 | // Binding assets applied by default to linker 24 | UPROPERTY(EditAnywhere, Category = "InputBindingConfig") 25 | TArray> BindingAssets; 26 | 27 | // Class of linker to spawn 28 | UPROPERTY(EditAnywhere, Category = "InputBindingConfig") 29 | TSubclassOf DefaultLinkerClass = UHeartSceneInputLinker::StaticClass(); 30 | 31 | UPROPERTY(BlueprintReadOnly, meta = (NoResetToDefault), Category = "InputBindingContainer") 32 | TObjectPtr Linker = nullptr; 33 | }; -------------------------------------------------------------------------------- /Source/HeartScene/Public/Input/HeartSceneInputLinker.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Input/HeartInputLinkerBase.h" 6 | #include "HeartSceneInputLinker.generated.h" 7 | 8 | /** 9 | * 10 | */ 11 | UCLASS() 12 | class HEARTSCENE_API UHeartSceneInputLinker : public UHeartInputLinkerBase 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | virtual bool InputKey(USceneComponent* Target, const FInputKeyEventArgs& Params); 18 | }; 19 | 20 | 21 | namespace Heart::Input 22 | { 23 | template <> 24 | struct TLinkerType 25 | { 26 | static constexpr bool Supported = true; 27 | 28 | using FValueType = USceneComponent*; 29 | 30 | template 31 | static FORCEINLINE T DefaultReply() 32 | { 33 | if constexpr (std::is_same_v) 34 | { 35 | return; 36 | } 37 | else return {}; 38 | } 39 | 40 | HEARTSCENE_API static UHeartSceneInputLinker* FindLinker(const USceneComponent* Component); 41 | }; 42 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/HeartSceneEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class HeartSceneEditor : ModuleRules 6 | { 7 | public HeartSceneEditor(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | HeartCore.ApplySharedModuleSetup(this, Target); 10 | 11 | PublicDependencyModuleNames.AddRange( 12 | new [] 13 | { 14 | "Core", 15 | "Heart", 16 | "HeartEditor", 17 | "HeartScene" 18 | } 19 | ); 20 | 21 | PrivateDependencyModuleNames.AddRange( 22 | new [] 23 | { 24 | "AdvancedPreviewScene", 25 | "CoreUObject", 26 | "Engine", 27 | "GameplayTags", 28 | "InputCore", 29 | "Slate", 30 | "SlateCore", 31 | "UnrealEd" 32 | } 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Private/HeartSceneEditorModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "HeartSceneEditorModule.h" 4 | 5 | #include "HeartEditorModule.h" 6 | #include "HeartSceneExtension.h" 7 | #include "Model/HeartGraph.h" 8 | #include "Preview/ApplicationMode_PreviewScene.h" 9 | 10 | #define LOCTEXT_NAMESPACE "HeartSceneEditorModule" 11 | 12 | void FHeartSceneEditorModule::StartupModule() 13 | { 14 | using namespace Heart::AssetEditor; 15 | 16 | // Register 3D scene preview application mode 17 | FHeartEditorModule& HeartEditorModule = FModuleManager::LoadModuleChecked("HeartEditor"); 18 | 19 | FRegisteredApplicationMode PreviewScene; 20 | PreviewScene.LocalizedName = LOCTEXT("ApplicationMode_PreviewScene.LocalizedName", "Scene"); 21 | PreviewScene.TooltipText = LOCTEXT("ApplicationMode_PreviewScene.TooltipText", "Switch to Preview Scene Mode"); 22 | PreviewScene.CreateModeInstance.BindLambda( 23 | [](const TSharedRef& Editor) 24 | { 25 | return MakeShared(Editor); 26 | }); 27 | PreviewScene.SupportsAsset.BindLambda( 28 | [](const UHeartGraph* Asset) 29 | { 30 | return IsValid(Asset->GetExtension()); 31 | }); 32 | 33 | HeartEditorModule.RegisterApplicationMode(FApplicationMode_PreviewScene::ModeID, PreviewScene); 34 | } 35 | 36 | void FHeartSceneEditorModule::ShutdownModule() 37 | { 38 | // Remove registered application mode 39 | FHeartEditorModule& HeartEditorModule = FModuleManager::LoadModuleChecked("HeartEditor"); 40 | HeartEditorModule.DeregisterApplicationMode(Heart::AssetEditor::FApplicationMode_PreviewScene::ModeID); 41 | } 42 | 43 | #undef LOCTEXT_NAMESPACE 44 | 45 | IMPLEMENT_MODULE(FHeartSceneEditorModule, HeartSceneEditor) -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Private/Preview/PreviewSceneCommands.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Preview/PreviewSceneCommands.h" 4 | 5 | #include "InputCoreTypes.h" 6 | 7 | #define LOCTEXT_NAMESPACE "PreviewSceneCommands" 8 | 9 | namespace Heart::AssetEditor 10 | { 11 | FPreviewSceneCommands::FPreviewSceneCommands() 12 | : TCommands( 13 | "AssetEditorTemplateEditor", 14 | LOCTEXT("AssetTemplateEditor", 15 | "Asset Editor Template Editor"), 16 | NAME_None, 17 | FAppStyle::GetAppStyleSetName()) 18 | { 19 | } 20 | 21 | void FPreviewSceneCommands::RegisterCommands() 22 | { 23 | UI_COMMAND(FocusViewport, "Focus Viewport", "Focus Viewport on Mesh", EUserInterfaceActionType::Button, FInputChord(EKeys::F)); 24 | } 25 | } 26 | 27 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Private/Preview/PreviewSceneConfig.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #include "Preview/PreviewSceneConfig.h" 4 | 5 | #include UE_INLINE_GENERATED_CPP_BY_NAME(PreviewSceneConfig) 6 | 7 | UPreviewSceneConfig::UPreviewSceneConfig() 8 | { 9 | PrimaryComponentTick.bCanEverTick = false; 10 | } 11 | 12 | void UPreviewSceneConfig::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) 13 | { 14 | Super::PostEditChangeProperty(PropertyChangedEvent); 15 | 16 | OnConfigEdit.ExecuteIfBound(PropertyChangedEvent); 17 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Private/Preview/TabSpawners.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "WorkflowOrientedApp/WorkflowTabFactory.h" 6 | 7 | // 8 | // SCENE PREVIEW TABS 9 | // 10 | 11 | namespace Heart::AssetEditor 12 | { 13 | class FHeartGraphEditor; 14 | class SPreviewSceneViewport; 15 | 16 | using FOnPreviewSceneCreated = TDelegate&)>; 17 | 18 | struct FPreviewSceneSummoner : public FWorkflowTabFactory 19 | { 20 | static const FLazyName TabId; 21 | 22 | FPreviewSceneSummoner(TSharedPtr AssetEditor, const FOnPreviewSceneCreated& OnPreviewSceneCreated); 23 | 24 | virtual TSharedRef CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override; 25 | virtual FText GetTabToolTipText(const FWorkflowTabSpawnInfo& Info) const override; 26 | 27 | private: 28 | TSharedPtr PreviewViewport; 29 | }; 30 | 31 | using FOnDetailsCreated = TDelegate&)>; 32 | 33 | struct FPreviewSceneDetailsPanelSummoner : public FWorkflowTabFactory 34 | { 35 | static const FLazyName TabId; 36 | 37 | FPreviewSceneDetailsPanelSummoner(TSharedPtr AssetEditor, const FOnDetailsCreated& OnDetailsCreated); 38 | 39 | virtual TSharedRef CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override; 40 | virtual FText GetTabToolTipText(const FWorkflowTabSpawnInfo& Info) const override; 41 | 42 | private: 43 | FOnDetailsCreated Callback; 44 | }; 45 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/HeartSceneEditorModule.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | class FHeartSceneEditorModule : public IModuleInterface 8 | { 9 | public: 10 | virtual void StartupModule() override; 11 | virtual void ShutdownModule() override; 12 | }; 13 | -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/Preview/ApplicationMode_PreviewScene.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "WorkflowOrientedApp/ApplicationMode.h" 6 | #include "WorkflowOrientedApp/WorkflowTabManager.h" 7 | 8 | namespace Heart::AssetEditor 9 | { 10 | class FHeartGraphEditor; 11 | class SPreviewSceneViewport; 12 | 13 | class FApplicationMode_PreviewScene : public FApplicationMode 14 | { 15 | public: 16 | static const FLazyName ModeID; 17 | 18 | FApplicationMode_PreviewScene(TSharedRef AssetEditor); 19 | 20 | /** FApplicationMode interface */ 21 | virtual void RegisterTabFactories(TSharedPtr InTabManager) override; 22 | 23 | virtual void PreDeactivateMode() override {} 24 | virtual void PostActivateMode() override {} 25 | 26 | private: 27 | void OnPreviewSceneCreated(const TSharedRef& InViewport); 28 | void OnDetailsCreated(const TSharedRef& InDetailsView); 29 | 30 | protected: 31 | /** The hosting app */ 32 | TWeakPtr HeartGraphAssetEditorPtr; 33 | 34 | /** The tab factories we support */ 35 | FWorkflowAllowedTabSet TabFactories; 36 | 37 | private: 38 | TSharedPtr Viewport; 39 | TSharedPtr DetailsView; 40 | }; 41 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/Preview/HeartPreviewScene.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "AdvancedPreviewScene.h" 6 | 7 | class AHeartSceneActor; 8 | class UPreviewSceneConfig; 9 | 10 | namespace Heart::AssetEditor 11 | { 12 | class FHeartGraphEditor; 13 | 14 | /** 15 | * 16 | */ 17 | class FHeartPreviewScene : public FAdvancedPreviewScene 18 | { 19 | public: 20 | FHeartPreviewScene(const ConstructionValues& CVS, const TSharedRef& EditorToolkit); 21 | virtual ~FHeartPreviewScene() override; 22 | 23 | virtual void Tick(float InDeltaTime) override; 24 | 25 | TSharedRef GetEditor() const 26 | { 27 | return EditorPtr.Pin().ToSharedRef(); 28 | } 29 | 30 | UPreviewSceneConfig* GetConfig() const { return SceneConfig; } 31 | 32 | void OnRefresh(); 33 | 34 | protected: 35 | void OnConfigEdit(const FPropertyChangedEvent& PropertyChangedEvent); 36 | 37 | void ReconstructSceneActor(); 38 | 39 | TObjectPtr SceneConfig; 40 | TObjectPtr SceneActor; 41 | 42 | private: 43 | TWeakPtr EditorPtr; 44 | }; 45 | } -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/Preview/PreviewSceneCommands.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Styling/AppStyle.h" 6 | #include "Framework/Commands/Commands.h" 7 | #include "Templates/SharedPointer.h" 8 | 9 | class FUICommandInfo; 10 | 11 | namespace Heart::AssetEditor 12 | { 13 | class FPreviewSceneCommands : public TCommands 14 | { 15 | public: 16 | FPreviewSceneCommands(); 17 | 18 | /** Focuses Viewport on Mesh */ 19 | TSharedPtr FocusViewport; 20 | 21 | /** Initialize commands */ 22 | virtual void RegisterCommands() override; 23 | }; 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/Preview/PreviewSceneConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Components/ActorComponent.h" 6 | #include "PreviewSceneConfig.generated.h" 7 | 8 | class AHeartSceneActor; 9 | 10 | UCLASS() 11 | class HEARTSCENEEDITOR_API UPreviewSceneConfig : public UActorComponent 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | UPreviewSceneConfig(); 17 | 18 | virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; 19 | 20 | using FOnConfigEdit = TDelegate; 21 | FOnConfigEdit OnConfigEdit; 22 | 23 | UPROPERTY(EditAnywhere, Category = "Config") 24 | TSoftClassPtr SceneClassOverride; 25 | }; -------------------------------------------------------------------------------- /Source/HeartSceneEditor/Public/Preview/PreviewSceneViewportClient.h: -------------------------------------------------------------------------------- 1 | // Copyright Guy (Drakynfly) Lundvall. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Widgets/DeclarativeSyntaxSupport.h" 6 | #include "EditorViewportClient.h" 7 | #include "SEditorViewport.h" 8 | 9 | namespace Heart::AssetEditor 10 | { 11 | class FHeartPreviewScene; 12 | 13 | /** 14 | * FEditorViewportClient is generally responsible for handling the viewport, camera movement, and 15 | * any of the options you'd find under the "Lit" menu on the standard Unreal Engine main viewport. 16 | */ 17 | class FPreviewSceneViewportClient : public FEditorViewportClient 18 | { 19 | public: 20 | /* Constructor and destructor */ 21 | FPreviewSceneViewportClient(const TSharedRef& InThumbnailViewport, const TSharedRef& InPreviewScene); 22 | 23 | /* Shameless stolen from SMaterialEditorViewport because for some reason a basic Focus on Selection is not implemented in the ViewportClient base class. */ 24 | void FocusViewportOnBounds(const FBoxSphereBounds Bounds, bool bInstant /*= false*/); 25 | 26 | /** Pointer back to the Editor Viewport */ 27 | TWeakPtr ViewportPtr; 28 | 29 | /* Stored pointer to the preview scene in which the graph visualizer is shown */ 30 | FHeartPreviewScene* AdvancedPreviewScene; 31 | }; 32 | } 33 | --------------------------------------------------------------------------------