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


C++ TSubclassOf类代码示例

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


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

示例1: SpawnVariableGetNode

UK2Node_VariableGet* UGameplayAbilityGraphSchema::SpawnVariableGetNode(const FVector2D GraphPosition, class UEdGraph* ParentGraph, FName VariableName, UStruct* Source) const
{
	// Perform handling to create custom nodes for some classes
	UProperty* VarProp = FindField<UProperty>(Source, VariableName);
	UObjectProperty* ObjProp = Cast<UObjectProperty>(VarProp);
	if (ObjProp)
	{
		UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(ParentGraph);
		TSubclassOf<UObject> GenClass = Blueprint->GeneratedClass;

		UObject* ActiveObject = GenClass->GetDefaultObject();

		// If the variable is a GameplayEffect create a custom node to show it
		FString PropType;
		ObjProp->GetCPPMacroType(PropType);
		if (PropType == "UGameplayEffect")
		{
			UK2Node_GameplayEffectVariable* NodeTemplate = NewObject<UK2Node_GameplayEffectVariable>();
			UEdGraphSchema_K2::ConfigureVarNode(NodeTemplate, VariableName, Source, Blueprint);

			UK2Node_GameplayEffectVariable* VariableNode = FEdGraphSchemaAction_K2NewNode::SpawnNodeFromTemplate<UK2Node_GameplayEffectVariable>(ParentGraph, NodeTemplate, GraphPosition);

			UGameplayEffect* GameplayEffect = Cast<UGameplayEffect>(ObjProp->GetObjectPropertyValue_InContainer(ActiveObject));
			if (GameplayEffect)
			{
				VariableNode->GameplayEffect = GameplayEffect;
			}

			return VariableNode;
		}
	}

	// Couldn't find an appropriate custom node for this variable, use the generic case
	return Super::SpawnVariableGetNode(GraphPosition, ParentGraph, VariableName, Source);
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:35,代码来源:GameplayAbilityGraphSchema.cpp

示例2: ApplyEffectSpec

FGAEffectHandle UGABlueprintLibrary::ApplyEffectSpec(const FHitResult& Target, APawn* Instigator,
	UObject* Causer, TSubclassOf<class UGAEffectSpecification> SpecIn)
{
	FGAEffectHandle ReturnHandle;
	IIGAAttributes* targetAttr = Cast<IIGAAttributes>(Target.Actor.Get());
	IIGAAttributes* instiAttr = Cast<IIGAAttributes>(Instigator);
	if (!targetAttr || !instiAttr)
		return ReturnHandle;

	UGAAttributeComponent* targetComp = targetAttr->GetAttributeComponent();
	UGAAttributeComponent* instiComp = instiAttr->GetAttributeComponent();

	FGAEffectContext context(Target.Location, Target.Actor, Causer,
		Instigator, targetComp, instiComp);
	FName EffectName;
	if (SpecIn.GetDefaultObject()->Policy.Type != EGAEffectType::Instant)
	{
		if (SpecIn.GetDefaultObject()->EffectName.CustomName)
			EffectName = SpecIn.GetDefaultObject()->EffectName.EffectName;
		else
			EffectName = SpecIn->GetFName();// Causer->GetClass()->GetFName();
	}
	ReturnHandle = instiComp->ApplyEffectToTarget(SpecIn, context, EffectName);
	return ReturnHandle;
}
开发者ID:Chooka,项目名称:ActionRPGGame,代码行数:25,代码来源:GABlueprintLibrary.cpp

示例3: TEXT

ASensor::ASensor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	/* Check if instantiation is real or just for placement guidlines */
	if (UObject::IsTemplate(RF_Transient)){
		return;
	}

//	UObject* something = StaticLoadObject(UObject::StaticClass(), NULL, TEXT("Blueprint'/Game/SensorNode.SensorNode'"));
//	UBlueprint* bp = Cast<UBlueprint>(something);
//	TSubclassOf<class UObject> MyItemBlueprint;
//	MyItemBlueprint = (UClass*)bp->GeneratedClass;
//	TSubclassOf<class UObject> MyItemBlueprint;
//	MyItemBlueprint = Cast<UClass>(blueprint->GeneratedClass);

	/* Find the blueprint of the 3D model */
	UBlueprint* blueprint = Cast<UBlueprint>(StaticLoadObject(UObject::StaticClass(), NULL, TEXT("Blueprint'/Game/SensorNode.SensorNode'")));
	TSubclassOf<class UObject> MyItemBlueprint = (UClass*)(blueprint->GeneratedClass);
	if (MyItemBlueprint != NULL) {
		UE_LOG(LogNet, Log, TEXT("BName: %s %s"), *(MyItemBlueprint->GetClass()->GetName()), *(this->GetActorLocation().ToString()));
	} else {
		UE_LOG(LogNet, Log, TEXT("I got nothing"));
	}

	/* Spawn the 3D model for the sensor in the virtual world */
	SensorActor = SpawnBP<AActor>(GetWorld(), MyItemBlueprint, this->GetActorLocation(), this->GetActorRotation());
	if(SensorActor) {
		UE_LOG(LogNet, Log, TEXT("SeName: %s"), *(SensorActor->GetName()));
		this->Children.Add(SensorActor);
		SensorActor->SetOwner(this);
		UE_LOG(LogNet, Log, TEXT("New Sensor: %s"), *(SensorActor->GetName()))
		/* Retrieve all the LEDS and turn them OFF */
		SensorActor->GetComponents(Leds);
		for (USpotLightComponent *l: Leds) {
			if (l == NULL) continue;
			UE_LOG(LogNet, Log, TEXT("%s owned by %s"), *(l->GetName()),
					*(l->GetOwner()->GetName()));
			l->SetIntensity(LEDOFF);
		}
	}
	else {
		UE_LOG(LogNet, Log, TEXT("SeName:Not spawned!"));
	}
//	AVirtual_CPS_WorldGameMode* gm = ((AVirtual_CPS_WorldGameMode*)GetWorld()->GetAuthGameMode());
//	if (gm)	ID = ((AVirtual_CPS_WorldGameMode*)GetWorld()->GetAuthGameMode())->getNewSensorID();

	/* Networking setup */
	sockSubSystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
	socket = sockSubSystem->CreateSocket(NAME_DGram, TEXT("UDPCONN2"), true);
	if (socket) UE_LOG(LogNet, Log, TEXT("Created Socket"));
	socket->SetReceiveBufferSize(RecvSize, RecvSize);
	socket->SetSendBufferSize(SendSize, SendSize);


}
开发者ID:fergul,项目名称:Ardan-Unreal,代码行数:56,代码来源:Sensor.cpp

