How can I check if a reference with a particular unresolved name is loaded using an if statement. Thanks
Pseudo code example
If (referenceLoaded "C:/bridge.ma"){ do stuff}
You could try something like
referenceQuery -isLoaded "C:/bridge.ma";
Which will return a 1 or 0 if the file is loaded or not.
Heres a rough example of the above in an if statement:
if (!`referenceQuery -isLoaded "C:/bridge.ma"`)
print("reference not loaded");
else if (`referenceQuery -isLoaded "C:/bridge.ma"`)
print("reference is loaded");
Sorry but I realize that it doesn't work as well as i want it to. It only works if the file as been referenced that is, it appears in the reference editor. However, I would like to beable to detect if the file is actually referenced. Right now the current code throws an error "please specify a reference node, referenced file, or node from a referenced file." I think it's because the file was never referenced before. But if the file was referenced but just not loaded, the code would work.
I resolved the erroring out issue by using catch
if (catch(!
referenceQuery -isLoaded "C:/bridge.ma")) {
continue;
}
else if (
referenceQuery -isLoaded "C:/bridge.ma") {
print("reference is loaded");
}