Skip to content

Commit

Permalink
Merge branch '5.2_dev' into 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlicekdominik committed Oct 7, 2024
2 parents 85e7c58 + f4632ee commit bbf058e
Show file tree
Hide file tree
Showing 33 changed files with 608 additions and 72 deletions.
8 changes: 4 additions & 4 deletions ActorInteractionPlugin.uplugin
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"FileVersion": 3,
"Version": 3,
"VersionName": "4.0.1.52",
"Version": 4,
"VersionName": "4.0.2.52",
"FriendlyName": "Mountea Interaction System",
"Description": "Mountea Interaction System is an Open-source Mountea Framework components-based simple framework providing utilities for smart Actor Interaction with other Actors. Developed with Game Developers in mind to allow as easy as possible implementation while maintaining high scalability and diverse options to tweak everything.",
"Description": "Mountea Interaction System is an Open-source Mountea Framework components-based simple framework providing utilities for smart Actor Interaction with other Actors.\nDeveloped with Game Developers in mind to allow as easy as possible implementation while maintaining high scalability and diverse options to tweak everything.",
"Category": "Mountea Framework",
"CreatedBy": "Dominik Pavlicek",
"CreatedBy": "Dominik (Pavlicek) Morse",
"CreatedByURL": "https://github.com/Mountea-Framework",
"DocsURL": "https://github.com/Mountea-Framework/MounteaInteractionSystem/wiki",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/ca842c00ec0d4db0b3aad17701e1637b",
Expand Down
Binary file modified Content/Example/BP_InteractionExample_Character.uasset
Binary file not shown.
Binary file added Content/Input/IA_Jump.uasset
Binary file not shown.
Binary file added Content/Input/IA_Look.uasset
Binary file not shown.
Binary file added Content/Input/IA_Move.uasset
Binary file not shown.
Binary file added Content/Input/IMC_Default.uasset
Binary file not shown.
Binary file modified Content/UMG/Base/WBP_InteractableBase.uasset
Binary file not shown.
Binary file modified Content/UMG/Examples/WBP_InteractableWidget_01.uasset
Binary file not shown.
Binary file modified Resources/CloseIcon.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 Resources/Dialoguer_Icon.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 removed Resources/DiscordIcon.png
Binary file not shown.
Binary file modified Resources/HeartIcon.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 removed Resources/HelpIcon.png
Binary file not shown.
Binary file added Resources/Help_Icon.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 removed Resources/Interactable.png
Binary file not shown.
Binary file modified Resources/InteractableIcon.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 modified Resources/InteractionConfigIcon.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 removed Resources/Interactor.png
Binary file not shown.
Binary file modified Resources/InteractorIcon.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 modified Resources/MoneyIcon.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 modified Resources/UnrealBucketIcon.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 Resources/Wiki_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ void UActorInteractorComponentBase::SetState_Server_Implementation(const EIntera

void UActorInteractorComponentBase::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent)
{
Super::PostEditChangeChainProperty(PropertyChangedEvent);

const FName PropertyName = (PropertyChangedEvent.MemberProperty != nullptr) ? PropertyChangedEvent.GetPropertyName() : NAME_None;

FString InteractorName = GetName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public ActorInteractionPluginEditor(ReadOnlyTargetRules Target) : base(Target)
"ToolMenus",
"InputCore",

"UMG"
"UMG",

"GameplayTags"
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "AssetActions/InteractableComponentAssetActions.h"

#include "AssetToolsModule.h"
#include "GameplayTagsManager.h"
#include "HttpModule.h"
#include "HelpButton/AIntPCommands.h"
#include "HelpButton/AIntPHelpStyle.h"
Expand All @@ -28,21 +29,23 @@

#include "Interfaces/IMainFrameModule.h"
#include "Serialization/JsonReader.h"
#include "Settings/MounteaInteractionEditorSettings.h"

DEFINE_LOG_CATEGORY(ActorInteractionPluginEditor);

static const FName AIntPHelpTabName("MounteaFramework");

const FString ChangelogURL = FString("https://raw.githubusercontent.com/Mountea-Framework/MounteaInteractionSystem/5.1/CHANGELOG.md");

#define LOCTEXT_NAMESPACE "FActorInteractionPluginEditor"

static const FName MenuName("LevelEditor.LevelEditorToolBar.PlayToolBar");

void FActorInteractionPluginEditor::StartupModule()
{
// Try to request Changelog from GitHub
// Try to request Changelog from GitHub & GameplayTags
{
Http = &FHttpModule::Get();
SendHTTPGet();
SendHTTPGet_Tags();
}

// Register Category
Expand Down Expand Up @@ -158,7 +161,7 @@ void FActorInteractionPluginEditor::StartupModule()
}
}

