[Bf-blender-cvs] [1ef01a11272] temp-sybren-alembic-customprops-read: Fixed data conversion issue reading arrays
Sybren A. Stüvel
noreply at git.blender.org
Thu Dec 7 10:36:34 CET 2017
Commit: 1ef01a11272ecf0167dbb699f51cf3025e57bc37
Author: Sybren A. Stüvel
Date: Mon Nov 13 14:58:06 2017 +0100
Branches: temp-sybren-alembic-customprops-read
https://developer.blender.org/rB1ef01a11272ecf0167dbb699f51cf3025e57bc37
Fixed data conversion issue reading arrays
===================================================================
M source/blender/alembic/intern/abc_object.cc
===================================================================
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index f03dfc53ba6..767cdd8b2b6 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -296,6 +296,9 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], const float time,
{
using Alembic::Abc::ISampleSelector;
ISampleSelector sample_sel(time, ISampleSelector::kFloorIndex);
+
+ /* Read custom properties before checking the Xform for validity,
+ * as subclasses might override and read from other things. */
read_custom_properties(sample_sel);
IXform ixform = xform();
@@ -413,7 +416,11 @@ static IDProperty *read_array(char idp_type,
IDProperty *iddata = IDP_New(IDP_ARRAY, &idval, header.getName().c_str());
BLTYPE *array = (BLTYPE *)IDP_Array(iddata);
- memcpy(array, data, dim.numPoints() * sizeof(BLTYPE));
+
+ /* We can't use memcpy here, because the types might need conversion. */
+ const size_t num = dim.numPoints();
+ for (size_t i=0; i < num; i++)
+ array[i] = data[i];
return iddata;
}
@@ -524,19 +531,19 @@ void AbcObjectReader::read_custom_properties_into(ID *id,
iddata = read_array<bool_t, int>(IDP_INT, header, dim, val);
break;
case kUint8POD:
- iddata = read_array<uint8_t, int>(IDP_INT, header, dim, val);
+ iddata = read_array<uint8_t, unsigned int>(IDP_INT, header, dim, val);
break;
case kInt8POD:
iddata = read_array<int8_t, int>(IDP_INT, header, dim, val);
break;
case kUint16POD:
- iddata = read_array<uint16_t, int>(IDP_INT, header, dim, val);
+ iddata = read_array<uint16_t, unsigned int>(IDP_INT, header, dim, val);
break;
case kInt16POD:
iddata = read_array<int16_t, int>(IDP_INT, header, dim, val);
break;
case kUint32POD:
- iddata = read_array<uint32_t, int>(IDP_INT, header, dim, val);
+ iddata = read_array<uint32_t, unsigned int>(IDP_INT, header, dim, val);
break;
case kInt32POD:
iddata = read_array<int32_t, int>(IDP_INT, header, dim, val);
More information about the Bf-blender-cvs
mailing list