MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / Scene_DuplicateMotionObject

Function Scene_DuplicateMotionObject

src/luxcore/pyluxcore.cpp:1179–1215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177}
1178
1179static void Scene_DuplicateMotionObject(luxcore::detail::SceneImpl *scene,
1180 const string &srcObjName,
1181 const string &dstObjName,
1182 const u_int steps,
1183 const boost::python::object &times,
1184 const boost::python::object &transformations,
1185 const u_int objectID) {
1186 if (!times.is_none() && !transformations.is_none()) {
1187 extract<boost::python::list> timesListExtract(times);
1188 extract<boost::python::list> transformationsListExtract(transformations);
1189
1190 if (timesListExtract.check() && transformationsListExtract.check()) {
1191 const boost::python::list &timesList = timesListExtract();
1192 const boost::python::list &transformationsList = transformationsListExtract();
1193
1194 if ((len(timesList) != steps) || (len(transformationsList) != steps))
1195 throw runtime_error("Wrong number of elements for the times and/or the list of transformations of method Scene.DuplicateObject()");
1196
1197 vector<float> timesVec(steps);
1198 vector<float> transVec(steps * 16);
1199 u_int transIndex = 0;
1200
1201 for (u_int i = 0; i < steps; ++i) {
1202 timesVec[i] = extract<float>(timesList[i]);
1203
1204 float mat[16];
1205 GetMatrix4x4(transformationsList[i], mat);
1206 for (u_int i = 0; i < 16; ++i)
1207 transVec[transIndex++] = mat[i];
1208 }
1209
1210 scene->DuplicateObject(srcObjName, dstObjName, steps, &timesVec[0], &transVec[0], objectID);
1211 } else
1212 throw runtime_error("Wrong data type for the list of transformation values of method Scene.DuplicateObject()");
1213 } else
1214 throw runtime_error("None times and/or transformations in Scene.DuplicateObject(): " + srcObjName);
1215}
1216
1217static void Scene_DuplicateMotionObjectMulti(luxcore::detail::SceneImpl *scene,
1218 const string &srcObjName,

Callers

nothing calls this directly

Calls 3

GetMatrix4x4Function · 0.85
checkMethod · 0.45
DuplicateObjectMethod · 0.45

Tested by

no test coverage detected