habitat_sim.attributes_managers.StageAttributesManager class

Manages StageAttributes which define metadata for stages (i.e. static background mesh such as architectural elements) pre-instantiation. Can import .stage_config.json files.

Methods

def create_new_template(self, handle: str, register_template: bool = False) -> attributes.StageAttributes
Creates a StageAttributes template built with default values, and registers it in the library if register_template is True.
def create_template(self, handle: str, register_template: bool = True) -> attributes.StageAttributes
Creates a StageAttributes template based on passed handle, and registers it in the library if register_template is True.
def filter_filepaths(self, attributes: attributes.StageAttributes) -> None
This attempts to filter any filenames in the passed StageAttributes template so that the fields that would be saved to file would only contain relative paths.
def get_first_matching_template_by_handle(self, handle_substr: str) -> attributes.StageAttributes
This returns a copy of the first StageAttributes template containing the passed handle substring if any exist, and NULL if none could be found.
def get_library_has_handle(self, handle: str) -> bool
Returns whether the passed handle describes an existing StageAttributes template in the library.
def get_library_has_id(self, template_id: int) -> bool
Returns whether the passed template ID describes an existing StageAttributes template in the library.
def get_num_templates(self, /) -> int
Returns the number of existing StageAttributes templates being managed.
def get_random_template_handle(self, /) -> str
Returns the handle for a random StageAttributes template chosen from the existing StageAttributes templates being managed.
def get_template_by_handle(self, handle: str) -> attributes.StageAttributes
This returns a copy of the StageAttributes template specified by the passed handle if it exists, and NULL if it does not.
def get_template_by_id(self, template_id: int) -> attributes.StageAttributes
This returns a copy of the StageAttributes template specified by the passed ID if it exists, and NULL if it does not.
def get_template_handle_by_id(self, template_id: int) -> str
Returns string handle for the StageAttributes template corresponding to passed ID.
def get_template_handles(self, search_str: str = '', contains: bool = True, sorted: bool = True) -> typing.List[str]
Returns a potentially sorted list of StageAttributes template handles that either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_template_id_by_handle(self, handle: str) -> int
Returns integer ID for the StageAttributes template with the passed handle.
def get_templates_CSV_info(self, search_str: str = '', contains: bool = True) -> str
Returns a comma-separated string describing each StageAttributes template whose handles either contain or explicitly do not contain the passed search_str, based on the value of boolean contains. Each template’s info is separated by a newline.
def get_templates_by_handle_substring(self, search_str: str = '', contains: bool = True) -> typing.Dict[str, attributes.StageAttributes]
Returns a dictionary of StageAttributes templates, keyed by their handles, for all handles that either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_templates_info(self, search_str: str = '', contains: bool = True) -> typing.List[str]
Returns a list of CSV strings describing each StageAttributes template whose handles either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_undeletable_handles(self, /) -> typing.List[str]
Returns a list of StageAttributes template handles for StageAttributes templates that have been marked undeletable by the system. These StageAttributes templates can still be edited.
def get_user_locked_handles(self, /) -> typing.List[str]
Returns a list of StageAttributes template handles for StageAttributes templates that have been marked locked by the user. These will be undeletable until unlocked by the user. These StageAttributes templates can still be edited.
def is_valid_filename(self, handle: str) -> bool
Returns whether the passed handle is a valid, existing file.
def load_configs(self, path: str, save_as_defaults: bool = False) -> typing.List[int]
Build StageAttributes templates for all JSON files with appropriate extension that exist in the provided file or directory path. If save_as_defaults is true, then these StageAttributes templates will be unable to be deleted
def register_template(self, template: attributes.StageAttributes, specified_handle: str = '', force_registration: bool = False) -> int
This registers a copy of the passed StageAttributes template in the library, and returns the template’s integer ID.
def remove_all_templates(self, /) -> typing.List[attributes.StageAttributes]
This removes, and returns, a list of all the StageAttributes templates referenced in the library that have not been marked undeletable by the system or read-only by the user.
def remove_template_by_handle(self, handle: str) -> attributes.StageAttributes
This removes, and returns the StageAttributes template referenced by the passed handle from the library.
def remove_template_by_id(self, template_id: int) -> attributes.StageAttributes
This removes, and returns the StageAttributes template referenced by the passed ID from the library.
def remove_templates_by_str(self, search_str: str = '', contains: bool = True) -> typing.List[attributes.StageAttributes]
This removes, and returns, a list of all the StageAttributes templates referenced in the library that have not been marked undeletable by the system or read-only by the user and whose handles either contain or explicitly do not contain the passed search_str.
def save_template_by_handle(self, handle: str, overwrite: bool) -> bool
Saves the StageAttributes template referenced by the passed handle to its source location if overwrite is true, will create a new incremented filename if overwrite is false. Returns whether was successful or not.
def save_template_by_handle_to_filepath(self, handle: str, filepath: str) -> bool
Saves the StageAttributes template referenced by the passed handle to the passed path, creating subdirectories if they do not exist. Returns whether was successful or not.
def save_template_to_filepath(self, handle: attributes.StageAttributes, filepath: str, create_subdir: bool) -> bool
Saves the passed StageAttributes template to the passed filepath. If only a filename is passed, it will save this template in its original source directory, otherwise if path + filename is passed it will save the template to the specified filepath, creating any necessary subdirectories only if create_subdir is true. If create_subdir is false, it will fail with a message if any subdirectories in the requested filepath do not exist.
def save_template_to_filepath(self, handle: attributes.StageAttributes, filepath: str, filename: str, create_subdir: bool) -> bool
Saves the passed StageAttributes template to the passed filepath + filename, creating any necessary subdirectories only if create_subdir is true. If create_subdir is false, it will fail with a message if any subdirectories in the requested filepath subdirectories do not exist.
def set_lock_by_substring(self, lock: bool, search_str: str = '', contains: bool = True) -> typing.List[str]
This sets the lock state for all StageAttributes templates whose handles either contain or explicitly do not contain the passed search_str. Returns a list of handles for StageAttributes templates locked by this function call. Lock == True makes the StageAttributes template unable to be deleted. Note : Locked StageAttributes templates can still be edited.
def set_template_list_lock(self, handles: typing.List[str], lock: bool) -> typing.List[str]
This sets the lock state for all StageAttributes templates whose handles are passed in list. Returns a list of handles for templates locked by this function call. Lock == True makes the StageAttributes template unable to be deleted. Note : Locked StageAttributes templates can still be edited.
def set_template_lock(self, handle: str, lock: bool) -> bool
This sets the lock state for the StageAttributes template that has the passed name. Lock == True makes the StageAttributes template unable to be deleted. Note : Locked StageAttributes templates can still be edited.