Describes a blob of exported scene data. Blobs can be nested - each blob may reference another blob, which in turn can reference another and so on. This is used to allow exporters to write more than one output for a given scene, such as material files. Existence of such files depends on the format.
The stream representation of an ExportDataBlob is as follows: String: Name of the Blob int: Length of Binary Data byte[]: Binary Data bool: If has next data blob String: Name of nested blob int: Length of nested blob binary data byte[]: Nested blob binary data bool: If nested blob has next data blob ....
        /// <summary>
        /// Creates a new ExportDataBlob.
        /// </summary>
        /// <param name="dataBlob">Unmanaged structure.</param>
        internal ExportDataBlob(ref AiExportDataBlob dataBlob)
        {
            m_name = dataBlob.Name.GetString();
            m_data = MemoryHelper.MarshalArray<byte>(dataBlob.Data, dataBlob.Size.ToInt32());
            m_next = null;

            if(dataBlob.NextBlob != IntPtr.Zero) {
                AiExportDataBlob nextBlob = MemoryHelper.MarshalStructure<AiExportDataBlob>(dataBlob.NextBlob);
                m_next = new ExportDataBlob(ref nextBlob);
            }
        }
Exemple #2
0
        private static void WriteBlob(ExportDataBlob blob, BinaryWriter writer)
        {
            if(blob == null || writer == null)
                return;

            bool hasNext = blob.NextBlob != null;

            writer.Write(blob.Name);
            writer.Write(blob.Data.Length);
            writer.Write(blob.Data);
            writer.Write(hasNext);

            if(hasNext)
                WriteBlob(blob.NextBlob, writer);
        }
Exemple #3
0
        /// <summary>
        /// Creates a new ExportDataBlob.
        /// </summary>
        /// <param name="dataBlob">Unmanaged structure.</param>
        internal ExportDataBlob(ref AiExportDataBlob dataBlob)
        {
            m_name = dataBlob.Name.GetString();

            if(dataBlob.Size.ToUInt32() > 0 && dataBlob.Data != IntPtr.Zero)
                m_data = MemoryHelper.FromNativeArray<byte>(dataBlob.Data, (int) dataBlob.Size.ToUInt32());

            m_next = null;

            if(dataBlob.NextBlob != IntPtr.Zero)
            {
                AiExportDataBlob nextBlob = MemoryHelper.MarshalStructure<AiExportDataBlob>(dataBlob.NextBlob);
                m_next = new ExportDataBlob(ref nextBlob);
            }
        }
Exemple #4
0
        private static ExportDataBlob ReadBlob(BinaryReader reader)
        {
            if(reader == null)
                return null;

            String name = reader.ReadString();
            int count = reader.ReadInt32();
            byte[] data = reader.ReadBytes(count);
            bool hasNext = reader.ReadBoolean();

            ExportDataBlob blob = new ExportDataBlob(name, data);

            if(hasNext)
                blob.m_next = ReadBlob(reader);

            return blob;
        }
Exemple #5
0
        private static ExportDataBlob ReadBlob(BinaryReader reader) {
            if(reader == null)
                return null;

            String name = reader.ReadString();
            int count = reader.ReadInt32();
            byte[] data = reader.ReadBytes(count);
            bool hasNext = reader.ReadBoolean();

            ExportDataBlob blob = new ExportDataBlob(name, data);

            if(hasNext)
                blob.m_next = ReadBlob(reader);

            return blob;
        }
Exemple #6
0
        private static void WriteBlob(ExportDataBlob blob, BinaryWriter writer) {
            if(blob == null || writer == null)
                return;

            bool hasNext = blob.NextBlob != null;

            writer.Write(blob.Name);
            writer.Write(blob.Data.Length);
            writer.Write(blob.Data);
            writer.Write(hasNext);

            if(hasNext)
                WriteBlob(blob.NextBlob, writer);
        }
Exemple #7
0
 /// <summary>
 /// Creates a new ExportDataBlob.
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="data">Data</param>
 internal ExportDataBlob(String name, byte[] data) {
     m_name = name;
     m_data = data;
     m_next = null;
 }
Exemple #8
0
 /// <summary>
 /// Creates a new ExportDataBlob.
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="data">Data</param>
 internal ExportDataBlob(String name, byte[] data)
 {
     m_name = name;
     m_data = data;
     m_next = null;
 }