void AnimationAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("AnimationAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("animationMode")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetAnimationMode(AnimationMode(ival)); } else if(node->GetNodeType() == STRING_NODE) { AnimationMode value; if(AnimationMode_FromString(node->AsString(), value)) SetAnimationMode(value); } } if((node = searchNode->GetNode("pipelineCachingMode")) != 0) SetPipelineCachingMode(node->AsBool()); if((node = searchNode->GetNode("frameIncrement")) != 0) SetFrameIncrement(node->AsInt()); if((node = searchNode->GetNode("timeout")) != 0) SetTimeout(node->AsInt()); if((node = searchNode->GetNode("playbackMode")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetPlaybackMode(PlaybackMode(ival)); } else if(node->GetNodeType() == STRING_NODE) { PlaybackMode value; if(PlaybackMode_FromString(node->AsString(), value)) SetPlaybackMode(value); } } }
void USkeletalMeshComponent::LoadedFromAnotherClass(const FName& OldClassName) { Super::LoadedFromAnotherClass(OldClassName); if(GetLinkerUE4Version() < VER_UE4_REMOVE_SINGLENODEINSTANCE) { static FName SingleAnimSkeletalComponent_NAME(TEXT("SingleAnimSkeletalComponent")); if(OldClassName == SingleAnimSkeletalComponent_NAME) { SetAnimationMode(EAnimationMode::Type::AnimationSingleNode); // support old compatibility code that changed variable name if (SequenceToPlay_DEPRECATED!=NULL && AnimToPlay_DEPRECATED== NULL) { AnimToPlay_DEPRECATED = SequenceToPlay_DEPRECATED; SequenceToPlay_DEPRECATED = NULL; } AnimationData.AnimToPlay = AnimToPlay_DEPRECATED; AnimationData.bSavedLooping = bDefaultLooping_DEPRECATED; AnimationData.bSavedPlaying = bDefaultPlaying_DEPRECATED; AnimationData.SavedPosition = DefaultPosition_DEPRECATED; AnimationData.SavedPlayRate = DefaultPlayRate_DEPRECATED; MarkPackageDirty(); } } }
void USkeletalMeshComponent::PlayAnimation(class UAnimationAsset* NewAnimToPlay, bool bLooping) { SetAnimationMode(EAnimationMode::AnimationSingleNode); SetAnimation(NewAnimToPlay); Play(bLooping); }