本文整理汇总了C++中TXshLevel类的典型用法代码示例。如果您正苦于以下问题:C++ TXshLevel类的具体用法?C++ TXshLevel怎么用?C++ TXshLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TXshLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enterEvent
void SceneViewer::enterEvent(QEvent *) {
if (m_isMouseEntered) return;
m_isMouseEntered = true;
TApp *app = TApp::instance();
modifiers = 0;
TTool *tool = app->getCurrentTool()->getTool();
TXshLevel *level = app->getCurrentLevel()->getLevel();
if (level && level->getSimpleLevel())
m_dpiScale =
getCurrentDpiScale(level->getSimpleLevel(), tool->getCurrentFid());
else
m_dpiScale = TPointD(1, 1);
if (m_freezedStatus != NO_FREEZED) return;
invalidateToolStatus();
if (tool && tool->isEnabled()) {
tool->setViewer(this);
tool->updateMatrix();
tool->onEnter();
}
setFocus();
updateGL();
}
示例2: onXshLevelSwitched
void TApp::onXshLevelSwitched(TXshLevel *) {
TXshLevel *level = m_currentLevel->getLevel();
if (level) {
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
// Devo aggiornare la paletta corrente
if (simpleLevel) {
m_paletteController->getCurrentLevelPalette()->setPalette(
simpleLevel->getPalette());
// Se il nuovo livello selezionato e' un ovl,
// la paletta corrente e' una cleanup palette
// => setto come handle corrente quello della paletta di cleanup.
TPalette *currentPalette =
m_paletteController->getCurrentPalette()->getPalette();
if (simpleLevel->getType() == OVL_XSHLEVEL && currentPalette &&
currentPalette->isCleanupPalette())
m_paletteController->editCleanupPalette();
return;
}
TXshPaletteLevel *paletteLevel = level->getPaletteLevel();
if (paletteLevel) {
m_paletteController->getCurrentLevelPalette()->setPalette(
paletteLevel->getPalette());
return;
}
}
m_paletteController->getCurrentLevelPalette()->setPalette(0);
}
示例3: onImageChanged
/*! Notify change of image in \b fid: update icon and notify level change.
*/
void TTool::notifyImageChanged(const TFrameId &fid) {
onImageChanged();
if (!m_application) return;
m_application->getCurrentScene()->setDirtyFlag(true);
if (m_application->getCurrentFrame()->isEditingLevel()) {
TXshLevel *xl = m_application->getCurrentLevel()->getLevel();
if (!xl) return;
TXshSimpleLevel *sl = xl->getSimpleLevel();
if (!sl) return;
sl->setDirtyFlag(true);
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
} else {
int row = m_application->getCurrentFrame()->getFrame();
int col = m_application->getCurrentColumn()->getColumnIndex();
if (col < 0) return;
TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet();
if (!xsh) return;
TXshCell cell = xsh->getCell(row, col);
TXshSimpleLevel *sl = cell.getSimpleLevel();
if (sl) {
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
sl->setDirtyFlag(true);
}
}
m_application->getCurrentLevel()->notifyLevelChange();
}
示例4: assert
void TApp::onLevelColorStyleSwitched() {
TPaletteHandle *ph = m_paletteController->getCurrentLevelPalette();
assert(ph);
if (ToonzCheck::instance()->setColorIndex(ph->getStyleIndex())) {
ToonzCheck *tc = ToonzCheck::instance();
int mask = tc->getChecks();
if (mask & ToonzCheck::eInk || mask & ToonzCheck::ePaint) {
IconGenerator::Settings s;
s.m_blackBgCheck = mask & ToonzCheck::eBlackBg;
s.m_transparencyCheck = mask & ToonzCheck::eTransparency;
s.m_inksOnly = mask & ToonzCheck::eInksOnly;
s.m_inkIndex = mask & ToonzCheck::eInk ? tc->getColorIndex() : -1;
s.m_paintIndex = mask & ToonzCheck::ePaint ? tc->getColorIndex() : -1;
IconGenerator::instance()->setSettings(s);
TXshLevel *sl = m_currentLevel->getLevel();
if (!sl) return;
std::vector<TFrameId> fids;
sl->getFids(fids);
for (int i = 0; i < (int)fids.size(); i++)
IconGenerator::instance()->invalidate(sl, fids[i]);
m_currentLevel->notifyLevelViewChange();
}
/*-- 表示オプションが切り替わっただけなので、DirtyFlagを立てない --*/
m_currentScene->notifySceneChanged(false);
}
}
示例5: updateAllLinkedStyles
void StudioPaletteCmd::updateAllLinkedStyles(TPaletteHandle *paletteHandle,
TXsheetHandle *xsheetHandle) {
if (!xsheetHandle) return;
TXsheet *xsheet = xsheetHandle->getXsheet();
if (!xsheet) return;
ToonzScene *scene = xsheet->getScene();
if (!scene) return;
// emit signal only if something changed
bool somethingChanged = false;
StudioPalette *sp = StudioPalette::instance();
TLevelSet *levelSet = scene->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
TXshLevel *xl = levelSet->getLevel(i);
TXshSimpleLevel *sl = xl ? xl->getSimpleLevel() : 0;
if (!sl) continue;
TPalette *palette = sl->getPalette();
if (palette) {
somethingChanged = somethingChanged | sp->updateLinkedColors(palette);
if (sl->getType() == TZP_XSHLEVEL) {
std::vector<TFrameId> fids;
sl->getFids(fids);
std::vector<TFrameId>::iterator it;
for (it = fids.begin(); it != fids.end(); ++it) {
TFrameId fid = *it;
std::string id = sl->getImageId(fid);
}
}
}
}
if (!paletteHandle || !paletteHandle->getPalette()) return;
if (somethingChanged) paletteHandle->notifyColorStyleChanged();
}
示例6: onXshLevelChanged
void TApp::onXshLevelChanged() {
TXshLevel *level = m_currentLevel->getLevel();
std::vector<TFrameId> fids;
if (level != 0) level->getFids(fids);
m_currentFrame->setFrameIds(fids);
// update current tool
m_currentTool->onImageChanged((TImage::Type)getCurrentImageType());
}
示例7: undo
void undo() const override {
TXshLevel *level = m_levelHandle->getLevel();
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
示例8: isColumnEmpty
bool TXsheet::setCell(int row, int col, const TXshCell &cell) {
if (row < 0 || col < 0) return false;
bool wasColumnEmpty = isColumnEmpty(col);
TXshCellColumn *cellColumn;
if (!cell.isEmpty()) {
TXshLevel *level = cell.m_level.getPointer();
assert(level);
int levelType = level->getType();
TXshColumn::ColumnType type = TXshColumn::eLevelType;
if (levelType == SND_XSHLEVEL)
type = TXshColumn::eSoundType;
else if (levelType == SND_TXT_XSHLEVEL)
type = TXshColumn::eSoundTextType;
else if (levelType == PLT_XSHLEVEL)
type = TXshColumn::ePaletteType;
else if (levelType == ZERARYFX_XSHLEVEL)
type = TXshColumn::eZeraryFxType;
else if (levelType == MESH_XSHLEVEL)
type = TXshColumn::eMeshType;
cellColumn = touchColumn(col, type)->getCellColumn();
} else {
TXshColumn *column = getColumn(col);
cellColumn = column ? column->getCellColumn() : 0;
}
if (!cellColumn || cellColumn->isLocked()) return false;
cellColumn->setXsheet(this);
if (!cellColumn->setCell(row, cell)) {
if (wasColumnEmpty) {
removeColumn(col);
insertColumn(col);
}
return false;
}
TFx *fx = cellColumn->getFx();
if (wasColumnEmpty && fx && fx->getOutputConnectionCount() == 0 &&
cellColumn->getPaletteColumn() == 0)
getFxDag()->addToXsheet(fx);
if (cell.isEmpty())
updateFrameCount();
else if (row >= m_imp->m_frameCount)
m_imp->m_frameCount = row + 1;
TNotifier::instance()->notify(TXsheetChange());
return true;
}
示例9: setLevel
void TXshLevelHandle::setLevel(TXshLevel *level) {
if (m_level == level) return;
TXshLevel *oldLevel = m_level;
m_level = level;
if (level) level->addRef();
bool levelExists = oldLevel ? oldLevel->getRefCount() > 1 : false;
if (oldLevel) oldLevel->release();
emit xshLevelSwitched(levelExists ? oldLevel : 0);
}
示例10: getLevelCount
TXshLevel *TLevelSet::getLevel(const ToonzScene &scene,
const TFilePath &levelPath) const {
const TFilePath &decodedPath = scene.decodeFilePath(levelPath);
int l, lCount = getLevelCount();
for (l = 0; l != lCount; ++l) {
TXshLevel *level = getLevel(l);
if (decodedPath == scene.decodeFilePath(level->getPath())) return level;
}
return 0;
}
示例11: computeThickness
void FullColorBrushTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e)
{
m_brushPos = m_mousePos = pos;
TRasterImageP ri = (TRasterImageP)getImage(true);
if (!ri)
return;
if (m_points.size() != 1) {
double maxThickness = m_thickness.getValue().second;
double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
TPointD rasCenter = ri->getRaster()->getCenterD();
TThickPoint point(pos + rasCenter, thickness);
m_points.push_back(point);
int m = m_points.size();
vector<TThickPoint> points;
points.push_back(m_points[m - 3]);
points.push_back(m_points[m - 2]);
points.push_back(m_points[m - 1]);
TRect bbox = m_brush->getBoundFromPoints(points);
updateWorkAndBackupRasters(bbox);
m_tileSaver->save(bbox);
m_brush->addArc(points[0], points[1], points[2], m_oldOpacity, opacity);
m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
TRectD invalidateRect = ToolUtils::getBounds(points, maxThickness);
invalidate(invalidateRect.enlarge(2) - rasCenter);
m_strokeRect += bbox;
m_lastRect.empty();
}
if (m_brush) {
delete m_brush;
m_brush = 0;
}
m_workRaster->unlock();
if (m_tileSet->getTileCount() > 0) {
delete m_tileSaver;
TTool::Application *app = TTool::getApplication();
TXshLevel *level = app->getCurrentLevel()->getLevel();
TXshSimpleLevelP simLevel = level->getSimpleLevel();
TFrameId frameId = getCurrentFid();
TRasterP ras = ri->getRaster()->extract(m_strokeRect)->clone();
TUndoManager::manager()->add(new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId,
m_isFrameCreated, ras, m_strokeRect.getP00()));
}
notifyImageChanged();
m_strokeRect.empty();
}
示例12: updateWindowTitle
void Filmstrip::onLevelSwitched(TXshLevel *oldLevel) {
updateWindowTitle();
int tc = ToonzCheck::instance()->getChecks();
if (tc & (ToonzCheck::eInk | ToonzCheck::ePaint)) {
TXshLevel *sl = TApp::instance()->getCurrentLevel()->getLevel();
if (!sl) return;
std::vector<TFrameId> fids;
sl->getFids(fids);
removeIcons(sl, fids, true);
}
update();
}
示例13: onCellSwitched
void MeshifyPopup::onCellSwitched()
{
// In case current cell level is not of the suitable type, disable the
// rasterization parameter
{
TXshLevel *level = ::levelToMeshify();
int type = level ? level->getType() : UNKNOWN_XSHLEVEL;
m_rasterizationDpi->setEnabled(type == PLI_XSHLEVEL || type == CHILD_XSHLEVEL);
}
acquirePreview();
}
示例14: getLevel
QScriptValue getLevel(QScriptContext *ctx, QScriptEngine *eng)
{
QString levelName = ctx->argument(0).toString();
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
TXshLevel *level = scene->getLevelSet()->getLevel(levelName.toStdWString());
if (!level) {
level = scene->createNewLevel(PLI_XSHLEVEL, levelName.toStdWString());
levelName = QString::fromStdWString(level->getName());
}
if (level->getSimpleLevel())
return eng->newQObject(new ScriptWrapper::Level(level->getSimpleLevel()), QScriptEngine::ScriptOwnership);
else
return QScriptValue();
}
示例15: TFilePath
void CastTreeViewer::dropEvent(QDropEvent *event)
{
m_dropTargetItem = 0;
if (m_dropFilePath != TFilePath()) {
IoCmd::loadScene(m_dropFilePath);
m_dropFilePath = TFilePath();
m_dropTargetItem = 0;
update();
return;
}
if (!event->mimeData()->hasFormat("application/vnd.toonz.levels"))
return;
m_dropTargetItem = itemAt(event->pos());
if (!m_dropTargetItem)
return;
TFilePath folderPath(m_dropTargetItem->data(1, Qt::DisplayRole).toString().toStdWString());
m_dropTargetItem = 0;
update();
if (folderPath.getName() == AudioFolderName) {
event->ignore();
return;
}
event->acceptProposedAction();
TLevelSet *levelSet = getLevelSet();
const CastItems *castItems = dynamic_cast<const CastItems *>(event->mimeData());
assert(castItems);
if (!castItems)
return;
int i;
TUndoManager::manager()->beginBlock();
for (i = 0; i < castItems->getItemCount(); i++) {
CastItem *item = castItems->getItem(i);
if (LevelCastItem *li = dynamic_cast<LevelCastItem *>(item)) {
TXshLevel *level = li->getLevel();
wstring levelName = level->getName();
MoveLevelToFolderUndo *undo = new MoveLevelToFolderUndo(levelSet, levelName, folderPath);
levelSet->moveLevelToFolder(folderPath, level);
TUndoManager::manager()->add(undo);
} else if (SoundCastItem *si = dynamic_cast<SoundCastItem *>(item)) {
}
}
TUndoManager::manager()->endBlock();
emit itemMovedToFolder();
}