fix the MCL/MCX build process so it properly loads all relationships

This commit is contained in:
Michael Becker 2024-08-26 22:56:24 -04:00
parent 8c138247e0
commit ca5d5c0b4a

View File

@ -24,14 +24,18 @@ class MemoryLibraryManager (MochaLibraryManager):
self.filename = "" self.filename = ""
self.codeDefinitionFileName = "" self.codeDefinitionFileName = ""
self.instance_ops = [ ]
self.attribute_ops = [ ]
self.relationship_ops = [ ]
def process_attribute_ops(self, ops): def process_attribute_ops(self, ops):
self.attribute_ops = ops self.attribute_ops.extend(ops)
def process_instance_ops(self, ops): def process_instance_ops(self, ops):
self.instance_ops = ops self.instance_ops.extend(ops)
def process_relationship_ops(self, ops): def process_relationship_ops(self, ops):
self.relationship_ops = ops self.relationship_ops.extend(ops)
def update_global_identifiers(self): def update_global_identifiers(self):
pass pass
@ -78,6 +82,7 @@ class MemoryLibraryManager (MochaLibraryManager):
# *** SECOND PASS *** # *** SECOND PASS ***
# first, go through and load all the instances GUIDs # first, go through and load all the instances GUIDs
refs = [ ]
insts = [ ] insts = [ ]
atts = [ ] atts = [ ]
rels = [ ] rels = [ ]
@ -114,8 +119,11 @@ class MemoryLibraryManager (MochaLibraryManager):
guids = guid_db.to_list() guids = guid_db.to_list()
defs_db = [ ]
for ref in self.entityReferences:
defs_db.append((ref, self.entityReferences[ref]))
from .sectionfile import SectionFile, Section, GuidSection, InstancesSection, AttributesSection, RelationshipsSection, StringTableSection, ResourcesSection from .sectionfile import SectionFile, Section, GuidSection, InstancesSection, AttributesSection, RelationshipsSection, StringTableSection, ResourcesSection, DefinitionsSection
f = SectionFile("MCX!", 2.0, 15) f = SectionFile("MCX!", 2.0, 15)
f.open(self.filename) f.open(self.filename)
@ -125,6 +133,7 @@ class MemoryLibraryManager (MochaLibraryManager):
f.sections.append(RelationshipsSection("Relationships", rels)) f.sections.append(RelationshipsSection("Relationships", rels))
f.sections.append(StringTableSection("StringTable", strs_db)) f.sections.append(StringTableSection("StringTable", strs_db))
f.sections.append(ResourcesSection("Resources", rsrc_db)) f.sections.append(ResourcesSection("Resources", rsrc_db))
f.sections.append(DefinitionsSection(defs_db))
f.save() f.save()