omni.kit.window.file

Provides utility functions to new/open/save/close USD files

class omni.kit.window.file.AppUI
destroy()
save_root_and_sublayers(new_root_path: str, dirty_sublayers: List[str], on_save_done: Optional[Callable] = None, dialog_options: int = <DialogOptions.NONE: (0, 'Show dialog using is-required logic')>, save_comment: str = '', allow_skip_sublayers: bool = False)
show_open_stage_failed_prompt(path)
show_save_layers_failed_prompt()
class omni.kit.window.file.CheckpointHelper
static extract_server_from_url(url: str)str
async static is_checkpoint_enabled_async(url: str)bool
static is_checkpoint_enabled_with_callback(url: str, callback: Callable)
server_cache = {}
class omni.kit.window.file.DialogOptions(value)

An enumeration.

FORCE = (1, 'Force dialog to show and ignore is-required logic')
HIDE = (2, 'Never show dialog')
NONE = (0, 'Show dialog using is-required logic')
class omni.kit.window.file.FileWindowExtension
add_reference(is_payload=False)
close(on_closed, fast_shutdown=False)

Check if current stage is dirty. If it’s dirty, it will ask if to save the file, then close stage.

create_stage(edit_layer_path: str, file_path: str, callback: Optional[Callable] = None)
new(template=None)

Create a new USD stage. If currently opened stage is dirty, a prompt will show to let you save it.

on_shutdown()
on_startup(ext_id)
open(open_loadset=UsdContextInitialLoadSet.LOAD_ALL)

Bring up a file picker to choose a USD file to open. If currently opened stage is dirty, a prompt will show to let you save it.

open_stage(path, open_loadset=UsdContextInitialLoadSet.LOAD_ALL, open_options: Optional[omni.kit.window.file.scripts.app_ui.OpenOptionsDelegate] = None)

open stage. If the current stage is dirty, a prompt will show to let you save it.

open_with_new_edit_layer(path: str, open_loadset: int = UsdContextInitialLoadSet.LOAD_ALL, callback: Optional[Callable] = None)
post_notification(info: bool = False, duration: int = 3)
prompt_if_unsaved_stage(callback: Callable)

Check if current stage is dirty. If it’s dirty, ask to save the file, then execute callback. Otherwise runs callback directly.

register_open_stage_addon(callback)
reopen()

Reopen currently opened stage. If the stage is dirty, a prompt will show to let you save it.

save(callback: Callable, allow_skip_sublayers: bool = False)

Save currently opened stage to file. Will call Save As for a newly created stage

save_as(flatten: bool, callback: Callable, allow_skip_sublayers: bool = False)

Bring up a file picker to choose a file to save current stage to.

save_layers(new_root_path, dirty_layers, on_save_done, create_checkpoint=True, checkpoint_comment='')

Save current layers

save_stage(path: str, callback: Optional[Callable] = None, flatten: bool = False, save_options: Optional[omni.kit.window.file.scripts.app_ui.SaveOptionsDelegate] = None, allow_skip_sublayers: bool = False)
class omni.kit.window.file.OpenOptionsDelegate
should_load_payload()
class omni.kit.window.file.Path(*args, **kwargs)

PurePath subclass that can make system calls.

Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.

absolute()

Return an absolute version of this path. This function works even if the path doesn’t point to anything.

No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.

chmod(mode)

Change the permissions of the path, like os.chmod().

classmethod cwd()

Return a new path pointing to the current working directory (as returned by os.getcwd()).

exists()

Whether this path exists.

expanduser()

Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)

glob(pattern)

Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.

group()

Return the group name of the file gid.

classmethod home()

Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).

is_block_device()

Whether this path is a block device.

is_char_device()

Whether this path is a character device.

is_dir()

Whether this path is a directory.

is_fifo()

Whether this path is a FIFO.

is_file()

Whether this path is a regular file (also True for symlinks pointing to regular files).

is_mount()

Check if this path is a POSIX mount point

is_socket()

Whether this path is a socket.

Whether this path is a symbolic link.

iterdir()

Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.

lchmod(mode)

Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.

lstat()

Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.

mkdir(mode=511, parents=False, exist_ok=False)

Create a new directory at this given path.

open(mode='r', buffering=- 1, encoding=None, errors=None, newline=None)

Open the file pointed by this path and return a file object, as the built-in open() function does.

owner()

Return the login name of the file owner.

read_bytes()

Open the file in bytes mode, read it, and close the file.

read_text(encoding=None, errors=None)

Open the file in text mode, read it, and close the file.

rename(target)

Rename this path to the given path.

replace(target)

Rename this path to the given path, clobbering the existing destination if it exists.

resolve(strict=False)

Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).

rglob(pattern)

Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.

rmdir()

Remove this directory. The directory must be empty.

samefile(other_path)

Return whether other_path is the same or not as this file (as returned by os.path.samefile()).

stat()

Return the result of the stat() system call on this path, like os.stat() does.

Make this path a symlink pointing to the given path. Note the order of arguments (self, target) is the reverse of os.symlink’s.

touch(mode=438, exist_ok=True)

Create this file with the given access mode, if it doesn’t exist.

Remove this file or link. If the path is a directory, use rmdir() instead.

write_bytes(data)

Open the file in bytes mode, write to it, and close the file.

write_text(data, encoding=None, errors=None)

Open the file in text mode, write to it, and close the file.

class omni.kit.window.file.Prompt(title: str, text: str, button_text: list, button_fn: list, modal: bool = False, callback_addons: List = [], decode_text: bool = True)
destroy()
hide()
is_visible()
set_text(text)
show()
class omni.kit.window.file.ReadOnlyOptionsWindow(open_with_new_edit_fn, open_original_fn, modal=False)
destroy()
hide()
is_visible()
show()
class omni.kit.window.file.SaveOptionsDelegate
get_comment()
omni.kit.window.file.add_reference(is_payload=False)
omni.kit.window.file.close(on_closed=None)
omni.kit.window.file.deregister_actions(extension_id)
omni.kit.window.file.get_file_exporter()omni.kit.window.file_exporter.extension.FileExporterExtension

Returns the singleton file_exporter extension.

omni.kit.window.file.get_file_importer()omni.kit.window.file_importer.extension.FileImporterExtension

Returns the singleton file_importer extension.

omni.kit.window.file.get_instance()
omni.kit.window.file.new(template=None)
omni.kit.window.file.open(open_loadset=UsdContextInitialLoadSet.LOAD_ALL)
omni.kit.window.file.open_stage(path, open_loadset=UsdContextInitialLoadSet.LOAD_ALL)
omni.kit.window.file.open_with_new_edit_layer(path, open_loadset=UsdContextInitialLoadSet.LOAD_ALL, callback=None)
omni.kit.window.file.prompt_if_unsaved_stage(job)
omni.kit.window.file.register_actions(extension_id)
omni.kit.window.file.register_open_stage_addon(callback)
omni.kit.window.file.reopen()
omni.kit.window.file.save(on_save_done=None, exit=False, dialog_options=<DialogOptions.NONE: (0, 'Show dialog using is-required logic')>)
omni.kit.window.file.save_as(flatten, on_save_done=None)
omni.kit.window.file.save_layers(new_root_path, dirty_layers, on_save_done, create_checkpoint=True, checkpoint_comment='')