-
Notifications
You must be signed in to change notification settings - Fork 18
pytha Path Handles
From the perspective of the Lua api, all files, directories and materials from a library are referred to by path handles.
As a layer of protection for confidential information, plugins have restricted access to the file system. Only those files and folders exposed explicitly by the user can be accessed and a few select locations (library folders).
All functions in the pyio and pytha libraries that access files (e.g. pytha.import_pyo) take a path handle instead of an explicit path string.
Both pyux.select_pyo and pyux.select_material allow the user to select a file (material) in a file selection dialog and will return a path handle to the selected file (material).
A special function is pyux.get_library_handle allows direct access to the PYTHA library folder and its subfolders.
The file name is available to the plugin through path_handle:get_name() - but not its full path.
A path handle can carry different access level:
| Level | Meaning |
|---|---|
| file | A handle to a single file. It cannot be listed or navigated. |
| directory | A handle to a directory. Its direct files can be listed and reached, but its sub-directories cannot. |
| recursive | A handle to a directory and its complete sub-tree. It can be listed and navigated to any depth. |
The access level is assigned when the handle is created and each API indicates the access level of the path handle that it creates.
Minimum PYTHA Version: V26
Groups, import_pyo, list_pyos, select_material, get_library_handle