本文整理汇总了C++中TXshLevel::getSimpleLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TXshLevel::getSimpleLevel方法的具体用法?C++ TXshLevel::getSimpleLevel怎么用?C++ TXshLevel::getSimpleLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TXshLevel
的用法示例。
在下文中一共展示了TXshLevel::getSimpleLevel方法的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: 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();
}
示例3: updateXshLevel
void TApp::updateXshLevel() {
TXshLevel *xl = 0;
if (m_currentFrame->isEditingScene()) {
int frame = m_currentFrame->getFrame();
int column = m_currentColumn->getColumnIndex();
TXsheet *xsheet = m_currentXsheet->getXsheet();
if (xsheet && column >= 0 && frame >= 0 && !xsheet->isColumnEmpty(column)) {
TXshCell cell = xsheet->getCell(frame, column);
xl = cell.m_level.getPointer();
// Se sono su una cella vuota successiva a celle di un certo livello
// prendo questo come livello corrente.
if (!xl && frame > 0) {
TXshCell cell = xsheet->getCell(frame - 1, column);
xl = cell.m_level.getPointer();
}
}
m_currentLevel->setLevel(xl);
// level could be the same, but palette could have changed
if (xl && xl->getSimpleLevel()) {
TPalette *currentPalette =
m_paletteController->getCurrentPalette()->getPalette();
int styleIndex =
m_paletteController->getCurrentLevelPalette()->getStyleIndex();
m_paletteController->getCurrentLevelPalette()->setPalette(
xl->getSimpleLevel()->getPalette(), styleIndex);
// Se il nuovo livello selezionato e' un ovl,
// la paletta corrente e' una cleanup palette
// => setto come handle corrente quello della paletta di cleanup.
if (xl->getType() == OVL_XSHLEVEL && currentPalette &&
currentPalette->isCleanupPalette())
m_paletteController->editCleanupPalette();
} else if (xl && xl->getPaletteLevel()) {
int styleIndex =
m_paletteController->getCurrentLevelPalette()->getStyleIndex();
m_paletteController->getCurrentLevelPalette()->setPalette(
xl->getPaletteLevel()->getPalette(), styleIndex);
} else
m_paletteController->getCurrentLevelPalette()->setPalette(0);
}
}
示例4: 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);
}
示例5: startOrganizePalette
bool StylePickerTool::startOrganizePalette() {
/* Check if the organizing operation is available */
TXshLevel *level = getApplication()->getCurrentLevel()->getLevel();
if (!level) {
DVGui::error(tr("No current level."));
return false;
}
if (level->getType() != PLI_XSHLEVEL && level->getType() != TZP_XSHLEVEL &&
level->getType() != PLT_XSHLEVEL) {
DVGui::error(tr("Current level has no available palette."));
return false;
}
/* palette should have more than one page to organize */
TPalette *pal = NULL;
if (level->getType() == PLT_XSHLEVEL)
pal = level->getPaletteLevel()->getPalette();
else
pal = level->getSimpleLevel()->getPalette();
if (!pal || pal->getPageCount() < 2) {
DVGui::error(
tr("Palette must have more than one palette to be organized."));
return false;
}
m_paletteToBeOrganized = pal;
std::cout << "Start Organize Palette" << std::endl;
return true;
}
示例6: notifyImageChanged
/*! 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();
}
示例7: 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();
}
示例8: clear
void TLevelSet::clear() {
for (std::vector<TXshLevel *>::iterator it = m_levels.begin();
it != m_levels.end(); ++it) {
TXshLevel *level = *it;
if (level->getSimpleLevel()) level->getSimpleLevel()->clearFrames();
(*it)->release();
}
m_levelTable.clear();
m_levels.clear();
m_folderTable.clear();
m_folders.clear();
m_folders.push_back(defaultRootFolder);
m_folders.push_back(defaultSoundRootFolder);
m_defaultFolder = defaultRootFolder;
}
示例9: leftButtonUp
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();
}
示例10: fetchSample
void BinarizePopup::fetchSample()
{
TApp *app = TApp::instance();
TImageP img;
if (app->getCurrentFrame()->isEditingLevel()) {
TXshLevel *xshLevel = app->getCurrentLevel()->getLevel();
if (xshLevel && xshLevel->getSimpleLevel()) {
TXshSimpleLevel *sl = xshLevel->getSimpleLevel();
img = sl->getFrame(app->getCurrentFrame()->getFid(), false);
}
} else {
TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet();
TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrame(), app->getCurrentColumn()->getColumnIndex());
img = cell.getImage(false);
}
TRasterImageP ri = img;
if (ri) {
setSample(ri->getRaster());
} else {
setSample(TRasterP());
}
}
示例11: onImageChanged
/*
If the working palette is changed, then deactivate the "organize palette"
toggle.
*/
void StylePickerTool::onImageChanged() {
std::cout << "StylePickerTool::onImageChanged" << std::endl;
if (!m_organizePalette.getValue() || !m_paletteToBeOrganized) return;
TXshLevel *level = getApplication()->getCurrentLevel()->getLevel();
if (!level) {
m_organizePalette.setValue(false);
getApplication()->getCurrentTool()->notifyToolChanged();
return;
}
TPalette *pal = NULL;
if (level->getType() == PLT_XSHLEVEL)
pal = level->getPaletteLevel()->getPalette();
else if (level->getSimpleLevel()) {
pal = level->getSimpleLevel()->getPalette();
}
if (!pal || pal != m_paletteToBeOrganized) {
m_organizePalette.setValue(false);
getApplication()->getCurrentTool()->notifyToolChanged();
return;
}
}
示例12: onLevelColorStyleChanged
void TApp::onLevelColorStyleChanged() {
onPaletteChanged();
TXshLevel *level = m_currentLevel->getLevel();
if (!level) return;
TPalette *palette = getCurrentPalette()->getPalette();
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
} else {
TLevelSet *levelSet = getCurrentScene()->getScene()->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
if (levelSet->getLevel(i)) {
simpleLevel = levelSet->getLevel(i)->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
}
}
}
}
}
示例13: load
QScriptValue Level::load(const QScriptValue &fpArg) {
if (m_sl) {
m_scene->getLevelSet()->removeLevel(m_sl, true);
m_sl->release();
m_sl = 0;
}
// get the path
TFilePath fp;
QScriptValue err = checkFilePath(context(), fpArg, fp);
if (err.isError()) return err;
QString fpStr = fpArg.toString();
try {
if (!TSystem::doesExistFileOrLevel(fp)) {
return context()->throwError(tr("File %1 doesn't exist").arg(fpStr));
}
TFileType::Type fileType = TFileType::getInfo(fp);
if (TFileType::isVector(fileType))
m_type = PLI_XSHLEVEL;
else if (0 != (fileType & TFileType::CMAPPED_IMAGE))
m_type = TZP_XSHLEVEL;
else if (0 != (fileType & TFileType::RASTER_IMAGE))
m_type = OVL_XSHLEVEL;
else {
return context()->throwError(tr("File %1 is unsupported").arg(fpStr));
}
TXshLevel *xl = m_scene->loadLevel(fp);
if (xl) {
m_sl = xl->getSimpleLevel();
m_sl->addRef();
}
return context()->thisObject();
} catch (...) {
return context()->throwError(tr("Exception reading %1").arg(fpStr));
}
}
示例14: setLevel
void Vectorizer::setLevel(const TXshSimpleLevelP &level)
{
m_level = level;
//Creo il livello pli
TXshSimpleLevel *sl = m_level.getPointer();
if (!sl)
return;
int rowCount = sl->getFrameCount();
if (rowCount <= 0 || sl->isEmpty())
return;
TXshLevel *xl;
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
// Build the new level name
wstring levelName = sl->getName() + L"v";
{
std::auto_ptr<NameBuilder> nameBuilder(NameBuilder::getBuilder(levelName));
for (;;) {
levelName = nameBuilder->getNext();
if (scene->getLevelSet()->getLevel(levelName) == 0)
break;
}
}
TFilePath dstPath = sl->getPath().withName(levelName).withType("pli");
dstPath = scene->decodeFilePath(dstPath);
bool overWrite = false;
if (TSystem::doesExistFileOrLevel(dstPath)) {
m_dialogShown = true;
std::wstring name = m_dialog->execute(scene, dstPath, true);
if (m_dialog->cancelPressed())
return;
switch (m_dialog->getChoice()) {
case OverwriteDialog::KEEP_OLD: {
xl = scene->getLevelSet()->getLevel(levelName);
if (!xl)
xl = scene->loadLevel(dstPath);
m_vLevel = xl->getSimpleLevel();
return;
}
CASE OverwriteDialog::OVERWRITE : overWrite = true;
DEFAULT:
levelName = name;
}
}
xl = scene->createNewLevel(PLI_XSHLEVEL, levelName);
TXshSimpleLevel *vl = xl->getSimpleLevel();
assert(vl);
if (overWrite) {
vl->setPath(scene->codeFilePath(dstPath));
vl->setName(levelName);
}
TPalette *palette = 0;
if (sl->getType() == TZP_XSHLEVEL)
palette = sl->getPalette();
palette = palette ? palette->clone() : new TPalette;
palette->setPaletteName(vl->getName());
vl->setPalette(palette);
m_vLevel = vl;
}
示例15:
TXshLevel *xl = cell.m_level.getPointer();
if (!xl) return;
ZPlacement cameraPlacement;
if (m_subXSheetStack.empty())
cameraPlacement = m_cameraPlacement;
else
cameraPlacement = m_subXSheetStack.back().m_camera;
TAffine columnZaff;
bool columnBehindCamera = TStageObject::perspective(
columnZaff, cameraPlacement.m_aff, cameraPlacement.m_z, columnAff,
columnZ, columnNoScaleZ);
if (!columnBehindCamera) return;
TXshSimpleLevel *sl = xl->getSimpleLevel();
bool storePlayer =
sl || (xl->getChildLevel() &&
locals::applyPlasticDeform(column.getPointer(), m_vs) &&
locals::isMeshDeformed(xsh, pegbar, m_vs));
if (storePlayer) {
// Build and store a player
Player player;
player.m_sl = sl;
player.m_fid = cell.m_frameId;
player.m_xsh = xsh;
player.m_column = col;
player.m_frame = row;