// Register Help Button
// Register Menu Button
{
FAIntPHelpStyle::Initialize();
FAIntPHelpStyle::ReloadTextures();
Expand Down Expand Up @@ -257,7 +260,108 @@ void FActorInteractionPluginEditor::HandleNewInteractableBlueprintCreated(UBluep
Blueprint->BroadcastChanged();
}

void FActorInteractionPluginEditor::PluginButtonClicked()
bool FActorInteractionPluginEditor::DoesHaveValidTags() const
{
if (!GConfig) return false;

const FString PluginDirectory = IPluginManager::Get().FindPlugin(TEXT("ActorInteractionPlugin"))->GetBaseDir();
const FString ConfigFilePath = PluginDirectory + "/Config/Tags/MounteaInteractionSystemTags.ini";
FString NormalizedConfigFilePath = FConfigCacheIni::NormalizeConfigIniPath(ConfigFilePath);

if (FPaths::FileExists(ConfigFilePath))
{
return GConfig->Find(NormalizedConfigFilePath) != nullptr;
}

return false;
}

void FActorInteractionPluginEditor::RefreshGameplayTags()
{
TSharedPtr<IPlugin> ThisPlugin = IPluginManager::Get().FindPlugin(TEXT("ActorInteractionPlugin"));
check(ThisPlugin.IsValid());

UGameplayTagsManager::Get().EditorRefreshGameplayTagTree();
}

void FActorInteractionPluginEditor::UpdateTagsConfig(const FString& NewContent)
{
if (!GConfig) return;

const FString PluginDirectory = IPluginManager::Get().FindPlugin(TEXT("ActorInteractionPlugin"))->GetBaseDir();
const FString ConfigFilePath = PluginDirectory + "/Config/Tags/MounteaInteractionSystemTags.ini";

FConfigFile* CurrentConfig = GConfig->Find(ConfigFilePath);

FString CurrentContent;
CurrentConfig->WriteToString(CurrentContent);

TArray<FString> Lines;
NewContent.ParseIntoArray(Lines, TEXT("\n"), true);

TArray<FString> CleanedLines;
for (FString& Itr : Lines)
{
if (Itr.Equals("[/Script/GameplayTags.GameplayTagsList]")) continue;

if (Itr.Contains("GameplayTagList="))
{
FString NewValue = Itr.Replace(TEXT("GameplayTagList="), TEXT(""));

CleanedLines.Add(NewValue);
}
}

if (!CurrentContent.Equals(NewContent))
{
TArray<FString> CurrentLines;
FConfigFile NewConfig;
NewConfig.SetArray(TEXT("/Script/GameplayTags.GameplayTagsList"), TEXT("GameplayTagList"), CleanedLines);
CurrentConfig->GetArray(TEXT("/Script/GameplayTags.GameplayTagsList"), TEXT("GameplayTagList"), CurrentLines);

for (const FString& Itr : CleanedLines)
{
if (CurrentLines.Contains(Itr)) continue;

CurrentLines.AddUnique(Itr);
}

CurrentConfig->SetArray(TEXT("/Script/GameplayTags.GameplayTagsList"), TEXT("GameplayTagList"), CurrentLines);
CurrentConfig->Write(ConfigFilePath);

RefreshGameplayTags();
}
}

void FActorInteractionPluginEditor::CreateTagsConfig(const FString& NewContent)
{
if (!GConfig) return;

const FString PluginDirectory = IPluginManager::Get().FindPlugin(TEXT("ActorInteractionPlugin"))->GetBaseDir();
const FString ConfigFilePath = PluginDirectory + "/Config/Tags/MounteaInteractionSystemTags.ini";

TArray<FString> Lines;
NewContent.ParseIntoArray(Lines, TEXT("\n"), true);

TArray<FString> CleanedLines;
for (FString& Itr : Lines)
{
if (Itr.Equals("[/Script/GameplayTags.GameplayTagsList]")) continue;

if (Itr.Contains("GameplayTagList="))
{
FString NewValue = Itr.Replace(TEXT("GameplayTagList="), TEXT(""));

CleanedLines.Add(NewValue);
}
}

FConfigFile NewConfig;
NewConfig.SetArray(TEXT("/Script/GameplayTags.GameplayTagsList"), TEXT("GameplayTagList"), CleanedLines);
NewConfig.Write(ConfigFilePath);
}

void FActorInteractionPluginEditor::PluginButtonClicked() const
{
const FString URL = "https://discord.gg/waYT2cn37z"; // Interaction Specific Link

Expand All @@ -267,46 +371,124 @@ void FActorInteractionPluginEditor::PluginButtonClicked()
}
}

