def diff(self, aos: T.bpy_prop_collection, key: str, prop: T.Property, context: Context) -> Optional[DeltaUpdate]: if len(aos) == 0: return None array_size, member_type = self.array_attr(aos, self._member_name, prop.bl_rna) typecode = self._array.typecode tmp_array = array.array(typecode, soa_initializer(member_type, array_size)) if logger.isEnabledFor(logging.DEBUG): message = ( f"diff {aos}.{self._member_name} proxy({len(self._array)} {typecode}) blender'{len(aos)} {member_type}'" ) logger.debug(message) try: aos.foreach_get(self._member_name, tmp_array) except RuntimeError as e: logger.error(f"diff soa {aos}.{self._member_name} failed") logger.error( f"... member size: {len(aos)}, tmp_array: ('{tmp_array.typecode}', {len(tmp_array)})" ) logger.error(f"... exception {e!r}") if self._array == tmp_array: return None diff = self.__class__() diff._member_name = self._member_name diff._array = tmp_array diff._attach(context) return DeltaUpdate(diff)
def diff(self, aos: T.bpy_prop_collection, key: str, prop: T.Property, context: Context) -> Optional[DeltaUpdate]: if len(aos) == 0: return None array_size, member_type = self.array_attr(aos, self._member_name, prop.bl_rna) typecode = self._array.typecode tmp_array = array.array(typecode, soa_initializer(member_type, array_size)) if logger.isEnabledFor(logging.DEBUG): message = ( f"diff {aos}.{self._member_name} proxy({len(self._array)} {typecode}) blender'{len(aos)} {member_type}'" ) logger.debug(message) aos.foreach_get(self._member_name, tmp_array) force_diff = context.visit_state.scratchpad.get("force_soa_diff", False) if self._array == tmp_array and not force_diff: return None diff = self.__class__() diff._member_name = self._member_name diff._array = tmp_array diff._attach(context) return DeltaUpdate(diff)