Beispiel #1
0
        public void FbxObject_TypedDisconnectAllSrcObjectWithInheritance_DisconnectsAllSrcObjectOfThatType()
        {
            // given:
            var obj   = new FbxObject("asdf");
            var mesh1 = new FbxMesh("mesh1");
            var node  = new FbxNode("node");
            var light = new FbxLight("light");

            obj.ConnectSrcObject(mesh1);
            obj.ConnectSrcObject(node);
            obj.ConnectSrcObject(light);

            // require:
            Assert.AreEqual(3, obj.GetSrcObjectCount());
            Assert.AreSame(mesh1, obj.GetSrcObject(0));
            Assert.AreSame(node, obj.GetSrcObject(1));
            Assert.AreSame(light, obj.GetSrcObject(2));

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxLight>());
            Assert.AreEqual(2, obj.GetSrcObjectCount <FbxNodeAttribute>());

            Assert.AreEqual(1, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(1, light.GetDstObjectCount());

            // when:
            var ret = obj.DisconnectAllSrcObject <FbxNodeAttribute>();

            // then:
            Assert.True(ret);
            Assert.AreEqual(1, obj.GetSrcObjectCount());
            Assert.AreSame(node, obj.GetSrcObject());
            Assert.AreSame(node, obj.GetSrcObject(0));

            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxLight>());
            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxNodeAttribute>());

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>(0));

            Assert.AreEqual(0, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(0, light.GetDstObjectCount());
        }
Beispiel #2
0
        public void FbxObject_TypedDisconnectAllSrcObject_DisconnectsAllSrcObjectOfThatType()
        {
            // given:
            var obj   = new FbxObject("asdf");
            var mesh1 = new FbxMesh("mesh1");
            var node  = new FbxNode("node");
            var mesh2 = new FbxMesh("mesh2");

            obj.ConnectSrcObject(mesh1);
            obj.ConnectSrcObject(node);
            obj.ConnectSrcObject(mesh2);

            // require:
            Assert.AreEqual(3, obj.GetSrcObjectCount());
            Assert.AreSame(mesh1, obj.GetSrcObject(0));
            Assert.AreSame(node, obj.GetSrcObject(1));
            Assert.AreSame(mesh2, obj.GetSrcObject(2));

            Assert.AreEqual(2, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());

            Assert.AreEqual(1, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(1, mesh2.GetDstObjectCount());

            // when:
            var ret = obj.DisconnectAllSrcObject <FbxMesh>();

            // then:
            Assert.True(ret);
            Assert.AreEqual(1, obj.GetSrcObjectCount());
            Assert.AreSame(node, obj.GetSrcObject());
            Assert.AreSame(node, obj.GetSrcObject(0));

            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxMesh>());

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>(0));

            Assert.AreEqual(0, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(0, mesh2.GetDstObjectCount());
        }