| 1215 | } |
| 1216 | |
| 1217 | static void Scene_DuplicateMotionObjectMulti(luxcore::detail::SceneImpl *scene, |
| 1218 | const string &srcObjName, |
| 1219 | const string &dstObjName, |
| 1220 | const unsigned int count, |
| 1221 | const u_int steps, |
| 1222 | const boost::python::object ×, |
| 1223 | const boost::python::object &transformations, |
| 1224 | const boost::python::object &objectIDs) { |
| 1225 | |
| 1226 | if (!PyObject_CheckBuffer(times.ptr())){ |
| 1227 | const string objType = extract<string>((times.attr("__class__")).attr("__name__")); |
| 1228 | throw runtime_error("Unsupported data type in Scene.DuplicateObject() method: " + objType); |
| 1229 | } |
| 1230 | if (!PyObject_CheckBuffer(transformations.ptr())){ |
| 1231 | const string objType = extract<string>((transformations.attr("__class__")).attr("__name__")); |
| 1232 | throw runtime_error("Unsupported data type in Scene.DuplicateObject() method: " + objType); |
| 1233 | } |
| 1234 | if (!PyObject_CheckBuffer(objectIDs.ptr())){ |
| 1235 | const string objType = extract<string>((objectIDs.attr("__class__")).attr("__name__")); |
| 1236 | throw runtime_error("Unsupported data type in Scene.DuplicateObject() method: " + objType); |
| 1237 | } |
| 1238 | |
| 1239 | Py_buffer timesView; |
| 1240 | if (PyObject_GetBuffer(times.ptr(), ×View, PyBUF_SIMPLE)) { |
| 1241 | const string objType = extract<string>((times.attr("__class__")).attr("__name__")); |
| 1242 | throw runtime_error("Unable to get a data view in Scene.DuplicateObject() method: " + objType); |
| 1243 | } |
| 1244 | Py_buffer transformationsView; |
| 1245 | if (PyObject_GetBuffer(transformations.ptr(), &transformationsView, PyBUF_SIMPLE)) { |
| 1246 | PyBuffer_Release(×View); |
| 1247 | |
| 1248 | const string objType = extract<string>((transformations.attr("__class__")).attr("__name__")); |
| 1249 | throw runtime_error("Unable to get a data view in Scene.DuplicateObject() method: " + objType); |
| 1250 | } |
| 1251 | Py_buffer objectIDsView; |
| 1252 | if (PyObject_GetBuffer(objectIDs.ptr(), &objectIDsView, PyBUF_SIMPLE)) { |
| 1253 | PyBuffer_Release(×View); |
| 1254 | PyBuffer_Release(&transformationsView); |
| 1255 | |
| 1256 | const string objType = extract<string>((objectIDs.attr("__class__")).attr("__name__")); |
| 1257 | throw runtime_error("Unable to get a data view in Scene.DuplicateObject() method: " + objType); |
| 1258 | } |
| 1259 | |
| 1260 | const size_t timesBufferSize = sizeof(float) * count; |
| 1261 | if ((size_t)timesView.len < timesBufferSize) { |
| 1262 | const string errorMsg = "Not enough times in the buffer of Scene.DuplicateObject() method: " + |
| 1263 | luxrays::ToString(timesView.len) + " instead of " + luxrays::ToString(timesBufferSize); |
| 1264 | |
| 1265 | PyBuffer_Release(×View); |
| 1266 | PyBuffer_Release(&transformationsView); |
| 1267 | PyBuffer_Release(&objectIDsView); |
| 1268 | |
| 1269 | throw runtime_error(errorMsg); |
| 1270 | } |
| 1271 | const size_t transformationsBufferSize = sizeof(float) * 16 * count; |
| 1272 | if ((size_t)transformationsView.len < transformationsBufferSize) { |
| 1273 | const string errorMsg = "Not enough matrices in the buffer of Scene.DuplicateObject() method: " + |
| 1274 | luxrays::ToString(transformationsView.len) + " instead of " + luxrays::ToString(transformationsBufferSize); |
nothing calls this directly
no test coverage detected