示例4: ExtractLocation

	FVector ExtractLocation(TSubclassOf<UEnvQueryItemType> ItemType, const TArray<uint8>& RawData, const TArray<FEnvQueryItem>& Items, int32 Index)
	{
		if (Items.IsValidIndex(Index) &&
			ItemType->IsChildOf(UEnvQueryItemType_VectorBase::StaticClass()))
		{
			UEnvQueryItemType_VectorBase* DefTypeOb = (UEnvQueryItemType_VectorBase*)ItemType->GetDefaultObject();
			return DefTypeOb->GetItemLocation(RawData.GetData() + Items[Index].DataOffset);
		}
		return FVector::ZeroVector;
	}
开发者ID:colwalder,项目名称:unrealengine,代码行数:10,代码来源:EQSRenderingComponent.cpp

示例5: SetGivenSelfScope

void FMemberReference::SetGivenSelfScope(const FName InMemberName, const FGuid InMemberGuid, TSubclassOf<class UObject> InMemberParentClass, TSubclassOf<class UObject> SelfScope) const
{
	MemberName = InMemberName;
	MemberGuid = InMemberGuid;
	MemberParentClass = (InMemberParentClass != nullptr) ? InMemberParentClass->GetAuthoritativeClass() : nullptr;
	MemberScope.Empty();
	bSelfContext = (SelfScope->IsChildOf(InMemberParentClass)) || (SelfScope->ClassGeneratedBy == InMemberParentClass->ClassGeneratedBy);
	bWasDeprecated = false;

	if (bSelfContext)
	{
		MemberParentClass = NULL;
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:14,代码来源:K2Node.cpp

示例6: RegisterCustomRenderer

void UThumbnailManager::RegisterCustomRenderer(UClass* Class, TSubclassOf<UThumbnailRenderer> RendererClass)
{
	check(Class != nullptr);
	check(*RendererClass != nullptr);

	const FString NewClassPathName = Class->GetPathName();

	// Verify that this class isn't already registered
	for (int32 Index = 0; Index < RenderableThumbnailTypes.Num(); ++Index)
	{
		if (ensure(RenderableThumbnailTypes[Index].ClassNeedingThumbnailName != NewClassPathName))
		{
		}
		else
		{
			return;
		}
	}

	// Register the new class
	FThumbnailRenderingInfo& Info = *(new (RenderableThumbnailTypes) FThumbnailRenderingInfo());
	Info.ClassNeedingThumbnailName = NewClassPathName;
	Info.ClassNeedingThumbnail = Class;
	Info.Renderer = NewObject<UThumbnailRenderer>(GetTransientPackage(), RendererClass);
	Info.RendererClassName = RendererClass->GetPathName();

	bMapNeedsUpdate = true;
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:28,代码来源:ThumbnailManager.cpp

示例7: GetNodeSpecificActions

//------------------------------------------------------------------------------
static void BlueprintActionDatabaseImpl::GetNodeSpecificActions(TSubclassOf<UEdGraphNode const> const NodeClass, FBlueprintActionDatabaseRegistrar& Registrar)
{
	using namespace FBlueprintNodeSpawnerFactory; // for MakeCommentNodeSpawner()/MakeDocumentationNodeSpawner()

	if (NodeClass->IsChildOf<UK2Node>() && !NodeClass->HasAnyClassFlags(CLASS_Abstract))
	{
		UK2Node const* const NodeCDO = NodeClass->GetDefaultObject<UK2Node>();
		check(NodeCDO != nullptr);
		NodeCDO->GetMenuActions(Registrar);
	}
	// unfortunately, UEdGraphNode_Comment is not a UK2Node and therefore cannot
	// leverage UK2Node's GetMenuActions() function, so here we HACK it in
	//
	// @TODO: DO NOT follow this example! Do as I say, not as I do! If we need
	//        to support other nodes in a similar way, then we should come up
	//        with a better (more generalized) solution.
	else if (NodeClass == UEdGraphNode_Comment::StaticClass())
	{
		Registrar.AddBlueprintAction(MakeCommentNodeSpawner());
	}
	else if (NodeClass == UEdGraphNode_Documentation::StaticClass())
	{
		// @TODO: BOOOOOOO! (see comment above)
		Registrar.AddBlueprintAction(MakeDocumentationNodeSpawner<UEdGraphNode_Documentation>());
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:27,代码来源:BlueprintActionDatabase.cpp

示例8: ApplyEffect

FGAEffectHandle FGAActiveEffectContainer::ApplyEffect(TSubclassOf<class UGAEffectSpecification> SpecIn,
	const FGAEffectContext& Ctx, const FName& EffectName)
{
	if (!SpecIn)
		return FGAEffectHandle();

	FGAEffectSpec spec(SpecIn.GetDefaultObject(), Ctx);
	spec.EffectName.EffectName = EffectName;
	switch (spec.Policy.Type)
	{
	case EGAEffectType::Instant:
	{
		FGAEffectInstant instntEffect(spec, Ctx);
		return HandleInstantEffect(instntEffect, Ctx);
	}
	case EGAEffectType::Periodic:
	{
		return HandleDurationEffect(spec, Ctx);
	}
	case EGAEffectType::Duration:
	{
		return HandleDurationEffect(spec, Ctx);
	}
	case EGAEffectType::Infinite:
	{
		break;
	}
	default:
	{
		return FGAEffectHandle();
	}
	}
	return FGAEffectHandle();
}
开发者ID:Irvaxis,项目名称:ActionRPGGame,代码行数:34,代码来源:GAEffects.cpp

示例9: SetExternalMember

void FMemberReference::SetExternalMember(FName InMemberName, TSubclassOf<class UObject> InMemberParentClass)
{
	MemberName = InMemberName;
	MemberParentClass = (InMemberParentClass != nullptr) ? InMemberParentClass->GetAuthoritativeClass() : nullptr;
	MemberScope.Empty();
	bSelfContext = false;
	bWasDeprecated = false;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:8,代码来源:K2Node.cpp

示例10: MakeGameEffect

FGAGameEffectHandle UGAAttributeComponent::MakeGameEffect(TSubclassOf<class UGAGameEffectSpec> SpecIn,
	const FGAEffectContext& ContextIn)
{
	FGAGameEffect* effect = new FGAGameEffect(SpecIn.GetDefaultObject(), ContextIn);
	FGAGameEffectHandle handle = FGAGameEffectHandle::GenerateHandle(effect);
	effect->Handle = &handle;
	return handle;
}
开发者ID:pcerioli,项目名称:ActionRPGGame,代码行数:8,代码来源:GAAttributeComponent.cpp

示例11: SetGivenSelfScope

void FMemberReference::SetGivenSelfScope(const FName InMemberName, const FGuid InMemberGuid, TSubclassOf<class UObject> InMemberParentClass, TSubclassOf<class UObject> SelfScope) const
{
	MemberName = InMemberName;
	MemberGuid = InMemberGuid;
	MemberParent = (InMemberParentClass != nullptr) ? InMemberParentClass->GetAuthoritativeClass() : nullptr;
	MemberScope.Empty();

	// SelfScope should always be valid, but if it's not ensure and move on, the node will be treated as if it's not self scoped.
	ensure(SelfScope);
	bSelfContext = SelfScope && ((SelfScope->IsChildOf(InMemberParentClass)) || (SelfScope->ClassGeneratedBy == InMemberParentClass->ClassGeneratedBy));
	bWasDeprecated = false;

	if (bSelfContext)
	{
		MemberParent = NULL;
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:17,代码来源:MemberReference.cpp

示例12: InitializeMap

TArray<UClass*> FComponentAssetBrokerage::GetSupportedAssets(UClass* InFilterComponentClass)
{
	InitializeMap();

	TArray< UClass* > SupportedAssets;

	for (auto ComponentTypeIt = ComponentToBrokerMap.CreateIterator(); ComponentTypeIt; ++ComponentTypeIt)
	{
		TSubclassOf<UActorComponent> Component = ComponentTypeIt.Key();

		if(InFilterComponentClass == NULL || Component->IsChildOf(InFilterComponentClass))
		{
			SupportedAssets.Add(ComponentTypeIt.Value()->GetSupportedAssetClass());
		}
	}
	
	return SupportedAssets;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:18,代码来源:ComponentAssetBroker.cpp

示例13: GetUIRecipeForMod

void AMod::GetUIRecipeForMod(TSubclassOf<AMod> modClass, TArray<TSubclassOf<AMod> >& recipeArray)
{
	AMod* defaultMod = Cast<AMod>(modClass->GetDefaultObject());
	if (IsValid(defaultMod))
	{
		for (TSubclassOf<AMod> recipeItem : defaultMod->recipe)
			recipeArray.Add(recipeItem);
	}
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:9,代码来源:Mod.cpp

示例14: FHTNTaskInstance

TSharedPtr<FHTNTaskInstance> UHTNPlannerComponent::InstantiateTask(const TSubclassOf<UHTNTask>& TaskClass)
{
	if(*TaskClass)
	{
		UHTNTask* TaskCDO = Cast<UHTNTask>(TaskClass->GetDefaultObject());
		TSharedPtr<FHTNTaskInstance> NewInstance = TSharedPtr<FHTNTaskInstance>(new FHTNTaskInstance(TaskCDO, TaskCDO->GetInstanceMemorySize()));
		NewInstance->Task->Instantiate(*this, NewInstance->GetMemory());
		return NewInstance;
	}

	return TSharedPtr<FHTNTaskInstance>(nullptr);
}
开发者ID:DennisSoemers,项目名称:HTN_Plan_Reuse,代码行数:12,代码来源:HTNPlannerComponent.cpp

示例15: AddCameraShake

void UCameraModifier_CameraShake::AddCameraShake( TSubclassOf<class UCameraShake> NewShake, float Scale, ECameraAnimPlaySpace PlaySpace, FRotator UserPlaySpaceRot )
{
	if (NewShake != NULL)
	{
		if (Cast<UCameraShake>(NewShake->GetDefaultObject())->bSingleInstance)
		{
			for (int32 i = 0; i < ActiveShakes.Num(); ++i)
			{
				if (ActiveShakes[i].SourceShakeName == NewShake->GetFName())
				{
					ReinitShake(i, Scale);
					return;
				}
			}
		}

		int32 NumShakes = ActiveShakes.Num();

		// Initialize new shake and add it to the list of active shakes
		ActiveShakes.Add(InitializeShake(NewShake, Scale, PlaySpace, UserPlaySpaceRot));
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:22,代码来源:CameraModifier_CameraShake.cpp


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