本文整理汇总了C++中IDetailCategoryBuilder类的典型用法代码示例。如果您正苦于以下问题:C++ IDetailCategoryBuilder类的具体用法?C++ IDetailCategoryBuilder怎么用?C++ IDetailCategoryBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDetailCategoryBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTransitionEventPropertyWidgets
void FAnimTransitionNodeDetails::CreateTransitionEventPropertyWidgets(IDetailCategoryBuilder& TransitionCategory, FString TransitionName)
{
TSharedPtr<IPropertyHandle> NameProperty = TransitionCategory.GetParentLayout().GetProperty(*(TransitionName + TEXT(".NotifyName")));
TransitionCategory.AddProperty( NameProperty )
.DisplayName( LOCTEXT("CreateTransition_CustomBlueprintEvent", "Custom Blueprint Event") );
}
示例2: BuildTextureSection
void FSpriteDetailsCustomization::BuildTextureSection(IDetailCategoryBuilder& SpriteCategory, IDetailLayoutBuilder& DetailLayout)
{
// Grab information about the material
TSharedPtr<IPropertyHandle> DefaultMaterialProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, DefaultMaterial));
FText SourceTextureOverrideLabel;
if (DefaultMaterialProperty.IsValid())
{
UObject* DefaultMaterialAsObject;
if (DefaultMaterialProperty->GetValue(/*out*/ DefaultMaterialAsObject) == FPropertyAccess::Success)
{
if (UMaterialInterface* DefaultMaterialInterface = Cast<UMaterialInterface>(DefaultMaterialAsObject))
{
if (UMaterial* DefaultMaterial = DefaultMaterialInterface->GetMaterial())
{
// Get a list of sprite samplers
TArray<const UMaterialExpressionSpriteTextureSampler*> SpriteSamplerExpressions;
DefaultMaterial->GetAllExpressionsOfType(/*inout*/ SpriteSamplerExpressions);
// Turn that into a set of labels
for (const UMaterialExpressionSpriteTextureSampler* Sampler : SpriteSamplerExpressions)
{
if (!Sampler->SlotDisplayName.IsEmpty())
{
if (Sampler->bSampleAdditionalTextures)
{
AdditionalTextureLabels.FindOrAdd(Sampler->AdditionalSlotIndex) = Sampler->SlotDisplayName;
}
else
{
SourceTextureOverrideLabel = Sampler->SlotDisplayName;
}
}
}
}
}
}
}
// Create the base texture widget
TSharedPtr<IPropertyHandle> SourceTextureProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SourceTexture));
DetailLayout.HideProperty(SourceTextureProperty);
SpriteCategory.AddCustomRow(SourceTextureProperty->GetPropertyDisplayName())
.NameContent()
[
CreateTextureNameWidget(SourceTextureProperty, SourceTextureOverrideLabel)
]
.ValueContent()
.MaxDesiredWidth(TOptional<float>())
[
SourceTextureProperty->CreatePropertyValueWidget()
];
// Create the additional textures widget
TSharedPtr<IPropertyHandle> AdditionalSourceTexturesProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, AdditionalSourceTextures));
TSharedRef<FDetailArrayBuilder> AdditionalSourceTexturesBuilder = MakeShareable(new FDetailArrayBuilder(AdditionalSourceTexturesProperty.ToSharedRef()));
AdditionalSourceTexturesBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FSpriteDetailsCustomization::GenerateAdditionalTextureWidget));
SpriteCategory.AddCustomBuilder(AdditionalSourceTexturesBuilder);
}
示例3: AddRangePropertyRow
void UAnimGraphNode_BoneDrivenController::AddRangePropertyRow(const FText& Name, const FText& Tooltip, IDetailCategoryBuilder& Category, TSharedRef<IPropertyHandle> PropertyHandle, const FName MinPropertyName, const FName MaxPropertyName, TAttribute<EVisibility> VisibilityAttribute)
{
const float MiddlePadding = 4.0f;
TSharedPtr<IPropertyHandle> MinProperty = PropertyHandle->GetChildHandle(MinPropertyName);
Category.GetParentLayout().HideProperty(MinProperty);
TSharedPtr<IPropertyHandle> MaxProperty = PropertyHandle->GetChildHandle(MaxPropertyName);
Category.GetParentLayout().HideProperty(MaxProperty);
Category.AddCustomRow(Name)
.Visibility(VisibilityAttribute)
.NameContent()
[
SNew(STextBlock)
.Text(Name)
.ToolTipText(Tooltip)
.Font(IDetailLayoutBuilder::GetDetailFont())
]
.ValueContent()
.MinDesiredWidth(100.0f * 2.0f)
.MaxDesiredWidth(100.0f * 2.0f)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.FillWidth(1)
.Padding(0.0f, 0.0f, MiddlePadding, 0.0f)
.VAlign(VAlign_Center)
[
MinProperty->CreatePropertyValueWidget()
]
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock)
.Text(LOCTEXT("MinMaxSpacer", ".."))
.Font(IDetailLayoutBuilder::GetDetailFont())
]
+SHorizontalBox::Slot()
.FillWidth(1)
.Padding(MiddlePadding, 0.0f, 0.0f, 0.0f)
.VAlign(VAlign_Center)
[
MaxProperty->CreatePropertyValueWidget()
]
];
}
示例4: CustomizeTargetDetails
void FOneSkyLocalizationServiceProvider::CustomizeTargetDetails(IDetailCategoryBuilder& DetailCategoryBuilder, TWeakObjectPtr<ULocalizationTarget> LocalizationTarget) const
{
if (!LocalizationTarget.IsValid())
{
return;
}
FOneSkyLocalizationTargetSetting* Settings = FOneSkyLocalizationServiceModule::Get().AccessSettings().GetSettingsForTarget(LocalizationTarget->Settings.Guid, true);
FText ProjectText = LOCTEXT("OneSkyProjectIdLabel", "OneSky Project ID");
FDetailWidgetRow& ProjectRow = DetailCategoryBuilder.AddCustomRow(ProjectText);
ProjectRow.NameContent()
[
SNew(STextBlock)
.Text(ProjectText)
];
ProjectRow.ValueContent()
[
SNew(SEditableTextBox)
.OnTextCommitted(FOnTextCommitted::CreateStatic(&ProjectChanged, LocalizationTarget->Settings.Guid))
.Text_Lambda([Settings]
{
int32 SavedProjectId = Settings->OneSkyProjectId;
if (SavedProjectId >= 0)
{
return (const FText&) FText::FromString(FString::FromInt(SavedProjectId));
}
// Show empty string if value is default (-1)
return FText::GetEmpty();
}
)
];
FText FileText = LOCTEXT("OneSkyFileNameLabel", "OneSky File Name");
FDetailWidgetRow& FileNameRow = DetailCategoryBuilder.AddCustomRow(FileText);
FileNameRow.NameContent()
[
SNew(STextBlock)
.Text(FileText)
];
FileNameRow.ValueContent()
[
SNew(SEditableTextBox)
.OnTextCommitted(FOnTextCommitted::CreateStatic(&FileNameChanged, LocalizationTarget->Settings.Guid))
.Text(FText::FromString(Settings->OneSkyFileName))
];
}
示例5: BuildRenderingSection
void FSpriteDetailsCustomization::BuildRenderingSection(IDetailCategoryBuilder& RenderingCategory, IDetailLayoutBuilder& DetailLayout)
{
// Add the rendering geometry mode into the parent container (renamed)
const FString RenderGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, RenderGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpritePolygonCollection, GeometryType));
RenderingCategory.AddProperty(DetailLayout.GetProperty(*RenderGeometryTypePropertyPath))
.DisplayName(LOCTEXT("RenderGeometryType", "Render Geometry Type"));
// Show the rendering geometry settings
TSharedRef<IPropertyHandle> RenderGeometry = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, RenderGeometry));
IDetailPropertyRow& RenderGeometryProperty = RenderingCategory.AddProperty(RenderGeometry);
// Add the render polygons into advanced (renamed)
const FString RenderGeometryPolygonsPropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, RenderGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpritePolygonCollection, Polygons));
RenderingCategory.AddProperty(DetailLayout.GetProperty(*RenderGeometryPolygonsPropertyPath), EPropertyLocation::Advanced)
.DisplayName(LOCTEXT("RenderPolygons", "Render Polygons"));
}
示例6: BuildImageRow
void FIOSTargetSettingsCustomization::BuildImageRow(IDetailLayoutBuilder& DetailLayout, IDetailCategoryBuilder& Category, const FPlatformIconInfo& Info, const FVector2D& MaxDisplaySize)
{
const FString AutomaticImagePath = EngineGraphicsPath / Info.IconPath;
const FString TargetImagePath = GameGraphicsPath / Info.IconPath;
Category.AddCustomRow(Info.IconName.ToString())
.NameContent()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(FMargin(0, 1, 0, 1))
.FillWidth(1.0f)
[
SNew(STextBlock)
.Text(Info.IconName)
.Font(DetailLayout.GetDetailFont())
]
]
.ValueContent()
.MaxDesiredWidth(400.0f)
.MinDesiredWidth(100.0f)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.FillWidth(1.0f)
.VAlign(VAlign_Center)
[
SNew(SExternalImageReference, AutomaticImagePath, TargetImagePath)
.FileDescription(Info.IconDescription)
.RequiredSize(Info.IconRequiredSize)
.MaxDisplaySize(MaxDisplaySize)
]
];
}
示例7: ConstructWidget
void FTODFloatCurveProperty::ConstructWidget(IDetailCategoryBuilder& CategoryBuilder)
{
CategoryBuilder.AddCustomRow(FString("Test Row"))
[
SNew(SProperty, PropertyHandle)
.CustomWidget()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
SNew(STextBlock)
.Text(FText::FromString(PropertyHandle->GetPropertyDisplayName()))
]
+ SVerticalBox::Slot()
[
SNew(SSpinBox<float>)
.MinSliderValue(0)
.MaxSliderValue(1024)
.Value(TAttribute<float>(this, &FTODFloatCurveProperty::GetFloatValueFromAttribute))
]
]
]
];
}
示例8: CustomizeSettingsDetails
void FOneSkyLocalizationServiceProvider::CustomizeSettingsDetails(IDetailCategoryBuilder& DetailCategoryBuilder) const
{
FOneSkyConnectionInfo ConnectionInfo = FOneSkyLocalizationServiceModule::Get().AccessSettings().GetConnectionInfo();
FText PublicKeyText = LOCTEXT("OneSkyPublicKeyLabel", "OneSky API Public Key");
FDetailWidgetRow& PublicKeyRow = DetailCategoryBuilder.AddCustomRow(PublicKeyText);
PublicKeyRow.NameContent()
[
SNew(STextBlock)
.Text(PublicKeyText)
];
PublicKeyRow.ValueContent()
[
SNew(SEditableTextBox)
.OnTextCommitted(FOnTextCommitted::CreateStatic(&PublicKeyChanged))
.Text(FText::FromString(ConnectionInfo.ApiKey))
];
FText SecretKeyText = LOCTEXT("OneSkySecretKeyLabel", "OneSky API Secret Key");
FDetailWidgetRow& SecretKeyRow = DetailCategoryBuilder.AddCustomRow(SecretKeyText);
SecretKeyRow.NameContent()
[
SNew(STextBlock)
.Text(SecretKeyText)
];
SecretKeyRow.ValueContent()
[
SNew(SEditableTextBox)
.OnTextCommitted(FOnTextCommitted::CreateStatic(&SecretKeyChanged))
.Text(FText::FromString(ConnectionInfo.ApiSecret))
];
FText SaveSecretKeyText = LOCTEXT("OneSkySaveSecret", "Remember Secret Key (WARNING: saved unencrypted)");
FDetailWidgetRow& SaveSecretKeyRow = DetailCategoryBuilder.AddCustomRow(SaveSecretKeyText);
SaveSecretKeyRow.NameContent()
[
SNew(STextBlock)
.Text(SaveSecretKeyText)
];
SaveSecretKeyRow.ValueContent()
[
SNew(SCheckBox)
.IsChecked(FOneSkyLocalizationServiceModule::Get().AccessSettings().GetSaveSecretKey() ? ECheckBoxState::Checked : ECheckBoxState::Unchecked)
.OnCheckStateChanged(FOnCheckStateChanged::CreateStatic(&SaveSecretKeyChanged))
];
}
示例9: BuildSpriteSection
void FSpriteDetailsCustomization::BuildSpriteSection(IDetailCategoryBuilder& SpriteCategory, IDetailLayoutBuilder& DetailLayout)
{
// Show other normal properties in the sprite category so that desired ordering doesn't get messed up
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SourceUV));
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SourceDimension));
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SourceTexture));
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, DefaultMaterial));
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, Sockets));
SpriteCategory.AddProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, PixelsPerUnrealUnit));
// Show/hide the experimental atlas group support based on whether or not it is enabled
TSharedPtr<IPropertyHandle> AtlasGroupProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, AtlasGroup));
TAttribute<EVisibility> AtlasGroupPropertyVisibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateStatic(&FSpriteDetailsCustomization::GetAtlasGroupVisibility));
SpriteCategory.AddProperty(AtlasGroupProperty, EPropertyLocation::Advanced).Visibility(AtlasGroupPropertyVisibility);
// Show/hide the custom pivot point based on the pivot mode
TSharedPtr<IPropertyHandle> PivotModeProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, PivotMode));
TSharedPtr<IPropertyHandle> CustomPivotPointProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CustomPivotPoint));
TAttribute<EVisibility> CustomPivotPointVisibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::GetCustomPivotVisibility, PivotModeProperty));
SpriteCategory.AddProperty(PivotModeProperty);
SpriteCategory.AddProperty(CustomPivotPointProperty).Visibility(CustomPivotPointVisibility);
}
示例10: BuildCollisionSection
void FSpriteDetailsCustomization::BuildCollisionSection(IDetailCategoryBuilder& CollisionCategory, IDetailLayoutBuilder& DetailLayout)
{
TSharedPtr<IPropertyHandle> SpriteCollisionDomainProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SpriteCollisionDomain));
TAttribute<EVisibility> ParticipatesInPhysics = TAttribute<EVisibility>::Create( TAttribute<EVisibility>::FGetter::CreateSP( this, &FSpriteDetailsCustomization::AnyPhysicsMode, SpriteCollisionDomainProperty) ) ;
TAttribute<EVisibility> ParticipatesInPhysics3D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use3DPhysics));
TAttribute<EVisibility> ParticipatesInPhysics2D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use2DPhysics));
CollisionCategory.AddProperty(SpriteCollisionDomainProperty);
// Add a warning bar about 2D collision being experimental
FText WarningFor2D = LOCTEXT("Experimental2DPhysicsWarning", "2D collision support is *experimental*");
FText TooltipFor2D = LOCTEXT("Experimental2DPhysicsWarningTooltip", "2D collision support is *experimental* and should not be relied on yet.\n\nRigid body collision detection and response works, but there are only precompiled libraries for Windows currently.\n\nRaycasts are partially supported (and need to be enabled in project settings), but queries, sweeps, or overlap tests are not implemented yet.");
GenerateWarningRow(CollisionCategory, /*bExperimental=*/ true, WarningFor2D, TooltipFor2D, TEXT("Shared/Editors/SpriteEditor"), TEXT("CollisionDomain2DWarning"))
.Visibility(ParticipatesInPhysics2D);
// Add a warning bar if 2D collision queries aren't enabled
TAttribute<EVisibility> WarnAbout2DQueriesBeingDisabledVisibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::Get2DPhysicsNotEnabledWarningVisibility, SpriteCollisionDomainProperty));
FText QueryWarningFor2D = LOCTEXT("Query2DPhysicsWarning", "2D collision queries are disabled");
FText QueryTooltipFor2D = LOCTEXT("Query2DPhysicsWarningTooltip", "You can enable 2D queries in Project Settings..Physics by setting bEnable2DPhysics to true, otherwise only collision detection and response will work.\n\nNote: Only raycasts are partially supported; other queries, sweeps, and overlap tests are not implemented yet.");
GenerateWarningRow(CollisionCategory, /*bExperimental=*/ false, QueryWarningFor2D, QueryTooltipFor2D, TEXT("Shared/Editors/SpriteEditor"), TEXT("Disabled2DCollisionQueriesWarning"))
.Visibility(WarnAbout2DQueriesBeingDisabledVisibility);
// Add the collision geometry mode into the parent container (renamed)
{
// Restrict the diced value
TSharedPtr<FPropertyRestriction> PreventDicedRestriction = MakeShareable(new FPropertyRestriction(LOCTEXT("CollisionGeometryDoesNotSupportDiced", "Collision geometry can not be set to Diced")));
PreventDicedRestriction->AddValue(TEXT("Diced"));
// Find and add the property
const FString CollisionGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpritePolygonCollection, GeometryType));
TSharedPtr<IPropertyHandle> CollisionGeometryTypeProperty = DetailLayout.GetProperty(*CollisionGeometryTypePropertyPath);
CollisionGeometryTypeProperty->AddRestriction(PreventDicedRestriction.ToSharedRef());
CollisionCategory.AddProperty(CollisionGeometryTypeProperty)
.DisplayName(LOCTEXT("CollisionGeometryType", "Collision Geometry Type"))
.Visibility(ParticipatesInPhysics);
}
// Show the collision geometry when not None
CollisionCategory.AddProperty( DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionGeometry)) )
.Visibility(ParticipatesInPhysics);
// Show the collision thickness only in 3D mode
CollisionCategory.AddProperty( DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionThickness)) )
.Visibility(ParticipatesInPhysics3D);
// Add the collision polygons into advanced (renamed)
const FString CollisionGeometryPolygonsPropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpritePolygonCollection, Polygons));
CollisionCategory.AddProperty(DetailLayout.GetProperty(*CollisionGeometryPolygonsPropertyPath), EPropertyLocation::Advanced)
.DisplayName(LOCTEXT("CollisionPolygons", "Collision Polygons"))
.Visibility(ParticipatesInPhysics);
// Show the default body instance (and only it) from the body setup (if it exists)
DetailLayout.HideProperty("BodySetup");
IDetailPropertyRow& BodySetupDefaultInstance = CollisionCategory.AddProperty("BodySetup.DefaultInstance");
TArray<TWeakObjectPtr<UObject>> SpritesBeingEdited;
DetailLayout.GetObjectsBeingCustomized(/*out*/ SpritesBeingEdited);
TArray<UObject*> BodySetupList;
for (auto WeakSpritePtr : SpritesBeingEdited)
{
if (UPaperSprite* Sprite = Cast<UPaperSprite>(WeakSpritePtr.Get()))
{
if (UBodySetup* BodySetup = Sprite->BodySetup)
{
BodySetupList.Add(BodySetup);
}
}
}
if (BodySetupList.Num() > 0)
{
IDetailPropertyRow* DefaultInstanceRow = CollisionCategory.AddExternalProperty(BodySetupList, GET_MEMBER_NAME_CHECKED(UBodySetup, DefaultInstance));
if (DefaultInstanceRow != nullptr)
{
DefaultInstanceRow->Visibility(ParticipatesInPhysics);
}
}
}
示例11: CreateTextureGroupEntryRow
void FDeviceProfileTextureLODSettingsDetails::CreateTextureGroupEntryRow(int32 GroupId, IDetailCategoryBuilder& DetailCategoryBuilder)
{
TSharedRef<IPropertyHandle> LODGroupElementHandle = LODGroupsArrayHandle->GetElement(GroupId);
DetailCategoryBuilder.AddCustomBuilder(MakeShareable(new FTextureLODGroupLayout(DeviceProfile, (TextureGroup)GroupId)));
}
示例12: AddTripletPropertyRow
void UAnimGraphNode_BoneDrivenController::AddTripletPropertyRow(const FText& Name, const FText& Tooltip, IDetailCategoryBuilder& Category, TSharedRef<IPropertyHandle> PropertyHandle, const FName XPropertyName, const FName YPropertyName, const FName ZPropertyName)
{
const float XYZPadding = 5.0f;
TSharedPtr<IPropertyHandle> XProperty = PropertyHandle->GetChildHandle(XPropertyName);
Category.GetParentLayout().HideProperty(XProperty);
TSharedPtr<IPropertyHandle> YProperty = PropertyHandle->GetChildHandle(YPropertyName);
Category.GetParentLayout().HideProperty(YProperty);
TSharedPtr<IPropertyHandle> ZProperty = PropertyHandle->GetChildHandle(ZPropertyName);
Category.GetParentLayout().HideProperty(ZProperty);
Category.AddCustomRow(Name)
.NameContent()
[
SNew(STextBlock)
.Text(Name)
.ToolTipText(Tooltip)
.Font(IDetailLayoutBuilder::GetDetailFont())
]
.ValueContent()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(0.f, 0.f, XYZPadding, 0.f)
.AutoWidth()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
[
XProperty->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.AutoWidth()
[
XProperty->CreatePropertyValueWidget()
]
]
+ SHorizontalBox::Slot()
.Padding(0.f, 0.f, XYZPadding, 0.f)
.AutoWidth()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
[
YProperty->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.AutoWidth()
[
YProperty->CreatePropertyValueWidget()
]
]
+ SHorizontalBox::Slot()
.Padding(0.f, 0.f, XYZPadding, 0.f)
.AutoWidth()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
[
ZProperty->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.AutoWidth()
[
ZProperty->CreatePropertyValueWidget()
]
]
];
}
示例13: BuildCollisionSection
void FSpriteDetailsCustomization::BuildCollisionSection(IDetailCategoryBuilder& CollisionCategory, IDetailLayoutBuilder& DetailLayout)
{
TSharedPtr<IPropertyHandle> SpriteCollisionDomainProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SpriteCollisionDomain));
CollisionCategory.HeaderContent
(
SNew(SBox)
.HAlign(HAlign_Right)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.Padding(FMargin(5.0f, 0.0f))
.AutoWidth()
[
SNew(STextBlock)
.Font(FEditorStyle::GetFontStyle("TinyText"))
.Text(this, &FSpriteDetailsCustomization::GetCollisionHeaderContentText, SpriteCollisionDomainProperty)
]
]
);
TAttribute<EVisibility> ParticipatesInPhysics = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP( this, &FSpriteDetailsCustomization::AnyPhysicsMode, SpriteCollisionDomainProperty));
TAttribute<EVisibility> ParticipatesInPhysics3D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use3DPhysics));
TAttribute<EVisibility> ParticipatesInPhysics2D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use2DPhysics));
TAttribute<EVisibility> HideWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeIsNot, ESpriteEditorMode::EditRenderingGeomMode));
TAttribute<EVisibility> ShowWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeMatches, ESpriteEditorMode::EditRenderingGeomMode));
static const FText EditCollisionInCollisionMode = LOCTEXT("CollisionPropertiesHiddenInRenderingMode", "Switch to 'Edit Collsion' mode\nto edit Collision settings");
CollisionCategory.AddCustomRow(EditCollisionInCollisionMode)
.Visibility(ShowWhenInRenderingMode)
.WholeRowContent()
.HAlign(HAlign_Center)
[
SNew(STextBlock)
.Font(DetailLayout.GetDetailFontItalic())
.Justification(ETextJustify::Center)
.Text(EditCollisionInCollisionMode)
];
CollisionCategory.AddProperty(SpriteCollisionDomainProperty).Visibility(HideWhenInRenderingMode);
// Add a warning bar about 2D collision being experimental
FText WarningFor2D = LOCTEXT("Experimental2DPhysicsWarning", "2D collision support is *experimental*");
FText TooltipFor2D = LOCTEXT("Experimental2DPhysicsWarningTooltip", "2D collision support is *experimental* and should not be relied on yet.\n\nRigid body collision detection and response works, but there are only precompiled libraries for Windows currently.\n\nRaycasts are partially supported (and need to be enabled in project settings), but queries, sweeps, or overlap tests are not implemented yet.");
GenerateWarningRow(CollisionCategory, /*bExperimental=*/ true, WarningFor2D, TooltipFor2D, TEXT("Shared/Editors/SpriteEditor"), TEXT("CollisionDomain2DWarning"))
.Visibility(ParticipatesInPhysics2D);
// Add a warning bar if 2D collision queries aren't enabled
TAttribute<EVisibility> WarnAbout2DQueriesBeingDisabledVisibility = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::Get2DPhysicsNotEnabledWarningVisibility, SpriteCollisionDomainProperty));
FText QueryWarningFor2D = LOCTEXT("Query2DPhysicsWarning", "2D collision queries are disabled");
FText QueryTooltipFor2D = LOCTEXT("Query2DPhysicsWarningTooltip", "You can enable 2D queries in Project Settings..Physics by setting bEnable2DPhysics to true, otherwise only collision detection and response will work.\n\nNote: Only raycasts are partially supported; other queries, sweeps, and overlap tests are not implemented yet.");
GenerateWarningRow(CollisionCategory, /*bExperimental=*/ false, QueryWarningFor2D, QueryTooltipFor2D, TEXT("Shared/Editors/SpriteEditor"), TEXT("Disabled2DCollisionQueriesWarning"))
.Visibility(WarnAbout2DQueriesBeingDisabledVisibility);
// Add the collision geometry mode into the parent container (renamed)
{
// Restrict the diced value
TSharedPtr<FPropertyRestriction> PreventDicedRestriction = MakeShareable(new FPropertyRestriction(LOCTEXT("CollisionGeometryDoesNotSupportDiced", "Collision geometry can not be set to Diced")));
const UEnum* const SpritePolygonModeEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("ESpritePolygonMode"));
PreventDicedRestriction->AddDisabledValue(SpritePolygonModeEnum->GetEnumNameStringByValue((uint8)ESpritePolygonMode::Diced));
// Find and add the property
const FString CollisionGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, GeometryType));
TSharedPtr<IPropertyHandle> CollisionGeometryTypeProperty = DetailLayout.GetProperty(*CollisionGeometryTypePropertyPath);
CollisionGeometryTypeProperty->AddRestriction(PreventDicedRestriction.ToSharedRef());
CollisionCategory.AddProperty(CollisionGeometryTypeProperty)
.DisplayName(LOCTEXT("CollisionGeometryType", "Collision Geometry Type"))
.Visibility(ParticipatesInPhysics);
}
// Show the collision thickness only in 3D mode
CollisionCategory.AddProperty( DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionThickness)) )
.Visibility(ParticipatesInPhysics3D);
// Show the default body instance (and only it) from the body setup (if it exists)
DetailLayout.HideProperty("BodySetup");
IDetailPropertyRow& BodySetupDefaultInstance = CollisionCategory.AddProperty("BodySetup.DefaultInstance");
TArray<TWeakObjectPtr<UObject>> SpritesBeingEdited;
DetailLayout.GetObjectsBeingCustomized(/*out*/ SpritesBeingEdited);
TArray<UObject*> BodySetupList;
for (auto WeakSpritePtr : SpritesBeingEdited)
{
if (UPaperSprite* Sprite = Cast<UPaperSprite>(WeakSpritePtr.Get()))
{
if (UBodySetup* BodySetup = Sprite->BodySetup)
{
BodySetupList.Add(BodySetup);
}
}
}
if (BodySetupList.Num() > 0)
{
IDetailPropertyRow* DefaultInstanceRow = CollisionCategory.AddExternalProperty(BodySetupList, GET_MEMBER_NAME_CHECKED(UBodySetup, DefaultInstance));
if (DefaultInstanceRow != nullptr)
{
//.........这里部分代码省略.........
示例14: BuildRenderingSection
void FSpriteDetailsCustomization::BuildRenderingSection(IDetailCategoryBuilder& RenderingCategory, IDetailLayoutBuilder& DetailLayout)
{
TAttribute<EVisibility> HideWhenInCollisionMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeIsNot, ESpriteEditorMode::EditCollisionMode));
TAttribute<EVisibility> ShowWhenInCollisionMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeMatches, ESpriteEditorMode::EditCollisionMode));
static const FText EditRenderingInRenderingMode = LOCTEXT("RenderingPropertiesHiddenInCollisionMode", "Switch to 'Edit RenderGeom' mode\nto edit Rendering settings");
RenderingCategory.AddCustomRow(EditRenderingInRenderingMode)
.Visibility(ShowWhenInCollisionMode)
.WholeRowContent()
.HAlign(HAlign_Center)
[
SNew(STextBlock)
.Font(DetailLayout.GetDetailFontItalic())
.Justification(ETextJustify::Center)
.Text(EditRenderingInRenderingMode)
];
TArray<TWeakObjectPtr<UObject>> ObjectsBeingCustomized;
DetailLayout.GetObjectsBeingCustomized(/*out*/ ObjectsBeingCustomized);
if (ObjectsBeingCustomized.Num() > 0)
{
if (UPaperSprite* SpriteBeingEdited = Cast<UPaperSprite>(ObjectsBeingCustomized[0].Get()))
{
static const FText TypesOfMaterialsTooltip = LOCTEXT("TypesOfMaterialsTooltip", "Translucent materials can have smooth alpha edges, blending with the background\nMasked materials have on or off alpha, useful for cutouts\nOpaque materials have no transparency but render faster");
RenderingCategory.HeaderContent
(
SNew(SBox)
.HAlign(HAlign_Right)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.Padding(FMargin(5.0f, 0.0f))
.AutoWidth()
[
SNew(STextBlock)
.Font(FEditorStyle::GetFontStyle("TinyText"))
.Text(this, &FSpriteDetailsCustomization::GetRenderingHeaderContentText, TWeakObjectPtr<UPaperSprite>(SpriteBeingEdited))
.ToolTipText(TypesOfMaterialsTooltip)
]
]
);
}
}
// Add the rendering geometry mode into the parent container (renamed)
const FString RenderGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, RenderGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, GeometryType));
TSharedPtr<IPropertyHandle> RenderGeometryTypeProperty = DetailLayout.GetProperty(*RenderGeometryTypePropertyPath);
RenderingCategory.AddProperty(RenderGeometryTypeProperty)
.DisplayName(LOCTEXT("RenderGeometryType", "Render Geometry Type"))
.Visibility(HideWhenInCollisionMode);
// Show the alternate material, but only when the mode is Diced
TAttribute<EVisibility> ShowWhenModeIsDiced = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PolygonModeMatches, RenderGeometryTypeProperty, ESpritePolygonMode::Diced));
TSharedPtr<IPropertyHandle> AlternateMaterialProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, AlternateMaterial));
RenderingCategory.AddProperty(AlternateMaterialProperty)
.Visibility(ShowWhenModeIsDiced);
// Show the rendering geometry settings
TSharedRef<IPropertyHandle> RenderGeometry = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, RenderGeometry));
IDetailPropertyRow& RenderGeometryProperty = RenderingCategory.AddProperty(RenderGeometry)
.Visibility(HideWhenInCollisionMode);
// Add the render polygons into advanced (renamed)
const FString RenderGeometryPolygonsPropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, RenderGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, Shapes));
RenderingCategory.AddProperty(DetailLayout.GetProperty(*RenderGeometryPolygonsPropertyPath), EPropertyLocation::Advanced)
.DisplayName(LOCTEXT("RenderShapes", "Render Shapes"))
.Visibility(HideWhenInCollisionMode);
}
示例15: BuildCollisionSection
void FSpriteDetailsCustomization::BuildCollisionSection(IDetailCategoryBuilder& CollisionCategory, IDetailLayoutBuilder& DetailLayout)
{
TSharedPtr<IPropertyHandle> SpriteCollisionDomainProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SpriteCollisionDomain));
CollisionCategory.HeaderContent
(
SNew(SBox)
.HAlign(HAlign_Right)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.Padding(FMargin(5.0f, 0.0f))
.AutoWidth()
[
SNew(STextBlock)
.Font(FEditorStyle::GetFontStyle("TinyText"))
.Text(this, &FSpriteDetailsCustomization::GetCollisionHeaderContentText, SpriteCollisionDomainProperty)
]
]
);
TAttribute<EVisibility> ParticipatesInPhysics = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP( this, &FSpriteDetailsCustomization::AnyPhysicsMode, SpriteCollisionDomainProperty));
TAttribute<EVisibility> ParticipatesInPhysics3D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use3DPhysics));
TAttribute<EVisibility> HideWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeIsNot, ESpriteEditorMode::EditRenderingGeomMode));
TAttribute<EVisibility> ShowWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeMatches, ESpriteEditorMode::EditRenderingGeomMode));
static const FText EditCollisionInCollisionMode = LOCTEXT("CollisionPropertiesHiddenInRenderingMode", "Switch to 'Edit Collsion' mode\nto edit Collision settings");
CollisionCategory.AddCustomRow(EditCollisionInCollisionMode)
.Visibility(ShowWhenInRenderingMode)
.WholeRowContent()
.HAlign(HAlign_Center)
[
SNew(STextBlock)
.Font(DetailLayout.GetDetailFontItalic())
.Justification(ETextJustify::Center)
.Text(EditCollisionInCollisionMode)
];
CollisionCategory.AddProperty(SpriteCollisionDomainProperty).Visibility(HideWhenInRenderingMode);
// Add the collision geometry mode into the parent container (renamed)
{
// Restrict the diced value
TSharedPtr<FPropertyRestriction> PreventDicedRestriction = MakeShareable(new FPropertyRestriction(LOCTEXT("CollisionGeometryDoesNotSupportDiced", "Collision geometry can not be set to Diced")));
const UEnum* const SpritePolygonModeEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("ESpritePolygonMode"));
PreventDicedRestriction->AddDisabledValue(SpritePolygonModeEnum->GetNameStringByValue((uint8)ESpritePolygonMode::Diced));
// Find and add the property
const FString CollisionGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, GeometryType));
TSharedPtr<IPropertyHandle> CollisionGeometryTypeProperty = DetailLayout.GetProperty(*CollisionGeometryTypePropertyPath);
CollisionGeometryTypeProperty->AddRestriction(PreventDicedRestriction.ToSharedRef());
CollisionCategory.AddProperty(CollisionGeometryTypeProperty)
.DisplayName(LOCTEXT("CollisionGeometryType", "Collision Geometry Type"))
.Visibility(ParticipatesInPhysics);
}
// Show the collision thickness only in 3D mode
CollisionCategory.AddProperty( DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionThickness)) )
.Visibility(ParticipatesInPhysics3D);
// Show the default body instance (and only it) from the body setup (if it exists)
DetailLayout.HideProperty("BodySetup");
IDetailPropertyRow& BodySetupDefaultInstance = CollisionCategory.AddProperty("BodySetup.DefaultInstance");
TArray<TWeakObjectPtr<UObject>> SpritesBeingEdited;
DetailLayout.GetObjectsBeingCustomized(/*out*/ SpritesBeingEdited);
TArray<UObject*> BodySetupList;
for (auto WeakSpritePtr : SpritesBeingEdited)
{
if (UPaperSprite* Sprite = Cast<UPaperSprite>(WeakSpritePtr.Get()))
{
if (UBodySetup* BodySetup = Sprite->BodySetup)
{
BodySetupList.Add(BodySetup);
}
}
}
if (BodySetupList.Num() > 0)
{
IDetailPropertyRow* DefaultInstanceRow = CollisionCategory.AddExternalObjectProperty(BodySetupList, GET_MEMBER_NAME_CHECKED(UBodySetup, DefaultInstance));
if (DefaultInstanceRow != nullptr)
{
DefaultInstanceRow->Visibility(ParticipatesInPhysics);
}
}
// Show the collision geometry when not None
CollisionCategory.AddProperty(DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionGeometry)))
.Visibility(ParticipatesInPhysics);
// Add the collision polygons into advanced (renamed)
const FString CollisionGeometryPolygonsPropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, Shapes));
CollisionCategory.AddProperty(DetailLayout.GetProperty(*CollisionGeometryPolygonsPropertyPath), EPropertyLocation::Advanced)
.DisplayName(LOCTEXT("CollisionShapes", "Collision Shapes"))
.Visibility(ParticipatesInPhysics);
}