Customizations/SURACameraDriverDetailsCustomization代码

/* ########### SURACameraDriverDetailsCustomization.h ########### */
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "IDetailCustomization.h"

class IDetailLayoutBuilder;

/**
 * 
 */
class FSURACameraDriverDetailsCustomization : public IDetailCustomization
{
public:
	static TSharedRef<IDetailCustomization> MakeInstance();

	//~ Begin IDetailCustomization Interface
	virtual void CustomizeDetails(IDetailLayoutBuilder& DetailLayout) override;
	//~ End IDetailCustomization Interface

private:
	TArray<TWeakObjectPtr<UObject>> CustomizedObjects;
};


/* ########### SURACameraDriverDetailsCustomization.cpp ########### */
// Copyright Epic Games, Inc. All Rights Reserved.

#include "Customizations/SURACameraDriverDetailsCustomization.h"

#include "DetailCategoryBuilder.h"
#include "DetailLayoutBuilder.h"
#include "DetailWidgetRow.h"
#include "SURACameraDriver.h"

#define LOCTEXT_NAMESPACE "SURACameraDriverDetailsCustomization"

/**
 *
 */
TSharedRef<IDetailCustomization> FSURACameraDriverDetailsCustomization ::MakeInstance()
{
	return MakeShared<FSURACameraDriverDetailsCustomization>();
}


void FSURACameraDriverDetailsCustomization ::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
	DetailLayout.GetObjectsBeingCustomized(CustomizedObjects);

	if (CustomizedObjects.Num())
	{
		TArray<FName> OutNames;
		DetailLayout.GetCategoryNames(OutNames);
		DetailLayout.HideCategory("TransformCommon");
		DetailLayout.HideCategory("SURAPlugin");
		IDetailCategoryBuilder& CamConfigCategory = DetailLayout.EditCategory(TEXT("Camera Config"));
		TSharedPtr<IPropertyHandle> CaptureCameraParamsPropertyHandle = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(ASURACameraDriver, CaptureCameraParams));
		IDetailPropertyRow& CaptureCameraParamsPropertyRow = CamConfigCategory.AddProperty(CaptureCameraParamsPropertyHandle);
	}
}

#undef LOCTEXT_NAMESPACE