本文整理汇总了C++中UObject::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::GetName方法的具体用法?C++ UObject::GetName怎么用?C++ UObject::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExportTextItem
void UObjectPropertyBase::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
UObject* Temp = GetObjectPropertyValue(PropertyValue);
if( Temp != NULL )
{
if (PortFlags & PPF_DebugDump)
{
ValueStr += Temp->GetFullName();
}
else if (Parent && !Parent->HasAnyFlags(RF_ClassDefaultObject) && Temp->IsDefaultSubobject())
{
if ((PortFlags & PPF_Delimited) && (!Temp->GetFName().IsValidXName(INVALID_OBJECTNAME_CHARACTERS)))
{
ValueStr += FString::Printf(TEXT("\"%s\""), *Temp->GetName().ReplaceQuotesWithEscapedQuotes());
}
else
{
ValueStr += Temp->GetName();
}
}
else
{
ValueStr += GetExportPath(Temp, Parent, ExportRootScope, PortFlags);
}
}
else
{
ValueStr += TEXT("None");
}
}
示例2: GetObjectName
FText SGraphPinObject::GetObjectName() const
{
FText Value = FText::GetEmpty();
if (GraphPinObj != NULL)
{
UObject* DefaultObject = GraphPinObj->DefaultObject;
if (DefaultObject != NULL)
{
Value = FText::FromString(DefaultObject->GetName());
int32 StringLen = Value.ToString().Len();
//If string is too long, then truncate (eg. "abcdefgijklmnopq" is converted as "abcd...nopq")
const int32 MaxAllowedLength = 16;
if (StringLen > MaxAllowedLength)
{
//Take first 4 characters
FString TruncatedStr(Value.ToString().Left(4));
TruncatedStr += FString( TEXT("..."));
//Take last 4 characters
TruncatedStr += Value.ToString().Right(4);
Value = FText::FromString(TruncatedStr);
}
}
}
return Value;
}
示例3: FindObject
UObject* UObject::FindObject ( wchar_t* ObjectName )
{
for ( int i = 0; i < UObject::GObjObjects()->Count; ++i )
{
UObject *pObject = GObjObjects()->Data[ i ];
if ( pObject == NULL )
continue;
if( pObject->GetName().compare( ObjectName ) == 0 )
return pObject;
wstring FullName = pObject->GetFullName();
if( FullName.length() )
{
if ( FullName.compare( ObjectName ) == 0 )
{
return pObject;
}
}
}
return NULL;
}
示例4: ExportTextItem
void UObjectPropertyBase::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
UObject* Temp = GetObjectPropertyValue(PropertyValue);
if (0 != (PortFlags & PPF_ExportCpp))
{
FString::Printf(TEXT("%s%s*"), PropertyClass->GetPrefixCPP(), *PropertyClass->GetName());
ValueStr += Temp
? FString::Printf(TEXT("LoadObject<%s%s>(nullptr, TEXT(\"%s\"))")
, PropertyClass->GetPrefixCPP()
, *PropertyClass->GetName()
, *(Temp->GetPathName().ReplaceCharWithEscapedChar()))
: TEXT("nullptr");
return;
}
if( Temp != NULL )
{
if (PortFlags & PPF_DebugDump)
{
ValueStr += Temp->GetFullName();
}
else if (Parent && !Parent->HasAnyFlags(RF_ClassDefaultObject) && Temp->IsDefaultSubobject())
{
if ((PortFlags & PPF_Delimited) && (!Temp->GetFName().IsValidXName(INVALID_OBJECTNAME_CHARACTERS)))
{
ValueStr += FString::Printf(TEXT("\"%s\""), *Temp->GetName().ReplaceQuotesWithEscapedQuotes());
}
else
{
ValueStr += Temp->GetName();
}
}
else
{
ValueStr += GetExportPath(Temp, Parent, ExportRootScope, PortFlags);
}
}
else
{
ValueStr += TEXT("None");
}
}
示例5: OnGetComboTextValue
FText SGraphPinObject::OnGetComboTextValue() const
{
FText Value = GetDefaultComboText();
if (GraphPinObj != NULL)
{
UObject* DefaultObject = GraphPinObj->DefaultObject;
if (DefaultObject != NULL)
{
Value = FText::FromString(DefaultObject->GetName());
}
}
return Value;
}
示例6: SaveDuplicatedAsset
/**
* Saves the duplicated asset
*/
void SaveDuplicatedAsset()
{
if (DuplicatedPackage && DuplicatedAsset)
{
DuplicatedPackage->SetDirtyFlag(true);
const FString PackagePath = FString::Printf(TEXT("%s/%s_Copy"), *GetGamePath(), *AssetName);
if (UPackage::SavePackage(DuplicatedPackage, NULL, RF_Standalone, *FPackageName::LongPackageNameToFilename(PackagePath, FPackageName::GetAssetPackageExtension()), GError, nullptr, false, true, SAVE_NoError))
{
TestStats->NumDuplicatesSaved++;
UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Saved asset %s (%s)"), *DuplicatedAsset->GetName(), *Class->GetName());
}
else
{
UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Unable to save asset %s (%s)"), *DuplicatedAsset->GetName(), *Class->GetName());
}
}
}
示例7: GetObjectDisplayName
FString SObjectNameEditableTextBox::GetObjectDisplayName(TWeakObjectPtr<UObject> Object)
{
FString Result;
if(Object.IsValid())
{
UObject* ObjectPtr = Object.Get();
if (ObjectPtr->IsA(AActor::StaticClass()))
{
Result = ((AActor*)ObjectPtr)->GetActorLabel();
}
else
{
Result = ObjectPtr->GetName();
}
}
return Result;
}
示例8: CreateComponentFromTemplate
UActorComponent* AActor::CreateComponentFromTemplate(UActorComponent* Template, const FString& InName)
{
UActorComponent* NewActorComp = NULL;
if(Template != NULL)
{
// If there is a Component with this name already (almost certainly because it is an Instance component), we need to rename it out of the way
if (!InName.IsEmpty())
{
UObject* ConflictingObject = FindObjectFast<UObject>(this, *InName);
if (ConflictingObject && ConflictingObject->IsA<UActorComponent>() && CastChecked<UActorComponent>(ConflictingObject)->CreationMethod == EComponentCreationMethod::Instance)
{
// Try and pick a good name
FString ConflictingObjectName = ConflictingObject->GetName();
int32 CharIndex = ConflictingObjectName.Len()-1;
while (FChar::IsDigit(ConflictingObjectName[CharIndex]))
{
--CharIndex;
}
int32 Counter = 0;
if (CharIndex < ConflictingObjectName.Len()-1)
{
Counter = FCString::Atoi(*ConflictingObjectName.RightChop(CharIndex+1));
ConflictingObjectName = ConflictingObjectName.Left(CharIndex+1);
}
FString NewObjectName;
do
{
NewObjectName = ConflictingObjectName + FString::FromInt(++Counter);
} while (FindObjectFast<UObject>(this, *NewObjectName) != nullptr);
ConflictingObject->Rename(*NewObjectName, this);
}
}
// Note we aren't copying the the RF_ArchetypeObject flag. Also note the result is non-transactional by default.
NewActorComp = (UActorComponent*)StaticDuplicateObject(Template, this, *InName, RF_AllFlags & ~(RF_ArchetypeObject|RF_Transactional|RF_WasLoaded|RF_Public|RF_InheritableComponentTemplate) );
NewActorComp->CreationMethod = EComponentCreationMethod::UserConstructionScript;
// Need to do this so component gets saved - Components array is not serialized
BlueprintCreatedComponents.Add(NewActorComp);
}
return NewActorComp;
}
示例9: OnGetComboTextValue
FText SGraphPinObject::OnGetComboTextValue() const
{
FText Value = GetDefaultComboText();
if (GraphPinObj != NULL)
{
UObject* DefaultObject = GraphPinObj->DefaultObject;
if (UField* Field = Cast<UField>(DefaultObject))
{
Value = Field->GetDisplayNameText();
}
else if (DefaultObject != NULL)
{
Value = FText::FromString(DefaultObject->GetName());
}
}
return Value;
}
示例10: GetInterpPropertyNames
void GetInterpPropertyNames(UObject* InObject, const FString& Prefix)
{
UClass* ObjectClass = InObject->GetClass();
// First search for any properties in this object
for (TFieldIterator<UProperty> ClassFieldIt(ObjectClass); ClassFieldIt; ++ClassFieldIt)
{
UProperty* ClassMemberProperty = *ClassFieldIt;
if (ClassMemberProperty->HasAnyPropertyFlags(CPF_Interp))
{
// Is this property the desired type?
if (IsDesiredProperty(ClassMemberProperty))
{
const FString QualifiedFullPath = FString::Printf(TEXT("%s%s"), *Prefix, *ClassMemberProperty->GetName());
GatheredPropertyPaths.Add(*QualifiedFullPath);
}
// If this is a struct, look for any desired properties inside of it
if (UStructProperty* OuterStructProperty = Cast<UStructProperty>(ClassMemberProperty))
{
for (TFieldIterator<UProperty> StructFieldIt(OuterStructProperty->Struct); StructFieldIt; ++StructFieldIt)
{
UProperty* StructMemberProperty = *StructFieldIt;
if (StructMemberProperty->HasAnyPropertyFlags(CPF_Interp) && IsDesiredProperty(StructMemberProperty))
{
const FString QualifiedFullPath = FString::Printf(TEXT("%s%s.%s"), *Prefix, *OuterStructProperty->GetName(), *StructMemberProperty->GetName());
GatheredPropertyPaths.Add(*QualifiedFullPath);
}
}
}
}
}
// Then iterate over each subobject of this object looking for interp properties.
TArray<UObject*> DefaultSubObjects;
ObjectClass->GetDefaultObjectSubobjects(DefaultSubObjects);
for (int32 SubObjectIndex = 0; SubObjectIndex < DefaultSubObjects.Num(); ++SubObjectIndex)
{
UObject* Component = DefaultSubObjects[SubObjectIndex];
const FString ComponentPrefix = Component->GetName() + TEXT(".");
GetInterpPropertyNames(Component, ComponentPrefix);
}
}
示例11: DescribeSelfToVisLog
void UCrowdFollowingComponent::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const
{
if (!bEnableCrowdSimulation)
{
Super::DescribeSelfToVisLog(Snapshot);
return;
}
FVisualLogStatusCategory Category;
Category.Category = TEXT("Path following");
if (DestinationActor.IsValid())
{
Category.Add(TEXT("Goal"), GetNameSafe(DestinationActor.Get()));
}
FString StatusDesc = GetStatusDesc();
FNavMeshPath* NavMeshPath = Path.IsValid() ? Path->CastPath<FNavMeshPath>() : NULL;
FAbstractNavigationPath* DirectPath = Path.IsValid() ? Path->CastPath<FAbstractNavigationPath>() : NULL;
if (Status == EPathFollowingStatus::Moving)
{
StatusDesc += FString::Printf(TEXT(" [path:%d, visited:%d]"), PathStartIndex, LastPathPolyIndex);
}
Category.Add(TEXT("Status"), StatusDesc);
Category.Add(TEXT("Path"), !Path.IsValid() ? TEXT("none") : NavMeshPath ? TEXT("navmesh") : DirectPath ? TEXT("direct") : TEXT("unknown"));
UObject* CustomLinkOb = GetCurrentCustomLinkOb();
if (CustomLinkOb)
{
Category.Add(TEXT("SmartLink"), CustomLinkOb->GetName());
}
UCrowdManager* Manager = UCrowdManager::GetCurrent(GetWorld());
if (Manager && !Manager->IsAgentValid(this))
{
Category.Add(TEXT("Simulation"), TEXT("unable to register!"));
}
Snapshot->Status.Add(Category);
}
示例12: GetCommandletName
/**
* Builds a human readable name from the commandlets name
*
* @param Commandlet the commandlet to mangle the name of
*/
static FString GetCommandletName(UCommandlet* Commandlet)
{
// Don't print out the default portion of the name
static INT SkipLen = appStrlen(TEXT("Default__"));
FString Name(*Commandlet->GetName() + SkipLen);
// Strip off everything past the friendly name
INT Index = Name.InStr(TEXT("Commandlet"));
if (Index != -1)
{
Name = Name.Left(Index);
}
// Get the code package this commandlet is contained in
UObject* Outer = Commandlet->GetOutermost();
// Build Package.Commandlet as the name
FString FullName = Outer->GetName();
FullName += TEXT(".");
FullName += Name;
return FullName;
}
示例13: GetDisplayValueAsString
FString SPropertyEditorCombo::GetDisplayValueAsString() const
{
const UProperty* Property = PropertyEditor->GetProperty();
const UByteProperty* ByteProperty = Cast<const UByteProperty>( Property );
const bool bStringEnumProperty = Property && Property->IsA(UStrProperty::StaticClass()) && Property->HasMetaData(TEXT("Enum"));
if ( !(ByteProperty || bStringEnumProperty) )
{
UObject* ObjectValue = NULL;
FPropertyAccess::Result Result = PropertyEditor->GetPropertyHandle()->GetValue( ObjectValue );
if( Result == FPropertyAccess::Success && ObjectValue != NULL )
{
return ObjectValue->GetName();
}
}
return (bUsesAlternateDisplayValues) ? PropertyEditor->GetValueAsDisplayString() : PropertyEditor->GetValueAsString();
}
示例14: GetNotifyName_Implementation
FString UAnimNotify::GetNotifyName_Implementation() const
{
UObject* ClassGeneratedBy = GetClass()->ClassGeneratedBy;
FString NotifyName;
if(ClassGeneratedBy)
{
// GeneratedBy will be valid for blueprint types and gives a clean name without a suffix
NotifyName = ClassGeneratedBy->GetName();
}
else
{
// Native notify classes are clean without a suffix otherwise
NotifyName = GetClass()->GetName();
}
NotifyName = NotifyName.Replace(TEXT("AnimNotify_"), TEXT(""), ESearchCase::CaseSensitive);
return NotifyName;
}
示例15: GenerateZConstructor
// Keep sync with FTypeSingletonCache::GenerateSingletonName
static FString GenerateZConstructor(UField* Item)
{
FString Result;
if (!ensure(Item))
{
return Result;
}
for (UObject* Outer = Item; Outer; Outer = Outer->GetOuter())
{
if (!Result.IsEmpty())
{
Result = TEXT("_") + Result;
}
if (Cast<UClass>(Outer) || Cast<UScriptStruct>(Outer))
{
FString OuterName = FEmitHelper::GetCppName(CastChecked<UField>(Outer), true);
Result = OuterName + Result;
// Structs can also have UPackage outer.
if (Cast<UClass>(Outer) || Cast<UPackage>(Outer->GetOuter()))
{
break;
}
}
else
{
Result = Outer->GetName() + Result;
}
}
// Can't use long package names in function names.
if (Result.StartsWith(TEXT("/Script/"), ESearchCase::CaseSensitive))
{
Result = FPackageName::GetShortName(Result);
}
const FString ClassString = Item->IsA<UClass>() ? TEXT("UClass") : TEXT("UScriptStruct");
return FString(TEXT("Z_Construct_")) + ClassString + TEXT("_") + Result + TEXT("()");
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:42,代码来源:BlueprintCompilerCppBackendValueHelper.cpp