bool UAnimationAsset::ReplaceSkeleton(USkeleton* NewSkeleton, bool bConvertSpaces/*=false*/) { // if it's not same if (NewSkeleton != Skeleton) { // get all sequences that need to change TArray<UAnimSequence*> AnimSeqsToReplace; if (UAnimSequence* AnimSequence = Cast<UAnimSequence>(this)) { AnimSeqsToReplace.AddUnique(AnimSequence); } if (GetAllAnimationSequencesReferred(AnimSeqsToReplace)) { for (auto Iter = AnimSeqsToReplace.CreateIterator(); Iter; ++Iter) { UAnimSequence* AnimSeq = *Iter; if (AnimSeq && AnimSeq->Skeleton != NewSkeleton) { AnimSeq->RemapTracksToNewSkeleton(NewSkeleton, bConvertSpaces); } } } SetSkeleton(NewSkeleton); PostEditChange(); MarkPackageDirty(); return true; } return false; }
void APlaneReflectionCapture::EditorApplyScale(const FVector& DeltaScale, const FVector* PivotLocation, bool bAltDown, bool bShiftDown, bool bCtrlDown) { UPlaneReflectionCaptureComponent* PlaneComponent = Cast<UPlaneReflectionCaptureComponent>(CaptureComponent); check(PlaneComponent); const FVector ModifiedScale = DeltaScale * ( AActor::bUsePercentageBasedScaling ? 5000.0f : 50.0f ); FMath::ApplyScaleToFloat(PlaneComponent->InfluenceRadiusScale, ModifiedScale); CaptureComponent->SetCaptureIsDirty(); PostEditChange(); }
void USoundCue::CompileSoundNodesFromGraphNodes() { // Use GraphNodes to make SoundNode Connections TArray<USoundNode*> ChildNodes; TArray<UEdGraphPin*> InputPins; for (int32 NodeIndex = 0; NodeIndex < SoundCueGraph->Nodes.Num(); ++NodeIndex) { USoundCueGraphNode* GraphNode = Cast<USoundCueGraphNode>(SoundCueGraph->Nodes[NodeIndex]); if (GraphNode && GraphNode->SoundNode) { // Set ChildNodes of each SoundNode GraphNode->GetInputPins(InputPins); ChildNodes.Empty(); for (int32 PinIndex = 0; PinIndex < InputPins.Num(); ++PinIndex) { UEdGraphPin* ChildPin = InputPins[PinIndex]; if (ChildPin->LinkedTo.Num() > 0) { USoundCueGraphNode* GraphChildNode = CastChecked<USoundCueGraphNode>(ChildPin->LinkedTo[0]->GetOwningNode()); ChildNodes.Add(GraphChildNode->SoundNode); } else { ChildNodes.AddZeroed(); } } GraphNode->SoundNode->SetFlags(RF_Transactional); GraphNode->SoundNode->Modify(); GraphNode->SoundNode->SetChildNodes(ChildNodes); GraphNode->SoundNode->PostEditChange(); } else { // Set FirstNode based on RootNode connection USoundCueGraphNode_Root* RootNode = Cast<USoundCueGraphNode_Root>(SoundCueGraph->Nodes[NodeIndex]); if (RootNode) { Modify(); if (RootNode->Pins[0]->LinkedTo.Num() > 0) { FirstNode = CastChecked<USoundCueGraphNode>(RootNode->Pins[0]->LinkedTo[0]->GetOwningNode())->SoundNode; } else { FirstNode = NULL; } PostEditChange(); } } } }
void UDebugSkelMeshComponent::ToggleClothSectionsVisibility(bool bShowOnlyClothSections) { FSkeletalMeshResource* SkelMeshResource = GetSkeletalMeshResource(); if (SkelMeshResource) { PreEditChange(NULL); for (int32 LODIndex = 0; LODIndex < SkelMeshResource->LODModels.Num(); LODIndex++) { FStaticLODModel& LODModel = SkelMeshResource->LODModels[LODIndex]; for (int32 SecIdx = 0; SecIdx < LODModel.Sections.Num(); SecIdx++) { FSkelMeshSection& Section = LODModel.Sections[SecIdx]; // toggle visibility between cloth sections and non-cloth sections if (bShowOnlyClothSections) { // enables only cloth sections if (LODModel.Chunks[Section.ChunkIndex].HasApexClothData()) { Section.bDisabled = false; } else { Section.bDisabled = true; } } else { // disables cloth sections and also corresponding original sections if (LODModel.Chunks[Section.ChunkIndex].HasApexClothData()) { Section.bDisabled = true; LODModel.Sections[Section.CorrespondClothSectionIndex].bDisabled = true; } else { Section.bDisabled = false; } } } } PostEditChange(); } }
void UAnimGraphNode_SkeletalControlBase::SetDefaultValue(const FString& UpdateDefaultValueName, const FVector& Value) { for (UEdGraphPin* Pin : Pins) { if (Pin->PinName == UpdateDefaultValueName) { if (GetSchema()->IsCurrentPinDefaultValid(Pin).IsEmpty()) { FString Str = FString::Printf(TEXT("%.3f,%.3f,%.3f"), Value.X, Value.Y, Value.Z); if (Pin->DefaultValue != Str) { PreEditChange(NULL); GetSchema()->TrySetDefaultValue(*Pin, Str); PostEditChange(); break; } } } } }
void UDebugSkelMeshComponent::RestoreClothSectionsVisibility() { // if this skeletal mesh doesn't have any clothing assets, just return if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } FSkeletalMeshResource* SkelMeshResource = GetSkeletalMeshResource(); if (SkelMeshResource) { PreEditChange(NULL); for(int32 LODIndex = 0; LODIndex < SkelMeshResource->LODModels.Num(); LODIndex++) { FStaticLODModel& LODModel = SkelMeshResource->LODModels[LODIndex]; // enables all sections first for(int32 SecIdx = 0; SecIdx < LODModel.Sections.Num(); SecIdx++) { LODModel.Sections[SecIdx].bDisabled = false; } // disables corresponding original section to enable the cloth section instead for(int32 SecIdx = 0; SecIdx < LODModel.Sections.Num(); SecIdx++) { FSkelMeshSection& Section = LODModel.Sections[SecIdx]; if(LODModel.Chunks[Section.ChunkIndex].HasApexClothData()) { LODModel.Sections[Section.CorrespondClothSectionIndex].bDisabled = true; } } } PostEditChange(); } }
void ASpotLight::EditorApplyScale(const FVector& DeltaScale, const FVector* PivotLocation, bool bAltDown, bool bShiftDown, bool bCtrlDown) { const FVector ModifiedScale = DeltaScale * ( AActor::bUsePercentageBasedScaling ? 10000.0f : 100.0f ); if ( bCtrlDown ) { FMath::ApplyScaleToFloat( SpotLightComponent->OuterConeAngle, ModifiedScale, 0.01f ); SpotLightComponent->OuterConeAngle = FMath::Min( 89.0f, SpotLightComponent->OuterConeAngle ); SpotLightComponent->InnerConeAngle = FMath::Min( SpotLightComponent->OuterConeAngle, SpotLightComponent->InnerConeAngle ); } else if ( bAltDown ) { FMath::ApplyScaleToFloat( SpotLightComponent->InnerConeAngle, ModifiedScale, 0.01f ); SpotLightComponent->InnerConeAngle = FMath::Min( 89.0f, SpotLightComponent->InnerConeAngle ); SpotLightComponent->OuterConeAngle = FMath::Max( SpotLightComponent->OuterConeAngle, SpotLightComponent->InnerConeAngle ); } else { FMath::ApplyScaleToFloat( SpotLightComponent->AttenuationRadius, ModifiedScale ); } PostEditChange(); }