Esempio n. 1
0
        public void FbxAnimLayer_Create_HasNamespacePrefix()
        {
            // given:
            var obj = new AnimLayer("asdf");

            // then:
            Assert.AreEqual("AnimLayer::", obj.GetNameSpacePrefix());
        }
Esempio n. 2
0
        public static int GetAnimLayerInt(AnimLayer animLayer)
        {
            int layerInt = (int)animLayer;

            // Hack, because we actually use two neck layers
            if (layerInt > 4)
            {
                layerInt++;
            }

            return(layerInt);
        }
Esempio n. 3
0
		public static int GetAnimLayerInt (AnimLayer animLayer)
		{
			int layerInt = (int) animLayer;
			
			// Hack, because we actually use two neck layers
			if (layerInt > 4)
			{
				layerInt ++;
			}
			
			return layerInt;
		}
Esempio n. 4
0
        public void AnimDataTest()
        {
            var input = new AnimLayer
            {
                Id       = 42,
                Duration = 900,
                Frames   = new short[] { 1, 2, 3, 4, 5 }
            };

            var serializer = new AnimLayerHandler();
            var output     = (AnimLayer)serializer.Reserialize(input);

            Assert.That(output.Id, Is.EqualTo(input.Id));
            Assert.That(output.Duration, Is.EqualTo(input.Duration));
            Assert.That(output.Frames, Is.EquivalentTo(input.Frames));
        }
Esempio n. 5
0
    override public void ShowGUI()
    {
        method = (AnimMethodChar)EditorGUILayout.EnumPopup("Method:", method);

        isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
        if (!isPlayer)
        {
            animChar = (Char)EditorGUILayout.ObjectField("Character:", animChar, typeof(Char), true);
        }

        if (method == AnimMethodChar.PlayCustom || method == AnimMethodChar.StopCustom)
        {
            clip = (AnimationClip)EditorGUILayout.ObjectField("Clip:", clip, typeof(AnimationClip), true);

            if (method == AnimMethodChar.PlayCustom)
            {
                layer = (AnimLayer)EditorGUILayout.EnumPopup("Layer:", layer);

                if (layer == AnimLayer.Base)
                {
                    EditorGUILayout.LabelField("Blend mode:", "Blend");
                    playModeBase = (AnimPlayModeBase)EditorGUILayout.EnumPopup("Play mode:", playModeBase);
                }
                else
                {
                    blendMode = (AnimationBlendMode)EditorGUILayout.EnumPopup("Blend mode:", blendMode);
                    playMode  = (AnimPlayMode)EditorGUILayout.EnumPopup("Play mode:", playMode);
                }
            }

            fadeTime = EditorGUILayout.Slider("Transition time:", fadeTime, 0f, 1f);
            willWait = EditorGUILayout.Toggle("Pause until finish?", willWait);
        }

        else if (method == AnimMethodChar.SetStandard)
        {
            clip     = (AnimationClip)EditorGUILayout.ObjectField("Clip:", clip, typeof(AnimationClip), true);
            standard = (AnimStandard)EditorGUILayout.EnumPopup("Change:", standard);
        }

        AfterRunningOption();
    }
Esempio n. 6
0
        public void Property_AttachCurveNode_IsAnimated()
        {
            // given:
            var node  = new Node("node");
            var acn   = new AnimCurveNode("acn");
            var x     = new AnimCurve("x");
            var scene = new Scene("scene");
            var layer = new AnimLayer("layer");
            var stack = new AnimStack("stack");

            var time = new FbxTime(0);
            var key  = new AnimCurveKey(time, 1.0f);

            x.KeyAdd(time, key);

            scene.ConnectSrcObject(node);
            scene.ConnectSrcObject(acn);
            scene.ConnectSrcObject(x);
            scene.ConnectSrcObject(layer);
            scene.ConnectSrcObject(stack);

            layer.ConnectSrcObject(acn);

            stack.ConnectSrcObject(layer);

            acn.AddChannel <double>("x", 1.0);
            acn.ConnectToChannel(x, 0U);

            // require:
            Assert.False(node.LclTranslation.IsAnimated());

            // when:
            node.LclTranslation.ConnectSrcObject(acn);

            // then:
            Assert.True(node.LclTranslation.IsAnimated());
        }
