Skip to content

Commit

Permalink
Initial commit 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
zosiu committed Jan 4, 2023
0 parents commit 62b7a69
Show file tree
Hide file tree
Showing 47 changed files with 1,457 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
StatementMacros: ['UPROPERTY', 'UFUNCTION', 'UCLASS', 'USTRUCT', 'UENUM', 'UINTERFACE', 'GENERATED_BODY']
Language: Cpp
BasedOnStyle: LLVM

AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: Empty
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: Inline
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: true
IndentBraces: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: false
ColumnLimit: 0
Cpp11BracedListStyle: true
EmptyLineBeforeAccessModifier: LogicalBlock
IndentCaseBlocks: false
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
NamespaceIndentation: Inner
PointerAlignment: Left
# PackConstructorInitializers: Never
SortIncludes: false
SpaceBeforeCaseColon: false
TabWidth: 4
UseTab: Always
33 changes: 33 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Baseline
[*]
charset = utf-8
indent_style = tab
indent_size = 4
tab_width = 4
trim_trailing_whitespace = true
max_line_length = 120

# MSBuild
[*.{csproj,proj,projitems,shproj,fsproj,target,props}]
indent_style = space
indent_size = 2

# XML config files
[*.{config,nuspec,resx,natvis}]
indent_style = space
indent_size = 2

# Python files
[*.py]
indent_style = space
indent_size = 4

# YAML files
[*.yaml]
indent_style = space
indent_size = 2
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Visual Studio 2015 user specific files
.vs/

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
*.ipa

# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb

# Binary Files
Binaries

# Built data for maps
*_BuiltData.uasset

# Compiled source files for the engine to use
Intermediate
1 change: 1 addition & 0 deletions .p4ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Version 1.0

