def ensure_uuid(item: bpy.types.ID) -> str: """Ensures that the item datablock has a mixer_uuid property""" uuid = item.get("mixer_uuid") if not uuid: uuid = str(uuid4()) item.mixer_uuid = uuid return uuid
def _path_resolve( datablock: bpy.types.ID, data_path: str) -> Union[FCurveValue, Iterable[FCurveValue]]: """Wrapper for datablock.path_resolve(data_path). Raise UnresolvablePathError when the path cannot be resolved. This is easier to deal with upstream than the generic ValueError raised by Blender. """ try: return datablock.path_resolve(data_path) # type: ignore except ValueError as ex: raise UnresolvablePathError(str(ex)) from ex