本文整理汇总了C++中UClass::GetDefaultSubobjectByName方法的典型用法代码示例。如果您正苦于以下问题:C++ UClass::GetDefaultSubobjectByName方法的具体用法?C++ UClass::GetDefaultSubobjectByName怎么用?C++ UClass::GetDefaultSubobjectByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UClass
的用法示例。
在下文中一共展示了UClass::GetDefaultSubobjectByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
else
{
UObject* Archetype = NULL;
UObject* ComponentTemplate = NULL;
// Since we are changing the class we can't use the Archetype,
// however that is fine since we will have been editing the CDO anyways
if (!FBlueprintEditorUtils::IsAnonymousBlueprintClass(SubobjectOuter->GetClass()))
{
// if an archetype was specified in the Begin Object block, use that as the template for the ConstructObject call.
FString ArchetypeName;
if (FParse::Value(Str, TEXT("Archetype="), ArchetypeName))
{
// if given a name, break it up along the ' so separate the class from the name
FString ObjectClass;
FString ObjectPath;
if ( FPackageName::ParseExportTextPath(ArchetypeName, &ObjectClass, &ObjectPath) )
{
// find the class
UClass* ArchetypeClass = (UClass*)StaticFindObject(UClass::StaticClass(), ANY_PACKAGE, *ObjectClass);
if (ArchetypeClass)
{
// if we had the class, find the archetype
Archetype = StaticFindObject(ArchetypeClass, ANY_PACKAGE, *ObjectPath);
}
}
}
}
if (SubobjectOuter->HasAnyFlags(RF_ClassDefaultObject))
{
if (!Archetype) // if an archetype was specified explicitly, we will stick with that
{
Archetype = ComponentOwnerClass->GetDefaultSubobjectByName(TemplateName);
if(Archetype)
{
if ( BaseTemplate == NULL )
{
// BaseTemplate should only be NULL if the Begin Object line specified a class
Warn->Logf(ELogVerbosity::Error, TEXT("BEGIN OBJECT: The component name %s is already used (if you want to override the component, don't specify a class): %s"), *TemplateName.ToString(), *StrLine);
return NULL;
}
// the component currently in the component template map and the base template should be the same
checkf(Archetype==BaseTemplate,TEXT("OverrideComponent: '%s' BaseTemplate: '%s'"), *Archetype->GetFullName(), *BaseTemplate->GetFullName());
}
}
}
else // handle the non-template case (subobjects and non-template components)
{
// don't allow Actor-derived subobjects
if ( TemplateClass->IsChildOf(AActor::StaticClass()) )
{
Warn->Logf(ELogVerbosity::Error,TEXT("Cannot create subobjects from Actor-derived classes: %s"), *StrLine);
return NULL;
}
ComponentTemplate = FindObject<UObject>(SubobjectOuter, *TemplateName.ToString());
if (ComponentTemplate != NULL)
{
// if we're overriding a subobject declared in a parent class, we should already have an object with that name that
// was instanced when ComponentOwnerClass's CDO was initialized; if so, it's archetype should be the BaseTemplate. If it
// isn't, then there are two unrelated subobject definitions using the same name.
if ( ComponentTemplate->GetArchetype() != BaseTemplate )
{
}