Esempio n. 7
0
    public bool IsPlaying(AnimLayer SpecialUpper)
    {
        var specialUpper = (int)SpecialUpper;

        return(!anim.GetCurrentAnimatorStateInfo(specialUpper).IsTag("idle") || anim.IsInTransition(specialUpper) && !anim.GetNextAnimatorStateInfo(specialUpper).IsTag("idle"));
    }
Esempio n. 8
0
        public void Property_MultipleStacks_GetCurveNodeOnlyGetsCurvesOnTheCurrentStack()
        {
            // given:
            var node  = new Node("node");
            var scene = new Scene("scene");

            var acn1   = new AnimCurveNode("acn1");
            var ac1    = new AnimCurve("ac1");
            var layer1 = new AnimLayer("layer1");
            var stack1 = new AnimStack("stack1");

            var acn2   = new AnimCurveNode("acn2");
            var ac2    = new AnimCurve("ac2");
            var layer2 = new AnimLayer("layer2");
            var stack2 = new AnimStack("stack2");

            var time = new FbxTime(0);
            var key  = new AnimCurveKey(time, 1.0f);

            ac1.KeyAdd(time, key);

            var time2 = new FbxTime(0);
            var key2  = new AnimCurveKey(time2, 1.0f);

            ac2.KeyAdd(time2, key2);

            scene.ConnectSrcObject(node);
            scene.ConnectSrcObject(acn1);
            scene.ConnectSrcObject(ac1);
            scene.ConnectSrcObject(layer1);
            scene.ConnectSrcObject(stack1);
            scene.ConnectSrcObject(acn2);
            scene.ConnectSrcObject(ac2);
            scene.ConnectSrcObject(layer2);
            scene.ConnectSrcObject(stack2);

            acn1.AddChannel <double>("x", 1.0);
            acn1.ConnectToChannel(ac1, 0U);
            layer1.ConnectSrcObject(acn1);
            stack1.ConnectSrcObject(layer1);

            acn2.AddChannel <double>("y", -1.0);
            acn2.ConnectToChannel(ac2, 0U);
            layer2.ConnectSrcObject(acn2);
            stack2.ConnectSrcObject(layer2);

            scene.SetCurrentAnimationStack(stack1);

            node.LclTranslation.ConnectSrcObject(acn1);
            node.LclRotation.ConnectSrcObject(acn2);

            // require:
            Assert.AreSame(stack1, scene.GetCurrentAnimationStack());
            Assert.AreSame(acn1, node.LclTranslation.GetCurveNode());
            Assert.Null(node.LclRotation.GetCurveNode());

            // when:
            scene.SetCurrentAnimationStack(stack2);

            // then:
            Assert.Null(node.LclTranslation.GetCurveNode());
            Assert.AreSame(acn2, node.LclRotation.GetCurveNode());
        }
Esempio n. 9
0
 void Start()
 {
     player           = Player.Instance;
     currentAnimLayer = AnimLayer.GROUND;
 }
Esempio n. 10
0
 private void SwitchToLayer(AnimLayer nextAnimLayer)
 {
     player.MyAnimator.SetLayerWeight((int)currentAnimLayer, 0);
     player.MyAnimator.SetLayerWeight((int)nextAnimLayer, 1);
     currentAnimLayer = nextAnimLayer;
 }
Esempio n. 11
0
 public bool IsPlaying(AnimLayer SpecialUpper)
 {
     var specialUpper = (int) SpecialUpper;
     return !anim.GetCurrentAnimatorStateInfo(specialUpper).IsTag("idle") || anim.IsInTransition(specialUpper) && !anim.GetNextAnimatorStateInfo(specialUpper).IsTag("idle");
 }
 public AnimLayerViewModel(AnimLayer layer)
 {
     name  = layer.Name;
     front = layer.Layer == Content.DrawLayer.Top;
 }