Ajout du projet Depths sur Git
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
// Copyright Benoit Pelletier 2023 - 2025 All Rights Reserved.
|
||||
//
|
||||
// This software is available under different licenses depending on the source from which it was obtained:
|
||||
// - The Fab EULA (https://fab.com/eula) applies when obtained from the Fab marketplace.
|
||||
// - The CeCILL-C license (https://cecill.info/licences/Licence_CeCILL-C_V1-en.html) applies when obtained from any other source.
|
||||
// Please refer to the accompanying LICENSE file for further details.
|
||||
|
||||
#include "DoorDefCustomization.h"
|
||||
#include "ProceduralDungeonTypes.h"
|
||||
#include "PropertyCustomizationHelpers.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FDoorDefCustomization"
|
||||
|
||||
TSharedRef<IPropertyTypeCustomization> FDoorDefCustomization::MakeInstance()
|
||||
{
|
||||
return MakeShareable(new FDoorDefCustomization());
|
||||
}
|
||||
|
||||
void FDoorDefCustomization::GetSortedChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, TArray<TSharedRef<IPropertyHandle>>& OutChildren)
|
||||
{
|
||||
TSharedPtr<IPropertyHandle> PositionProp = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDoorDef, Position));
|
||||
TSharedPtr<IPropertyHandle> DirectionProp = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDoorDef, Direction));
|
||||
TSharedPtr<IPropertyHandle> TypeProp = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDoorDef, Type));
|
||||
|
||||
// ============= Copied from VectorStructCustomization class (private in engine so can't inherit from it) ============================
|
||||
// Only replaced the StructPropertyHandle to the PositionProp
|
||||
|
||||
static const FName X("X");
|
||||
static const FName Y("Y");
|
||||
static const FName Z("Z");
|
||||
|
||||
TSharedPtr<IPropertyHandle> VectorChildren[3];
|
||||
|
||||
uint32 NumChildren;
|
||||
PositionProp->GetNumChildren(NumChildren);
|
||||
|
||||
for (uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex)
|
||||
{
|
||||
TSharedRef<IPropertyHandle> ChildHandle = PositionProp->GetChildHandle(ChildIndex).ToSharedRef();
|
||||
const FName PropertyName = ChildHandle->GetProperty()->GetFName();
|
||||
|
||||
if (PropertyName == X)
|
||||
{
|
||||
VectorChildren[0] = ChildHandle;
|
||||
}
|
||||
else if (PropertyName == Y)
|
||||
{
|
||||
VectorChildren[1] = ChildHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
check(PropertyName == Z);
|
||||
VectorChildren[2] = ChildHandle;
|
||||
}
|
||||
}
|
||||
|
||||
OutChildren.Add(VectorChildren[0].ToSharedRef());
|
||||
OutChildren.Add(VectorChildren[1].ToSharedRef());
|
||||
OutChildren.Add(VectorChildren[2].ToSharedRef());
|
||||
|
||||
// ================ Add Direction property in the children ===================
|
||||
|
||||
OutChildren.Add(DirectionProp.ToSharedRef());
|
||||
OutChildren.Add(TypeProp.ToSharedRef());
|
||||
}
|
||||
|
||||
TSharedRef<SWidget> FDoorDefCustomization::MakeChildWidget(TSharedRef<IPropertyHandle>& StructurePropertyHandle, TSharedRef<IPropertyHandle>& PropertyHandle)
|
||||
{
|
||||
const FFieldClass* PropertyClass = PropertyHandle->GetPropertyClass();
|
||||
if (PropertyClass == FEnumProperty::StaticClass())
|
||||
return PropertyHandle->CreatePropertyValueWidget();
|
||||
|
||||
if (PropertyClass == FStructProperty::StaticClass())
|
||||
return PropertyHandle->CreatePropertyValueWidget();
|
||||
|
||||
if (PropertyClass == FObjectProperty::StaticClass())
|
||||
return PropertyHandle->CreatePropertyValueWidget();
|
||||
|
||||
return FMathStructCustomization::MakeChildWidget(StructurePropertyHandle, PropertyHandle);
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Copyright Benoit Pelletier 2023 - 2025 All Rights Reserved.
|
||||
//
|
||||
// This software is available under different licenses depending on the source from which it was obtained:
|
||||
// - The Fab EULA (https://fab.com/eula) applies when obtained from the Fab marketplace.
|
||||
// - The CeCILL-C license (https://cecill.info/licences/Licence_CeCILL-C_V1-en.html) applies when obtained from any other source.
|
||||
// Please refer to the accompanying LICENSE file for further details.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IPropertyTypeCustomization.h"
|
||||
#include "PropertyHandle.h"
|
||||
#include "Customizations/MathStructCustomizations.h"
|
||||
|
||||
class FDoorDefCustomization : public FMathStructCustomization
|
||||
{
|
||||
public:
|
||||
static TSharedRef<IPropertyTypeCustomization> MakeInstance();
|
||||
|
||||
protected:
|
||||
// ~BEGIN FMathStructCustomization
|
||||
virtual void GetSortedChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, TArray<TSharedRef<IPropertyHandle>>& OutChildren) override;
|
||||
virtual TSharedRef<SWidget> MakeChildWidget(TSharedRef<IPropertyHandle>& StructurePropertyHandle, TSharedRef<IPropertyHandle>& PropertyHandle) override;
|
||||
// ~END FMathStructCustomization
|
||||
};
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// Copyright Benoit Pelletier 2024 - 2025 All Rights Reserved.
|
||||
//
|
||||
// This software is available under different licenses depending on the source from which it was obtained:
|
||||
// - The Fab EULA (https://fab.com/eula) applies when obtained from the Fab marketplace.
|
||||
// - The CeCILL-C license (https://cecill.info/licences/Licence_CeCILL-C_V1-en.html) applies when obtained from any other source.
|
||||
// Please refer to the accompanying LICENSE file for further details.
|
||||
|
||||
#include "Margin3DCustomization.h"
|
||||
#include "ProceduralDungeonEditorSettings.h"
|
||||
#include "PropertyCustomizationHelpers.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FMargin3DCustomization"
|
||||
|
||||
TSharedRef<IPropertyTypeCustomization> FMargin3DCustomization::MakeInstance()
|
||||
{
|
||||
return MakeShareable(new FMargin3DCustomization());
|
||||
}
|
||||
|
||||
void FMargin3DCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
|
||||
{
|
||||
TSharedPtr<IPropertyHandle> AxisProps[3] = {
|
||||
StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FMargin3D, XAxis)),
|
||||
StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FMargin3D, YAxis)),
|
||||
StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FMargin3D, ZAxis))
|
||||
};
|
||||
|
||||
TSharedPtr<SHorizontalBox> ValueRow;
|
||||
|
||||
HeaderRow
|
||||
.NameContent()
|
||||
[
|
||||
StructPropertyHandle->CreatePropertyNameWidget()
|
||||
]
|
||||
.ValueContent()[
|
||||
SAssignNew(ValueRow, SHorizontalBox)
|
||||
];
|
||||
|
||||
for (const auto& AxisProp : AxisProps)
|
||||
{
|
||||
auto PositiveProp = AxisProp->GetChildHandle(GET_MEMBER_NAME_CHECKED(FVector2D, X));
|
||||
auto NegativeProp = AxisProp->GetChildHandle(GET_MEMBER_NAME_CHECKED(FVector2D, Y));
|
||||
|
||||
// Axis name
|
||||
ValueRow->AddSlot()
|
||||
.AutoWidth()
|
||||
[
|
||||
AxisProp->CreatePropertyNameWidget()
|
||||
];
|
||||
|
||||
if (PositiveProp)
|
||||
{
|
||||
// Margin along positive axis
|
||||
ValueRow->AddSlot()
|
||||
.AutoWidth()
|
||||
.Padding(3.0f, 0.0f)
|
||||
[
|
||||
PositiveProp->CreatePropertyValueWidget()
|
||||
];
|
||||
}
|
||||
|
||||
if (NegativeProp)
|
||||
{
|
||||
// Margin along negative axis
|
||||
ValueRow->AddSlot()
|
||||
.AutoWidth()
|
||||
.Padding(0.0f, 0.0f, 20.0f, 0.0f)
|
||||
[
|
||||
NegativeProp->CreatePropertyValueWidget()
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FMargin3DCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
|
||||
{
|
||||
// TODO?
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// Copyright Benoit Pelletier 2024 - 2025 All Rights Reserved.
|
||||
//
|
||||
// This software is available under different licenses depending on the source from which it was obtained:
|
||||
// - The Fab EULA (https://fab.com/eula) applies when obtained from the Fab marketplace.
|
||||
// - The CeCILL-C license (https://cecill.info/licences/Licence_CeCILL-C_V1-en.html) applies when obtained from any other source.
|
||||
// Please refer to the accompanying LICENSE file for further details.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IPropertyTypeCustomization.h"
|
||||
#include "PropertyHandle.h"
|
||||
|
||||
class FMargin3DCustomization : public IPropertyTypeCustomization
|
||||
{
|
||||
public:
|
||||
static TSharedRef<IPropertyTypeCustomization> MakeInstance();
|
||||
|
||||
protected:
|
||||
//~ BEGIN IPropertyTypeCustomization
|
||||
virtual void CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
||||
virtual void CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
||||
//~ END IPropertyTypeCustomization
|
||||
};
|
||||
Reference in New Issue
Block a user