public static FragmentCollection FillFrom(DsonDocument doc) { DsonRoot root = doc.Root; Dictionary <string, DsonObject> fragments = new Dictionary <string, DsonObject>(); foreach (DsonObject obj in Utils.SafeArray(root.geometry_library)) { fragments[obj.id] = obj; } foreach (DsonObject obj in Utils.SafeArray(root.modifier_library)) { fragments[obj.id] = obj; } foreach (DsonObject obj in Utils.SafeArray(root.uv_set_library)) { fragments[obj.id] = obj; } foreach (DsonObject obj in Utils.SafeArray(root.node_library)) { fragments[obj.id] = obj; } foreach (DsonObject obj in Utils.SafeArray(root.image_library)) { fragments[obj.id] = obj; } foreach (DsonObject obj in Utils.SafeArray(root.material_library)) { fragments[obj.id] = obj; } return(new FragmentCollection(doc, fragments)); }
private FragmentCollection LocateCollection(string documentPath, bool throwIfMissing = true) { if (!documentCache.TryGetValue(documentPath, out FragmentCollection fragments)) { var contentFile = fileLocator.Locate(documentPath, throwIfMissing); if (contentFile == null) { return(null); } DsonDocument root = DsonDocument.LoadFromFile(this, contentFile, documentPath); fragments = FragmentCollection.FillFrom(root); documentCache[documentPath] = fragments; } return(fragments); }
private FragmentCollection(DsonDocument doc, Dictionary <string, DsonObject> fragments) { this.doc = doc; this.fragments = fragments; }