Skip to content

Commit cd4facc

Browse files
committed
feat: add get_parent for DaedalusSymbol
1 parent 8343ded commit cd4facc

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/zenkit/daedalus_script.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ def get_float(self, i: int = 0, ctx: DaedalusInstance | None = None) -> float:
135135
def set_float(self, val: float, i: int = 0, ctx: DaedalusInstance | None = None) -> None:
136136
DLL.ZkDaedalusSymbol_setFloat(self._handle, c_float(val), c_uint16(i), ctx.handle if ctx else None)
137137

138+
def get_parent_as_symbol(self, find_root: bool = False) -> "DaedalusSymbol | None":
139+
if self.parent < 0:
140+
return None
141+
142+
handle = self._keepalive.get_symbol_by_index(self.parent)
143+
144+
while find_root and handle and handle.parent >= 0:
145+
handle = self._keepalive.get_symbol_by_index(handle.parent)
146+
147+
return handle
148+
138149
@property
139150
def is_const(self) -> bool:
140151
return DLL.ZkDaedalusSymbol_getIsConst(self._handle) != 0

0 commit comments

Comments
 (0)