Ejemplo n.º 1
0
//-*****************************************************************************
void OCameraSchema::init( uint32_t iTsIdx )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "OCameraSchema::init()" );

    AbcA::CompoundPropertyWriterPtr _this = this->getPtr();

    // 14 double values
    AbcA::DataType dType( Util::kFloat64POD, 16 );
    m_coreProperties = Abc::OScalarProperty( _this, ".core", dType, iTsIdx );

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
Ejemplo n.º 2
0
QString ReportGenerator::findTemplate( const QString& type )
{
  DocType dType( type );

  QString tmplFile = dType.templateFile( mArchDoc->locale()->country() );

  if ( tmplFile.isEmpty() ) {
    KMessageBox::error( 0, i18n("A document template named %1 could not be loaded. "
                                "Please check the installation." ).arg( dType.templateFile() ) ,
                        i18n( "Template not found" ) );
  }

  mMergeIdent = dType.mergeIdent();
  mWatermarkFile = dType.watermarkFile();

  return tmplFile;
}
Ejemplo n.º 3
0
QString ReportGenerator::findTemplate( const QString& type )
{
  DocType dType( type );
  const QString country = mArchDoc->locale()->bcp47Name();
  const QString tmplFile = dType.templateFile(country);

  if ( tmplFile.isEmpty() ) {
      QMessageBox msgBox;
      msgBox.setText(i18n("A document template named %1 could not be loaded. ", tmplFile));
      msgBox.setInformativeText(i18n("Please check your installation!"));
      msgBox.setStandardButtons(QMessageBox::Ok);
      msgBox.exec();
  }

  mMergeIdent = dType.mergeIdent();
  mWatermarkFile = dType.watermarkFile();

  return tmplFile;
}
Ejemplo n.º 4
0
//-*****************************************************************************
void OCameraSchema::set( const CameraSample &iSamp )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "OCameraSchema::set()" );

    double sampleData[16];
    for ( size_t i = 0; i < 16; ++i )
        sampleData[i] = iSamp.getCoreValue( i );

    if ( m_coreProperties.getNumSamples() == 0 )
    {
        m_initialSample = iSamp;

        std::size_t numChannels = iSamp.getNumOpChannels();
        std::size_t numOps = iSamp.getNumOps();

        std::vector < std::string > filmBackOps( numOps );
        std::vector <double> opChannels ( numChannels );

        std::size_t curChannel = 0;
        for ( std::size_t i = 0; i < numOps; ++i )
        {
            const FilmBackXformOp & op = iSamp[i];
            filmBackOps[i] = op.getTypeAndHint();
            for ( std::size_t j = 0; j < op.getNumChannels();
                ++j, ++curChannel )
            {
                opChannels[curChannel] = op.getChannelValue( j );
            }
        }

        // we are in scalar territory, write the ops as scalar
        if ( numOps > 0 && numOps < 256 )
        {
            AbcA::DataType dType( Util::kStringPOD, numOps );
            Abc::OScalarProperty filmBackOpsProp( this->getPtr(),
                ".filmBackOps", dType );
            filmBackOpsProp.set( &filmBackOps.front() );
        }
        // too big for scalar, write ops as an array
        else if ( numChannels >= 256 )
        {
            OStringArrayProperty filmBackOpsProp( this->getPtr(),
                ".filmBackOps" );
            StringArraySample ssamp( &filmBackOps.front(), filmBackOps.size() );
            filmBackOpsProp.set( ssamp );
        }

        // do the same thing for the channels
        if ( numChannels > 0 && numChannels < 256 )
        {
            AbcA::DataType dType( Util::kFloat64POD, numChannels );
            m_smallFilmBackChannelsProperty = Abc::OScalarProperty( this->getPtr(),
                ".filmBackChannels", dType );
            m_smallFilmBackChannelsProperty.set( &opChannels.front() );

        }
        else if ( numChannels >= 256 )
        {
            m_bigFilmBackChannelsProperty = Abc::ODoubleArrayProperty( this->getPtr(),
                ".filmBackChannels" );
            DoubleArraySample dsamp( &opChannels.front(), opChannels.size() );
            m_bigFilmBackChannelsProperty.set( dsamp );
        }
    }
    else
    {
        std::size_t numOps = iSamp.getNumOps();
        ABCA_ASSERT( numOps == m_initialSample.getNumOps(),
            "Number of Film Back Xform Ops differ expected: " <<
            m_initialSample.getNumOps() << " got: " << numOps );

        std::vector <double> opChannels ( m_initialSample.getNumOpChannels() );
        std::size_t chan = 0;
        for ( std::size_t i = 0; i < numOps; ++i )
        {
            const FilmBackXformOp & op = iSamp[i];
            const FilmBackXformOp & oldOp = m_initialSample[i];

            ABCA_ASSERT( oldOp.getType() == op.getType(),
                "Film Back Xform Operation type differs from initial sample"
                " at index: " << i );

            std::size_t numChannels = op.getNumChannels();
            for ( std::size_t j = 0; j < numChannels; ++j, ++chan )
            {
                opChannels[chan] = op.getChannelValue( j );
            }
        }

        if ( m_smallFilmBackChannelsProperty )
        {
            m_smallFilmBackChannelsProperty.set( &opChannels.front() );
        }
        else if ( m_bigFilmBackChannelsProperty )
        {
            DoubleArraySample dsamp( &opChannels.front(), opChannels.size() );
            m_bigFilmBackChannelsProperty.set( dsamp );
        }
        // else no film back channels
    }

    m_coreProperties.set( sampleData );

    ALEMBIC_ABC_SAFE_CALL_END();
}