Exocortex / ExocortexCrate

http://exocortex.com/products/crate
BSD 3-Clause "New" or "Revised" License
134 stars 68 forks source link

New OArchive's num time samples when creating an object #18

Open cgdougm opened 9 years ago

cgdougm commented 9 years ago

The OBJ2ABC.py sample is always croaking when trying to create a new OArchive complaining about the number of time samples being out of range.

I'm brand new to this code (and may be to only person on the planet trying to create ABC's from OBJ's using Python ;-) but thought it best to mention the problem here first in case someone more familiar with this can shed light.

static PyObject * oArchive_createObject(PyObject * self, PyObject * args)
{
   oArchive * archive = (oArchive *)self;
. . . 
   int tsIndex = 1;
. . . 
   // check if the timesampling is in range
   if(tsIndex < 0 || tsIndex >= (int)archive->mArchive->getNumTimeSamplings())
   {
      PyErr_SetString(getError(), "timeSamplingIndex is out of range!");
      return NULL;
   }

Since tsIndex is always one, that must mean that the getNumTimeSamplings() is returning zero (which it does when any error condition exists.)

I don't really understand the wisdom here of only allowing creation a new object when the number of time samples is two or greater.

TIA.