我正在编写一个 DXL 脚本,它通过多个级别跟踪链接。我注意到当模块打开时,脚本会正确地遍历这些链接。但是,大约有 20 个模块需要迭代,我不想打开所有这些模块。如何在无需手动打开链接模块的情况下查看这些链接?
这是我的代码示例:
// Checks to see if the object exists or not. If not returns a null.
// This will be eventually adapted to make sure the object is from a
// specific set of modules, but for now we're just checking for ability
// to retrieve
Object getObject(Link obj_link) {
ModuleVersion other_ver = null
ModName_ other_mod = null
Object other_obj
other_ver = sourceVersion obj_link
other_mod = module(other_ver)
if (null other_mod || isDeleted other_mod) return null
other_obj = source obj_link
if (null other_obj) load(other_ver, true)
other_obj = source obj_link
if (isDeleted other_obj) return null
return other_obj
}
// Displays the object from a specific link module if it's found
void showOut(Object o) {
Link l_obj_link
string s = null
Item linkModItem = itemFromID(MODULE_ID)
string linkModName = fullName(linkModItem)
for l_obj_link in all(o <- linkModName) do {
Object test_obj
display("Test")
test_obj = getObject(l_obj_link)
if (null test_obj){
display("Null Object Found")
} else {
s = probeRichAttr_(test_obj, "Object Identifier", false)
displayRich(s)
}
}
}
// Call showOut for the object
showOut(obj)
同样,将其用作布局 DXL 脚本,当且仅当打开链接模块时,我才能看到对象 ID。