Skip to content

Commit

Permalink
First pass RedEditorIconWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-DowlingSoka committed Jun 1, 2022
1 parent 846635a commit 56d0688
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 25 deletions.
13 changes: 13 additions & 0 deletions Config/BaseRedTechArtTools.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[/Script/RedTechArtToolsEditor.RedDeveloperSettings]
+EditorIconWidgetSearchPaths=Content/Slate/Starship/Common
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/Common
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/SceneOutliner
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/GraphEditors
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/MainToolbar
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/Paint
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/Landscape
+EditorIconWidgetSearchPaths=Plugins/Editor/ModelingToolsEditorMode/Content/Icons
+EditorIconWidgetSearchPaths=Plugins/Experimental/ChaosEditor/Content
+EditorIconWidgetSearchPaths=Content/Editor/Slate/GenericCurveEditor/Icons
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/GeneralTools
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/TimelineEditor
13 changes: 13 additions & 0 deletions Config/DefaultRedTechArtTools.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[/Script/RedTechArtToolsEditor.RedDeveloperSettings]
+EditorIconWidgetSearchPaths=Content/Slate/Starship/Common
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/Common
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/SceneOutliner
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/GraphEditors
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/MainToolbar
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/Paint
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/Landscape
+EditorIconWidgetSearchPaths=Plugins/Editor/ModelingToolsEditorMode/Content/Icons
+EditorIconWidgetSearchPaths=Plugins/Experimental/ChaosEditor/Content
+EditorIconWidgetSearchPaths=Content/Editor/Slate/GenericCurveEditor/Icons
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Icons/GeneralTools
+EditorIconWidgetSearchPaths=Content/Editor/Slate/Starship/TimelineEditor
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions Content/Python/ContentOrganizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2022 Ryan DowlingSoka - MIT License - See LICENSE file for more.
# WIP : Not ready for use.

import shutil
import unreal

class ContentOrganizerUtilities(object):

@staticmethod
def convert_content_path_to_disk_path(content_path:str) -> str:
success, path = unreal.RedTechArtToolsBlueprintLibrary.convert_package_path_to_local_path(content_path)
if success:
return path
else:
return ""

@staticmethod
def move_directories_outside_unreal(source_path: str, target_path: str) -> bool:
local_source_path = ContentOrganizerUtilities.convert_content_path_to_disk_path(source_path)
local_target_path = ContentOrganizerUtilities.convert_content_path_to_disk_path(target_path)

if local_source_path and local_target_path:
shutil.copytree(local_source_path, local_target_path, dirs_exist_ok=True)


@staticmethod
def write_redirects_to_ini(redirects:str) -> bool:
default_engine_ini = f"{unreal.Paths.project_config_dir()}/DefaultEngine.ini"
return True
Binary file not shown.
4 changes: 2 additions & 2 deletions RedTechArtTools.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 1,
"Version": 5,
"VersionName": "1.0.5",
"Version": 6,
"VersionName": "1.1.5",
"FriendlyName": "Red Tech Art Tools",
"Description": "Open Source Tech Art Tools for use in UE5. Material Editing, Geometry Scripting, Content Management and more.",
"Category": "Tech Art",
Expand Down
27 changes: 27 additions & 0 deletions Source/RedTechArtToolsEditor/Private/RedDeveloperSettings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// MIT License
//
// Copyright (c) 2022 Ryan DowlingSoka
//
// 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.

#include "RedDeveloperSettings.h"

URedDeveloperSettings::URedDeveloperSettings()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@

#include "RedMaterialParameterBlueprintLibrary.h"

