Skip to content

Commit a4cd37b

Browse files
committed
v1.0 Release
0 parents  commit a4cd37b

13 files changed

+313
-0
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: ayetsg

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ignore VS artifacts
2+
.vs/*
3+
.vsconfig
4+
5+
# Ignore Rider artifacts
6+
**/.idea/*
7+
8+
# Ignore engine build artifacts
9+
**/Intermediate/*
10+
11+
# Ignore engine content artifacts
12+
**/Saved/*
13+
**/DerivedDataCache/*
14+
15+
# Ignore binaries
16+
**/Binaries/*
17+
**/*.lib

Aliaser.uplugin

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"FileVersion": 3,
3+
"Version": 1,
4+
"VersionName": "1.0.0",
5+
"FriendlyName": "Aliaser",
6+
"Description": "Allows aliases to other assets to be shown in the Content Browser.",
7+
"Category": "Editor",
8+
"CreatedBy": "AyeTSG",
9+
"CreatedByURL": "https://ayetsg.com",
10+
"DocsURL": "",
11+
"MarketplaceURL": "",
12+
"SupportURL": "",
13+
"CanContainContent": false,
14+
"IsBetaVersion": false,
15+
"IsExperimentalVersion": false,
16+
"Installed": false,
17+
"Modules": [
18+
{
19+
"Name": "Aliaser",
20+
"Type": "Editor",
21+
"LoadingPhase": "PostEngineInit"
22+
}
23+
],
24+
"Plugins": [
25+
{
26+
"Name": "ContentBrowserAliasDataSource",
27+
"Enabled": true
28+
}
29+
]
30+
}

Config/FilterPlugin.ini

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[FilterPlugin]
2+
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
3+
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
4+
;
5+
; Examples:
6+
; /README.txt
7+
; /Extras/...
8+
; /Binaries/ThirdParty/*.dll
9+
10+
; License/Readme
11+
/LICENSE
12+
/README.MD

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2024 AyeTSG
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Aliaser
2+
Allows aliases to other assets to be shown in the Content Browser.
3+
4+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Q5Q4PD7ZS)
5+
6+
----------
7+
8+
## Usage of Aliaser
9+
10+
To use Aliaser, you must configure it properly within your project settings. You can find the Aliaser settings panel within `Project Settings -> Plugins -> Aliaser`.
11+
12+
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.
13+
14+
![Example of a valid alias](Resources/valid_alias.png)
15+
16+
**NOTE: Aliaser currently requires an editor restart for aliases to show in the Content Browser.**

Resources/Icon128.png

3.69 KB
Loading

Resources/valid_alias.png

12.4 KB
Loading

Source/Aliaser/Aliaser.Build.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Aliaser - /Aliaser/Source/Aliaser.Build.cs
2+
// Copyright AyeTSG 2022-2024.
3+
4+
using UnrealBuildTool;
5+
6+
public class Aliaser : ModuleRules
7+
{
8+
public Aliaser(ReadOnlyTargetRules Target) : base(Target)
9+
{
10+
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
11+
bEnforceIWYU = true;
12+
13+
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "UnrealEd", "ContentBrowserData", "ContentBrowserAliasDataSource" });
14+
PrivateDependencyModuleNames.AddRange(new string[] { });
15+
}
16+
}

Source/Aliaser/Private/Aliaser.cpp

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Aliaser - /Aliaser/Source/Private/Aliaser.cpp
2+
// Copyright AyeTSG 2023-2024.
3+
4+
#include "Aliaser.h"
5+
#include "AliaserSettings.h"
6+
#include "Modules/ModuleManager.h"
7+
#include "Interfaces/IPluginManager.h"
8+
#include "IContentBrowserDataModule.h"
9+
#include "ISettingsModule.h"
10+
#include "ISettingsSection.h"
11+
12+
13+
/**
14+
* Define our localization namespace
15+
*/
16+
#define LOCTEXT_NAMESPACE "FAliaserModule"
17+
18+
/**
19+
* Define our logging category
20+
*/
21+
DEFINE_LOG_CATEGORY(LogAliaser);
22+
23+
/**
24+
* Define our data source
25+
*/
26+
TStrongObjectPtr<UContentBrowserAliasDataSource> AliaserDataSource;
27+
28+
void FAliaser::StartupModule()
29+
{
30+
UE_LOG(LogAliaser, Log, TEXT("Aliaser module starting up"));
31+
32+
/**
33+
* Get the settings module
34+
*/
35+
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
36+
if (SettingsModule != nullptr)
37+
{
38+
/**
39+
* Register our settings page
40+
*/
41+
ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "Aliaser", INVTEXT("Aliaser"), INVTEXT("Configure the Aliaser plug-in"), GetMutableDefault<UAliaserSettings>());
42+
UE_LOG(LogAliaser, Log, TEXT("Registered settings \"Project -> Plugins -> Aliaser\""));
43+
}
44+
45+
/**
46+
* Initialize the Aliaser data source
47+
*/
48+
AliaserDataSource.Reset(NewObject<UContentBrowserAliasDataSource>(GetTransientPackage(), "AliaserData"));
49+
AliaserDataSource->Initialize();
50+
51+
52+
/**
53+
* For each user-configured alias
54+
*/
55+
for (auto aliasEntry : AliaserSettings->AliasEntries)
56+
{
57+
/**
58+
* Get the UObject of the asset
59+
*/
60+
UObject* Object = aliasEntry.AssetPath.TryLoad();
61+
62+
/**
63+
* Get the FAssetData of that UObject
64+
*/
65+
FAssetData ObjectData = FAssetData(Object, true);
66+
67+
/**
68+
* Register the alias within the data source
69+
*/
70+
AliaserDataSource->AddAlias(ObjectData, aliasEntry.AliasPath, false, true);
71+
}
72+
73+
/**
74+
* Debug: Logs aliases associated with this data source
75+
*/
76+
//AliaserDataSource->LogAliases();
77+
78+
/**
79+
* Get the content browser data system
80+
* and enable the data source
81+
*/
82+
UE_LOG(LogAliaser, Log, TEXT("Enabling AliaserData data source"));
83+
UContentBrowserDataSubsystem* ContentBrowserData = GEditor->GetEditorSubsystem<UContentBrowserDataSubsystem>();
84+
ContentBrowserData->ActivateDataSource("AliaserData");
85+
}
86+
87+
void FAliaser::ShutdownModule()
88+
{
89+
UE_LOG(LogAliaser, Log, TEXT("Aliaser module shutting down"));
90+
91+
/**
92+
* Get the settings module
93+
*/
94+
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
95+
if (SettingsModule != nullptr)
96+
{
97+
/**
98+
* Deregister our settings page
99+
*/
100+
SettingsModule->UnregisterSettings("Project", "Plugins", "Aliaser");
101+
UE_LOG(LogAliaser, Log, TEXT("Dergistered settings \"Project -> Plugins -> Aliaser\""));
102+
}
103+
}
104+
105+
/**
106+
* Undefine our localization namespace
107+
*/
108+
#undef LOCTEXT_NAMESPACE
109+
110+
/**
111+
* Implement FAliaser as the module class
112+
*/
113+
IMPLEMENT_GAME_MODULE(FAliaser, Aliaser);
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Aliaser - /Aliaser/Source/Private/AliaserSettings.cpp
2+
// Copyright AyeTSG 2023-2024.
3+
4+
#include "AliaserSettings.h"
5+
6+
UAliaserSettings::UAliaserSettings()
7+
/**
8+
* Oh hi! This is currently empty, but this is
9+
* typically used for something like setting the
10+
* default variables for the aliaser settings
11+
*/
12+
{};

