Isotropix Forums

Get all references

Clarisse Scripting related topics

Get all references

Unread postby dane » Wed Sep 25, 2019 8:09 pm

Hey guys,

How would I get a list of all references in a scene?

So find all the referenced files and list their file path?

Thanks for any help,

Dan
dane
 
Posts: 98
Joined: Wed Aug 29, 2018 11:50 am

Re: Get all references

Unread postby julian » Wed Sep 25, 2019 9:18 pm

Hi Dan,

You can get a list of contexts and select only those where is_reference() is true:

python code

contexts = ix.api.OfContextSet()
ix.application.get_factory().get_root().resolve_all_contexts(contexts)
for context in contexts:
if context.is_reference() and not context.is_disabled():
filename = context.get_attribute("filename").get_string()
ix.log_info("{}: {}".format(context.get_name(), filename))


There is another way, using ix.api.OfAttr.get_path_attrs() and then check the attribute's object type, but I found it would sometimes miss some objects in deeply nested references.

Hope it helps!

Julian
julian@conductortech.com
julian
 
Posts: 23
Joined: Tue Feb 05, 2019 2:51 pm

Re: Get all references

Unread postby dane » Thu Sep 26, 2019 9:19 am

Exactly what I was after!

Thanks so much Julian
dane
 
Posts: 98
Joined: Wed Aug 29, 2018 11:50 am


Return to Scripting