Skip to content

Commit

Permalink
Update test characters
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed Jun 22, 2020
1 parent 30a0e3e commit 3efda46
Show file tree
Hide file tree
Showing 46 changed files with 40 additions and 39 deletions.
Binary file modified Content/Tests/BasicMaterial.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Diffuse.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Ganfault.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Glow.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Mask.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Material.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Normal.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Skeleton.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Ganfault/Specular.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Character.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Diffuse.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Mask.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Material.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Normal.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Skeleton.uasset
Binary file not shown.
Binary file removed Content/Tests/Characters/Kachujin/Specular.uasset
Binary file not shown.
Binary file added Content/Tests/Characters/Prototype.uasset
Binary file not shown.
Binary file added Content/Tests/Characters/PrototypeFemale.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/Tests/Characters/PrototypeSkeleton.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Tests/Tests.umap
Binary file not shown.
Binary file modified Content/Tests/TextureMaterial.uasset
Binary file not shown.
6 changes: 3 additions & 3 deletions Source/Managed/Framework/Codegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ internal static class Shared {
AnimationInstance.montageGetPlayRate = GenerateOptimizedFunction<AnimationInstance.MontageGetPlayRateFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageGetPosition = GenerateOptimizedFunction<AnimationInstance.MontageGetPositionFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageGetBlendTime = GenerateOptimizedFunction<AnimationInstance.MontageGetBlendTimeFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageSetPlayRate = GenerateOptimizedFunction<AnimationInstance.MontageSetPlayRateFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageGetCurrentSection = GenerateOptimizedFunction<AnimationInstance.MontageGetCurrentSectionFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageSetPlayRate = GenerateOptimizedFunction<AnimationInstance.MontageSetPlayRateFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageSetPosition = GenerateOptimizedFunction<AnimationInstance.MontageSetPositionFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montageSetNextSection = GenerateOptimizedFunction<AnimationInstance.MontageSetNextSectionFunction>(animationInstanceFunctions[head++]);
AnimationInstance.montagePlay = GenerateOptimizedFunction<AnimationInstance.MontagePlayFunction>(animationInstanceFunctions[head++]);
Expand Down Expand Up @@ -1265,8 +1265,8 @@ partial class AnimationInstance {
internal delegate float MontageGetPlayRateFunction(IntPtr animationInstance, IntPtr montage);
internal delegate float MontageGetPositionFunction(IntPtr animationInstance, IntPtr montage);
internal delegate float MontageGetBlendTimeFunction(IntPtr animationInstance, IntPtr montage);
internal delegate void MontageSetPlayRateFunction(IntPtr animationInstance, IntPtr montage, float value);
internal delegate void MontageGetCurrentSectionFunction(IntPtr animationInstance, IntPtr montage, byte[] sectionName);
internal delegate void MontageSetPlayRateFunction(IntPtr animationInstance, IntPtr montage, float value);
internal delegate void MontageSetPositionFunction(IntPtr animationInstance, IntPtr montage, float position);
internal delegate void MontageSetNextSectionFunction(IntPtr animationInstance, IntPtr montage, string sectionToChange, string nextSection);
internal delegate float MontagePlayFunction(IntPtr animationInstance, IntPtr montage, float playRate, float timeToStartMontageAt, Bool stopAllMontages);
Expand All @@ -1281,8 +1281,8 @@ partial class AnimationInstance {
internal static MontageGetPlayRateFunction montageGetPlayRate;
internal static MontageGetPositionFunction montageGetPosition;
internal static MontageGetBlendTimeFunction montageGetBlendTime;
internal static MontageSetPlayRateFunction montageSetPlayRate;
internal static MontageGetCurrentSectionFunction montageGetCurrentSection;
internal static MontageSetPlayRateFunction montageSetPlayRate;
internal static MontageSetPositionFunction montageSetPosition;
internal static MontageSetNextSectionFunction montageSetNextSection;
internal static MontagePlayFunction montagePlay;
Expand Down
20 changes: 10 additions & 10 deletions Source/Managed/Framework/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4389,16 +4389,6 @@ public partial class AnimationInstance : IEquatable<AnimationInstance> {
return montageGetBlendTime(Pointer, montage.Pointer);
}

/// <summary>
/// Sets the current play rate of the animation montage
/// </summary>
public void MontageSetPlayRate(AnimationMontage montage, float value) {
if (montage == null)
throw new ArgumentNullException(nameof(montage));

montageSetPlayRate(Pointer, montage.Pointer, value);
}

/// <summary>
/// Returns the name of the current animation montage section
/// </summary>
Expand All @@ -4413,6 +4403,16 @@ public partial class AnimationInstance : IEquatable<AnimationInstance> {
return Encoding.UTF8.GetString(stringBuffer).TrimFromZero();
}

/// <summary>
/// Sets the current play rate of the animation montage
/// </summary>
public void MontageSetPlayRate(AnimationMontage montage, float value) {
if (montage == null)
throw new ArgumentNullException(nameof(montage));

montageSetPlayRate(Pointer, montage.Pointer, value);
}

/// <summary>
/// Sets the current position of the animation montage
/// </summary>
Expand Down
41 changes: 21 additions & 20 deletions Source/Managed/Tests/SkeletalMeshes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,35 @@ public static class SkeletalMeshes {

World.GetFirstPlayerController().SetViewTarget(World.GetActor<Camera>("MainCamera"));

Actor kachujin = new Actor("Kachujin");
SkeletalMeshComponent kachujinSkeletalMeshComponent = new SkeletalMeshComponent(kachujin);
SkeletalMesh kachujinSkeletalMesh = SkeletalMesh.Load("/Game/Tests/Characters/Kachujin/SkeletalMesh");
Actor prototypeLeft = new Actor("prototypeLeft");
SkeletalMeshComponent prototypeLeftMeshComponent = new SkeletalMeshComponent(prototypeLeft);
SkeletalMesh prototypeLeftMesh = SkeletalMesh.Load("/Game/Tests/Characters/Prototype");

kachujinSkeletalMeshComponent.SetSkeletalMesh(kachujinSkeletalMesh);
kachujinSkeletalMeshComponent.SetWorldLocation(new Vector3(-700.0f, -70.0f, -100.0f));
kachujinSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
kachujinSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
kachujinSkeletalMeshComponent.PlayAnimation(AnimationSequence.Load("/Game/Tests/Characters/Kachujin/AnimationSequenceSwordSwing"), true);
prototypeLeftMeshComponent.SetSkeletalMesh(prototypeLeftMesh);
prototypeLeftMeshComponent.SetWorldLocation(new Vector3(-700.0f, -70.0f, -100.0f));
prototypeLeftMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
prototypeLeftMeshComponent.SetAnimationMode(AnimationMode.Asset);
prototypeLeftMeshComponent.PlayAnimation(AnimationSequence.Load("/Game/Tests/Characters/Animations/IdleAnimationSequence"), true);

Assert.IsTrue(kachujinSkeletalMeshComponent.IsPlaying);
Assert.IsTrue(prototypeLeftMeshComponent.IsPlaying);

Actor ganfault = new Actor("Ganfault");
SkeletalMeshComponent ganfaultSkeletalMeshComponent = new SkeletalMeshComponent(ganfault);
SkeletalMesh ganfaultSkeletalMesh = SkeletalMesh.Load("/Game/Tests/Characters/Ganfault/SkeletalMesh");
Actor prototypeRight = new Actor("prototypeRight");
SkeletalMeshComponent prototypeRightSkeletalMeshComponent = new SkeletalMeshComponent(prototypeRight);
SkeletalMesh prototypeRightSkeletalMesh = SkeletalMesh.Load("/Game/Tests/Characters/Prototype");

ganfaultSkeletalMeshComponent.SetSkeletalMesh(ganfaultSkeletalMesh);
ganfaultSkeletalMeshComponent.SetWorldLocation(new Vector3(-700.0f, 70.0f, -100.0f));
ganfaultSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
ganfaultSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
prototypeRightSkeletalMeshComponent.SetSkeletalMesh(prototypeRightSkeletalMesh);
prototypeRightSkeletalMeshComponent.SetWorldLocation(new Vector3(-700.0f, 70.0f, -100.0f));
prototypeRightSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
prototypeRightSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
prototypeRightSkeletalMeshComponent.CreateAndSetMaterialInstanceDynamic(0).SetVectorParameterValue("AccentColor", new LinearColor(0.0f, 0.5f, 1.0f));

AnimationMontage ganfaultAnimationMontage = AnimationMontage.Load("/Game/Tests/Characters/Ganfault/AnimationMontage");
AnimationMontage prototypeRightAnimationMontage = AnimationMontage.Load("/Game/Tests/Characters/Animations/RunAnimationMontage");

ganfaultSkeletalMeshComponent.PlayAnimation(ganfaultAnimationMontage, true);
prototypeRightSkeletalMeshComponent.PlayAnimation(prototypeRightAnimationMontage, true);

AnimationInstance ganfaultAnimationInstance = ganfaultSkeletalMeshComponent.GetAnimationInstance();
AnimationInstance prototypeRightAnimationInstance = prototypeRightSkeletalMeshComponent.GetAnimationInstance();

Assert.IsTrue(ganfaultAnimationInstance.MontageIsPlaying(ganfaultAnimationMontage));
Assert.IsTrue(prototypeRightAnimationInstance.MontageIsPlaying(prototypeRightAnimationMontage));
}

public static void OnEndPlay() {
Expand Down
2 changes: 1 addition & 1 deletion Source/Native/Source/UnrealCLR/Private/UnrealCLR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ void UnrealCLR::Module::StartupModule() {
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageGetPlayRate;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageGetPosition;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageGetBlendTime;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageSetPlayRate;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageGetCurrentSection;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageSetPlayRate;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageSetPosition;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontageSetNextSection;
Shared::AnimationInstanceFunctions[head++] = &UnrealCLRFramework::AnimationInstance::MontagePlay;
Expand Down
8 changes: 4 additions & 4 deletions Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,16 +1238,16 @@ namespace UnrealCLRFramework {
return AnimationInstance->Montage_GetBlendTime(Montage);
}

void MontageSetPlayRate(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Value) {
AnimationInstance->Montage_SetPlayRate(Montage, Value);
}

void MontageGetCurrentSection(UAnimInstance* AnimationInstance, UAnimMontage* Montage, char* SectionName) {
const char* sectionName = TCHAR_TO_ANSI(*AnimationInstance->Montage_GetCurrentSection(Montage).ToString());

UnrealCLR::Utility::Strcpy(SectionName, sectionName, UnrealCLR::Utility::Strlen(sectionName));
}

void MontageSetPlayRate(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Value) {
AnimationInstance->Montage_SetPlayRate(Montage, Value);
}

void MontageSetPosition(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Position) {
AnimationInstance->Montage_SetPosition(Montage, Position);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Native/Source/UnrealCLR/Public/UnrealCLRFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ namespace UnrealCLRFramework {
static float MontageGetPlayRate(UAnimInstance* AnimationInstance, UAnimMontage* Montage);
static float MontageGetPosition(UAnimInstance* AnimationInstance, UAnimMontage* Montage);
static float MontageGetBlendTime(UAnimInstance* AnimationInstance, UAnimMontage* Montage);
static void MontageSetPlayRate(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Value);
static void MontageGetCurrentSection(UAnimInstance* AnimationInstance, UAnimMontage* Montage, char* SectionName);
static void MontageSetPlayRate(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Value);
static void MontageSetPosition(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float Position);
static void MontageSetNextSection(UAnimInstance* AnimationInstance, UAnimMontage* Montage, const char* SectionToChange, const char* NextSection);
static float MontagePlay(UAnimInstance* AnimationInstance, UAnimMontage* Montage, float PlayRate, float TimeToStartMontageAt, bool StopAllMontages);
Expand Down

0 comments on commit 3efda46

Please sign in to comment.