Skip to content

Commit

Permalink
v1.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
AyeTSG committed Nov 30, 2023
0 parents commit a4cd37b
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: ayetsg
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ignore VS artifacts
.vs/*
.vsconfig

# Ignore Rider artifacts
**/.idea/*

# Ignore engine build artifacts
**/Intermediate/*

# Ignore engine content artifacts
**/Saved/*
**/DerivedDataCache/*

# Ignore binaries
**/Binaries/*
**/*.lib
30 changes: 30 additions & 0 deletions Aliaser.uplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0.0",
"FriendlyName": "Aliaser",
"Description": "Allows aliases to other assets to be shown in the Content Browser.",
"Category": "Editor",
"CreatedBy": "AyeTSG",
"CreatedByURL": "https://ayetsg.com",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": false,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": false,
"Modules": [
{
"Name": "Aliaser",
"Type": "Editor",
"LoadingPhase": "PostEngineInit"
}
],
"Plugins": [
{
"Name": "ContentBrowserAliasDataSource",
"Enabled": true
}
]
}
12 changes: 12 additions & 0 deletions Config/FilterPlugin.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[FilterPlugin]
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
;
; Examples:
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll

; License/Readme
/LICENSE
/README.MD
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2024 AyeTSG

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.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Aliaser
Allows aliases to other assets to be shown in the Content Browser.

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Q5Q4PD7ZS)

----------

## Usage of Aliaser

To use Aliaser, you must configure it properly within your project settings. You can find the Aliaser settings panel within `Project Settings -> Plugins -> Aliaser`.

To create an alias, add a new entry to the `Alias Entries` list. Then, select the asset you wish to alias using the `Asset Path` property. Finally, to set where the asset is aliased, type a complete content path, making sure to begin with `/`, into the `Alias Path` field. Spaces, aswell as symbols can also be used in your alias path. The following is an example of a correct asset alias.

![Example of a valid alias](Resources/valid_alias.png)

**NOTE: Aliaser currently requires an editor restart for aliases to show in the Content Browser.**
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.
Binary file added Resources/valid_alias.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Source/Aliaser/Aliaser.Build.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Aliaser - /Aliaser/Source/Aliaser.Build.cs
// Copyright AyeTSG 2022-2024.

using UnrealBuildTool;

public class Aliaser : ModuleRules
{
public Aliaser(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bEnforceIWYU = true;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "UnrealEd", "ContentBrowserData", "ContentBrowserAliasDataSource" });
PrivateDependencyModuleNames.AddRange(new string[] { });
}
}
113 changes: 113 additions & 0 deletions Source/Aliaser/Private/Aliaser.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// Aliaser - /Aliaser/Source/Private/Aliaser.cpp
// Copyright AyeTSG 2023-2024.

#include "Aliaser.h"
#include "AliaserSettings.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "IContentBrowserDataModule.h"
#include "ISettingsModule.h"
#include "ISettingsSection.h"


/**
* Define our localization namespace
*/
#define LOCTEXT_NAMESPACE "FAliaserModule"

/**
* Define our logging category
*/
DEFINE_LOG_CATEGORY(LogAliaser);

/**
* Define our data source
*/
TStrongObjectPtr<UContentBrowserAliasDataSource> AliaserDataSource;

void FAliaser::StartupModule()
{
UE_LOG(LogAliaser, Log, TEXT("Aliaser module starting up"));

/**
* Get the settings module
*/
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
if (SettingsModule != nullptr)
{
/**
* Register our settings page
*/
ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "Aliaser", INVTEXT("Aliaser"), INVTEXT("Configure the Aliaser plug-in"), GetMutableDefault<UAliaserSettings>());
UE_LOG(LogAliaser, Log, TEXT("Registered settings \"Project -> Plugins -> Aliaser\""));
}

/**
* Initialize the Aliaser data source
*/
AliaserDataSource.Reset(NewObject<UContentBrowserAliasDataSource>(GetTransientPackage(), "AliaserData"));
AliaserDataSource->Initialize();