#include "ContentBrowserModule.h"
#include "EditorTutorial.h"
#include "Materials/MaterialExpressionCurveAtlasRowParameter.h"
#include "Materials/MaterialExpressionScalarParameter.h"
#include "Materials/MaterialExpressionVectorParameter.h"
#include "Editor.h"
#include "IContentBrowserSingleton.h"
#include "IMaterialEditor.h"
#include "MaterialEditorUtilities.h"
#include "Subsystems/AssetEditorSubsystem.h"
Expand Down Expand Up @@ -341,4 +343,4 @@ void URedMaterialParameterBlueprintLibrary::SetMaterialParameter_ScalarAtlas(FRe
Expression->Modify();
Expression->Atlas = ScalarAtlas;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,63 +21,68 @@
// SOFTWARE.

#include "RedTechArtToolsBlueprintLibrary.h"

#include "IContentBrowserSingleton.h"
#include "Dialogs/DlgPickPath.h"
#include "Engine/DataTable.h"
#include "GameFramework/GameStateBase.h"

/** Output entire contents of a DataTable as a string */
FString URedTechArtToolsBlueprintLibrary::GetTableAsString(const UDataTable* DataTable, const bool bUseJsonObjectsForStructs, const bool bUseSimpleText)
FString URedTechArtToolsBlueprintLibrary::GetTableAsString(const UDataTable* DataTable,
const bool bUseJsonObjectsForStructs,
const bool bUseSimpleText)
{
if(IsValid(DataTable))
if (IsValid(DataTable))
{
EDataTableExportFlags Flags = EDataTableExportFlags::None;
if(bUseJsonObjectsForStructs)
if (bUseJsonObjectsForStructs)
Flags = EDataTableExportFlags::UseJsonObjectsForStructs;

if(bUseSimpleText)
if (bUseSimpleText)
Flags = Flags | EDataTableExportFlags::UseSimpleText;

return DataTable->GetTableAsString(Flags);
}
return "";
}


/** Output entire contents of DataTable as CSV */
FString URedTechArtToolsBlueprintLibrary::GetTableAsCSV(const UDataTable* DataTable, const bool bUseJsonObjectsForStructs, const bool bUseSimpleText)
FString URedTechArtToolsBlueprintLibrary::GetTableAsCSV(const UDataTable* DataTable,
const bool bUseJsonObjectsForStructs, const bool bUseSimpleText)
{
if(IsValid(DataTable))
if (IsValid(DataTable))
{
EDataTableExportFlags Flags = EDataTableExportFlags::None;
if(bUseJsonObjectsForStructs)
if (bUseJsonObjectsForStructs)
Flags = EDataTableExportFlags::UseJsonObjectsForStructs;

if(bUseSimpleText)
if (bUseSimpleText)
Flags = Flags | EDataTableExportFlags::UseSimpleText;

return DataTable->GetTableAsString(Flags);
}
return "";
}


/** Output entire contents of DataTable as JSON */
FString URedTechArtToolsBlueprintLibrary::GetTableAsJSON(const UDataTable* DataTable, const bool bUseJsonObjectsForStructs, const bool bUseSimpleText)
FString URedTechArtToolsBlueprintLibrary::GetTableAsJSON(const UDataTable* DataTable,
const bool bUseJsonObjectsForStructs,
const bool bUseSimpleText)
{
if(IsValid(DataTable))
if (IsValid(DataTable))
{
EDataTableExportFlags Flags = EDataTableExportFlags::None;
if(bUseJsonObjectsForStructs)
if (bUseJsonObjectsForStructs)
Flags = EDataTableExportFlags::UseJsonObjectsForStructs;

if(bUseSimpleText)
if (bUseSimpleText)
Flags = Flags | EDataTableExportFlags::UseSimpleText;

return DataTable->GetTableAsString(Flags);
}
return "";

AInfo a;
a.GetActorLocation();
}

bool URedTechArtToolsBlueprintLibrary::AlphaNumericLessThan(FString& A, FString& B)
Expand All @@ -98,4 +103,50 @@ bool URedTechArtToolsBlueprintLibrary::AlphaNumericGreaterThan(FString& A, FStri
bool URedTechArtToolsBlueprintLibrary::AlphaNumericGreaterThanOrEqual(FString& A, FString& B)
{
return A >= B;
}
}

FString URedTechArtToolsBlueprintLibrary::PickContentPath(bool& bWasPathPicked, const FString DialogTitle,
const FString DefaultPath)
{
const TSharedRef<SDlgPickPath> PickContentPathDlg = SNew(SDlgPickPath).Title(FText::FromString(DialogTitle)).
DefaultPath(FText::FromString(DefaultPath));

switch (const EAppReturnType::Type ReturnType = PickContentPathDlg->ShowModal())
{
case EAppReturnType::Cancel:
bWasPathPicked = false;
return "";
case EAppReturnType::Ok:
default:
bWasPathPicked = true;
return PickContentPathDlg->GetPath().ToString();
}
}

void URedTechArtToolsBlueprintLibrary::ConvertPackagePathToLocalPath(const FString PackagePath, bool& bOutSuccess,
FString& OutLocalPath)
{
bOutSuccess = FPackageName::TryConvertGameRelativePackagePathToLocalPath(PackagePath, OutLocalPath);
}


void URedTechArtToolsBlueprintLibrary::GetConfigArrayValue(const FString ConfigName, const FString SectionName,
const FString KeyName,
TArray<FString>& OutArrayValues)
{
if (const FConfigFile* ConfigFile = GConfig->FindConfigFile(*GConfig->GetConfigFilename(*ConfigName)))
{
ConfigFile->GetArray(*SectionName, *KeyName, OutArrayValues);
}
}

void URedTechArtToolsBlueprintLibrary::SetConfigArrayValue(const FString ConfigName, const FString SectionName,
const FString KeyName, const TArray<FString>& InArrayValues)
{
if (FConfigFile* ConfigFile = GConfig->FindConfigFile(*GConfig->GetConfigFilename(*ConfigName)))
{
ConfigFile->SetArray(*SectionName, *KeyName, InArrayValues);
ConfigFile->Dirty = true;
GConfig->Flush(false);
}
}
25 changes: 24 additions & 1 deletion Source/RedTechArtToolsEditor/Private/RedTechArtToolsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
// SOFTWARE.

#include "CoreMinimal.h"
#include "RedEditorIconWidget.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "IRedTechArtToolsEditor.h"
#include "ISettingsModule.h"
#include "Customization/RedEditorIconPathCustomization.h"

#define LOCTEXT_NAMESPACE "RedTechArtTools"

class FRedTechArtToolsEditor final : public IRedTechArtToolsEditor
{
Expand All @@ -37,9 +40,29 @@ IMPLEMENT_MODULE(FRedTechArtToolsEditor, RedTechArtToolsEditor )

void FRedTechArtToolsEditor::StartupModule()
{
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomPropertyTypeLayout(
FRedEditorIconPath::StaticStruct()->GetFName(),
FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FRedEditorIconPathCustomization::MakeInstance));

PropertyModule.NotifyCustomizationModuleChanged();
}


void FRedTechArtToolsEditor::ShutdownModule()
{
if (FModuleManager::Get().IsModuleLoaded("PropertyEditor"))
{
FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.UnregisterCustomPropertyTypeLayout(FRedEditorIconPath::StaticStruct()->GetFName());

PropertyModule.NotifyCustomizationModuleChanged();
}

if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
{
SettingsModule->UnregisterSettings("Project", "Plugins", "RedTechArtTools");
}
}

#undef LOCTEXT_NAMESPACE
43 changes: 43 additions & 0 deletions Source/RedTechArtToolsEditor/Public/RedDeveloperSettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// MIT License
//
// Copyright (c) 2022 Ryan DowlingSoka
//
// 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.

#pragma once

#include "CoreMinimal.h"
#include "DeveloperSettingsClasses.h"
#include "RedDeveloperSettings.generated.h"

/**
* Developer settings for the RED Tech Art Tools Plugin.
*/
UCLASS(Config=RedTechArtTools, DefaultConfig, meta=(DisplayName="RED Tech Art Tools"))
class REDTECHARTTOOLSEDITOR_API URedDeveloperSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Editor Icon Widget")
TArray<FString> EditorIconWidgetSearchPaths;

virtual FName GetCategoryName() const override {return FName("Plugins");}

URedDeveloperSettings();
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class REDTECHARTTOOLSEDITOR_API URedTechArtToolsBlueprintLibrary : public UBluep
/** Output entire contents of DataTable as CSV */
UFUNCTION(BlueprintCallable, Category=DataTable)
static FString GetTableAsCSV(const UDataTable* DataTable, bool bUseJsonObjectsForStructs = false, bool bUseSimpleText = false);


/** Output entire contents of DataTable as JSON */
UFUNCTION(BlueprintCallable, Category=DataTable)
Expand All @@ -63,4 +62,20 @@ class REDTECHARTTOOLSEDITOR_API URedTechArtToolsBlueprintLibrary : public UBluep
/** Is A less than or equal to B alphanumerically. */
UFUNCTION(BlueprintCallable, Category=String)
static bool AlphaNumericGreaterThanOrEqual(UPARAM(ref) FString& A, UPARAM(ref) FString& B);

/** Opens a modal content picker for a content directory. */
UFUNCTION(BlueprintCallable, Category=EditorScripting)
static FString PickContentPath(bool& bWasPathPicked, const FString DialogTitle = "Pick Path", const FString DefaultPath = "/Game");

/** Converts a game relative (or long) package path to a local filesystem path. */
UFUNCTION(BlueprintCallable, Category=EditorScripting)
static void ConvertPackagePathToLocalPath(const FString PackagePath, bool& bOutSuccess, FString& OutLocalPath);

/** Get array values from loaded config Array Values */
UFUNCTION(BlueprintCallable, Category=EditorScripting)
static void GetConfigArrayValue(const FString ConfigName, const FString SectionName, const FString KeyName, TArray<FString>& OutArrayValues);

/** Set array values from loaded config Array Values. Flushes config file after setting values. */
UFUNCTION(BlueprintCallable, Category=EditorScripting)
static void SetConfigArrayValue(const FString ConfigName, const FString SectionName, const FString KeyName, UPARAM(ref) const TArray<FString>& InArrayValues);
};
8 changes: 7 additions & 1 deletion Source/RedTechArtToolsEditor/RedTechArtToolsEditor.build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ public RedTechArtToolsEditor(ReadOnlyTargetRules Target) : base(Target)
"BlueprintEditorLibrary",
"Core",
"CoreUObject",
"DeveloperSettings",
"EditorFramework",
"Engine",
"InputCore",
"MaterialEditor",
"UnrealEd"
"Slate",
"SlateCore",
"ToolWidgets",
"UnrealEd",
"UMG"
});

PublicIncludePaths.AddRange(new string[] { });
Expand Down

0 comments on commit 56d0688

Please sign in to comment.