-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathz64xml.py
More file actions
31 lines (23 loc) · 689 Bytes
/
z64xml.py
File metadata and controls
31 lines (23 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import xml.etree.ElementTree as ET
from .common_utils import *
class Z64XML:
def __init__(self, path):
self.path = path
self.doc = ET.parse(path)
self.root = self.doc.getroot()
def get_file(self, name):
node = self.root.find(f'.//File[@Name="{name}"]')
return Z64File(self, node)
class Z64File:
def __init__(self, xml, node):
self.xml = xml
self.node = node
@property
@yield_list
def textures(self):
for child in self.node.findall('./Texture'):
yield Z64Texture(self, child)
class Z64Texture:
def __init__(self, file_, node):
self.file = file_
self.node = node