/**
* For each user-configured alias
*/
for (auto aliasEntry : AliaserSettings->AliasEntries)
{
/**
* Get the UObject of the asset
*/
UObject* Object = aliasEntry.AssetPath.TryLoad();

/**
* Get the FAssetData of that UObject
*/
FAssetData ObjectData = FAssetData(Object, true);

/**
* Register the alias within the data source
*/
AliaserDataSource->AddAlias(ObjectData, aliasEntry.AliasPath, false, true);
}

/**
* Debug: Logs aliases associated with this data source
*/
//AliaserDataSource->LogAliases();

/**
* Get the content browser data system
* and enable the data source
*/
UE_LOG(LogAliaser, Log, TEXT("Enabling AliaserData data source"));
UContentBrowserDataSubsystem* ContentBrowserData = GEditor->GetEditorSubsystem<UContentBrowserDataSubsystem>();
ContentBrowserData->ActivateDataSource("AliaserData");
}

void FAliaser::ShutdownModule()
{
UE_LOG(LogAliaser, Log, TEXT("Aliaser module shutting down"));

/**
* Get the settings module
*/
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
if (SettingsModule != nullptr)
{
/**
* Deregister our settings page
*/
SettingsModule->UnregisterSettings("Project", "Plugins", "Aliaser");
UE_LOG(LogAliaser, Log, TEXT("Dergistered settings \"Project -> Plugins -> Aliaser\""));
}
}

/**
* Undefine our localization namespace
*/
#undef LOCTEXT_NAMESPACE

/**
* Implement FAliaser as the module class
*/
IMPLEMENT_GAME_MODULE(FAliaser, Aliaser);
12 changes: 12 additions & 0 deletions Source/Aliaser/Private/AliaserSettings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Aliaser - /Aliaser/Source/Private/AliaserSettings.cpp
// Copyright AyeTSG 2023-2024.

#include "AliaserSettings.h"

UAliaserSettings::UAliaserSettings()
/**
* Oh hi! This is currently empty, but this is
* typically used for something like setting the
* default variables for the aliaser settings
*/
{};
26 changes: 26 additions & 0 deletions Source/Aliaser/Public/Aliaser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Aliaser - /Aliaser/Source/Public/Aliaser.h
// Copyright AyeTSG 2023-2024.

#pragma once

#include "CoreMinimal.h"
#include "AliaserSettings.h"
#include "Modules/ModuleInterface.h"
#include "ContentBrowserAliasDataSource.h"

/**
* Declare our logging category
*/
DECLARE_LOG_CATEGORY_EXTERN(LogAliaser, All, All);

class FAliaser : public IModuleInterface
{
public:
/**
* Holds the user-configured settings for Aliaser
*/
const UAliaserSettings* AliaserSettings = GetDefault<UAliaserSettings>();

virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
51 changes: 51 additions & 0 deletions Source/Aliaser/Public/AliaserSettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Aliaser - /Aliaser/Source/Public/AliaserSettings.h
// Copyright AyeTSG 2023-2024.

#pragma once

#include "CoreMinimal.h"
#include "Containers/Map.h"
#include "AliaserSettings.generated.h"

/***
* Holds an aliaser entry
*/
USTRUCT(BlueprintType)
struct FAliserAliasEntry
{
GENERATED_BODY()

public:
/**
* Path to the asset being aliased
*/
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
FSoftObjectPath AssetPath;

/**
* Where should the alias be put in the content browser?
*/
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
FName AliasPath;
};

/**
* Holds the primary settings for Aliaser
*/
UCLASS(Config=Editor, DefaultConfig)
class UAliaserSettings : public UObject
{
GENERATED_BODY()

public:
/**
* Default constructor
*/
UAliaserSettings();

/**
* List of assets, then aliases
*/
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
TArray<FAliserAliasEntry> AliasEntries;
};

0 comments on commit a4cd37b

Please sign in to comment.