Ejemplo n.º 1
0
 public readonly int FindIndexAll(ReadOnlySpan <byte> nodeName, Span <int> buffer) => FbxNode_.FindIndexAll(Pointer->ChildrenInternal, nodeName, buffer);
Ejemplo n.º 2
0
 public readonly int FindIndexAll(RawString nodeName, Span <int> buffer) => FbxNode_.FindIndexAll(Pointer->ChildrenInternal, nodeName.AsSpan(), buffer);
Ejemplo n.º 3
0
 public readonly int FindIndex(RawString nodeName) => FbxNode_.FindIndex(Pointer->ChildrenInternal, nodeName.AsSpan());
Ejemplo n.º 4
0
 public readonly int FindIndex(string nodeName) => FbxNode_.FindIndex(Pointer->ChildrenInternal, nodeName);
Ejemplo n.º 5
0
 public readonly int FindIndex(ReadOnlySpan <byte> nodeName) => FbxNode_.FindIndex(Pointer->ChildrenInternal, nodeName);
Ejemplo n.º 6
0
 public readonly bool TryFind(string nodeName, out FbxNode node) => FbxNode_.TryFind(Pointer->ChildrenInternal, nodeName, out node);
Ejemplo n.º 7
0
 public readonly bool TryFind(ReadOnlySpan <byte> nodeName, out FbxNode node) => FbxNode_.TryFind(Pointer->ChildrenInternal, nodeName, out node);
Ejemplo n.º 8
0
 public readonly FbxNode Find(string nodeName) => FbxNode_.Find(Pointer->ChildrenInternal, nodeName);
Ejemplo n.º 9
0
        private static unsafe bool ParseNodeRecord(Reader reader, int version, out FbxNode_ node)
        {
            ulong endOfRecord;
            ulong propertyCount;
            ulong propertyListLen;
            byte  nameLen;

            if (version >= 7400 && version < 7500)
            {
                reader.UInt32(out var eor);
                endOfRecord = eor;
                reader.UInt32(out var pc);
                propertyCount = pc;
                reader.UInt32(out var pll);
                propertyListLen = pll;
                reader.Byte(out nameLen);
            }
            else if (version >= 7500 && version < 7600)
            {
                reader.UInt64(out endOfRecord);
                reader.UInt64(out propertyCount);
                reader.UInt64(out propertyListLen);
                reader.Byte(out nameLen);
            }
            else
            {
                throw new NotSupportedException($"Format version '{version}' is not supported.");
            }
            var isNullRecord = (endOfRecord == 0) && (propertyCount == 0) && (propertyListLen == 0) && (nameLen == 0);

            if (isNullRecord)
            {
                node = default;
                return(false);
            }

            node = default;
            try {
                node = new FbxNode_(new RawStringMem(nameLen), (int)propertyCount);
                var name       = node.NameInternal;
                var properties = node.PropertiesInternal;
                reader.Read(name);
                SanitizeString(name);
                for (int i = 0; i < (int)propertyCount; i++)
                {
                    ParseProperty(reader, ref properties[i]);
                }
                var hasChildren   = (ulong)reader.BaseStream.Position != endOfRecord;
                var hasNullRecord = hasChildren || propertyCount == 0;
                if (hasChildren || hasNullRecord)
                {
                    while (true)
                    {
                        if (!ParseNodeRecord(reader, version, out var child))
                        {
                            break;
                        }
                        node.AddChild(child);
                    }
                }
            }
            catch {
                node.Free();
                node = default;
                throw;
            }
            return(true);
        }