void TVectorBrushStyle::loadBrush(const std::string &brushName) { m_brushName = brushName; m_colorCount = 0; if (brushName.empty()) return; if (!m_brush) { //Load the image associated with fp TFilePath fp(m_rootDir + TFilePath(brushName + ".pli")); TLevelReaderP lr(fp); TLevelP level = lr->loadInfo(); m_brush = lr->getFrameReader(level->begin()->first)->load(); assert(m_brush); TPalette *palette = level->getPalette(); m_brush->setPalette(palette); } assert(m_brush); m_colorCount = m_brush->getPalette()->getStyleInPagesCount() - 1; //No transparent }
void TLevelWriter::save(const TLevelP &level) { for (TLevel::Iterator it = level->begin(); it != level->end(); it++) { if (it->second) getFrameWriter(it->first)->save(it->second); } }
const TImageInfo *TLevelReader::getImageInfo() { if (m_info) return m_info; TLevelP level = loadInfo(); if (level->getFrameCount() == 0) return 0; return getImageInfo(level->begin()->first); }
void FormatSettingsPopup::showEvent(QShowEvent *se) { #ifdef WIN32 if (m_format == "avi") { assert(m_codecComboBox); m_codecComboBox->blockSignals(true); m_codecComboBox->clear(); ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); TEnumProperty *eProps = dynamic_cast<TEnumProperty *>(m_props->getProperty(0)); assert(eProps); TDimension res(0, 0); if (m_levelPath.isEmpty()) res = scene->getCurrentCamera()->getRes(); else { TLevelReaderP lr(m_levelPath); TLevelP level = lr->loadInfo(); const TImageInfo *info = lr->getImageInfo(level->begin()->first); res.lx = info->m_lx; res.ly = info->m_ly; } TEnumProperty::Range range = eProps->getRange(); int currIndex = -1; wstring defaultVal = eProps->getValue(); QMap<wstring, bool> usableCodecs = AviCodecRestrictions::getUsableCodecs(res); for (int i = 0; i < (int)range.size(); i++) { wstring nameProp = range[i]; if (nameProp == L"Uncompressed" || (usableCodecs.contains(nameProp) && usableCodecs[nameProp])) { if (nameProp == defaultVal) currIndex = m_codecComboBox->count(); m_codecComboBox->addItem(QString::fromStdWString(nameProp)); } } m_codecComboBox->blockSignals(false); if (currIndex >= 0) m_codecComboBox->setCurrentIndex(currIndex); } #endif Dialog::showEvent(se); }