当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedRef::AccessRawData方法代码示例

本文整理汇总了C++中TSharedRef::AccessRawData方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::AccessRawData方法的具体用法?C++ TSharedRef::AccessRawData怎么用?C++ TSharedRef::AccessRawData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSharedRef的用法示例。


在下文中一共展示了TSharedRef::AccessRawData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CustomizeStructHeader

void FSlateSoundStructCustomization::CustomizeStructHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IStructCustomizationUtils& StructCustomizationUtils)
{
	TSharedPtr<IPropertyHandle> ResourceObjectProperty = StructPropertyHandle->GetChildHandle(TEXT("ResourceObject"));
	check(ResourceObjectProperty.IsValid());

	TArray<void*> StructPtrs;
	StructPropertyHandle->AccessRawData(StructPtrs);
	for(auto It = StructPtrs.CreateConstIterator(); It; ++It)
	{
		FSlateSound* const SlateSound = reinterpret_cast<FSlateSound*>(*It);
		SlateSoundStructs.Add(SlateSound);
	}

	HeaderRow
	.NameContent()
	[
		StructPropertyHandle->CreatePropertyNameWidget()
	]
	.ValueContent()
	.MinDesiredWidth(250.0f)
	[
		SNew(SObjectPropertyEntryBox)
		.PropertyHandle(ResourceObjectProperty)
		.AllowedClass(USoundBase::StaticClass())
		.OnObjectChanged(this, &FSlateSoundStructCustomization::OnObjectChanged)
	];
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:SlateSoundCustomization.cpp

示例2: CustomizeHeader

BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void FAIDataProviderValueDetails::CustomizeHeader(TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	DataBindingProperty = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FAIDataProviderValue, DataBinding));
	DataFieldProperty = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FAIDataProviderValue, DataField));
	DefaultValueProperty = StructPropertyHandle->GetChildHandle(TEXT("DefaultValue"));

	DataBindingProperty->SetOnPropertyValueChanged(FSimpleDelegate::CreateSP(this, &FAIDataProviderValueDetails::OnBindingChanged));
	
	TArray<void*> StructPtrs;
	StructPropertyHandle->AccessRawData(StructPtrs);
	DataPtr = (StructPtrs.Num() == 1) ? reinterpret_cast<FAIDataProviderValue*>(StructPtrs[0]) : nullptr;
	OnBindingChanged();

	TSharedRef<SWidget> DefPropWidget = DefaultValueProperty->CreatePropertyValueWidget();
	DefPropWidget->SetVisibility(TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FAIDataProviderValueDetails::GetDefaultValueVisibility)));

	HeaderRow
	.NameContent()
	[
		StructPropertyHandle->CreatePropertyNameWidget()
	]
	.ValueContent()
	.VAlign(VAlign_Center)
	.MinDesiredWidth(300.0f)
	[
		SNew(SHorizontalBox)
		+ SHorizontalBox::Slot()
		.Padding(0.0f, 2.0f, 5.0f, 2.0f)
		[
			SNew(STextBlock)
			.Text(this, &FAIDataProviderValueDetails::GetValueDesc)
			.Font(IDetailLayoutBuilder::GetDetailFont())
			.Visibility(TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FAIDataProviderValueDetails::GetBindingDescVisibility)))
		]
		+ SHorizontalBox::Slot()
		.Padding(0.0f, 2.0f, 5.0f, 2.0f)
		[
			DefPropWidget
		]
	];
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:42,代码来源:AIDataProviderValueDetails.cpp

示例3: CustomizeChildren

