Ejemplo n.º 1
0
 public virtual FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)NativeMethods.FbxNodeAttribute_GetAttributeType(swigCPtr);
     if (NativeMethods.SWIGPendingException.Pending)
     {
         throw NativeMethods.SWIGPendingException.Retrieve();
     }
     return(ret);
 }
        override public void TestBasics(T layerContainer, FbxNodeAttribute.EType typ)
        {
            base.TestBasics(layerContainer, typ);

            int index = layerContainer.CreateLayer();

            Assert.GreaterOrEqual(index, 0);  // check an index is returned (-1 is error)

            // make sure doesn't crash and returns expected value
            Assert.IsNotNull(layerContainer.GetLayer(index));
            Assert.IsNull(layerContainer.GetLayer(int.MinValue));
            Assert.IsNull(layerContainer.GetLayer(int.MaxValue));
            Assert.AreEqual(layerContainer.GetLayerCount(), 1);
            Assert.AreEqual(layerContainer.GetLayerCount(FbxLayerElement.EType.eUnknown), 0);
            Assert.AreEqual(layerContainer.GetLayerCount(FbxLayerElement.EType.eUnknown, true), 0);
        }
        virtual public void TestBasics(T attr, FbxNodeAttribute.EType typ)
        {
            Assert.AreEqual(typ, attr.GetAttributeType());
            Assert.AreEqual(attr.Color, attr.FindProperty(FbxNodeAttribute.sColor));
            TestGetter(FbxNodeAttribute.sDefaultColor);
            Assert.AreEqual(0, attr.GetNodeCount());

            var node1 = FbxNode.Create(Manager, "node1");
            var node2 = FbxNode.Create(Manager, "node2");

            node1.SetNodeAttribute(attr);
            node2.SetNodeAttribute(attr);
            Assert.AreEqual(2, attr.GetNodeCount());
            Assert.AreEqual(node1, attr.GetNode());
            Assert.AreEqual(node2, attr.GetNode(1));
        }
        override public void TestBasics(T fbxGeometry, FbxNodeAttribute.EType typ)
        {
            base.TestBasics(fbxGeometry, typ);

            int origCount = fbxGeometry.GetDeformerCount();

            // test get blendshape deformer
            FbxBlendShape blendShape = FbxBlendShape.Create(Manager, "blendShape");
            int           index      = fbxGeometry.AddDeformer(blendShape);

            Assert.GreaterOrEqual(index, 0);
            origCount++;

            // TODO: (UNI-19581): If we add the blendShape after the skin, then the below
            //                    tests fail.
            Assert.AreEqual(blendShape, fbxGeometry.GetBlendShapeDeformer(index));
            Assert.AreEqual(blendShape, fbxGeometry.GetBlendShapeDeformer(index, null));
            Assert.AreEqual(blendShape, fbxGeometry.GetDeformer(index, FbxDeformer.EDeformerType.eBlendShape));
            Assert.AreEqual(1, fbxGeometry.GetDeformerCount(FbxDeformer.EDeformerType.eBlendShape));

            // test add deformer
            FbxSkin skin      = FbxSkin.Create(Manager, "skin");
            int     skinIndex = fbxGeometry.AddDeformer(skin);

            Assert.GreaterOrEqual(skinIndex, 0);
            Assert.AreEqual(skin, fbxGeometry.GetDeformer(skinIndex));

            // test get invalid deformer index doesn't crash
            fbxGeometry.GetDeformer(-1, new FbxStatus());
            fbxGeometry.GetDeformer(int.MaxValue, new FbxStatus());

            // test get deformer null FbxStatus
            fbxGeometry.GetDeformer(0, null);

            // check right index but wrong type
            Assert.IsNull(fbxGeometry.GetDeformer(skinIndex, FbxDeformer.EDeformerType.eVertexCache, null));

            Assert.AreEqual(origCount + 1, fbxGeometry.GetDeformerCount());

            // test add null deformer
            Assert.That(() => fbxGeometry.AddDeformer(null), Throws.Exception.TypeOf <System.ArgumentNullException>());

            // test add invalid deformer
            skin.Destroy();
            Assert.That(() => fbxGeometry.AddDeformer(skin), Throws.Exception.TypeOf <System.ArgumentNullException>());
        }
