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); }
void FDeviceProfileTextureLODSettingsDetails::CreateTextureGroupEntryRow(int32 GroupId, IDetailCategoryBuilder& DetailCategoryBuilder) { TSharedRef<IPropertyHandle> LODGroupElementHandle = LODGroupsArrayHandle->GetElement(GroupId); DetailCategoryBuilder.AddCustomBuilder(MakeShareable(new FTextureLODGroupLayout(DeviceProfile, (TextureGroup)GroupId))); }