public void FbxEporter() { //Generate an FBX document FbxDocument fbxDoc = new FbxDocument(); FbxNode t; //FBX Header Extension FbxHeaderExtension he = new FbxHeaderExtension(); t = he.getFBXNode(); fbxDoc.Nodes.Add(t); t = new FbxNode(); t.Name = "Test"; t.Value = (new List <int>() { 0, 1, 2, 3, 4, 5, 6 }).ToArray(); fbxDoc.Nodes.Add(t); //Try to export FileStream fs = new FileStream("test.fbx", FileMode.Create); FbxAsciiWriter writer = new FbxAsciiWriter(fs); writer.Write(fbxDoc); fs.Close(); }
public FbxDocument GetDocument(int pIndex) { global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxManager_GetDocument(swigCPtr, pIndex); FbxDocument ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxDocument(cPtr, false); return(ret); }
public FbxGeometry(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; FbxDocument.ObjectCache.Add(this, Id); Id = new FbxObjectId { Id = (long)node.Properties[0] }; foreach (var child in node.Childs) { switch (child.Name) { case "Vertices": ObjectGeometryVertices = new FbxObjectGeometryVertices(child); break; case "PolygonVertexIndex": FbxObjectGeometryPolygonMap = new FbxObjectGeometryPolygonMap(child); ObjectGeometryPolygonVertexIndex = new FbxObjectGeometryPolygonVertexIndex(child, FbxObjectGeometryPolygonMap); break; case "LayerElementNormal": Normal = new FbxObjectGeometryLayerElementNormal(child, FbxObjectGeometryPolygonMap); break; case "LayerElementUV": UV = new FbxObjectGeometryLayerElementUv(child); break; case "LayerElementMaterial": MaterialIndex = new FbxObjectGeometryLayerElementMaterial(child); break; } } }
public new static FbxDocument Create(FbxObject pContainer, string pName) { global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxDocument_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName); FbxDocument ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxDocument(cPtr, false); return(ret); }
public FbxDocument GetRootDocument() { global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxObject_GetRootDocument(swigCPtr); FbxDocument ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxDocument(cPtr, false); return(ret); }
public bool Equals(FbxDocument other) { if (object.ReferenceEquals(other, null)) { return(false); } return(this.swigCPtr.Handle.Equals(other.swigCPtr.Handle)); }
public int GetReferencingObjects(FbxDocument pFromDoc, SWIGTYPE_p_FbxArrayT_FbxObject_p_t pReferencingObjects) { int ret = FbxWrapperNativePINVOKE.FbxDocument_GetReferencingObjects(swigCPtr, FbxDocument.getCPtr(pFromDoc), SWIGTYPE_p_FbxArrayT_FbxObject_p_t.getCPtr(pReferencingObjects)); if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending) { throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool GetResolvedUrl(string pUrl, FbxDocument pDoc, FbxString pResolvedPath) { bool ret = FbxWrapperNativePINVOKE.FbxXRefManager_GetResolvedUrl__SWIG_1(swigCPtr, pUrl, FbxDocument.getCPtr(pDoc), FbxString.getCPtr(pResolvedPath)); if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending) { throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool GetFirstMatchingUrl(string pPrefix, string pOptExt, FbxDocument pDoc, FbxString pResolvedPath) { bool ret = FbxWrapperNativePINVOKE.FbxXRefManager_GetFirstMatchingUrl(swigCPtr, pPrefix, pOptExt, FbxDocument.getCPtr(pDoc), FbxString.getCPtr(pResolvedPath)); if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending) { throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public int GetReferencedObjects(FbxDocument pToDoc, SWIGTYPE_p_FbxArrayT_FbxObject_p_t pReferencedObjects) { int ret = fbx_wrapperPINVOKE.FbxDocument_GetReferencedObjects(swigCPtr, FbxDocument.getCPtr(pToDoc), SWIGTYPE_p_FbxArrayT_FbxObject_p_t.getCPtr(pReferencedObjects)); if (fbx_wrapperPINVOKE.SWIGPendingException.Pending) { throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public FbxObjectMaterial(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; Id = new FbxObjectId { Id = (long)node.Properties[0] }; Name = (string)node.Properties[1]; FbxDocument.ObjectCache.Add(this, Id); }
public bool Import(FbxDocument pDocument) { bool ret = NativeMethods.FbxImporter_Import(swigCPtr, FbxDocument.getCPtr(pDocument)); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } return(ret); }
public FbxObjectTexture(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; Id = new FbxObjectId { Id = (long)node.Properties[0] }; Name = (string)node.Properties[1]; RelativeFilename = (string)node.GetChild("RelativeFilename").Properties[0]; FbxDocument.ObjectCache.Add(this, Id); }
public new static FbxDocument Create(FbxObject pContainer, string pName) { global::System.IntPtr cPtr = NativeMethods.FbxDocument_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName); FbxDocument ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxDocument(cPtr, false); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Writes an FBX document /// </summary> /// <param name="document">The top level document node</param> /// <param name="path"></param> public static void WriteAscii(FbxDocument document, string path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } using (var stream = new FileStream(path, FileMode.Create)) { var writer = new FbxAsciiWriter(stream); writer.Write(document); } }
public void TestCrashOnGetDocumentInfo() { using (var doc = FbxDocument.Create(Manager, "")) { using (var docInfo = CreateObject()) { doc.SetDocumentInfo(docInfo); docInfo.Destroy(); // Crash! Normally FBX disconnects when you destroy an // object, but not so for the link between a document and // its document info. doc.GetDocumentInfo().Url.Get(); } } }
public void TestInitializeValidFilenameOnly() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter. Use default file type and IO settings. bool exportStatus = m_exporter.Initialize(filename); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); Assert.IsTrue(File.Exists(filename)); }
public void TestInitializeFileFormatNegative() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter. Pass it a negative file format different than -1. bool exportStatus = m_exporter.Initialize(filename, int.MinValue); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); Assert.IsTrue(File.Exists(filename)); }
public void TestInitializeFileFormatInvalid() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter. Pass it a file format that's not valid. bool exportStatus = m_exporter.Initialize(filename, int.MaxValue); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsFalse(status); Assert.IsFalse(File.Exists(filename)); }
public void TestInitializeValidFileFormat() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter. Use a valid non-default file format. bool exportStatus = m_exporter.Initialize(filename, 1); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); Assert.IsTrue(File.Exists(filename)); }
public void TestInitializeNullIOSettings() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter with explicit null IO settings (which is // also the default). bool exportStatus = m_exporter.Initialize(filename, -1, null); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); Assert.IsTrue(File.Exists(filename)); }
public void TestExportEmptyFbxDocument() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); string filename = GetRandomFilename(m_testFolder); // Initialize the exporter. bool exportStatus = m_exporter.Initialize(filename, -1, Manager.GetIOSettings()); Assert.IsTrue(exportStatus); m_exporter.SetProgressCallback((float a, string b) => true); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); Assert.IsTrue(File.Exists(filename)); }
public void TestInitializeInvalidFilenameOnly() { FbxDocument emptyDoc = FbxDocument.Create(Manager, "empty"); // Build the filename without the extension. string filename = GetRandomFilename(m_testFolder, false); // Initialize the exporter. Use default file type and IO settings. bool exportStatus = m_exporter.Initialize(filename); Assert.IsTrue(exportStatus); bool status = m_exporter.Export(emptyDoc); Assert.IsTrue(status); // FbxSdk doesn't create a file in this situation Assert.IsFalse(File.Exists(filename)); }
public FbxObject(FbxDocument fbxDocument, FbxData data) { var objNode = data.Node.GetChild("Objects"); foreach (var child in objNode.Childs) { switch (child.Name) { case "Geometry": Geometry.Add(new FbxGeometry(fbxDocument, child)); break; case "Material": Materials.Add(new FbxObjectMaterial(fbxDocument, child)); break; case "Texture": Textures.Add(new FbxObjectTexture(fbxDocument, child)); break; } } }
/// <summary> /// /// </summary> /// <param name="document"></param> public FbxHelper(FbxDocument document) { // set document _document = document; // get and store sfbx version var ver = _document.GetNodesByName("FBXVersion"); if (ver.Length > 0) { Version = (int)ver[0].Value; } else { Version = -1; } // get connectors var connections = _document.GetNodesByName("C"); if (connections.Length == 0) { connections = _document.GetNodesByName("Connect"); } // use strings for backwards compatibility foreach (var oo in connections) { if (!Connections.ContainsKey(oo.Properties[1].ToString())) { Connections.Add(oo.Properties[1].ToString(), new List <string>()); } Connections[oo.Properties[1].ToString()].Add(oo.Properties[2].ToString()); } }
public virtual bool Read(FbxDocument pDocument) { bool ret = fbx_wrapperPINVOKE.FbxReader_Read(swigCPtr, FbxDocument.getCPtr(pDocument)); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FbxDocument obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public bool Export(FbxDocument pDocument, FbxIO pFbxObject) { bool ret = FbxWrapperNativePINVOKE.FbxExporter_Export__SWIG_2(swigCPtr, FbxDocument.getCPtr(pDocument), FbxIO.getCPtr(pFbxObject)); return(ret); }
public bool Export(FbxDocument pDocument, bool pNonBlocking) { bool ret = FbxWrapperNativePINVOKE.FbxExporter_Export__SWIG_0(swigCPtr, FbxDocument.getCPtr(pDocument), pNonBlocking); return(ret); }
public virtual bool Write(FbxDocument pDocument) { bool ret = fbx_wrapperPINVOKE.FbxWriter_Write(swigCPtr, FbxDocument.getCPtr(pDocument)); return(ret); }