habitat_sim.attributes_managers.PbrShaderAttributesManager class

Manages PbrShaderAttributess which define PBR shader calculation control values, such as enabling IBL or specifying direct and indirect lighting balance. Can import .pbr_config.json files.

Methods

def create_new_template(self, handle: str, register_template: bool = False) -> attributes.PbrShaderAttributes
Creates a PbrShaderAttributes 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.PbrShaderAttributes
Creates a PbrShaderAttributes template based on passed handle, and registers it in the library if register_template is True.
def get_first_matching_template_by_handle(self, handle_substr: str) -> attributes.PbrShaderAttributes
This returns a copy of the first PbrShaderAttributes 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 PbrShaderAttributes template in the library.
def get_library_has_id(self, template_id: int) -> bool
Returns whether the passed template ID describes an existing PbrShaderAttributes template in the library.
def get_num_templates(self, /) -> int
Returns the number of existing PbrShaderAttributes templates being managed.
def get_random_template_handle(self, /) -> str
Returns the handle for a random PbrShaderAttributes template chosen from the existing PbrShaderAttributes templates being managed.
def get_template_by_handle(self, handle: str) -> attributes.PbrShaderAttributes
This returns a copy of the PbrShaderAttributes 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.PbrShaderAttributes
This returns a copy of the PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes 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.PbrShaderAttributes]
Returns a dictionary of PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes template handles for PbrShaderAttributes templates that have been marked undeletable by the system. These PbrShaderAttributes templates can still be edited.
def get_user_locked_handles(self, /) -> typing.List[str]
Returns a list of PbrShaderAttributes template handles for PbrShaderAttributes templates that have been marked locked by the user. These will be undeletable until unlocked by the user. These PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes templates will be unable to be deleted
def register_template(self, template: attributes.PbrShaderAttributes, specified_handle: str = '', force_registration: bool = False) -> int
This registers a copy of the passed PbrShaderAttributes template in the library, and returns the template’s integer ID.
def remove_all_templates(self, /) -> typing.List[attributes.PbrShaderAttributes]
This removes, and returns, a list of all the PbrShaderAttributes 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.PbrShaderAttributes
This removes, and returns the PbrShaderAttributes template referenced by the passed handle from the library.
def remove_template_by_id(self, template_id: int) -> attributes.PbrShaderAttributes
This removes, and returns the PbrShaderAttributes template referenced by the passed ID from the library.
def remove_templates_by_str(self, search_str: str = '', contains: bool = True) -> typing.List[attributes.PbrShaderAttributes]
This removes, and returns, a list of all the PbrShaderAttributes 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 PbrShaderAttributes 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 PbrShaderAttributes 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.PbrShaderAttributes, filepath: str, create_subdir: bool) -> bool
Saves the passed PbrShaderAttributes 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.PbrShaderAttributes, filepath: str, filename: str, create_subdir: bool) -> bool
Saves the passed PbrShaderAttributes 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 PbrShaderAttributes templates whose handles either contain or explicitly do not contain the passed search_str. Returns a list of handles for PbrShaderAttributes templates locked by this function call. Lock == True makes the PbrShaderAttributes template unable to be deleted. Note : Locked PbrShaderAttributes 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 PbrShaderAttributes templates whose handles are passed in list. Returns a list of handles for templates locked by this function call. Lock == True makes the PbrShaderAttributes template unable to be deleted. Note : Locked PbrShaderAttributes templates can still be edited.
def set_template_lock(self, handle: str, lock: bool) -> bool
This sets the lock state for the PbrShaderAttributes template that has the passed name. Lock == True makes the PbrShaderAttributes template unable to be deleted. Note : Locked PbrShaderAttributes templates can still be edited.