Source/Aliaser/Public/Aliaser.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Aliaser - /Aliaser/Source/Public/Aliaser.h
2+
// Copyright AyeTSG 2023-2024.
3+
4+
#pragma once
5+
6+
#include "CoreMinimal.h"
7+
#include "AliaserSettings.h"
8+
#include "Modules/ModuleInterface.h"
9+
#include "ContentBrowserAliasDataSource.h"
10+
11+
/**
12+
* Declare our logging category
13+
*/
14+
DECLARE_LOG_CATEGORY_EXTERN(LogAliaser, All, All);
15+
16+
class FAliaser : public IModuleInterface
17+
{
18+
public:
19+
/**
20+
* Holds the user-configured settings for Aliaser
21+
*/
22+
const UAliaserSettings* AliaserSettings = GetDefault<UAliaserSettings>();
23+
24+
virtual void StartupModule() override;
25+
virtual void ShutdownModule() override;
26+
};
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Aliaser - /Aliaser/Source/Public/AliaserSettings.h
2+
// Copyright AyeTSG 2023-2024.
3+
4+
#pragma once
5+
6+
#include "CoreMinimal.h"
7+
#include "Containers/Map.h"
8+
#include "AliaserSettings.generated.h"
9+
10+
/***
11+
* Holds an aliaser entry
12+
*/
13+
USTRUCT(BlueprintType)
14+
struct FAliserAliasEntry
15+
{
16+
GENERATED_BODY()
17+
18+
public:
19+
/**
20+
* Path to the asset being aliased
21+
*/
22+
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
23+
FSoftObjectPath AssetPath;
24+
25+
/**
26+
* Where should the alias be put in the content browser?
27+
*/
28+
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
29+
FName AliasPath;
30+
};
31+
32+
/**
33+
* Holds the primary settings for Aliaser
34+
*/
35+
UCLASS(Config=Editor, DefaultConfig)
36+
class UAliaserSettings : public UObject
37+
{
38+
GENERATED_BODY()
39+
40+
public:
41+
/**
42+
* Default constructor
43+
*/
44+
UAliaserSettings();
45+
46+
/**
47+
* List of assets, then aliases
48+
*/
49+
UPROPERTY(Category = "Aliaser", Config, EditAnywhere)
50+
TArray<FAliserAliasEntry> AliasEntries;
51+
};

0 commit comments

Comments
 (0)