Ejemplo n.º 5
0
        override public void TestBasics(T geometryBase, FbxNodeAttribute.EType typ)
        {
            base.TestBasics(geometryBase, typ);

            geometryBase.InitControlPoints(24);
            Assert.AreEqual(geometryBase.GetControlPointsCount(), 24);
            geometryBase.SetControlPointAt(new FbxVector4(1, 2, 3, 4), 0);
            Assert.AreEqual(new FbxVector4(1, 2, 3, 4), geometryBase.GetControlPointAt(0));

            int layerId0 = geometryBase.CreateLayer();
            int layerId1 = geometryBase.CreateLayer();
            var layer0   = geometryBase.GetLayer(layerId0);
            var layer1   = geometryBase.GetLayer(layerId1);

            Assert.AreNotEqual(layer0, layer1);

            // Fbx crashes setting a negative control point index, so we do some testing:
            Assert.That(() => geometryBase.SetControlPointAt(new FbxVector4(), -1), Throws.Exception.TypeOf <System.ArgumentOutOfRangeException>());

            // It doesn't crash with past-the-end, it resizes; make sure we don't block that.
            geometryBase.SetControlPointAt(new FbxVector4(1, 2, 3, 4), 50); // does not throw
            Assert.AreEqual(geometryBase.GetControlPointsCount(), 51);

            // It doesn't crash getting negative nor past-the-end.
            // The vector returned is documented to be (0,0,0,1) but actually
            // seems to be (0,0,0,epsilon).
            geometryBase.GetControlPointAt(-1);
            geometryBase.GetControlPointAt(geometryBase.GetControlPointsCount() + 1);

            var elementNormal = geometryBase.CreateElementNormal();

            Assert.IsInstanceOf <FbxLayerElementNormal> (elementNormal);

            var elementTangent = geometryBase.CreateElementTangent();

            Assert.IsInstanceOf <FbxLayerElementTangent> (elementTangent);
        }
Ejemplo n.º 6
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)fbx_wrapperPINVOKE.FbxLayerContainer_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 7
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)fbx_wrapperPINVOKE.FbxTrimNurbsSurface_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 8
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)FbxWrapperNativePINVOKE.FbxBoundary_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 9
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)FbxWrapperNativePINVOKE.FbxOpticalReference_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 10
0
 public virtual FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)fbx_wrapperPINVOKE.FbxNodeAttribute_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 11
0
        public FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute.EType pAttributeType)
        {
            FbxClassId ret = new FbxClassId(FbxWrapperNativePINVOKE.FbxScene_ConvertAttributeTypeToClassID(swigCPtr, (int)pAttributeType), true);

            return(ret);
        }
Ejemplo n.º 12
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)fbx_wrapperPINVOKE.FbxCameraSwitcher_GetAttributeType(swigCPtr);
     return(ret);
 }
Ejemplo n.º 13
0
        public SWIGTYPE_p_FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute.EType pAttributeType)
        {
            SWIGTYPE_p_FbxClassId ret = new SWIGTYPE_p_FbxClassId(fbx_wrapperPINVOKE.FbxScene_ConvertAttributeTypeToClassID(swigCPtr, (int)pAttributeType), true);

            return(ret);
        }
Ejemplo n.º 14
0
 public override FbxNodeAttribute.EType GetAttributeType()
 {
     FbxNodeAttribute.EType ret = (FbxNodeAttribute.EType)fbx_wrapperPINVOKE.FbxSkeleton_GetAttributeType(swigCPtr);
     return(ret);
 }