habitat_sim.attributes_managers.ObjectAttributesManager class

Manages ObjectAttributes which define metadata for rigid objects pre-instantiation. Can import .object_config.json files.

Methods

def create_new_template(self, handle: str, register_template: bool = False) -> attributes.ObjectAttributes
Creates a ObjectAttributes 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.ObjectAttributes
Creates a ObjectAttributes template based on passed handle, and registers it in the library if register_template is True.
def filter_filepaths(self, attributes: attributes.ObjectAttributes) -> None
This attempts to filter any filenames in the passed ObjectAttributes template so that the fields that would be saved to file would only contain relative paths.
def get_file_template_handles(self, search_str: str = '', contains: bool = True, sorted: bool = True) -> typing.List[str]
Returns a potentially sorted list of file-based ObjectAttributes template handles that either contain or explicitly do not contain the passed search_str, based on the value of contains.
def get_first_matching_template_by_handle(self, handle_substr: str) -> attributes.ObjectAttributes
This returns a copy of the first ObjectAttributes 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 ObjectAttributes template in the library.
def get_library_has_id(self, template_id: int) -> bool
Returns whether the passed template ID describes an existing ObjectAttributes template in the library.
def get_num_file_templates(self, /) -> int
Returns the number of existing file-based ObjectAttributes templates being managed.
def get_num_synth_templates(self, /) -> int
Returns the number of existing synthesized(primitive asset)-based ObjectAttributes templates being managed.
def get_num_templates(self, /) -> int
Returns the number of existing ObjectAttributes templates being managed.
def get_random_file_template_handle(self, /) -> str
Returns the handle for a random file-based template chosen from the existing ObjectAttributes templates being managed.
def get_random_synth_template_handle(self, /) -> str
Returns the handle for a random synthesized(primitive asset)-based template chosen from the existing ObjectAttributes templates being managed.
def get_random_template_handle(self, /) -> str
Returns the handle for a random ObjectAttributes template chosen from the existing ObjectAttributes templates being managed.
def get_synth_template_handles(self, search_str: str = '', contains: bool = True, sorted: bool = True) -> typing.List[str]
Returns a potentially sorted list of synthesized(primitive asset)-based ObjectAttributes template handles that either contain or explicitly do not contain the passed search_str, based on the value of contains.
def get_template_by_handle(self, handle: str) -> attributes.ObjectAttributes
This returns a copy of the ObjectAttributes 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.ObjectAttributes
This returns a copy of the ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes 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.ObjectAttributes]
Returns a dictionary of ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes template handles for ObjectAttributes templates that have been marked undeletable by the system. These ObjectAttributes templates can still be edited.
def get_user_locked_handles(self, /) -> typing.List[str]
Returns a list of ObjectAttributes template handles for ObjectAttributes templates that have been marked locked by the user. These will be undeletable until unlocked by the user. These ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes templates will be unable to be deleted
def load_object_configs(self, path: str, save_as_defaults: bool = False) -> typing.List[int]
DEPRECATED : use “load_configs” instead. Build ObjectAttributes templates for all files with “.object_config.json” extension that exist in the provided file or directory path. If save_as_defaults is true, then these ObjectAttributes templates will be unable to be deleted
def register_template(self, template: attributes.ObjectAttributes, specified_handle: str = '', force_registration: bool = False) -> int
This registers a copy of the passed ObjectAttributes template in the library, and returns the template’s integer ID.
def remove_all_templates(self, /) -> typing.List[attributes.ObjectAttributes]
This removes, and returns, a list of all the ObjectAttributes 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.ObjectAttributes
This removes, and returns the ObjectAttributes template referenced by the passed handle from the library.
def remove_template_by_id(self, template_id: int) -> attributes.ObjectAttributes
This removes, and returns the ObjectAttributes template referenced by the passed ID from the library.
def remove_templates_by_str(self, search_str: str = '', contains: bool = True) -> typing.List[attributes.ObjectAttributes]
This removes, and returns, a list of all the ObjectAttributes 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 ObjectAttributes 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 ObjectAttributes 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.ObjectAttributes, filepath: str, create_subdir: bool) -> bool
Saves the passed ObjectAttributes 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.ObjectAttributes, filepath: str, filename: str, create_subdir: bool) -> bool
Saves the passed ObjectAttributes 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 ObjectAttributes templates whose handles either contain or explicitly do not contain the passed search_str. Returns a list of handles for ObjectAttributes templates locked by this function call. Lock == True makes the ObjectAttributes template unable to be deleted. Note : Locked ObjectAttributes 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 ObjectAttributes templates whose handles are passed in list. Returns a list of handles for templates locked by this function call. Lock == True makes the ObjectAttributes template unable to be deleted. Note : Locked ObjectAttributes templates can still be edited.
def set_template_lock(self, handle: str, lock: bool) -> bool
This sets the lock state for the ObjectAttributes template that has the passed name. Lock == True makes the ObjectAttributes template unable to be deleted. Note : Locked ObjectAttributes templates can still be edited.