void FActorInteractionPluginEditor::WikiButtonClicked() const
{
const FString URL = "https://github.com/Mountea-Framework/MounteaInteractionSystem/wiki/How-to-Setup-Interaction";

if (!URL.IsEmpty())
{
FPlatformProcess::LaunchURL(*URL, nullptr, nullptr);
}
}

void FActorInteractionPluginEditor::DialoguerButtonClicked() const
{
const FString URL = "https://mountea-framework.github.io/MounteaDialoguer/";

if (!URL.IsEmpty())
{
FPlatformProcess::LaunchURL(*URL, nullptr, nullptr);
}
}

void FActorInteractionPluginEditor::RegisterMenus()
{
// Owner will be used for cleanup in call to UToolMenus::UnregisterOwner
FToolMenuOwnerScoped OwnerScoped(this);

// Register in Window tab
{
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Help");
if (UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Help"))
{
FToolMenuSection& Section = Menu->FindOrAddSection("MounteaFramework");
Section.Label = FText::FromString(TEXT("Mountea Framework"));

FToolMenuEntry Entry = Section.AddMenuEntryWithCommandList
(
FAIntPCommands::Get().PluginAction,
PluginCommands,
NSLOCTEXT("MounteaSupport", "TabTitle", "Mountea Support"),
NSLOCTEXT("MounteaSupport", "TooltipText", "Opens Mountea Framework Support channel"),
FSlateIcon(FAIntPHelpStyle::GetStyleSetName(), "AIntPSupport.PluginAction.small")
);
if (Menu->ContainsSection("MounteaFramework") == false)
{
FToolMenuSection& Section = Menu->FindOrAddSection("MounteaFramework");

Section.InsertPosition.Position = EToolMenuInsertType::First;
Section.Label = FText::FromString(TEXT("Mountea Framework"));

FToolMenuEntry SupportEntry = Section.AddMenuEntryWithCommandList
(
FAIntPCommands::Get().PluginAction,
PluginCommands,
LOCTEXT("MounteaSystemEditor_SupportButton_Label", "Mountea Support"),
LOCTEXT("MounteaSystemEditor_SupportButton_ToolTip", "🆘 Open Mountea Framework Support channel"),
FSlateIcon(FAIntPHelpStyle::GetStyleSetName(), "AIntPStyleSet.Help")
);
SupportEntry.Name = FName("MounteaFrameworkSupport");
}
}
}

// Register in Level Editor Toolbar
{
UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.PlayToolBar");
UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu(MenuName);
{
FToolMenuSection& Section = ToolbarMenu->FindOrAddSection("MounteaFramework");
{
Section.Label = FText::FromString(TEXT("Mountea Framework"));

FToolMenuEntry& Entry = Section.AddEntry(FToolMenuEntry::InitToolBarButton(FAIntPCommands::Get().PluginAction));
Entry.SetCommandList(PluginCommands);

Entry.InsertPosition.Position = EToolMenuInsertType::First;
}
ToolbarMenu->RemoveSection("MounteaFramework"); // Cleanup
FToolMenuEntry& Entry = ToolbarMenu->FindOrAddSection("MounteaFramework")
.AddEntry(FToolMenuEntry::InitComboButton(
"MounteaMenu",
FUIAction(),
FOnGetContent::CreateRaw(this, &FActorInteractionPluginEditor::MakeMounteaMenuWidget),
LOCTEXT("MounteaMainMenu_Label", "Mountea Framework"),
LOCTEXT("MounteaMainMenu_Tooltip", "📂 Open Mountea Framework menu.\n\n❔ Provides link to Documentation, Support Discord and Dialogue tool."),
FSlateIcon(FAIntPHelpStyle::Get().GetStyleSetName(), "AIntPStyleSet.Dialoguer"),
false,
"MounteaMenu"
));

Entry.Label = LOCTEXT("MounteaFramework_Label", "Mountea Framework");
Entry.Name = TEXT("MounteaMenu");
Entry.StyleNameOverride = "CalloutToolbar";
Entry.SetCommandList(PluginCommands);
}
}
}

TSharedRef<SWidget> FActorInteractionPluginEditor::MakeMounteaMenuWidget() const
{
FMenuBuilder MenuBuilder(true, PluginCommands);

MenuBuilder.BeginSection("MounteaMenu_Links", LOCTEXT("MounteaMenuOptions_Options", "Mountea Links"));
{
// Support Entry
MenuBuilder.AddMenuEntry(
LOCTEXT("MounteaSystemEditor_SupportButton_Label", "Mountea Support"),
LOCTEXT("MounteaSystemEditor_SupportButton_ToolTip", "🆘 Open Mountea Framework Support channel"),
FSlateIcon(FAIntPHelpStyle::GetStyleSetName(), "AIntPStyleSet.Help"),
FUIAction(
FExecuteAction::CreateRaw(this, &FActorInteractionPluginEditor::PluginButtonClicked)
)
);
// Wiki Entry
MenuBuilder.AddMenuEntry(
LOCTEXT("MounteaSystemEditor_WikiButton_Label", "Mountea Wiki"),
LOCTEXT("MounteaSystemEditor_WikiButton_ToolTip", "📖 Open Mountea Framework Documentation"),
FSlateIcon(FAIntPHelpStyle::GetStyleSetName(), "AIntPStyleSet.Wiki"),
FUIAction(
FExecuteAction::CreateRaw(this, &FActorInteractionPluginEditor::WikiButtonClicked)
)
);
}
MenuBuilder.EndSection();

MenuBuilder.BeginSection("MounteaMenu_Tools", LOCTEXT("MounteaMenuOptions_Tools", "Mountea Tools"));
{
// Dialoguer Entry
MenuBuilder.AddMenuEntry(
LOCTEXT("MounteaSystemEditor_DialoguerButton_Label", "Mountea Dialoguer"),
LOCTEXT("MounteaSystemEditor_DialoguerButton_ToolTip", "⛰ Open Mountea Dialoguer Standalone Tool\n\n❔ Mountea Dialoguer is a standalone tool created for Dialogue crafting. Mountea Dialogue System supports native import for `.mnteadlg` files."),
FSlateIcon(FAIntPHelpStyle::GetStyleSetName(), "AIntPStyleSet.Dialoguer"),
FUIAction(
FExecuteAction::CreateRaw(this, &FActorInteractionPluginEditor::DialoguerButtonClicked)
)
);
}
MenuBuilder.EndSection();

return MenuBuilder.MakeWidget();
}

void FActorInteractionPluginEditor::OnGetResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
FString ResponseBody;
Expand Down Expand Up @@ -337,6 +519,33 @@ void FActorInteractionPluginEditor::SendHTTPGet()
Request->ProcessRequest();
}

void FActorInteractionPluginEditor::OnGetResponse_Tags(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{

}

void FActorInteractionPluginEditor::SendHTTPGet_Tags()
{
const UMounteaInteractionEditorSettings* Settings = GetDefault<UMounteaInteractionEditorSettings>();
if (DoesHaveValidTags())
{
if (!Settings->AllowCheckTagUpdate())
{
return;
}
}

const TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();

Request->OnProcessRequestComplete().BindRaw(this, &FActorInteractionPluginEditor::OnGetResponse_Tags);
Request->SetURL(Settings->GetGameplayTagsURL());

Request->SetVerb("GET");
Request->SetHeader("User-Agent", "X-UnrealEngine-Agent");
Request->SetHeader("Content-Type", "text");
Request->ProcessRequest();
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FActorInteractionPluginEditor, ActorInteractionPluginEditor);
Loading

0 comments on commit bbf058e

Please sign in to comment.