fix: view_settings error
fix: empty collection error
This commit is contained in:
@ -47,6 +47,10 @@ def np_load_collection(dikt: dict, collection: bpy.types.CollectionProperty, att
|
|||||||
:arg attributes: list of attributes name
|
:arg attributes: list of attributes name
|
||||||
:type attributes: list
|
:type attributes: list
|
||||||
"""
|
"""
|
||||||
|
if not dikt or len(collection) == 0:
|
||||||
|
logger.warning(f'Skipping collection')
|
||||||
|
return
|
||||||
|
|
||||||
if attributes is None:
|
if attributes is None:
|
||||||
attributes = dikt.keys()
|
attributes = dikt.keys()
|
||||||
|
|
||||||
@ -111,11 +115,15 @@ def np_dump_collection_primitive(collection: bpy.types.CollectionProperty, attri
|
|||||||
:type attribute: str
|
:type attribute: str
|
||||||
:return: numpy byte buffer
|
:return: numpy byte buffer
|
||||||
"""
|
"""
|
||||||
|
if len(collection) == 0:
|
||||||
|
logger.warning(f'Skipping empty {attribute} attribute')
|
||||||
|
return {}
|
||||||
|
|
||||||
attr_infos = collection[0].bl_rna.properties.get(attribute)
|
attr_infos = collection[0].bl_rna.properties.get(attribute)
|
||||||
|
|
||||||
assert(attr_infos.type in ['FLOAT', 'INT', 'BOOLEAN'])
|
assert(attr_infos.type in ['FLOAT', 'INT', 'BOOLEAN'])
|
||||||
|
|
||||||
|
|
||||||
size = sum(attr_infos.array_dimensions) if attr_infos.is_array else 1
|
size = sum(attr_infos.array_dimensions) if attr_infos.is_array else 1
|
||||||
|
|
||||||
dumped_sequence = np.zeros(
|
dumped_sequence = np.zeros(
|
||||||
@ -182,9 +190,11 @@ def np_load_collection_primitives(collection: bpy.types.CollectionProperty, attr
|
|||||||
:arg attribute: target attribute
|
:arg attribute: target attribute
|
||||||
:type attribute: str
|
:type attribute: str
|
||||||
:arg sequence: data buffer
|
:arg sequence: data buffer
|
||||||
:type sequence: str
|
:type sequence: strr
|
||||||
:return: numpy byte buffer
|
|
||||||
"""
|
"""
|
||||||
|
if len(collection) == 0:
|
||||||
|
logger.warning(f"Skipping loadin {attribute}")
|
||||||
|
return
|
||||||
|
|
||||||
attr_infos = collection[0].bl_rna.properties.get(attribute)
|
attr_infos = collection[0].bl_rna.properties.get(attribute)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user