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


C++ UObject::GetClass方法代码示例

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


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

示例1: GetActions

void FAssetTypeActions_GameplayTagAssetBase::GetActions(const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder)
{
	TArray<UObject*> ContainerObjectOwners;
	TArray<FGameplayTagContainer*> Containers;
	for (int32 ObjIdx = 0; ObjIdx < InObjects.Num(); ++ObjIdx)
	{
		UObject* CurObj = InObjects[ObjIdx];
		if (CurObj)
		{
			UStructProperty* StructProp = FindField<UStructProperty>(CurObj->GetClass(), OwnedGameplayTagPropertyName);
			if(StructProp != NULL)
			{
				ContainerObjectOwners.Add(CurObj);
				Containers.Add(StructProp->ContainerPtrToValuePtr<FGameplayTagContainer>(CurObj));
			}
		}
	}

	ensure(Containers.Num() == ContainerObjectOwners.Num());
	if (Containers.Num() > 0 && (Containers.Num() == ContainerObjectOwners.Num()))
	{
		MenuBuilder.AddMenuEntry(
			LOCTEXT("GameplayTags_Edit", "Edit Gameplay Tags..."),
			LOCTEXT("GameplayTags_EditToolTip", "Opens the Gameplay Tag Editor."),
			FSlateIcon(),
			FUIAction(FExecuteAction::CreateSP(this, &FAssetTypeActions_GameplayTagAssetBase::OpenGameplayTagEditor, ContainerObjectOwners, Containers), FCanExecuteAction()));
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:28,代码来源:AssetTypeActions_GameplayTagAssetBase.cpp

示例2: GetToolkitName

FText FSimpleAssetEditor::GetToolkitName() const
{
	const TArray<UObject*>& EditingObjs = GetEditingObjects();

	check( EditingObjs.Num() > 0 );

	FFormatNamedArguments Args;
	Args.Add( TEXT("ToolkitName"), GetBaseToolkitName() );

	if( EditingObjs.Num() == 1 )
	{
		const UObject* EditingObject = EditingObjs[ 0 ];

		const bool bDirtyState = EditingObject->GetOutermost()->IsDirty();

		Args.Add( TEXT("ObjectName"), FText::FromString( EditingObject->GetName() ) );
		Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
		return FText::Format( LOCTEXT("ToolkitTitle", "{ObjectName}{DirtyState} - {ToolkitName}"), Args );
	}
	else
	{
		bool bDirtyState = false;
		UClass* SharedBaseClass = nullptr;
		for( int32 x = 0; x < EditingObjs.Num(); ++x )
		{
			UObject* Obj = EditingObjs[ x ];
			check( Obj );

			UClass* ObjClass = Cast<UClass>(Obj);
			if (ObjClass == nullptr)
			{
				ObjClass = Obj->GetClass();
			}
			check( ObjClass );

			// Initialize with the class of the first object we encounter.
			if( SharedBaseClass == nullptr )
			{
				SharedBaseClass = ObjClass;
			}

			// If we've encountered an object that's not a subclass of the current best baseclass,
			// climb up a step in the class hierarchy.
			while( !ObjClass->IsChildOf( SharedBaseClass ) )
			{
				SharedBaseClass = SharedBaseClass->GetSuperClass();
			}

			// If any of the objects are dirty, flag the label
			bDirtyState |= Obj->GetOutermost()->IsDirty();
		}

		check(SharedBaseClass);

		Args.Add( TEXT("NumberOfObjects"), EditingObjs.Num() );
		Args.Add( TEXT("ClassName"), FText::FromString( SharedBaseClass->GetName() ) );
		Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
		return FText::Format( LOCTEXT("ToolkitTitle_EditingMultiple", "{NumberOfObjects} {ClassName}{DirtyState} - {ToolkitName}"), Args );
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:60,代码来源:SimpleAssetEditor.cpp

示例3: GetEnumForByteTrack

UEnum* GetEnumForByteTrack(TSharedPtr<ISequencer> Sequencer, const FGuid& OwnerObjectHandle, FName PropertyName, UMovieSceneByteTrack* ByteTrack)
{
	
	UObject* RuntimeObject = Sequencer->GetFocusedMovieSceneSequence()->FindObject(OwnerObjectHandle);

	TSet<UEnum*> PropertyEnums;
	if (RuntimeObject != nullptr)
	{
		UProperty* Property = RuntimeObject->GetClass()->FindPropertyByName(PropertyName);
		if (Property != nullptr)
		{
			UByteProperty* ByteProperty = Cast<UByteProperty>(Property);
			if (ByteProperty != nullptr && ByteProperty->Enum != nullptr)
			{
				PropertyEnums.Add(ByteProperty->Enum);
			}
		}
	}

	UEnum* TrackEnum;
	if (PropertyEnums.Num() == 1)
	{
		TrackEnum = PropertyEnums.Array()[0];
	}
	else
	{
		TrackEnum = nullptr;
	}
	return TrackEnum;
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:30,代码来源:BytePropertyTrackEditor.cpp

示例4: VerifyReplacement

void FBlueprintCompileReinstancer::VerifyReplacement()
{
	TArray<UObject*> SourceObjects;

	// Find all instances of the old class
	for( TObjectIterator<UObject> it; it; ++it )
	{
		UObject* CurrentObj = *it;

		if( (CurrentObj->GetClass() == DuplicatedClass) )
		{
			SourceObjects.Add(CurrentObj);
		}
	}

	// For each instance, track down references
	if( SourceObjects.Num() > 0 )
	{
		TFindObjectReferencers<UObject> Referencers(SourceObjects, NULL, false);
		for (TFindObjectReferencers<UObject>::TIterator It(Referencers); It; ++It)
		{
			UObject* CurrentObject = It.Key();
			UObject* ReferencedObj = It.Value();
			FPlatformMisc::LowLevelOutputDebugStringf(TEXT("- Object %s is referencing %s ---"), *CurrentObject->GetName(), *ReferencedObj->GetName());
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:27,代码来源:KismetReinstanceUtilities.cpp

示例5: GetClass

UClass* FClassData::GetClass()
{
	UClass* RetClass = Class.Get();
	if (RetClass == NULL && GeneratedClassPackage.Len())
	{
		GWarn->BeginSlowTask(LOCTEXT("LoadPackage", "Loading Package..."), true);

		UPackage* Package = LoadPackage(NULL, *GeneratedClassPackage, LOAD_NoRedirects);
		if (Package)
		{
			Package->FullyLoad();

			UObject* Object = FindObject<UObject>(Package, *AssetName);

			GWarn->EndSlowTask();

			UBlueprint* BlueprintOb = Cast<UBlueprint>(Object);
			RetClass = BlueprintOb ? *BlueprintOb->GeneratedClass : Object->GetClass();
			Class = RetClass;
		}
		else
		{
			GWarn->EndSlowTask();

			FMessageLog EditorErrors("EditorErrors");
			EditorErrors.Error(LOCTEXT("PackageLoadFail", "Package Load Failed"));
			EditorErrors.Info(FText::FromString(GeneratedClassPackage));
			EditorErrors.Notify(LOCTEXT("PackageLoadFail", "Package Load Failed"));
		}
	}

	return RetClass;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:33,代码来源:BehaviorTreeEditorTypes.cpp

示例6: SetBestBaseClass

// Looks at the Objects array and returns the best base class.  Called by
// Finalize(); that is, when the list of selected objects is being finalized.
void FObjectPropertyNode::SetBestBaseClass()
{
	BaseClass = NULL;

	for( int32 x = 0 ; x < Objects.Num() ; ++x )
	{
		UObject* Obj = Objects[x].Get();
		
		if( Obj )
		{
			UClass* ObjClass = Cast<UClass>(Obj);
			if (ObjClass == NULL)
			{
				ObjClass = Obj->GetClass();
			}
			check( ObjClass );

			// Initialize with the class of the first object we encounter.
			if( BaseClass == NULL )
			{
				BaseClass = ObjClass;
			}

			// If we've encountered an object that's not a subclass of the current best baseclass,
			// climb up a step in the class hierarchy.
			while( !ObjClass->IsChildOf( BaseClass.Get() ) )
			{
				BaseClass = BaseClass->GetSuperClass();
			}
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:34,代码来源:ObjectPropertyNode.cpp

示例7: GetPathName

/**
 * Internal version of GetPathName() that eliminates unnecessary copies.
 */
void UObjectBaseUtility::GetPathName( const UObject* StopOuter, FString& ResultString ) const
{
	if( this != StopOuter && this != NULL )
	{
		UObject* ObjOuter = GetOuter();
		if (ObjOuter && ObjOuter != StopOuter )
		{
			ObjOuter->GetPathName( StopOuter, ResultString );

			// SUBOBJECT_DELIMITER is used to indicate that this object's outer is not a UPackage
			if (ObjOuter->GetClass() != UPackage::StaticClass()
			&& ObjOuter->GetOuter()->GetClass() == UPackage::StaticClass())
			{
				ResultString += SUBOBJECT_DELIMITER;
			}
			else
			{
				ResultString += TEXT(".");
			}
		}
		AppendName(ResultString);
	}
	else
	{
		ResultString += TEXT("None");
	}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:30,代码来源:UObjectBaseUtility.cpp

示例8: NewData

TSharedPtr<FGraphNodeClassNode> FGraphNodeClassHelper::CreateClassDataNode(const class FAssetData& AssetData)
{
	TSharedPtr<FGraphNodeClassNode> Node;
	const FString* GeneratedClassname = AssetData.TagsAndValues.Find("GeneratedClass");
	const FString* ParentClassname = AssetData.TagsAndValues.Find("ParentClass");

	if (GeneratedClassname && ParentClassname)
	{
		FString AssetClassName = *GeneratedClassname;
		UObject* Outer1(NULL);
		ResolveName(Outer1, AssetClassName, false, false);

		FString AssetParentClassName = *ParentClassname;
		UObject* Outer2(NULL);
		ResolveName(Outer2, AssetParentClassName, false, false);

		Node = MakeShareable(new FGraphNodeClassNode);
		Node->ParentClassName = AssetParentClassName;

		UObject* AssetOb = AssetData.IsAssetLoaded() ? AssetData.GetAsset() : NULL;
		UBlueprint* AssetBP = Cast<UBlueprint>(AssetOb);
		UClass* AssetClass = AssetBP ? *AssetBP->GeneratedClass : AssetOb ? AssetOb->GetClass() : NULL;

		FGraphNodeClassData NewData(AssetData.AssetName.ToString(), AssetData.PackageName.ToString(), AssetClassName, AssetClass);
		Node->Data = NewData;
	}

	return Node;
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:29,代码来源:AIGraphTypes.cpp

示例9: FindClass

	// Finds the class for the given stack state.
	UStruct* FindClass( const FReadState& State )
	{
		UStruct* Class = nullptr;

		if (State.Property != nullptr)
		{
			UProperty* ParentProperty = State.Property;
			UArrayProperty* ArrayProperty = Cast<UArrayProperty>(ParentProperty);

			if (ArrayProperty != nullptr)
			{
				ParentProperty = ArrayProperty->Inner;
			}

			UStructProperty* StructProperty = Cast<UStructProperty>(ParentProperty);
			UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>(ParentProperty);

			if (StructProperty != nullptr)
			{
				Class = StructProperty->Struct;
			}
			else if (ObjectProperty != nullptr)
			{
				Class = ObjectProperty->PropertyClass;
			}
		}
		else
		{
			UObject* RootObject = static_cast<UObject*>(State.Data);
			Class = RootObject->GetClass();
		}

		return Class;
	}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:35,代码来源:StructDeserializer.cpp

示例10: CheckValidObject

void UObjectPropertyBase::CheckValidObject(void* Value) const
{
	UObject *Object = GetObjectPropertyValue(Value);
	if (Object)
	{
		//
		// here we want to make sure the the object value still matches the 
		// object type expected by the property...

		UClass* ObjectClass = Object->GetClass();
		// we could be in the middle of replacing references to the 
		// PropertyClass itself (in the middle of an FArchiveReplaceObjectRef 
		// pass)... if this is the case, then we might have already replaced 
		// the object's class, but not the PropertyClass yet (or vise-versa)... 
		// so we use this to ensure, in that situation, that we don't clear the 
		// object value (if CLASS_NewerVersionExists is set, then we are likely 
		// in the middle of an FArchiveReplaceObjectRef pass)
		bool bIsReplacingClassRefs = PropertyClass && PropertyClass->HasAnyClassFlags(CLASS_NewerVersionExists) != ObjectClass->HasAnyClassFlags(CLASS_NewerVersionExists);
		
#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
		FLinkerLoad* PropertyLinker = GetLinker();
		bool const bIsDeferringValueLoad = ((PropertyLinker == nullptr) || (PropertyLinker->LoadFlags & LOAD_DeferDependencyLoads)) &&
			(Object->IsA<ULinkerPlaceholderExportObject>() || Object->IsA<ULinkerPlaceholderClass>());

#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
		check( bIsDeferringValueLoad || (!Object->IsA<ULinkerPlaceholderExportObject>() && !Object->IsA<ULinkerPlaceholderClass>()) );
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS

#else  // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING 
		bool const bIsDeferringValueLoad = false;
#endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING

		if ((PropertyClass != nullptr) && !ObjectClass->IsChildOf(PropertyClass) && !bIsReplacingClassRefs && !bIsDeferringValueLoad)
		{
			UE_LOG(LogProperty, Warning,
				TEXT("Serialized %s for a property of %s. Reference will be NULLed.\n    Property = %s\n    Item = %s"),
				*Object->GetClass()->GetFullName(),
				*PropertyClass->GetFullName(),
				*GetFullName(),
				*Object->GetFullName()
				);
			SetObjectPropertyValue(Value, NULL);
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:45,代码来源:PropertyBaseObject.cpp

示例11: DeselectAll

void USelection::DeselectAll( UClass* InClass )
{
	// Fast path for deselecting all UObjects with any flags
	if ( InClass == UObject::StaticClass() )
	{
		InClass = nullptr;
	}

	bool bSelectionChanged = false;

	TSet<FSelectedClassInfo> RemovedClasses;
	// Remove from the end to minimize memmoves.
	for ( int32 i = SelectedObjects.Num()-1 ; i >= 0 ; --i )
	{
		UObject* Object = GetSelectedObject(i);

		if ( !Object )
		{		
			// Remove NULLs from SelectedObjects array.
			SelectedObjects.RemoveAt( i );
		}
		else if( !InClass || Object->IsA( InClass ) )
		{
			// if the object is of type InClass then all objects of that same type will be removed
			RemovedClasses.Add(FSelectedClassInfo(Object->GetClass()));

			GSelectedAnnotation.Clear(Object);
			SelectedObjects.RemoveAt( i );

			// Call this after the item has been removed from the selection set.
			USelection::SelectObjectEvent.Broadcast( Object );

			bSelectionChanged = true;
		}
	}

	if( InClass == nullptr )
	{
		SelectedClasses.Empty();
	}
	else
	{
		// Remove the passed in class and all child classes that were removed
		// from the list of currently selected classes
		RemovedClasses.Add(InClass);
		SelectedClasses = SelectedClasses.Difference(RemovedClasses);
	}

	if ( bSelectionChanged )
	{
		MarkBatchDirty();
		if ( !IsBatchSelecting() )
		{
			USelection::SelectionChangedEvent.Broadcast(this);
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:57,代码来源:Selection.cpp

示例12: GetDisplayValueIcon

const FSlateBrush* SPropertyEditorEditInline::GetDisplayValueIcon() const
{
	UObject* CurrentValue = nullptr;
	FPropertyAccess::Result Result = PropertyEditor->GetPropertyHandle()->GetValue( CurrentValue );
	if( Result == FPropertyAccess::Success && CurrentValue != nullptr )
	{
		return FClassIconFinder::FindIconForClass(CurrentValue->GetClass());
	}

	return nullptr;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:11,代码来源:SPropertyEditorEditInline.cpp

示例13: Identical

bool UObjectPropertyBase::Identical( const void* A, const void* B, uint32 PortFlags ) const
{
	UObject* ObjectA = A ? GetObjectPropertyValue(A) : NULL;
	UObject* ObjectB = B ? GetObjectPropertyValue(B) : NULL;
	if (!ObjectA && !ObjectB)
	{
		return true;
	}
	if (!ObjectA || !ObjectB)
	{
		return false;
	}
	// Compare actual pointers. We don't do this during PIE because we want to be sure to serialize everything. An example is the LevelScriptActor being serialized against its CDO,
	// which contains actor references. We want to serialize those references so they are fixed up.
	const bool bDuplicatingForPIE = (PortFlags&PPF_DuplicateForPIE) != 0;
	bool bResult = !bDuplicatingForPIE ? (ObjectA == ObjectB) : false;
	// always serialize the cross level references, because they could be NULL
	// @todo: okay, this is pretty hacky overall - we should have a PortFlag or something
	// that is set during SavePackage. Other times, we don't want to immediately return false
	// (instead of just this ExportDefProps case)
	// instance testing
	if (!bResult && ObjectA->GetClass() == ObjectB->GetClass())
	{
		bool bPerformDeepComparison = (PortFlags&PPF_DeepComparison) != 0;
		if ((PortFlags&PPF_DeepCompareInstances) && !bPerformDeepComparison)
		{
			bPerformDeepComparison = ObjectA->IsTemplate() != ObjectB->IsTemplate();
		}

		if (!bResult && bPerformDeepComparison)
		{
			// In order for deep comparison to be match they both need to have the same name and that name needs to be included in the instancing table for the class
			if (ObjectA->GetFName() == ObjectB->GetFName() && ObjectA->GetClass()->GetDefaultSubobjectByName(ObjectA->GetFName()))
			{
				checkSlow(ObjectA->IsDefaultSubobject() && ObjectB->IsDefaultSubobject() && ObjectA->GetClass()->GetDefaultSubobjectByName(ObjectA->GetFName()) == ObjectB->GetClass()->GetDefaultSubobjectByName(ObjectB->GetFName())); // equivalent
				bResult = AreInstancedObjectsIdentical(ObjectA,ObjectB,PortFlags);
			}
		}
	}
	return bResult;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:41,代码来源:PropertyBaseObject.cpp

示例14: CreateOrOverwriteAsset

UObject* UFactory::CreateOrOverwriteAsset(UClass* InClass, UObject* InParent, FName InName, EObjectFlags InFlags, UObject* InTemplate) const
{
	// Creates an asset if it doesn't exist.
	UObject* ExistingAsset = StaticFindObject(NULL, InParent, *InName.ToString());
	if ( !ExistingAsset )
	{
		return NewObject<UObject>(InParent, InClass, InName, InFlags, InTemplate);
	}

	// If it does exist then it overwrites it if possible.
	if ( ExistingAsset->GetClass()->IsChildOf(InClass) )
	{
		return NewObject<UObject>(InParent, InClass, InName, InFlags, InTemplate);
	}
	
	// If it can not overwrite then it will delete and replace.
	if ( ObjectTools::DeleteSingleObject( ExistingAsset ) )
	{
		// Keep InPackage alive through the GC, in case ExistingAsset was the only reason it was around.
		const bool bRootedPackage = InParent->IsRooted();
		if ( !bRootedPackage )
		{
			InParent->AddToRoot();
		}

		// Force GC so we can cleanly create a new asset (and not do an 'in place' replacement)
		CollectGarbage( GARBAGE_COLLECTION_KEEPFLAGS );

		if ( !bRootedPackage )
		{
			InParent->RemoveFromRoot();
		}

		// Try to find the existing asset again now that the GC has occurred
		ExistingAsset = StaticFindObject(NULL, InParent, *InName.ToString());
		if ( ExistingAsset )
		{
			// Even after the delete and GC, the object is still around. Fail this operation.
			return NULL;
		}
		else
		{
			// We can now create the asset in the package
			return NewObject<UObject>(InParent, InClass, InName, InFlags, InTemplate);
		}
	}
	else
	{
		// The delete did not succeed. There are still references to the old content.
		return NULL;
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:52,代码来源:Factory.cpp

示例15: GetDisplayValueAsString

FText SPropertyEditorEditInline::GetDisplayValueAsString() const
{
	UObject* CurrentValue = NULL;
	FPropertyAccess::Result Result = PropertyEditor->GetPropertyHandle()->GetValue( CurrentValue );
	if( Result == FPropertyAccess::Success && CurrentValue != NULL )
	{
		return CurrentValue->GetClass()->GetDisplayNameText();
	}
	else
	{
		return PropertyEditor->GetValueAsText();
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:13,代码来源:SPropertyEditorEditInline.cpp


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