Skip to content

Commit

Permalink
Support Mass Framwork
Browse files Browse the repository at this point in the history
  • Loading branch information
ivazhuk committed Aug 26, 2024
1 parent 25fea9e commit 1516bca
Show file tree
Hide file tree
Showing 23 changed files with 3,387 additions and 21 deletions.
4 changes: 4 additions & 0 deletions SodaSim.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
{
"Name": "GeometryProcessing",
"Enabled": true
},
{
"Name": "MassGameplay",
"Enabled": true
}
]

Expand Down
4 changes: 4 additions & 0 deletions Source/RuntimeEditor/Private/RuntimeEditorModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ void FRuntimeEditorModule::StartupModule()
RegisterObjectCustomizations();
RegisterPropertyTypeCustomizations();

StructViewerModule.StartupModule();

Documentation = soda::FDocumentation::Create();
FMultiBoxSettings::ToolTipConstructor = FMultiBoxSettings::FConstructToolTip::CreateLambda([this](const TAttribute<FText>& ToolTipText, const TSharedPtr<SWidget>& OverrideContent, const TSharedPtr<const FUICommandInfo>& Action)
{
Expand Down Expand Up @@ -298,6 +300,8 @@ void FRuntimeEditorModule::ShutdownModule()
AllSinglePropertyViews.Empty();

soda::SClassViewer::DestroyClassHierarchy();

StructViewerModule.ShutdownModule();
}

TSharedRef<SWindow> FRuntimeEditorModule::CreateFloatingDetailsView(const TArray< UObject* >& InObjects, bool bIsLockable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
#include "UObject/ConstructorHelpers.h"
//#include "Editor.h"

#include "RuntimeClassViewer/ClassViewerFilter.h"
#include "RuntimeMetaData.h"
#include "RuntimeClassViewer/SClassViewer.h"

namespace soda
{
/*

class FPropertyEditorInlineClassFilter : public IClassViewerFilter
{
public:
Expand Down Expand Up @@ -71,7 +73,7 @@ class FPropertyEditorInlineClassFilter : public IClassViewerFilter
return false;
}
};
*/


void SPropertyEditorEditInline::Construct( const FArguments& InArgs, const TSharedRef< class FPropertyEditor >& InPropertyEditor )
{
Expand All @@ -83,7 +85,7 @@ void SPropertyEditorEditInline::Construct( const FArguments& InArgs, const TShar
[
SAssignNew(ComboButton, SComboButton)
.IsEnabled(this, &SPropertyEditorEditInline::IsValueEnabled, WeakHandlePtr)
//.OnGetMenuContent(this, &SPropertyEditorEditInline::GenerateClassPicker)
.OnGetMenuContent(this, &SPropertyEditorEditInline::GenerateClassPicker)
.ContentPadding(0)
.ToolTipText(InPropertyEditor, &FPropertyEditor::GetValueAsText )
.ButtonContent()
Expand Down Expand Up @@ -169,7 +171,7 @@ bool SPropertyEditorEditInline::IsClassAllowed( UClass* CheckClass, bool bAllowA
check(CheckClass);
return PropertyEditorHelpers::IsEditInlineClassAllowed( CheckClass, bAllowAbstract ) && CheckClass->HasAnyClassFlags(CLASS_EditInlineNew);
}
/*

TSharedRef<SWidget> SPropertyEditorEditInline::GenerateClassPicker()
{
FClassViewerInitializationOptions Options;
Expand Down Expand Up @@ -201,9 +203,9 @@ TSharedRef<SWidget> SPropertyEditorEditInline::GenerateClassPicker()

FOnClassPicked OnPicked( FOnClassPicked::CreateRaw( this, &SPropertyEditorEditInline::OnClassPicked ) );

return FModuleManager::LoadModuleChecked<FClassViewerModule>("ClassViewer").CreateClassViewer(Options, OnPicked);
return SNew(SClassViewer, Options).OnClassPickedDelegate(OnPicked); //FModuleManager::LoadModuleChecked<FClassViewerModule>("ClassViewer").CreateClassViewer(Options, OnPicked);
}
*/

void SPropertyEditorEditInline::OnClassPicked(UClass* InClass)
{
TArray<FObjectBaseAddress> ObjectsToModify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SPropertyEditorEditInline : public SCompoundWidget
*
* @return The Class Picker widget.
*/
//TSharedRef<SWidget> GenerateClassPicker();
TSharedRef<SWidget> GenerateClassPicker();

/**
* Callback function from the Class Picker for when a Class is picked.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "Widgets/Layout/SBox.h"

//#include "DragAndDrop/AssetDragDropOp.h"
//#include "StructViewerModule.h"
//#include "StructViewerFilter.h"
#include "RuntimeStructViewer/StructViewerModule.h"
#include "RuntimeStructViewer/StructViewerFilter.h"
#include "Engine/UserDefinedStruct.h"

#include "RuntimeMetaData.h"
Expand All @@ -18,15 +18,15 @@
namespace soda
{

class FPropertyEditorStructFilter/* : public IStructViewerFilter*/
class FPropertyEditorStructFilter : public IStructViewerFilter
{
public:
/** The meta struct for the property that classes must be a child-of. */
const UScriptStruct* MetaStruct = nullptr;

// TODO: Have a flag controlling whether we allow UserDefinedStructs, even when a MetaClass is set (as they cannot support inheritance, but may still be allowed (eg, data tables))?

virtual bool IsStructAllowed(/*const FStructViewerInitializationOptions& InInitOptions, */const UScriptStruct* InStruct/*, TSharedRef<FStructViewerFilterFuncs> InFilterFuncs*/) //override
virtual bool IsStructAllowed(const FStructViewerInitializationOptions& InInitOptions, const UScriptStruct* InStruct, TSharedRef<FStructViewerFilterFuncs> InFilterFuncs) override
{
if (InStruct->IsA<UUserDefinedStruct>())
{
Expand All @@ -38,7 +38,7 @@ class FPropertyEditorStructFilter/* : public IStructViewerFilter*/
return !MetaStruct || InStruct->IsChildOf(MetaStruct);
}

virtual bool IsUnloadedStructAllowed(/*const FStructViewerInitializationOptions& InInitOptions, const FName InStructPath, TSharedRef<FStructViewerFilterFuncs> InFilterFuncs*/) //override
virtual bool IsUnloadedStructAllowed(const FStructViewerInitializationOptions& InInitOptions, const FSoftObjectPath& InStructPath, TSharedRef<FStructViewerFilterFuncs> InFilterFuncs) override
{
// User Defined Structs don't support inheritance, so only include them if we have don't a MetaStruct set
return MetaStruct == nullptr;
Expand Down Expand Up @@ -121,7 +121,7 @@ void SPropertyEditorStruct::Construct(const FArguments& InArgs, const TSharedPtr
}

SAssignNew(ComboButton, SComboButton)
//.OnGetMenuContent(this, &SPropertyEditorStruct::GenerateStructPicker)
.OnGetMenuContent(this, &SPropertyEditorStruct::GenerateStructPicker)
.ContentPadding(FMargin(2.0f, 2.0f))
.ToolTipText(this, &SPropertyEditorStruct::GetDisplayValue)
.ButtonContent()
Expand Down Expand Up @@ -180,7 +180,6 @@ FText SPropertyEditorStruct::GetDisplayValue() const
}
}

/*
TSharedRef<SWidget> SPropertyEditorStruct::GenerateStructPicker()
{

Expand Down Expand Up @@ -210,12 +209,11 @@ TSharedRef<SWidget> SPropertyEditorStruct::GenerateStructPicker()
.AutoHeight()
.MaxHeight(500)
[
FModuleManager::LoadModuleChecked<FStructViewerModule>("StructViewer").CreateStructViewer(Options, OnPicked)
FModuleManager::LoadModuleChecked<FRuntimeEditorModule>("RuntimeEditor").GetStructViewer().CreateStructViewer(Options, OnPicked)
]
];

}
*/

void SPropertyEditorStruct::OnStructPicked(const UScriptStruct* InStruct)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SPropertyEditorStruct : public SCompoundWidget
*
* @return The Struct Picker widget.
*/
//TSharedRef<SWidget> GenerateStructPicker();
TSharedRef<SWidget> GenerateStructPicker();

/**
* Callback function from the Struct Picker for when a struct is picked.
Expand Down
Loading

0 comments on commit 1516bca

Please sign in to comment.