本文整理汇总了C++中UProperty::CopySingleValue方法的典型用法代码示例。如果您正苦于以下问题:C++ UProperty::CopySingleValue方法的具体用法?C++ UProperty::CopySingleValue怎么用?C++ UProperty::CopySingleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UProperty
的用法示例。
在下文中一共展示了UProperty::CopySingleValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CacheValue
/**
* Caches the property value
*/
void CacheValue()
{
Data.Reset();
FPropertyNode& PropertyNodeRef = *PropertyNode.Pin();
UProperty* Property = PropertyNodeRef.GetProperty();
{
// Not supported yet
check( !Property->IsA( UArrayProperty::StaticClass() ) )
if( PropertyNodeRef.GetArrayIndex() == INDEX_NONE && Property->ArrayDim > 1 )
{
// Check static arrays
Data.AddZeroed( Property->ArrayDim * Property->ElementSize );
Property->CopyCompleteValue( Data.GetData(), PropertyValueAddress);
}
else
{
// Regular properties
Data.AddZeroed( Property->ElementSize );
Property->CopySingleValue( Data.GetData(), PropertyValueAddress );
}
}
}
示例2: ReceivedBunch
//.........这里部分代码省略.........
}
// Pointer to destination.
uint8 * DestObj = (uint8*)Object;
uint8 * DestRecent = RepState->StaticBuffer.Num() ? RepState->StaticBuffer.GetTypedData() : NULL;
// Check property ordering.
FPropertyRetirement & Retire = Retirement[ ReplicatedProp->RepIndex + Element ];
if ( Bunch.PacketId >= Retire.InPacketId ) //!! problem with reliable pkts containing dynamic references, being retransmitted, and overriding newer versions. Want "OriginalPacketId" for retransmissions?
{
// Receive this new property.
Retire.InPacketId = Bunch.PacketId;
}
else
{
// Skip this property, because it's out-of-date.
UE_LOG( LogNetTraffic, Log, TEXT( "Received out-of-date %s" ), *ReplicatedProp->GetName() );
DestObj = NULL;
DestRecent = NULL;
}
FMemMark Mark(FMemStack::Get());
uint8 * Data = DestObj ? ReplicatedProp->ContainerPtrToValuePtr<uint8>(DestObj, Element) : NewZeroed<uint8>(FMemStack::Get(),ReplicatedProp->ElementSize);
TArray<uint8> MetaData;
PTRINT Offset = 0;
// Copy current value over to Recent for comparison
if ( DestRecent )
{
Offset = ReplicatedProp->ContainerPtrToValuePtr<uint8>(DestRecent, Element) - DestRecent;
check( Offset >= 0 && Offset < RepState->StaticBuffer.Num() ); //@todo if we move properties outside of the memory block, then this will not work anyway
ReplicatedProp->CopySingleValue( DestRecent + Offset, Data );
}
// Receive custom delta property.
UStructProperty * StructProperty = Cast< UStructProperty >( ReplicatedProp );
if ( StructProperty == NULL )
{
// This property isn't custom delta
UE_LOG( LogNetTraffic, Error, TEXT( "Property isn't custom delta %s" ), *ReplicatedProp->GetName() );
return false;
}
UScriptStruct * InnerStruct = StructProperty->Struct;
if ( !( InnerStruct->StructFlags & STRUCT_NetDeltaSerializeNative ) )
{
// This property isn't custom delta
UE_LOG( LogNetTraffic, Error, TEXT( "Property isn't custom delta %s" ), *ReplicatedProp->GetName() );
return false;
}
UScriptStruct::ICppStructOps * CppStructOps = InnerStruct->GetCppStructOps();
check( CppStructOps );
check( !InnerStruct->InheritedCppStructOps() );
FNetDeltaSerializeInfo Parms;
FNetSerializeCB NetSerializeCB( OwningChannel->Connection->Driver );
Parms.DebugName = StructProperty->GetName();
Parms.Struct = InnerStruct;