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


C++ UClass类代码示例

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


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

示例1: FClassThumbnailScene

bool UClassThumbnailRenderer::CanVisualizeAsset(UObject* Object)
{
	if (ThumbnailScene == nullptr)
	{
		ThumbnailScene = new FClassThumbnailScene();
	}

	UClass* Class = Cast<UClass>(Object);

	// Only visualize actor based classes
	if (Class && Class->IsChildOf(AActor::StaticClass()))
	{
		// Try to find any visible primitive components in the class' CDO
		AActor* CDO = Class->GetDefaultObject<AActor>();

		TInlineComponentArray<UActorComponent*> Components;
		CDO->GetComponents(Components);

		for (auto CompIt = Components.CreateConstIterator(); CompIt; ++CompIt)
		{
			if (ThumbnailScene->IsValidComponentForVisualization(*CompIt))
			{
				return true;
			}
		}
	}

	return false;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:29,代码来源:ClassThumbnailRenderer.cpp

示例2: Disasm

// Disassemble all functions in any classes that have matching names.
void FKismetBytecodeDisassembler::DisassembleAllFunctionsInClasses(FOutputDevice& Ar, const FString& ClassnameSubstring)
{
	FKismetBytecodeDisassembler Disasm(Ar);
		
	for (TObjectIterator<UClass> ClassIter; ClassIter; ++ClassIter)
	{
		UClass* Class = *ClassIter;

		FString ClassName = Class->GetName();
		if (FCString::Strfind(*ClassName, *ClassnameSubstring))
		{
			Ar.Logf(TEXT("Processing class %s"), *ClassName);

			for (TFieldIterator<UFunction> FunctionIter(Class, EFieldIteratorFlags::ExcludeSuper); FunctionIter; ++FunctionIter)
			{
				UFunction* Function = *FunctionIter;
				FString FunctionName = Function->GetName();
				Ar.Logf(TEXT("  Processing function %s (%d bytes)"), *FunctionName, Function->Script.Num());

				Disasm.DisassembleStructure(Function);

				Ar.Logf(TEXT(""));
			}

			Ar.Logf(TEXT(""));
			Ar.Logf(TEXT("-----------"));
			Ar.Logf(TEXT(""));
		}

	}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:32,代码来源:ScriptDisassembler.cpp

示例3: LoadCommandlet

/**
 * Trys to load the UClass for the commandlet that was requested
 *
 * @param CommandletName the name of the commandlet to load
 */
static UClass* LoadCommandlet(const TCHAR* CommandletName)
{
	// Try to find the UClass for the commandlet (works for all but script classes)
	UClass* Class = FindObject<UClass>(ANY_PACKAGE,CommandletName,FALSE);

	// Don't accept classes that are not commandlets...
	if (!Class->IsChildOf(UCommandlet::StaticClass()))
	{
		Class = NULL;
	}

	// Name mangle by appending Commandlet
	FString AppendedName(CommandletName);
	AppendedName += TEXT("Commandlet");
	if (Class == NULL)
	{
		Class = FindObject<UClass>(ANY_PACKAGE,*AppendedName,FALSE);
		// Don't accept classes that are not commandlets...
		if (!Class->IsChildOf(UCommandlet::StaticClass()))
		{
			Class = NULL;
		}
	}
	// Let the user know that the commandlet wasn't found
	if (Class == NULL)
	{
		warnf(TEXT("Failed to load commandlet %s"),CommandletName);
	}
	return Class;
}
开发者ID:LiuKeHua,项目名称:colorful-engine,代码行数:35,代码来源:UHelpCommandlet.cpp

示例4: UE_LOG

int32 UFixupNeedsLoadForEditorGameCommandlet::InitializeResaveParameters(const TArray<FString>& Tokens, TArray<FString>& MapPathNames)
{
	int32 Result = Super::InitializeResaveParameters(Tokens, MapPathNames);
	// We need ResaveClasses to be specified, otherwise we won't know what to update
	if (Result == 0 && !ResaveClasses.Num())
	{
		UE_LOG(LogContentCommandlet, Error, TEXT("FixupNeedsLoadForEditorGame commandlet requires at least one resave class name. Use -RESAVECLASS=ClassA,ClassB,ClassC to specify resave classes."));
		Result = 1;
	}
	else
	{
		for (FName& ClassName : ResaveClasses)
		{			
			if (!ResaveClassNeedsLoadForEditorGameValues.Contains(ClassName))
			{
				UClass* ResaveClass = FindObject<UClass>(ANY_PACKAGE, *ClassName.ToString());
				if (ResaveClass)
				{
					UObject* DefaultObject = ResaveClass->GetDefaultObject();
					ResaveClassNeedsLoadForEditorGameValues.Add(ClassName, DefaultObject->NeedsLoadForEditorGame());
				}
			}
			else if (Verbosity != UResavePackagesCommandlet::ONLY_ERRORS)
			{
				UE_LOG(LogContentCommandlet, Warning, TEXT("Resave Class \"%s\" could not be found. Make sure the class name is valid and that it's a native class."), *ClassName.ToString());
			}
		}
		if (ResaveClassNeedsLoadForEditorGameValues.Num() == 0)
		{
			UE_LOG(LogContentCommandlet, Error, TEXT("Got %d classes to resave but none of the exist."), ResaveClasses.Num());
			Result = 1;
		}
	}
	return Result;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:35,代码来源:FixupNeedsLoadForEditorGameCommandlet.cpp

示例5: if

//------------------------------------------------------------------------------
bool UBlueprintBoundEventNodeSpawner::IsBindingCompatible(UObject const* BindingCandidate) const
{
	bool bMatchesNodeType = false;
	if (NodeClass->IsChildOf<UK2Node_ComponentBoundEvent>())
	{
		UObjectProperty const* BindingProperty = Cast<UObjectProperty>(BindingCandidate);
		bMatchesNodeType = (BindingProperty != nullptr);
	}
	else if (NodeClass->IsChildOf<UK2Node_ActorBoundEvent>())
	{
		bMatchesNodeType = BindingCandidate->IsA<AActor>();
	}

	const UMulticastDelegateProperty* Delegate = GetEventDelegate();

	if ( !ensureMsgf(!FBlueprintNodeSpawnerUtils::IsStaleFieldAction(this), 
			TEXT("Invalid BlueprintBoundEventNodeSpawner (for %s). Was the action database properly updated when this class was compiled?"), 
			*Delegate->GetOwnerClass()->GetName()))
	{
		return false;
	}

	UClass* DelegateOwner = Delegate->GetOwnerClass()->GetAuthoritativeClass();
	UClass* BindingClass  = FBlueprintNodeSpawnerUtils::GetBindingClass(BindingCandidate)->GetAuthoritativeClass();

	return bMatchesNodeType && BindingClass->IsChildOf(DelegateOwner) && !FObjectEditorUtils::IsVariableCategoryHiddenFromClass(Delegate, BindingClass);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:28,代码来源:BlueprintBoundEventNodeSpawner.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: GetConfigFile

bool UOnlineHotfixManager::HotfixPakIniFile(const FString& FileName)
{
	FConfigFile* ConfigFile = GetConfigFile(FileName);
	ConfigFile->Combine(FileName);
	UE_LOG(LogHotfixManager, Log, TEXT("Hotfix merged INI (%s) found in a PAK file"), *FileName);

	FName IniFileName(*FileName, FNAME_Find);
	int32 NumObjectsReloaded = 0;
	const double StartTime = FPlatformTime::Seconds();
	// Now that we have a list of classes to update, we can iterate objects and
	// reload if they match the INI file that was changed
	for (FObjectIterator It; It; ++It)
	{
		UClass* Class = It->GetClass();
		if (Class->HasAnyClassFlags(CLASS_Config) &&
			Class->ClassConfigName == IniFileName)
		{
			// Force a reload of the config vars
			It->ReloadConfig();
			NumObjectsReloaded++;
		}
	}
	UE_LOG(LogHotfixManager, Log, TEXT("Updating config from %s took %f seconds reloading %d objects"),
		*FileName, FPlatformTime::Seconds() - StartTime, NumObjectsReloaded);
	return true;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:26,代码来源:OnlineHotfixManager.cpp

示例8: GetClass

void AActor::ResetPropertiesForConstruction()
{
	// Get class CDO
	AActor* Default = GetClass()->GetDefaultObject<AActor>();
	// RandomStream struct name to compare against
	const FName RandomStreamName(TEXT("RandomStream"));

	// We don't want to reset references to world object
	const bool bIsLevelScriptActor = IsA(ALevelScriptActor::StaticClass());

	// Iterate over properties
	for( TFieldIterator<UProperty> It(GetClass()) ; It ; ++It )
	{
		UProperty* Prop = *It;
		UStructProperty* StructProp = Cast<UStructProperty>(Prop);
		UClass* PropClass = CastChecked<UClass>(Prop->GetOuter()); // get the class that added this property

		// First see if it is a random stream, if so reset before running construction script
		if( (StructProp != NULL) && (StructProp->Struct != NULL) && (StructProp->Struct->GetFName() == RandomStreamName) )
		{
			FRandomStream* StreamPtr =  StructProp->ContainerPtrToValuePtr<FRandomStream>(this);
			StreamPtr->Reset();
		}
		// If it is a blueprint added variable that is not editable per-instance, reset to default before running construction script
		else if( !bIsLevelScriptActor 
				&& Prop->HasAnyPropertyFlags(CPF_DisableEditOnInstance)
				&& PropClass->HasAnyClassFlags(CLASS_CompiledFromBlueprint) 
				&& !Prop->IsA(UDelegateProperty::StaticClass()) 
				&& !Prop->IsA(UMulticastDelegateProperty::StaticClass()) )
		{
			Prop->CopyCompleteValue_InContainer(this, Default);
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:34,代码来源:ActorConstruction.cpp

示例9: SNew

TSharedRef<SWidget> SContentReference::MakeAssetPickerMenu()
{
	FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));

	FAssetPickerConfig AssetPickerConfig;

	UClass* FilterClass = AllowedClass.Get();
	if (FilterClass != NULL)
	{
		AssetPickerConfig.Filter.ClassNames.Add(FilterClass->GetFName());
		AssetPickerConfig.Filter.bRecursiveClasses = true;
	}

	AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SContentReference::OnAssetSelectedFromPicker);
	AssetPickerConfig.OnShouldFilterAsset = OnShouldFilterAsset;
	AssetPickerConfig.bAllowNullSelection = true;
	AssetPickerConfig.ThumbnailLabel = EThumbnailLabel::ClassName;
	AssetPickerConfig.InitialAssetViewType = InitialAssetViewType;

	return SNew(SBox)
		.WidthOverride(AssetPickerSizeOverride.Get().X)
		.HeightOverride(AssetPickerSizeOverride.Get().Y)
		[
			ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig)
		];
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:26,代码来源:SContentReference.cpp

示例10: FindIconForActors

const FSlateBrush* FClassIconFinder::FindIconForActors(const TArray< TWeakObjectPtr<AActor> >& InActors, UClass*& CommonBaseClass)
{
	// Get the common base class of the selected actors
	const FSlateBrush* CommonIcon = nullptr;
	for( int32 ActorIdx = 0; ActorIdx < InActors.Num(); ++ActorIdx )
	{
		TWeakObjectPtr<AActor> Actor = InActors[ActorIdx];
		UClass* ObjClass = Actor->GetClass();

		if (!CommonBaseClass)
		{
			CommonBaseClass = ObjClass;
		}
		while (!ObjClass->IsChildOf(CommonBaseClass))
		{
			CommonBaseClass = CommonBaseClass->GetSuperClass();
		}

		const FSlateBrush* ActorIcon = FindIconForActor(Actor);

		if (!CommonIcon)
		{
			CommonIcon = ActorIcon;
		}
		if (CommonIcon != ActorIcon)
		{
			CommonIcon = FindIconForClass(CommonBaseClass);
		}
	}

	return CommonIcon;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:32,代码来源:ClassIconFinder.cpp

示例11: DestroyActorsForMovie

void UActorAnimationPlayer::SpawnActorsForMovie(TSharedRef<FMovieSceneSequenceInstance> MovieSceneInstance)
{
	UWorld* WorldPtr = World.Get();

	if (WorldPtr == nullptr)
	{
		return;
	}

	UMovieScene* MovieScene = MovieSceneInstance->GetSequence()->GetMovieScene();

	if (MovieScene == nullptr)
	{
		return;
	}

	TArray<FSpawnedActorInfo>* FoundSpawnedActors = InstanceToSpawnedActorMap.Find(MovieSceneInstance);

	if (FoundSpawnedActors != nullptr)
	{
		// Remove existing spawned actors for this movie
		DestroyActorsForMovie( MovieSceneInstance );
	}

	TArray<FSpawnedActorInfo>& SpawnedActorList = InstanceToSpawnedActorMap.Add(MovieSceneInstance, TArray<FSpawnedActorInfo>());

	for (auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex)
	{
		auto& Spawnable = MovieScene->GetSpawnable(SpawnableIndex);
		UClass* GeneratedClass = Spawnable.GetClass();
		
		if ((GeneratedClass == nullptr) || !GeneratedClass->IsChildOf(AActor::StaticClass()))
		{
			continue;
		}

		AActor* ActorCDO = CastChecked<AActor>(GeneratedClass->ClassDefaultObject);
		const FVector SpawnLocation = ActorCDO->GetRootComponent()->RelativeLocation;
		const FRotator SpawnRotation = ActorCDO->GetRootComponent()->RelativeRotation;

		FActorSpawnParameters SpawnInfo;
		{
			SpawnInfo.ObjectFlags = RF_NoFlags;
		}

		AActor* NewActor = WorldPtr->SpawnActor(GeneratedClass, &SpawnLocation, &SpawnRotation, SpawnInfo);

		if (NewActor)
		{	
			// Actor was spawned OK!
			FSpawnedActorInfo NewInfo;
			{
				NewInfo.RuntimeGuid = Spawnable.GetGuid();
				NewInfo.SpawnedActor = NewActor;
			}
						
			SpawnedActorList.Add(NewInfo);
		}
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:60,代码来源:ActorAnimationPlayer.cpp

示例12:

UFunction* UK2Node_MakeArray::GetArrayAddFunction() const
{
	UClass* ArrayLibClass = UKismetArrayLibrary::StaticClass();
	UFunction* ReturnFunction = ArrayLibClass->FindFunctionByName(FName(TEXT("Array_Add")));
	check(ReturnFunction);
	return ReturnFunction;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:7,代码来源:K2Node_MakeArray.cpp

示例13: while

UActorFactory* FPlacementMode::FindLastUsedFactoryForAssetType( UObject* Asset ) const
{
	if ( Asset == NULL )
	{
		return NULL;
	}

	UActorFactory* LastUsedFactory = NULL;

	UClass* CurrentClass = Cast<UClass>( Asset ); 
	if ( CurrentClass == NULL )
	{
		CurrentClass = Asset->GetClass();
	}

	while ( LastUsedFactory == NULL && CurrentClass != NULL && CurrentClass != UClass::StaticClass() )
	{
		const TWeakObjectPtr< UActorFactory >* FoundFactory = AssetTypeToFactory.Find( *CurrentClass->GetPathName() );
		if ( FoundFactory != NULL && FoundFactory->IsValid() )
		{
			LastUsedFactory = FoundFactory->Get();
		}
		else
		{
			CurrentClass = CurrentClass->GetSuperClass();
		}
	}

	return LastUsedFactory;
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:30,代码来源:PlacementMode.cpp

示例14: FindIconNameForClass

FName FClassIconFinder::FindIconNameForClass(UClass* InClass, const FName& InDefaultName )
{
	FName BrushName = InDefaultName;
	const FSlateBrush* Brush = NULL;

	if ( InClass != NULL )
	{
		// walk up class hierarchy until we find an icon
		UClass* ActorClass = InClass;
		while( (Brush == NULL || Brush == FEditorStyle::GetDefaultBrush()) && ActorClass && (ActorClass != AActor::StaticClass()) )
		{
			BrushName = *FString::Printf( TEXT( "ClassIcon.%s" ), *ActorClass->GetName() );
			Brush = FEditorStyle::GetBrush( BrushName );
			ActorClass = ActorClass->GetSuperClass();
		}
	}

	if( Brush == NULL || Brush == FEditorStyle::GetDefaultBrush() )
	{
		// If we didn't supply an override name for the default icon use default class icon.
		if( InDefaultName == "" )
		{
			BrushName = TEXT( "ClassIcon.Default" );
		}
		else
		{
			BrushName = InDefaultName;
		}
	}

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

示例15: FindNetServiceFunctionById

UFunction* FindNetServiceFunctionById(int16 RPCId)
{
	UFunction** Function = RPCFunctionMap.Find(RPCId);
	if (!Function)
	{
		for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
		{
			UClass* Class = *ClassIt;
			if (Class->IsChildOf(AActor::StaticClass())
				&& !(Class->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated)))
			{
				for (TFieldIterator<UFunction> FuncIt(Class); FuncIt; ++FuncIt) 
				{
					UFunction* CurFunc = *FuncIt;
					if (CurFunc->RPCId > 0)
					{
						RPCFunctionMap.Add(CurFunc->RPCId, CurFunc);
					}
				}
			}
		}
		
		Function = RPCFunctionMap.Find(RPCId);
	}

	return *Function;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:OnlineMsgSteam.cpp


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