Abc::M44d AbcObjectCache::getXformMatrix(int index) { if(iXformMap.find(index) == iXformMap.end()){ AbcG::XformSample sample; getXform(); pObjXform->getSchema().get(sample, index); Abc::M44d mat = sample.getMatrix(); iXformMap[index] = mat; return mat; } return iXformMap[index]; }
static PyObject * iXformProperty_getValues(PyObject * self, PyObject * args) { ALEMBIC_TRY_STATEMENT iXformProperty * prop = (iXformProperty*)self; unsigned long long sampleIndex = 0; unsigned long long start = 0; unsigned long long count = 0; PyArg_ParseTuple(args, "|KKK", &sampleIndex,&start,&count); size_t numSamples = iXformProperty_getNbStoredSamples_func(self); if(sampleIndex >= numSamples) { std::string msg; msg.append("SampleIndex for Property '"); msg.append(iXformProperty_getName_func()); msg.append("' is out of bounds!"); PyErr_SetString(getError(), msg.c_str()); return NULL; } PyObject * tuple = NULL; tuple = PyTuple_New(16); AbcG::XformSample sample; prop->mXformSchema->get(sample,sampleIndex); Abc::M44d value = sample.getMatrix(); PyTuple_SetItem(tuple,0,Py_BuildValue("d",value.x[0][0])); PyTuple_SetItem(tuple,1,Py_BuildValue("d",value.x[0][1])); PyTuple_SetItem(tuple,2,Py_BuildValue("d",value.x[0][2])); PyTuple_SetItem(tuple,3,Py_BuildValue("d",value.x[0][3])); PyTuple_SetItem(tuple,4,Py_BuildValue("d",value.x[1][0])); PyTuple_SetItem(tuple,5,Py_BuildValue("d",value.x[1][1])); PyTuple_SetItem(tuple,6,Py_BuildValue("d",value.x[1][2])); PyTuple_SetItem(tuple,7,Py_BuildValue("d",value.x[1][3])); PyTuple_SetItem(tuple,8,Py_BuildValue("d",value.x[2][0])); PyTuple_SetItem(tuple,9,Py_BuildValue("d",value.x[2][1])); PyTuple_SetItem(tuple,10,Py_BuildValue("d",value.x[2][2])); PyTuple_SetItem(tuple,11,Py_BuildValue("d",value.x[2][3])); PyTuple_SetItem(tuple,12,Py_BuildValue("d",value.x[3][0])); PyTuple_SetItem(tuple,13,Py_BuildValue("d",value.x[3][1])); PyTuple_SetItem(tuple,14,Py_BuildValue("d",value.x[3][2])); PyTuple_SetItem(tuple,15,Py_BuildValue("d",value.x[3][3])); return tuple; ALEMBIC_PYOBJECT_CATCH_STATEMENT }