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


C++ USkeletalMeshComponent类代码示例

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


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

示例1: ClearAllAnimSetLinkupCaches

void UAnimSet::ClearAllAnimSetLinkupCaches()
{
	double Start = FPlatformTime::Seconds();

	TArray<UAnimSet*> AnimSets;
	TArray<USkeletalMeshComponent*> SkelComps;
	// Find all AnimSets and SkeletalMeshComponents (just do one iterator)
	for(TObjectIterator<UObject> It;It;++It)
	{
		UAnimSet* AnimSet = Cast<UAnimSet>(*It);
		if(AnimSet && !AnimSet->IsPendingKill() && !AnimSet->IsTemplate())
		{
			AnimSets.Add(AnimSet);
		}

		USkeletalMeshComponent* SkelComp = Cast<USkeletalMeshComponent>(*It);
		if(SkelComp && !SkelComp->IsPendingKill() && !SkelComp->IsTemplate())
		{
			SkelComps.Add(SkelComp);
		}
	}

	// For all AnimSets, empty their linkup cache
	for(int32 i=0; i<AnimSets.Num(); i++)
	{
		AnimSets[i]->LinkupCache.Empty();
		AnimSets[i]->SkelMesh2LinkupCache.Empty();
	}

	UE_LOG(LogAnimation, Log, TEXT("ClearAllAnimSetLinkupCaches - Took %3.2fms"), (FPlatformTime::Seconds() - Start)*1000.f);
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:31,代码来源:AnimSet.cpp

示例2: Super

ACVehicleSpawner::ACVehicleSpawner(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer){
	USkeletalMeshComponent* Mesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("Mesh"));
	static ConstructorHelpers::FObjectFinder<USkeletalMesh> PlaceHolderMesh(TEXT("SkeletalMesh'/Game/Spawner/placeholder_vehicle.placeholder_vehicle'"));
	Mesh->SetSkeletalMesh(PlaceHolderMesh.Object);
	RootComponent = Mesh;

	SetActorHiddenInGame(true);

	static ConstructorHelpers::FClassFinder<AFlockingVehicle> CarFinder(TEXT("/Game/Vehicle/FlockingCar"));
	static ConstructorHelpers::FClassFinder<AFlockingVehicle> SedanFinder(TEXT("/Game/Vehicle/FlockingSedan"));
	static ConstructorHelpers::FClassFinder<AFlockingVehicle> EmergencyFinder(TEXT("/Game/Vehicle/EmergencyVehicle"));
	static ConstructorHelpers::FClassFinder<AFlockingVehicle> BusFinder(TEXT("/Game/Vehicle/FlockingBus"));
	static ConstructorHelpers::FObjectFinder<UMaterial> Yellow(TEXT("Material'/Game/Sedan/Materials/M_Vehicle_Sedan_yelllo.M_Vehicle_Sedan_yelllo'"));
	static ConstructorHelpers::FObjectFinder<UMaterial> Blue(TEXT("Material'/Game/Sedan/Materials/M_Vehicle_Sedan.M_Vehicle_Sedan'"));
	static ConstructorHelpers::FObjectFinder<UMaterial> Green(TEXT("Material'/Game/Sedan/Materials/M_Vehicle_Sedan_green.M_Vehicle_Sedan_green'"));


	VehicleTypeClass.Add((uint8)EVehicleType::VT_Car, CarFinder.Class);
	VehicleTypeClass.Add((uint8)EVehicleType::VT_Sedan, SedanFinder.Class);
	VehicleTypeClass.Add((uint8)EVehicleType::VT_Bus, BusFinder.Class);
	VehicleTypeClass.Add((uint8)EVehicleType::VT_Emergency, EmergencyFinder.Class);

	TArray<UMaterial*> Materials;
	Materials.Add(Yellow.Object);
	Materials.Add(Blue.Object);
	Materials.Add(Green.Object);

	VehicleTypeMaterials.Add((uint8)EVehicleType::VT_Car, Materials);
	VehicleTypeMaterials.Add((uint8)EVehicleType::VT_Sedan, Materials);
}
开发者ID:HighwayFlocking,项目名称:HighwayFlocking,代码行数:30,代码来源:CVehicleSpawner.cpp

