Skip to content

Commit

Permalink
fixed game build
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto De Ioris committed Jan 19, 2018
1 parent 03d49e1 commit a9bf643
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Plugins/MaRLEnE/MaRLEnE.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"Modules": [
{
"Name": "MaRLEnE",
"Type": "Developer",
"Type": "Runtime",
"LoadingPhase": "Default"
}
]
}
}
11 changes: 9 additions & 2 deletions Plugins/MaRLEnE/Source/MaRLEnE/Private/MLObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include "MLObserversManager.h"

#include "DetailWidgetRow.h"

#if WITH_EDITOR
TSharedRef<IPropertyTypeCustomization> FMLObservedPropertyDetails::MakeInstance()
{
return MakeShareable(new FMLObservedPropertyDetails);
Expand Down Expand Up @@ -147,6 +147,7 @@ bool FMLObservedPropertyDetails::ObservableProp(UProperty *Prop)

return false;
}
#endif

UBlueprintGeneratedClass *UMLObserver::GetBlueprintTemplate()
{
Expand All @@ -161,6 +162,7 @@ UBlueprintGeneratedClass *UMLObserver::GetBlueprintTemplate()
return nullptr;
}

#if WITH_EDITOR
void FMLObservedPropertyDetails::CustomizeHeader(TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{

Expand Down Expand Up @@ -264,6 +266,7 @@ void FMLObservedPropertyDetails::CustomizeChildren(TSharedRef<class IPropertyHan
{
//Create further customization here
}
#endif


// Sets default values for this component's properties
Expand All @@ -284,6 +287,7 @@ UMLObserver::UMLObserver()

void UMLObserver::OnRegister()
{
#if WITH_EDITOR
AActor *Owner = GetOwner();
if (Owner && Owner->GetRootComponent() && !BillboardComponent)
{
Expand All @@ -295,8 +299,10 @@ void UMLObserver::OnRegister()
BillboardComponent->SetupAttachment(Owner->GetRootComponent());
BillboardComponent->RegisterComponent();
BillboardComponent->SetRelativeLocation(BillboardLocation);

BillboardComponent->SetEditorScale(BillboardScale);
}
#endif

Super::OnRegister();
}
Expand Down Expand Up @@ -341,7 +347,7 @@ void UMLObserver::TickComponent(float DeltaTime, ELevelTick TickType, FActorComp

void UMLObserver::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{

#if WITH_EDITOR
if (BillboardComponent)
{
if (PropertyChangedEvent.GetPropertyName() == FName("BillboardLocation"))
Expand All @@ -357,5 +363,6 @@ void UMLObserver::PostEditChangeProperty(FPropertyChangedEvent & PropertyChanged

FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyEditorModule.NotifyCustomizationModuleChanged();
#endif
}

10 changes: 9 additions & 1 deletion Plugins/MaRLEnE/Source/MaRLEnE/Private/MaRLEnE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

#include "MaRLEnE.h"


#if WITH_EDITOR
#include "ISettingsModule.h"
#include "ISettingsSection.h"
#include "ISettingsContainer.h"
#include "PropertyEditorModule.h"
#endif

#include "MaRLEnESettings.h"
#include "MLObserver.h"
Expand All @@ -16,6 +19,7 @@ void FMaRLEnEModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module

#if WITH_EDITOR
if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
{
// Create the new category
Expand All @@ -33,28 +37,32 @@ void FMaRLEnEModule::StartupModule()
);
}


if (FPropertyEditorModule *PropertyModule = FModuleManager::GetModulePtr<FPropertyEditorModule>("PropertyEditor"))
{

//Custom detail views
PropertyModule->RegisterCustomPropertyTypeLayout("MLObservedProperty", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMLObservedPropertyDetails::MakeInstance));
}
#endif
}

void FMaRLEnEModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.

#if WITH_EDITOR
if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
{
SettingsModule->UnregisterSettings("Project", "MaRLEnE", "General");
}


if (FPropertyEditorModule *PropertyModule = FModuleManager::GetModulePtr<FPropertyEditorModule>("PropertyEditor"))
{
PropertyModule->UnregisterCustomPropertyTypeLayout("MLObservedProperty");
}
#endif
}

#undef LOCTEXT_NAMESPACE
Expand Down
5 changes: 5 additions & 0 deletions Plugins/MaRLEnE/Source/MaRLEnE/Public/MLObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "Components/BillboardComponent.h"
#if WITH_EDITOR
#include "Editor/PropertyEditor/Public/IDetailCustomization.h"
#include "Editor/PropertyEditor/Public/DetailCategoryBuilder.h"
#include "Editor/PropertyEditor/Public/DetailLayoutBuilder.h"
#include "DetailWidgetRow.h"
#endif
#include "Engine/BlueprintGeneratedClass.h"
#include "MLObserver.generated.h"

Expand Down Expand Up @@ -43,6 +46,7 @@ struct FMLPropertyItem
UClass *Class;
};

#if WITH_EDITOR
class FMLObservedPropertyDetails : public IPropertyTypeCustomization
{
public:
Expand All @@ -69,6 +73,7 @@ class FMLObservedPropertyDetails : public IPropertyTypeCustomization

bool ObservableProp(UProperty *Prop);
};
#endif


UCLASS(ClassGroup = MaRLEnE, meta = (BlueprintSpawnableComponent), HideCategories(Mobility, Rendering, LOD, Collision, Physics, Activation, Cooking))
Expand Down

0 comments on commit a9bf643

Please sign in to comment.