toonz/sources/toonz/cellselection.cpp
//-----------------------------------------------------------------------------
// Convert selected vector cells to ToonzRaster
Convert selected vector cells to ToonzRaster
Convert selected vector cells to ToonzRaster
bool TCellSelection::areOnlyVectorCellsSelected() {
  int r0, c0, r1, c1;
  getSelectedCells(r0, c0, r1, c1);
  int i;
  ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
  TXsheet *xsh      = scene->getXsheet();
  TXshCell firstCell = xsh->getCell(r0, c0);
  if (firstCell.isEmpty()) {
    DVGui::error(QObject::tr("This command only works on vector cells."));
    return false;
  }
  TXshSimpleLevel *sourceSl = firstCell.getSimpleLevel();
  if (!sourceSl || sourceSl->getType() != PLI_XSHLEVEL) {
    DVGui::error(QObject::tr("This command only works on vector cells."));
    return false;
  }
  if (c0 != c1) {
    DVGui::error(
        QObject::tr("Please select only one column for this command."));
    return false;
  }
  for (i = r0; i <= r1; i++) {
    TXshCell testCell = xsh->getCell(i, c0);
    if (testCell.isEmpty() || testCell.getSimpleLevel() != sourceSl) {
      DVGui::error(
          QObject::tr("All selected cells must belong to the same level."));
      return false;
    }
  }
  return true;
}
bool TCellSelection :: areOnlyVectorCellsSelected ( ) { int r0 , c0 , r1 , c1 ; getSelectedCells ( r0 , c0 , r1 , c1 ) ; int i ; ToonzScene * scene = TApp :: instance ( ) -> getCurrentScene ( ) -> getScene ( ) ; TXsheet * xsh = scene -> getXsheet ( ) ; TXshCell firstCell = xsh -> getCell ( r0 , c0 ) ; if ( firstCell . isEmpty ( ) ) { DVGui :: error ( QObject :: tr ( " " ) ) ; return false ; } TXshSimpleLevel * sourceSl = firstCell . getSimpleLevel ( ) ; if ( ! sourceSl || sourceSl -> getType ( ) != PLI_XSHLEVEL ) { DVGui :: error ( QObject :: tr ( " " ) ) ; return false ; } if ( c0 != c1 ) { DVGui :: error ( QObject :: tr ( " " ) ) ; return false ; } for ( i = r0 ; i <= r1 ; i ++ ) { TXshCell testCell = xsh -> getCell ( i , c0 ) ; if ( testCell . isEmpty ( ) || testCell . getSimpleLevel ( ) != sourceSl ) { DVGui :: error ( QObject :: tr ( " " ) ) ; return false ; } } return true ; }
Convert selected vector cells to ToonzRaster
Convert selected vector cells to ToonzRaster
// set up basics