bool CKeyframeList::OnEditComplete(int nRow, int nCol, CWnd* pEditor, LV_DISPINFO* pLVDI) { float num = atof(pLVDI->item.pszText); //TODO: clarify input switch(nCol) { case TIME_COL: { if(nRow == 0 || num < 0.0) num = 0.0;//1st number must have a time of 0 and be greater than zero //gather data pointers ((KeyFrame*) GetItemData(nRow))->timeStamp = num; fixTimes(false); break; } case DURATION_COL: { if(nRow == GetItemCount()-1) num = 0.0; //last keyframe can only have duration of 0 //update changed data: ((KeyFrame*) GetItemData(nRow))->duration = num; fixTimes(true); break; } } return false; }
api::DirectionData DirectionReader::getDirectionData() { myOutDirectionData = initializeData(); updateTimeForOffset(); parsePlacement(); parseValues(); // need to make sure all the MarkData item times match the DirectionData time fixTimes(); return returnData(); }
void CKeyframeList::DeleteItem(int item) { delete (KeyFrame*) GetItemData(item); CListCtrl::DeleteItem(item); if(item == 0) ((KeyFrame*)GetItemData(0))->distFromPrev = 0; else if(item != GetItemCount()) { osg::Vec3 a = ((KeyFrame*)GetItemData(item))->ctrlPoint.getPosition(); osg::Vec3 b = ((KeyFrame*)GetItemData(item-1))->ctrlPoint.getPosition(); a = b-a; ((KeyFrame*)GetItemData(item))->distFromPrev = sqrt(a.x() * a.x() + a.y() * a.y() + a.z() * a.z()); } fixTimes(true); }