Skip to content

Commit

Permalink
feat ( #37 ) : saving settings for cleaner configs
Browse files Browse the repository at this point in the history
- now cleaner configs automatically saved if any property changed
  • Loading branch information
ashe23 committed Jun 17, 2022
1 parent 6931a34 commit 2339a13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ProjectCleaner.uplugin
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.6.0",
"VersionName": "1.7.0",
"FriendlyName": "ProjectCleaner",
"Description": "UE4 plugin for managing unused assets in project.",
"Description": "Unreal engine plugin for managing all unused assets and empty folders in project",
"Category": "ProjectManagementTools",
"CreatedBy": "Ashot Barkhudaryan",
"CreatedByURL": "https://github.com/ashe23",
Expand Down
4 changes: 4 additions & 0 deletions Source/ProjectCleaner/Private/Core/ProjectCleanerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ FProjectCleanerManager::FProjectCleanerManager()
CleanerConfigs = GetMutableDefault<UCleanerConfigs>();

ensure(CleanerConfigs);

CleanerConfigs->LoadConfig();
}

FProjectCleanerManager::~FProjectCleanerManager()
Expand All @@ -40,6 +42,8 @@ void FProjectCleanerManager::Update()
{
OnCleanerManagerUpdated.Execute();
}

CleanerConfigs->PostEditChange();
}

void FProjectCleanerManager::ExcludeSelectedAssets(const TArray<FAssetData>& Assets)
Expand Down
17 changes: 12 additions & 5 deletions Source/ProjectCleaner/Public/StructsContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,29 @@ class ICleanerUIActions
virtual int32 DeleteEmptyFolders() = 0;
};

UCLASS(Transient)
UCLASS(Transient, Config=EditorPerProjectUserSettings)
class UCleanerConfigs : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(DisplayName = "Scan Developer Content", EditAnywhere, Category = "CleanerConfigs", meta = (ToolTip = "Scan assets in 'Developers' folder. By Default false"))
UPROPERTY(DisplayName = "Scan Developer Content", EditAnywhere, Config, Category = "CleanerConfigs", meta = (ToolTip = "Scan assets in 'Developers' folder. By Default false"))
bool bScanDeveloperContents = false;

UPROPERTY(DisplayName = "Delete Empty Folders After Assets Deleted", EditAnywhere, Category = "CleanerConfigs")
UPROPERTY(DisplayName = "Delete Empty Folders After Assets Deleted", EditAnywhere, Config, Category = "CleanerConfigs")
bool bAutomaticallyDeleteEmptyFolders = true;

UPROPERTY(DisplayName = "Paths", EditAnywhere, Category = "CleanerConfigs|ExcludeOptions", meta = (ContentDir))
UPROPERTY(DisplayName = "Paths", EditAnywhere, Config, Category = "CleanerConfigs|ExcludeOptions", meta = (ContentDir))
TArray<FDirectoryPath> Paths;

UPROPERTY(DisplayName = "Classes", EditAnywhere, Category = "CleanerConfigs|ExcludeOptions")
UPROPERTY(DisplayName = "Classes", EditAnywhere, Config, Category = "CleanerConfigs|ExcludeOptions")
TArray<UClass*> Classes;

virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override
{
Super::PostEditChangeProperty(PropertyChangedEvent);

SaveConfig();
}
};

UCLASS(Transient)
Expand Down

0 comments on commit 2339a13

Please sign in to comment.