Isotropix Forums

Path Manager functionality in Python

Clarisse Scripting related topics

Path Manager functionality in Python

Unread postby briansilva » Tue Aug 20, 2019 12:45 pm

Hello!

From Python, I'd like to be able to list all file paths referenced from a project file the same way that the Path Manager does. Is this possible in Python, and can someone point me to it?

Thank you!
briansilva
 
Posts: 19
Joined: Mon Mar 25, 2019 12:43 pm

Re: Path Manager functionality in Python

Unread postby julian » Tue Aug 20, 2019 3:33 pm

This will print all path attributes along with their value and whether input or output

python code

attrs = ix.api.OfAttr.get_path_attrs()
for attr in attrs:
path = attr.get_string()
attr_name = attr.get_name()
obj_name = attr.get_parent_object().get_name()
is_output = ix.api.OfAttr.get_visual_hint_name(
attr.get_visual_hint()) == "VISUAL_HINT_FILENAME_SAVE"
type_val = "output" if is_output else "input"
info = {"object": obj_name, "attribute":attr_name, "path": path, "type": type_val}
ix.log_info(info)
julian
 
Posts: 23
Joined: Tue Feb 05, 2019 2:51 pm

Re: Path Manager functionality in Python

Unread postby briansilva » Wed Aug 21, 2019 4:42 pm

That works great, and using the VISUAL_HINT to differentiate input/output is very useful. Thanks!
briansilva
 
Posts: 19
Joined: Mon Mar 25, 2019 12:43 pm


Return to Scripting