Endpoints provided:
* linking Blueprint nodes
- focus node
- open the jump target of the node
* linking levels at specific camera coordinates
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* [fastfend](https://github.com/fastfend)
* [zosiu](https://github.com/zosiu)
Binary file added Content/Editor/Slate/RedTalaria_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Content/Editor/Slate/attribution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hermes icons (RedTalaria_16.png) created by max.icons - Flaticon : https://www.flaticon.com/free-icons/hermes
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 CD PROJEKT S.A.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# RedTalaria URLs for Unreal Engine

RedTalaria is a plugin for Unreal Engine that builds on [Hermes](https://github.com/jorgenpt/Hermes) and provides a collection of Hermes endpoints to link "parts" of your project and share them with your team e.g. through Slack.

Big thanks to [Jørgen P. Tjernø](https://github.com/jorgenpt) for [Hermes](https://github.com/jorgenpt/Hermes)!

# Engine compatibilty

RedTalaria was tested (and thus should be compatible) with UE 5.1 and UE 4.27.

# Setup

1. Setup [Hermes](https://github.com/jorgenpt/Hermes#setup).
2. Clone this repository into your project's Plugins folder.
3. Start your editor and enjoy your new Hermes endpoints.

# Using

## Linking Blueprint nodes
Once you've set up RedTalaria, you should be able to right click on any Blueprint node and see a new `Copy 'Focus node' URL` option:

[<img src="README_link_blueprint_node_focus.png?raw=true">](README_link_blueprint_node_focus.png?raw=true)

Clicking on links like these will open up the asset in the editor and focus on the linked node.

---

For nodes that have a jump target, you'll see an additional `Copy 'Open node' URL` option:

[<img src="README_link_blueprint_node_jump_target.png?raw=true">](README_link_blueprint_node_jump_target.png?raw=true)

Clicking on links like these will open up the (jump target of the) linked node in the editor.

## Linking Levels at a specific camera position
Once you've set up RedTalaria, under the Viewport options menu you should see a new `Copy camera coords URL` option (it will only be active for perspective viewports):

[<img src="README_link_level_at_camera_coords.png?raw=true">](README_link_level_at_camera_coords.png?raw=true)

Clicking on links like these will open up the level at the exact camera location / rotation for when the link was made.

# Extending

## Creating custom URLs for graph nodes
Take a look at [RedHermesGraphNodeEndpoint](Source/RedHermesGraphNodeEndpoint/Public/RedHermesGraphNodeEndpoint.h) & [RedHermesGraphNodeEndpointEditorExtension](Source/RedHermesGraphNodeEndpoint/Public/RedHermesGraphNodeEndpointEditorExtension.h), which serve as a base for linking graph nodes, and
[RedHermesBlueprintNodeEndpoint](Source/RedHermesBlueprintNodeEndpoint/Public/RedHermesBlueprintNodeEndpoint.h) as a concrete example building on them.

## Creating custom URLs with your own functionality
Take a look at [RedHermesEndpoint](Source/RedTalaria/Public/RedHermesEndpoint.h), which serves as a base for custom Hermes endpoints, and [RedHermesLevelAtCameraCoordsEndpoint](Source/RedHermesLevelAtCameraCoordsEndpoint/Public/RedHermesLevelAtCameraCoordsEndpoint.h) & [RedHermesLevelAtCameraCoordsEndpointEditorExtension](Source/RedHermesLevelAtCameraCoordsEndpoint/Public/RedHermesLevelAtCameraCoordsEndpointEditorExtension.h) as a concrete example building on it.

# License

Hermes icons ([Icon128.png](Resources/Icon128.png) & [RedTalaria_16.png](Content/Editor/Slate/RedTalaria_16.png)) created by max.icons - [Flaticon](https://www.flaticon.com/free-icons/hermes).

RedTalaria is licensed under the MIT license ([LICENSE](LICENSE.txt) or http://opensource.org/licenses/MIT).
Binary file added README_link_blueprint_node_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README_link_blueprint_node_jump_target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README_link_level_at_camera_coords.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions RedTalaria.uplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "RedTalaria",
"Description": "A collection of Hermes endpoints. Hermes icons created by max.icons - Flaticon : https://www.flaticon.com/free-icons/hermes",
"Category": "Other",
"CreatedBy": "CD PROJEKT S.A.",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": false,
"Modules": [
{
"Name": "RedTalariaUrls",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "RedTalaria",
"Type": "EditorNoCommandlet",
"LoadingPhase": "Default",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "RedHermesGraphNodeEndpoint",
"Type": "EditorNoCommandlet",
"LoadingPhase": "Default",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "RedHermesBlueprintNodeEndpoint",
"Type": "EditorNoCommandlet",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "RedHermesLevelAtCameraCoordsEndpoint",
"Type": "EditorNoCommandlet",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
}
],
"Plugins": [
{
"Name": "HermesCore",
"Enabled": true,
"WhitelistPlatforms": [
"Win64"
]
}
]
}
Binary file added Resources/Icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/attribution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hermes icons (Icon128.png) created by max.icons - Flaticon : https://www.flaticon.com/free-icons/hermes
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright (c) CD PROJEKT S.A. All Rights Reserved.

#include "RedHermesBlueprintNodeEndpoint.h"

#include "RedHermesGraphNodeEndpoint.h"
#include "RedHermesGraphNodeEndpointEditorExtension.h"
#include "Kismet2/KismetEditorUtilities.h"

#define LOCTEXT_NAMESPACE "FRedHermesBlueprintNodeEndpointModule"

void FRedHermesBlueprintNodeEndpointModule::StartupModule()
{
if (const auto RedHermesGraphNodeEndpoint = GEditor->GetEditorSubsystem<URedHermesGraphNodeEndpoint>())
{
OnRequestDelegateHandle
= RedHermesGraphNodeEndpoint->OnRequest().AddStatic(&FRedHermesBlueprintNodeEndpointModule::HandleRequest);
}

if (const auto NodeExtensionSubsystem = GEditor->GetEditorSubsystem<URedHermesGraphNodeEndpointEditorExtension>())
{
OnNodeMenuExtensionHookRequestDelegateHandle
= NodeExtensionSubsystem->OnNodeMenuExtensionHookRequest().AddStatic(&FRedHermesBlueprintNodeEndpointModule::ProvideNodeExtensionHook);
}
}

void FRedHermesBlueprintNodeEndpointModule::ShutdownModule()
{
if (OnRequestDelegateHandle.IsValid())
{
if (GEditor != nullptr)
{
if (const auto RedHermesGraphNodeEndpoint = GEditor->GetEditorSubsystem<URedHermesGraphNodeEndpoint>())
{
RedHermesGraphNodeEndpoint->OnRequest().Remove(OnRequestDelegateHandle);
}
OnRequestDelegateHandle.Reset();
}
}

if (OnNodeMenuExtensionHookRequestDelegateHandle.IsValid())
{
if (GEditor != nullptr)
{
if (const auto NodeExtensionSubsystem = GEditor->GetEditorSubsystem<URedHermesGraphNodeEndpointEditorExtension>())
{
NodeExtensionSubsystem->OnNodeMenuExtensionHookRequest().Remove(OnNodeMenuExtensionHookRequestDelegateHandle);
}
OnNodeMenuExtensionHookRequestDelegateHandle.Reset();
}
}
}

const UEdGraphNode* FRedHermesBlueprintNodeEndpointModule::GetNodeInAsset(FGuid NodeGuid, const UObject* Asset)
{
if (const auto BlueprintObj = Cast<UBlueprint>(Asset))
{
TArray<UEdGraph*> Graphs;
BlueprintObj->GetAllGraphs(Graphs);

for (const UEdGraph* Graph : Graphs)
{
for (const UEdGraphNode* Node : Graph->Nodes)
{
if (Node->NodeGuid == NodeGuid)
{
return Node;
}
}
}
}

return nullptr;
}

void FRedHermesBlueprintNodeEndpointModule::HandleRequest(FGuid NodeGuid, UObject* Asset, bool bOpenJumpTarget)
{
if (const UEdGraphNode* Node = GetNodeInAsset(NodeGuid, Asset))
{
const UObject* JumpTarget = Node->GetJumpTargetForDoubleClick();
FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(bOpenJumpTarget && JumpTarget ? JumpTarget : Node, false);
}
}

void FRedHermesBlueprintNodeEndpointModule::ProvideNodeExtensionHook(const UEdGraphNode* Node, const UEdGraph* /*Graph*/, TSet<FName>& ExtensionHooks)
{
if (Node->IsA<UK2Node>())
{
ExtensionHooks.Emplace(FName(TEXT("EdGraphSchemaNodeActions")));
}
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FRedHermesBlueprintNodeEndpointModule, RedHermesBlueprintNodeEndpoint)
Loading

0 comments on commit 62b7a69

Please sign in to comment.