void FVehicleTransmissionDataCustomization::CustomizeChildren(TSharedRef<class IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	// copy all transmision instances I'm accessing right now
	TArray<void*> StructPtrs;
	StructPropertyHandle->AccessRawData(StructPtrs);
	
	if (StructPtrs.Num() == 1)
	{
		SelectedTransmission = (FVehicleTransmissionData *)StructPtrs[0];
	}
	else
	{
		SelectedTransmission = NULL;
	}


	uint32 NumChildren = 0;
	StructPropertyHandle->GetNumChildren(NumChildren);

	FName GearsSetupGroupName = TEXT("GearsSetup");
	FText GearsSetupGroupLabel = LOCTEXT("GearSetupLabel", "Gears Setup");
	IDetailGroup * GearSetupGroup = NULL;
	
	for (uint32 ChildIdx = 0; ChildIdx < NumChildren; ++ChildIdx)
	{
		TSharedRef<IPropertyHandle> ChildProperty = StructPropertyHandle->GetChildHandle(ChildIdx).ToSharedRef();
		const FString PropertyName = ChildProperty->GetProperty() ? ChildProperty->GetProperty()->GetName() : TEXT("");

		if (PropertyName == TEXT("ForwardGears") || PropertyName == TEXT("NeutralGearUpRatio") || PropertyName == TEXT("ReverseGearRatio"))
		{
			if (GearSetupGroup == NULL)
			{
				GearSetupGroup = &StructBuilder.AddChildGroup(GearsSetupGroupName, GearsSetupGroupLabel);
				BuildColumnsHeaderHelper(StructPropertyHandle, StructBuilder.AddChildContent(GearsSetupGroupLabel));
			}

			//determine which gear we're showing
			EGearType GearType = ForwardGear;
			if (PropertyName == TEXT("NeutralGearUpRatio"))
			{
				GearType = NeutralGear;
			}
			else if
			(PropertyName == TEXT("ReverseGearRatio"))
			{
				GearType = ReverseGear;
			}
						
			if (GearType == ForwardGear)
			{
				TSharedRef<FDetailArrayBuilder> GearsArrayBuilder = MakeShareable(new FDetailArrayBuilder(ChildProperty, false));
				GearsArrayBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FVehicleTransmissionDataCustomization::CreateGearUIDelegate));
				StructBuilder.AddChildCustomBuilder(GearsArrayBuilder);
			}
			else
			{
				const FText PropertyNameText = FText::FromString(PropertyName);
				CreateGearUIHelper(StructBuilder.AddChildContent(PropertyNameText), PropertyNameText, ChildProperty, GearType);
			}


		}
		else
		{	//Add all other properties
			StructBuilder.AddChildProperty(ChildProperty);
		}
	}

}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:69,代码来源:VehicleTransmissionDataCustomization.cpp

示例4: CustomizeStructHeader

void FKeyStructCustomization::CustomizeStructHeader( TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IStructCustomizationUtils& StructCustomizationUtils )
{
    PropertyHandle = StructPropertyHandle;

    TArray<void*> StructPtrs;
    StructPropertyHandle->AccessRawData(StructPtrs);
    check(StructPtrs.Num() != 0);
    const FKey& SelectedKey = *(FKey*)StructPtrs[0];

    bool bMultipleValues = false;
    for (int32 StructPtrIndex = 1; StructPtrIndex < StructPtrs.Num(); ++StructPtrIndex)
    {
        if (*(FKey*)StructPtrs[StructPtrIndex] != SelectedKey)
        {
            bMultipleValues = true;
            break;
        }
    }

    TSharedPtr<FKey> InitialSelectedItem;
    TArray<FKey> AllKeys;
    EKeys::GetAllKeys(AllKeys);

    for (FKey Key : AllKeys)
    {
        TSharedPtr<FKey> InputKey = MakeShareable(new FKey(Key));
        InputKeys.Add(InputKey);
        if (Key == SelectedKey)
        {
            InitialSelectedItem = InputKey;
        }
    }

    // create struct header
    HeaderRow.NameContent()
    [
        StructPropertyHandle->CreatePropertyNameWidget()
    ]
    .ValueContent()
    .MinDesiredWidth(125.0f)
    .MaxDesiredWidth(325.0f)
    [
        SNew(SHorizontalBox)

        + SHorizontalBox::Slot()
        .FillWidth(1.0f)
        [
            // text box
            SNew(SComboBox< TSharedPtr<FKey> >)
            .OptionsSource(&InputKeys)
            .InitiallySelectedItem(InitialSelectedItem)
            .OnGenerateWidget(this, &FKeyStructCustomization::OnGenerateComboWidget)
            .OnSelectionChanged(this, &FKeyStructCustomization::OnSelectionChanged)
            .Content()
            [
                SAssignNew(TextBlock, STextBlock)
                .Text(bMultipleValues ? LOCTEXT("MultipleValues", "Multiple Values") : SelectedKey.GetDisplayName())
                .Font(StructCustomizationUtils.GetRegularFont())
            ]
        ]
    ];
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:62,代码来源:KeyStructCustomization.cpp


注:本文中的TSharedRef::AccessRawData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。