示例3: ResultBox

FBox UPhysicsConstraintComponent::GetBodyBoxInternal(EConstraintFrame::Type Frame, FName InBoneName) const
{
	FBox ResultBox(0);

	UPrimitiveComponent* PrimComp  = GetComponentInternal(Frame);

	// Skeletal case
	USkeletalMeshComponent* SkelComp = Cast<USkeletalMeshComponent>(PrimComp);
	if(SkelComp != NULL)
	{
		UPhysicsAsset * const PhysicsAsset = SkelComp->GetPhysicsAsset();
		if (PhysicsAsset)
		{
			int32 BoneIndex = SkelComp->GetBoneIndex(InBoneName);
			int32 BodyIndex = PhysicsAsset->FindBodyIndex(InBoneName);
			if(BoneIndex != INDEX_NONE && BodyIndex != INDEX_NONE)
			{	
				const FTransform BoneTransform = SkelComp->GetBoneTransform(BoneIndex);
				ResultBox = PhysicsAsset->BodySetup[BodyIndex]->AggGeom.CalcAABB(BoneTransform);
			}
		}
	}
	else if(PrimComp != NULL)
	{
		ResultBox = PrimComp->Bounds.GetBox();
	}

	return ResultBox;
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:29,代码来源:PhysicsConstraintComponent.cpp

示例4: ResetAnimSet

void UAnimSet::ResetAnimSet()
{
#if WITH_EDITORONLY_DATA
	// Make sure we handle AnimSequence references properly before emptying the array.
	for(int32 i=0; i<Sequences.Num(); i++)
	{	
		UAnimSequence* AnimSeq = Sequences[i];
		if( AnimSeq )
		{
			AnimSeq->RecycleAnimSequence();
		}
	}
	Sequences.Empty();
	TrackBoneNames.Empty();
	LinkupCache.Empty();
	SkelMesh2LinkupCache.Empty();

	// We need to re-init any skeleltal mesh components now, because they might still have references to linkups in this set.
	for(TObjectIterator<USkeletalMeshComponent> It;It;++It)
	{
		USkeletalMeshComponent* SkelComp = *It;
		if(!SkelComp->IsPendingKill() && !SkelComp->IsTemplate())
		{
			SkelComp->InitAnim(true);
		}
	}
#endif // WITH_EDITORONLY_DATA
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:28,代码来源:AnimSet.cpp

示例5: UpdateRefreshBones

void FMovieSceneSkeletalAnimationTrackInstance::RefreshInstance( const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, IMovieScenePlayer& Player, FMovieSceneSequenceInstance& SequenceInstance )
{
	UpdateRefreshBones(RuntimeObjects);

	// When not in preview playback we need to stop any running animations to prevent the animations from being advanced a frame when
	// they are ticked by the engine.
	for ( TWeakObjectPtr<UObject> RuntimeObjectPtr : RuntimeObjects )
	{
		if ( ShouldUsePreviewPlayback( Player, RuntimeObjectPtr.Get() ) == false )
		{
			USkeletalMeshComponent* SkeletalMeshComponent = GetSkeletalMeshComponentFromRuntimeObjectPtr( RuntimeObjectPtr );
			if ( SkeletalMeshComponent != nullptr )
			{
				UAnimInstance* AnimInstance = SkeletalMeshComponent->GetAnimInstance();
				if ( AnimInstance )
				{
					UAnimSingleNodeInstance * SingleNodeInstance = SkeletalMeshComponent->GetSingleNodeInstance();
					if ( SingleNodeInstance )
					{
						SingleNodeInstance->SetPlaying( false );
					}
					// TODO: Anim montage?
				}
			}
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:27,代码来源:MovieSceneSkeletalAnimationTrackInstance.cpp

示例6: DetachMeshFromPawn

void AShooterWeapon::AttachMeshToPawn()
{
	if (MyPawn)
	{
		// Remove and hide both first and third person meshes
		DetachMeshFromPawn();

		// For locally controller players we attach both weapons and let the bOnlyOwnerSee, bOwnerNoSee flags deal with visibility.
		FName AttachPoint = MyPawn->GetWeaponAttachPoint();
		if( MyPawn->IsLocallyControlled() == true )
		{
			USkeletalMeshComponent* PawnMesh1p = MyPawn->GetSpecifcPawnMesh(true);
			USkeletalMeshComponent* PawnMesh3p = MyPawn->GetSpecifcPawnMesh(false);
			Mesh1P->SetHiddenInGame( false );
			Mesh3P->SetHiddenInGame( false );
			Mesh1P->AttachTo(PawnMesh1p, AttachPoint);
			Mesh3P->AttachTo(PawnMesh3p, AttachPoint);
		}
		else
		{
			USkeletalMeshComponent* UseWeaponMesh = GetWeaponMesh();
			USkeletalMeshComponent* UsePawnMesh = MyPawn->GetPawnMesh();
			UseWeaponMesh->AttachTo(UsePawnMesh, AttachPoint);	
			UseWeaponMesh->SetHiddenInGame( false );
		}
	}
}
开发者ID:t-p-tan,项目名称:CS4350-Die-Another-Day,代码行数:27,代码来源:ShooterWeapon.cpp

示例7: GetOwningComponent

void UAnimInstance::SetMorphTarget(FName MorphTargetName, float Value)
{
	USkeletalMeshComponent * Component = GetOwningComponent();
	if (Component)
	{
		Component->SetMorphTarget(MorphTargetName, Value);
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:8,代码来源:AnimInstance.cpp

示例8: GetMainWeaponMesh

FVector AARCharacter::GetMainWeaponSocket(const FName& Socket) const
{
	USkeletalMeshComponent* Component = GetMainWeaponMesh();
	if (!Component)
		return GetMesh()->GetSocketLocation(TEXT("headSocket"));

	return Component->GetSocketLocation(Socket);
}
开发者ID:iniside,项目名称:ActionRPGGame,代码行数:8,代码来源:ARCharacter.cpp

示例9: GetSkelMeshComponent

APawn* UAnimInstance::TryGetPawnOwner()
{
	USkeletalMeshComponent* OwnerComponent = GetSkelMeshComponent();
	if (AActor* OwnerActor = OwnerComponent->GetOwner())
	{
		return Cast<APawn>(OwnerActor);
	}

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

示例10: GetWeaponMesh

void ASFlashlight::BeginPlay()
{
	Super::BeginPlay();

	/* Create an instance unique to this actor instance to manipulate emissive intensity */
	USkeletalMeshComponent* MeshComp = GetWeaponMesh();
	if (MeshComp)
	{
		MatDynamic = MeshComp->CreateAndSetMaterialInstanceDynamic(0);
	}
}
开发者ID:emotionalplague,项目名称:EpicSurvivalGameSeries,代码行数:11,代码来源:SFlashlight.cpp

示例11: GetAnimPreviewScene

FWidget::EWidgetMode FFabrikEditMode::GetWidgetMode() const
{
	USkeletalMeshComponent* SkelComp = GetAnimPreviewScene().GetPreviewMeshComponent();
	int32 BoneIndex = SkelComp->GetBoneIndex(GraphNode->Node.EffectorTransformBone.BoneName);

	if (BoneIndex != INDEX_NONE)
	{
		return FWidget::WM_Translate;
	}

	return FWidget::WM_None;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:12,代码来源:FabrikEditMode.cpp

示例12: OnDeath

void AGamePlayCharacter::OnDeath(float KillingDamage, FDamageEvent const& DamageEvent, APawn* PawnInstigator, AActor* DamageCauser)
{
	Super::OnDeath(KillingDamage, DamageEvent, PawnInstigator, DamageCauser);
	if (CurrentWeapon)
	{
		CurrentWeapon->GetRootComponent()->DetachFromParent();
		USkeletalMeshComponent* WeaponMesh = CurrentWeapon->WeaponMesh;
		if (WeaponMesh)
		{
			WeaponMesh->SetSimulatePhysics(true);
			WeaponMesh->SetCollisionProfileName(TEXT("PhysicsActor"));
			WeaponMesh->AddAngularImpulse(FVector(1000, 500, 0));
		}
	}
}
开发者ID:1992please,项目名称:Unreal_ShooterGame,代码行数:15,代码来源:GamePlayCharacter.cpp

示例13: RefreshLODChange

void FLODUtilities::RefreshLODChange(const USkeletalMesh* SkeletalMesh)
{
	for (FObjectIterator Iter(USkeletalMeshComponent::StaticClass()); Iter; ++Iter)
	{
		USkeletalMeshComponent* SkeletalMeshComponent = Cast<USkeletalMeshComponent>(*Iter);
		if  (SkeletalMeshComponent->SkeletalMesh == SkeletalMesh)
		{
			// it needs to recreate IF it already has been created
			if (SkeletalMeshComponent->IsRegistered())
			{
				SkeletalMeshComponent->UpdateLODStatus();
				SkeletalMeshComponent->MarkRenderStateDirty();
			}
		}
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:16,代码来源:LODUtilities.cpp

示例14: GetAnimPreviewScene

FVector FObserveBoneEditMode::GetWidgetLocation() const
{
	USkeletalMeshComponent* SkelComp = GetAnimPreviewScene().GetPreviewMeshComponent();
	USkeleton* Skeleton = SkelComp->SkeletalMesh->Skeleton;
	FVector WidgetLoc = FVector::ZeroVector;

	int32 MeshBoneIndex = SkelComp->GetBoneIndex(GraphNode->Node.BoneToObserve.BoneName);

	if (MeshBoneIndex != INDEX_NONE)
	{
		const FTransform BoneTM = SkelComp->GetBoneTransform(MeshBoneIndex);
		WidgetLoc = BoneTM.GetLocation();
	}

	return WidgetLoc;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:16,代码来源:ObserveBoneEditMode.cpp

示例15: check

void FGameplayAbilityActorInfo::InitFromActor(AActor *InOwnerActor, AActor *InAvatarActor, UAbilitySystemComponent* InAbilitySystemComponent)
{
	check(InOwnerActor);
	check(InAbilitySystemComponent);

	OwnerActor = InOwnerActor;
	AvatarActor = InAvatarActor;
	AbilitySystemComponent = InAbilitySystemComponent;

	// Look for a player controller or pawn in the owner chain.
	AActor *TestActor = InOwnerActor;
	while (TestActor)
	{
		if (APlayerController * CastPC = Cast<APlayerController>(TestActor))
		{
			PlayerController = CastPC;
			break;
		}

		if (APawn * Pawn = Cast<APawn>(TestActor))
		{
			PlayerController = Cast<APlayerController>(Pawn->GetController());
			break;
		}

		TestActor = TestActor->GetOwner();
	}

	if (AvatarActor.Get())
	{
		// Grab Components that we care about
		USkeletalMeshComponent * SkelMeshComponent = AvatarActor->FindComponentByClass<USkeletalMeshComponent>();
		if (SkelMeshComponent)
		{
			this->AnimInstance = SkelMeshComponent->GetAnimInstance();
		}

		MovementComponent = AvatarActor->FindComponentByClass<UMovementComponent>();
	}
	else
	{
		MovementComponent = NULL;
		AnimInstance = NULL;
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:45,代码来源:GameplayAbilityTypes.cpp


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