本文整理汇总了C++中UScriptStruct::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ UScriptStruct::GetName方法的具体用法?C++ UScriptStruct::GetName怎么用?C++ UScriptStruct::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UScriptStruct
的用法示例。
在下文中一共展示了UScriptStruct::GetName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NetSerialize
bool FGameplayAbilityTargetDataHandle::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
uint8 DataNum;
if (Ar.IsSaving())
{
UE_CLOG(Data.Num() > MAX_uint8, LogAbilitySystem, Warning, TEXT("Too many TargetData sources (%d!) to net serialize. Clamping to %d"), Data.Num(), MAX_uint8);
DataNum = FMath::Min<int32>( Data.Num(), MAX_uint8 );
}
Ar << DataNum;
if (Ar.IsLoading())
{
Data.SetNumZeroed(DataNum);
}
for (int32 i = 0; i < DataNum && !Ar.IsError(); ++i)
{
UScriptStruct* ScriptStruct = Data[i].IsValid() ? Data[i]->GetScriptStruct() : NULL;
Ar << ScriptStruct;
if (ScriptStruct)
{
if (Ar.IsLoading())
{
// For now, just always reset/reallocate the data when loading.
// Longer term if we want to generalize this and use it for property replication, we should support
// only reallocating when necessary
check(!Data[i].IsValid());
FGameplayAbilityTargetData * NewData = (FGameplayAbilityTargetData*)FMemory::Malloc(ScriptStruct->GetCppStructOps()->GetSize());
ScriptStruct->InitializeStruct(NewData);
Data[i] = TSharedPtr<FGameplayAbilityTargetData>(NewData);
}
void* ContainerPtr = Data[i].Get();
if (ScriptStruct->StructFlags & STRUCT_NetSerializeNative)
{
ScriptStruct->GetCppStructOps()->NetSerialize(Ar, Map, bOutSuccess, Data[i].Get());
}
else
{
// This won't work since UStructProperty::NetSerializeItem is deprecrated.
// 1) we have to manually crawl through the topmost struct's fields since we don't have a UStructProperty for it (just the UScriptProperty)
// 2) if there are any UStructProperties in the topmost struct's fields, we will assert in UStructProperty::NetSerializeItem.
ABILITY_LOG(Fatal, TEXT("FGameplayAbilityTargetDataHandle::NetSerialize called on data struct %s without a native NetSerialize"), *ScriptStruct->GetName());
for (TFieldIterator<UProperty> It(ScriptStruct); It; ++It)
{
if (It->PropertyFlags & CPF_RepSkip)
{
continue;
}
void* PropertyData = It->ContainerPtrToValuePtr<void*>(ContainerPtr);
It->NetSerializeItem(Ar, Map, PropertyData);
}
}
}
}
//ABILITY_LOG(Warning, TEXT("FGameplayAbilityTargetDataHandle Serialized: %s"), ScriptStruct ? *ScriptStruct->GetName() : TEXT("NULL") );
bOutSuccess = true;
return true;
}
示例2: NetSerialize
bool FGameplayEffectContextHandle::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
bool ValidData = Data.IsValid();
Ar.SerializeBits(&ValidData,1);
if (ValidData)
{
if (Ar.IsLoading())
{
// For now, just always reset/reallocate the data when loading.
// Longer term if we want to generalize this and use it for property replication, we should support
// only reallocating when necessary
if (Data.IsValid() == false)
{
Data = TSharedPtr<FGameplayEffectContext>(UAbilitySystemGlobals::Get().AllocGameplayEffectContext());
}
}
void* ContainerPtr = Data.Get();
UScriptStruct* ScriptStruct = Data->GetScriptStruct();
if (ScriptStruct->StructFlags & STRUCT_NetSerializeNative)
{
ScriptStruct->GetCppStructOps()->NetSerialize(Ar, Map, bOutSuccess, Data.Get());
}
else
{
// This won't work since UStructProperty::NetSerializeItem is deprecrated.
// 1) we have to manually crawl through the topmost struct's fields since we don't have a UStructProperty for it (just the UScriptProperty)
// 2) if there are any UStructProperties in the topmost struct's fields, we will assert in UStructProperty::NetSerializeItem.
ABILITY_LOG(Fatal, TEXT("FGameplayEffectContextHandle::NetSerialize called on data struct %s without a native NetSerialize"), *ScriptStruct->GetName());
}
}
bOutSuccess = true;
return true;
}
示例3: ProcessCommon
void FKismetBytecodeDisassembler::ProcessCommon(int32& ScriptIndex, EExprToken Opcode)
{
switch (Opcode)
{
case EX_PrimitiveCast:
{
// A type conversion.
uint8 ConversionType = ReadBYTE(ScriptIndex);
Ar.Logf(TEXT("%s $%X: PrimitiveCast of type %d"), *Indents, (int32)Opcode, ConversionType);
AddIndent();
Ar.Logf(TEXT("%s Argument:"), *Indents);
ProcessCastByte(ConversionType, ScriptIndex);
//@TODO:
//Ar.Logf(TEXT("%s Expression:"), *Indents);
//SerializeExpr( ScriptIndex );
break;
}
case EX_ObjToInterfaceCast:
{
// A conversion from an object variable to a native interface variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: ObjToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_CrossInterfaceCast:
{
// A conversion from one interface variable to a different interface variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: InterfaceToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_InterfaceToObjCast:
{
// A conversion from an interface variable to a object variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* ObjectClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: InterfaceToObjCast to %s"), *Indents, (int32)Opcode, *ObjectClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_Let:
{
Ar.Logf(TEXT("%s $%X: Let (Variable = Expression)"), *Indents, (int32)Opcode);
AddIndent();
// Variable expr.
Ar.Logf(TEXT("%s Variable:"), *Indents);
SerializeExpr( ScriptIndex );
// Assignment expr.
Ar.Logf(TEXT("%s Expression:"), *Indents);
SerializeExpr( ScriptIndex );
DropIndent();
break;
}
case EX_LetObj:
case EX_LetWeakObjPtr:
{
if( Opcode == EX_LetObj )
{
Ar.Logf(TEXT("%s $%X: Let Obj (Variable = Expression)"), *Indents, (int32)Opcode);
}
else
{
Ar.Logf(TEXT("%s $%X: Let WeakObjPtr (Variable = Expression)"), *Indents, (int32)Opcode);
}
AddIndent();
// Variable expr.
Ar.Logf(TEXT("%s Variable:"), *Indents);
SerializeExpr( ScriptIndex );
// Assignment expr.
Ar.Logf(TEXT("%s Expression:"), *Indents);
SerializeExpr( ScriptIndex );
DropIndent();
break;
}
case EX_LetBool:
{
Ar.Logf(TEXT("%s $%X: LetBool (Variable = Expression)"), *Indents, (int32)Opcode);
AddIndent();
//.........这里部分代码省略.........
示例4: CreatePropertyOnScope
/** Creates a property named PropertyName of type PropertyType in the Scope or returns NULL if the type is unknown, but does *not* link that property in */
UProperty* FKismetCompilerUtilities::CreatePropertyOnScope(UStruct* Scope, const FName& PropertyName, const FEdGraphPinType& Type, UClass* SelfClass, uint64 PropertyFlags, const UEdGraphSchema_K2* Schema, FCompilerResultsLog& MessageLog)
{
//@TODO: Check for name conflicts!
// Properties are non-transactional as they're regenerated on every compile
const EObjectFlags ObjectFlags = RF_Public;
UProperty* NewProperty = NULL;
UObject* PropertyScope = NULL;
FName ValidatedPropertyName = PropertyName;
// Check to see if there's already a property on this scope, and throw an internal compiler error if so
// If this happens, it breaks the property link, which causes stack corruption and hard-to-track errors, so better to fail at this point
{
UProperty* ExistingProperty = FindObject<UProperty>(Scope, *PropertyName.ToString(), false);
if( ExistingProperty )
{
MessageLog.Error(*FString::Printf(TEXT("Internal Compiler Error: Duplicate property %s on scope %s"), *PropertyName.ToString(), (Scope ? *Scope->GetName() : TEXT("None"))));
// Find a free name, so we can still create the property to make it easier to spot the duplicates, and avoid crashing
uint32 Counter = 0;
FString TestNameString;
do
{
TestNameString = PropertyName.ToString() + FString::Printf(TEXT("_ERROR_DUPLICATE_%d"), Counter++);
} while (FindObject<UProperty>(Scope, *TestNameString, false) != NULL);
ValidatedPropertyName = FName(*TestNameString);
}
}
// Handle creating an array property, if necessary
const bool bIsArrayProperty = Type.bIsArray;
UArrayProperty* NewArrayProperty = NULL;
if( bIsArrayProperty )
{
NewArrayProperty = NewNamedObject<UArrayProperty>(Scope, ValidatedPropertyName, ObjectFlags);
PropertyScope = NewArrayProperty;
}
else
{
PropertyScope = Scope;
}
//@TODO: Nasty string if-else tree
if (Type.PinCategory == Schema->PC_Object)
{
UClass* SubType = (Type.PinSubCategory == Schema->PSC_Self) ? SelfClass : Cast<UClass>(Type.PinSubCategoryObject.Get());
if( SubType == NULL )
{
// If this is from a degenerate pin, because the object type has been removed, default this to a UObject subtype so we can make a dummy term for it to allow the compiler to continue
SubType = UObject::StaticClass();
}
if (SubType != NULL)
{
if (SubType->HasAnyClassFlags(CLASS_Interface))
{
UInterfaceProperty* NewPropertyObj = NewNamedObject<UInterfaceProperty>(PropertyScope, ValidatedPropertyName, ObjectFlags);
NewPropertyObj->InterfaceClass = SubType;
NewProperty = NewPropertyObj;
}
else
{
UObjectPropertyBase* NewPropertyObj = NULL;
if( Type.bIsWeakPointer )
{
NewPropertyObj = NewNamedObject<UWeakObjectProperty>(PropertyScope, ValidatedPropertyName, ObjectFlags);
}
else
{
NewPropertyObj = NewNamedObject<UObjectProperty>(PropertyScope, ValidatedPropertyName, ObjectFlags);
}
NewPropertyObj->PropertyClass = SubType;
NewProperty = NewPropertyObj;
}
}
}
else if (Type.PinCategory == Schema->PC_Struct)
{
UScriptStruct* SubType = Cast<UScriptStruct>(Type.PinSubCategoryObject.Get());
if (SubType != NULL)
{
FString StructureError;
if (FStructureEditorUtils::EStructureError::Ok == FStructureEditorUtils::IsStructureValid(SubType, NULL, &StructureError))
{
UStructProperty* NewPropertyStruct = NewNamedObject<UStructProperty>(PropertyScope, ValidatedPropertyName, ObjectFlags);
NewPropertyStruct->Struct = SubType;
NewProperty = NewPropertyStruct;
}
else
{
MessageLog.Error(
*FString::Printf(
*LOCTEXT("InvalidStructForField_Error", "Invalid property '%s' structure '%s' error: %s").ToString(),
*PropertyName.ToString(),
//.........这里部分代码省略.........
示例5: NetSerialize
bool FGameplayEffectContextHandle::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
UScriptStruct* ScriptStruct = Data.IsValid() ? Data->GetScriptStruct() : NULL;
Ar << ScriptStruct;
if (ScriptStruct)
{
if (Ar.IsLoading())
{
// For now, just always reset/reallocate the data when loading.
// Longer term if we want to generalize this and use it for property replication, we should support
// only reallocating when necessary
check(!Data.IsValid());
FGameplayEffectContext * NewData = (FGameplayEffectContext*)FMemory::Malloc(ScriptStruct->GetCppStructOps()->GetSize());
ScriptStruct->InitializeStruct(NewData);
Data = TSharedPtr<FGameplayEffectContext>(NewData);
}
void* ContainerPtr = Data.Get();
if (ScriptStruct->StructFlags & STRUCT_NetSerializeNative)
{
ScriptStruct->GetCppStructOps()->NetSerialize(Ar, Map, bOutSuccess, Data.Get());
}
else
{
// This won't work since UStructProperty::NetSerializeItem is deprecrated.
// 1) we have to manually crawl through the topmost struct's fields since we don't have a UStructProperty for it (just the UScriptProperty)
// 2) if there are any UStructProperties in the topmost struct's fields, we will assert in UStructProperty::NetSerializeItem.
ABILITY_LOG(Fatal, TEXT("FGameplayEffectContextHandle::NetSerialize called on data struct %s without a native NetSerialize"), *ScriptStruct->GetName());
for (TFieldIterator<UProperty> It(ScriptStruct); It; ++It)
{
if (It->PropertyFlags & CPF_RepSkip)
{
continue;
}
void * PropertyData = It->ContainerPtrToValuePtr<void*>(ContainerPtr);
It->NetSerializeItem(Ar, Map, PropertyData);
}
}
}
bOutSuccess = true;
return true;
}
示例6: ProcessCommon
void FKismetBytecodeDisassembler::ProcessCommon(int32& ScriptIndex, EExprToken Opcode)
{
switch (Opcode)
{
case EX_PrimitiveCast:
{
// A type conversion.
uint8 ConversionType = ReadBYTE(ScriptIndex);
Ar.Logf(TEXT("%s $%X: PrimitiveCast of type %d"), *Indents, (int32)Opcode, ConversionType);
AddIndent();
Ar.Logf(TEXT("%s Argument:"), *Indents);
ProcessCastByte(ConversionType, ScriptIndex);
//@TODO:
//Ar.Logf(TEXT("%s Expression:"), *Indents);
//SerializeExpr( ScriptIndex );
break;
}
case EX_ObjToInterfaceCast:
{
// A conversion from an object variable to a native interface variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: ObjToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_CrossInterfaceCast:
{
// A conversion from one interface variable to a different interface variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* InterfaceClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: InterfaceToInterfaceCast to %s"), *Indents, (int32)Opcode, *InterfaceClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_InterfaceToObjCast:
{
// A conversion from an interface variable to a object variable.
// We use a different bytecode to avoid the branching each time we process a cast token
// the interface class to convert to
UClass* ObjectClass = ReadPointer<UClass>(ScriptIndex);
Ar.Logf(TEXT("%s $%X: InterfaceToObjCast to %s"), *Indents, (int32)Opcode, *ObjectClass->GetName());
SerializeExpr( ScriptIndex );
break;
}
case EX_Let:
{
Ar.Logf(TEXT("%s $%X: Let (Variable = Expression)"), *Indents, (int32)Opcode);
AddIndent();
ReadPointer<UProperty>(ScriptIndex);
// Variable expr.
Ar.Logf(TEXT("%s Variable:"), *Indents);
SerializeExpr( ScriptIndex );
// Assignment expr.
Ar.Logf(TEXT("%s Expression:"), *Indents);
SerializeExpr( ScriptIndex );
DropIndent();
break;
}
case EX_LetObj:
case EX_LetWeakObjPtr:
{
if( Opcode == EX_LetObj )
{
Ar.Logf(TEXT("%s $%X: Let Obj (Variable = Expression)"), *Indents, (int32)Opcode);
}
else
{
Ar.Logf(TEXT("%s $%X: Let WeakObjPtr (Variable = Expression)"), *Indents, (int32)Opcode);
}
AddIndent();
// Variable expr.
Ar.Logf(TEXT("%s Variable:"), *Indents);
SerializeExpr( ScriptIndex );
// Assignment expr.
Ar.Logf(TEXT("%s Expression:"), *Indents);
SerializeExpr( ScriptIndex );
DropIndent();
break;
}
case EX_LetBool:
{
Ar.Logf(TEXT("%s $%X: LetBool (Variable = Expression)"), *Indents, (int32)Opcode);
//.........这里部分代码省略.........