|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// System includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tsystem.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "timagecache.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Geometry
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Image
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "timageinfo.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tropcm.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Sound
|
|
Toshihiro Shimizu |
890ddd |
#include "tsop.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsound.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Strings
|
|
Toshihiro Shimizu |
890ddd |
#include "tconvert.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// File-related includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfiletype.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "filebrowsermodel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "fileviewerpopup.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// OpenGL
|
|
Toshihiro Shimizu |
890ddd |
#include "tgl.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorgl.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorrenderdata.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Qt helpers
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/imageutils.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// App-Stage includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tapp.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toutputproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheethandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshsimplelevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/levelproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tscenehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/sceneproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevelhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcamera.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/preferences.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tproject.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Image painting
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/imagepainter.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Preview
|
|
Toshihiro Shimizu |
890ddd |
#include "previewfxmanager.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Panels
|
|
Toshihiro Shimizu |
890ddd |
#include "pane.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// recent files
|
|
Toshihiro Shimizu |
890ddd |
#include "mainwindow.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Other widgets
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/flipconsole.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvdialog.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "filmstripselection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "castselection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "histogrampopup.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qapplication></qapplication>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdesktopwidget></qdesktopwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qsettings></qsettings>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpainter></qpainter>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdialogbuttonbox></qdialogbuttonbox>
|
|
Toshihiro Shimizu |
890ddd |
#include <qabstractbutton></qabstractbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qradiobutton></qradiobutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qslider></qslider>
|
|
Toshihiro Shimizu |
890ddd |
#include <qbuttongroup></qbuttongroup>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbar></qtoolbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmainwindow></qmainwindow>
|
|
Toshihiro Shimizu |
890ddd |
#include <qurl></qurl>
|
|
Toshihiro Shimizu |
890ddd |
#include <qobject></qobject>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdesktopservices></qdesktopservices>
|
|
Toshihiro Shimizu |
890ddd |
#include <qvboxlayout></qvboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qhboxlayout></qhboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpushbutton></qpushbutton>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#include <stdint.h> // for uintptr_t</stdint.h>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#include "avicodecrestrictions.h"
|
|
Shinya Kitaoka |
3bfa54 |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "flipbook.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace ImageUtils;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Shinya Kitaoka |
120a6e |
QString getShortcut(const char *id) {
|
|
Shinya Kitaoka |
120a6e |
return QString::fromStdString(
|
|
Shinya Kitaoka |
120a6e |
CommandManager::instance()->getShortcutFromId(id));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Toshihiro Shimizu |
890ddd |
/* inline TRect getImageBounds(const TImageP& img)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if(TRasterImageP ri= img)
|
|
Toshihiro Shimizu |
890ddd |
return ri->getRaster()->getBounds();
|
|
Toshihiro Shimizu |
890ddd |
else if(TToonzImageP ti= img)
|
|
Toshihiro Shimizu |
890ddd |
return ti->getRaster()->getBounds();
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TVectorImageP vi= img;
|
|
Toshihiro Shimizu |
890ddd |
return convert(vi->getBBox());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
inline TRectD getImageBoundsD(const TImageP &img) {
|
|
Shinya Kitaoka |
120a6e |
if (TRasterImageP ri = img)
|
|
Shinya Kitaoka |
120a6e |
return TRectD(0, 0, ri->getRaster()->getLx(), ri->getRaster()->getLy());
|
|
Shinya Kitaoka |
120a6e |
else if (TToonzImageP ti = img)
|
|
Shinya Kitaoka |
120a6e |
return TRectD(0, 0, ti->getSize().lx, ti->getSize().ly);
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
TVectorImageP vi = img;
|
|
Shinya Kitaoka |
120a6e |
return vi->getBBox();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \class FlipBook
|
|
Shinya Kitaoka |
120a6e |
\brief The FlipBook class provides to view level images.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
The object is composed of grid layout \b QGridLayout which
|
|
Shinya Kitaoka |
120a6e |
contains an image
|
|
Shinya Kitaoka |
120a6e |
viewer \b ImageViewer and a double button bar. It is possible
|
|
Shinya Kitaoka |
120a6e |
decide widget
|
|
Shinya Kitaoka |
120a6e |
title and which button bar show by setting QString and bool in
|
|
Shinya Kitaoka |
120a6e |
constructor.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
You can set level to show in FlipBook using \b setLevel(); and
|
|
Shinya Kitaoka |
120a6e |
call
|
|
Shinya Kitaoka |
120a6e |
onDrawFrame() to show FlipBook current frame. The current frame
|
|
Shinya Kitaoka |
120a6e |
can be
|
|
Shinya Kitaoka |
120a6e |
set directly using setCurrentFrame(int index) or using slot
|
|
Shinya Kitaoka |
120a6e |
methods connected
|
|
Shinya Kitaoka |
120a6e |
to button bar.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa FlipBookPool class.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
FlipBook::FlipBook(QWidget *parent, QString viewerTitle,
|
|
manongjohn |
77dd6e |
std::vector<int> flipConsoleButtonMask, UCHAR flags,</int>
|
|
Shinya Kitaoka |
120a6e |
bool isColorModel) //, bool showOnlyPlayBackgroundButton)
|
|
shun-iwasawa |
215a5b |
: QWidget(parent)
|
|
shun-iwasawa |
215a5b |
, m_viewerTitle(viewerTitle)
|
|
shun-iwasawa |
215a5b |
, m_levelNames()
|
|
shun-iwasawa |
215a5b |
, m_levels()
|
|
shun-iwasawa |
215a5b |
, m_playSound(false)
|
|
shun-iwasawa |
215a5b |
, m_snd(0)
|
|
shun-iwasawa |
215a5b |
, m_player(0)
|
|
shun-iwasawa |
215a5b |
//, m_doCompare(false)
|
|
shun-iwasawa |
215a5b |
, m_currentFrameToSave(0)
|
|
shun-iwasawa |
215a5b |
, m_lw()
|
|
shun-iwasawa |
215a5b |
, m_lr()
|
|
shun-iwasawa |
215a5b |
, m_loadPopup(0)
|
|
shun-iwasawa |
215a5b |
, m_savePopup(0)
|
|
shun-iwasawa |
215a5b |
, m_shrink(1)
|
|
shun-iwasawa |
215a5b |
, m_isPreviewFx(false)
|
|
shun-iwasawa |
215a5b |
, m_previewedFx(0)
|
|
shun-iwasawa |
215a5b |
, m_previewXsh(0)
|
|
shun-iwasawa |
215a5b |
, m_previewUpdateTimer(this)
|
|
shun-iwasawa |
215a5b |
, m_xl(0)
|
|
shun-iwasawa |
215a5b |
, m_title1()
|
|
shun-iwasawa |
215a5b |
, m_poolIndex(-1)
|
|
shun-iwasawa |
215a5b |
, m_freezed(false)
|
|
shun-iwasawa |
215a5b |
, m_loadbox()
|
|
shun-iwasawa |
215a5b |
, m_dim()
|
|
shun-iwasawa |
215a5b |
, m_loadboxes()
|
|
shun-iwasawa |
215a5b |
, m_freezeButton(0)
|
|
shun-iwasawa |
215a5b |
, m_flags(flags) {
|
|
Shinya Kitaoka |
120a6e |
setAcceptDrops(true);
|
|
Shinya Kitaoka |
120a6e |
setFocusPolicy(Qt::StrongFocus);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// flipConsoleButtonMask = flipConsoleButtonMask & ~FlipConsole::eSubCamera;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ImageUtils::FullScreenWidget *fsWidget =
|
|
Shinya Kitaoka |
120a6e |
new ImageUtils::FullScreenWidget(this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer = new ImageViewer(
|
|
manongjohn |
77dd6e |
fsWidget, this,
|
|
manongjohn |
77dd6e |
std::find(flipConsoleButtonMask.begin(), flipConsoleButtonMask.end(),
|
|
manongjohn |
77dd6e |
FlipConsole::eHisto) == flipConsoleButtonMask.end());
|
|
Shinya Kitaoka |
120a6e |
fsWidget->setWidget(m_imageViewer);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
setFocusProxy(m_imageViewer);
|
|
Shinya Kitaoka |
120a6e |
m_title = m_viewerTitle;
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setIsColorModel(isColorModel);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// layout
|
|
Shinya Kitaoka |
120a6e |
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
Jeremy Bullock |
915f19 |
mainLayout->setMargin(0);
|
|
Shinya Kitaoka |
120a6e |
mainLayout->setSpacing(0);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(fsWidget, 1);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole = new FlipConsole(
|
|
Shinya Kitaoka |
120a6e |
mainLayout, flipConsoleButtonMask, true, 0,
|
|
Shinya Kitaoka |
120a6e |
(viewerTitle == "") ? "FlipConsole" : viewerTitle, this, !isColorModel);
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(m_flipConsole);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
setLayout(mainLayout);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// signal-slot connection
|
|
Shinya Kitaoka |
120a6e |
bool ret = connect(m_flipConsole, SIGNAL(buttonPressed(FlipConsole::EGadget)),
|
|
Shinya Kitaoka |
120a6e |
this, SLOT(onButtonPressed(FlipConsole::EGadget)));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRate(TApp::instance()
|
|
Shinya Kitaoka |
120a6e |
->getCurrentScene()
|
|
Shinya Kitaoka |
120a6e |
->getScene()
|
|
Shinya Kitaoka |
120a6e |
->getProperties()
|
|
Shinya Kitaoka |
120a6e |
->getOutputProperties()
|
|
Shinya Kitaoka |
120a6e |
->getFrameRate());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
mainLayout->addWidget(m_flipConsole);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_previewUpdateTimer.setSingleShot(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(parentWidget(), SIGNAL(closeButtonPressed()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onCloseButtonPressed()));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(parentWidget(), SIGNAL(doubleClick(QMouseEvent *)), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onDoubleClick(QMouseEvent *)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(&m_previewUpdateTimer, SIGNAL(timeout()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(performFxUpdate()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_viewerTitle = (m_viewerTitle.isEmpty()) ? tr("Flipbook") : m_viewerTitle;
|
|
Shinya Kitaoka |
120a6e |
parentWidget()->setWindowTitle(m_viewerTitle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
/*! add freeze button to the flipbook. called from the function
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::openFlipBook.
|
|
Shinya Kitaoka |
120a6e |
this button will hide for re-use, at onCloseButtonPressed
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::addFreezeButtonToTitleBar() {
|
|
Shinya Kitaoka |
120a6e |
// If there is the button already, then reuse it.
|
|
Shinya Kitaoka |
120a6e |
if (m_freezeButton) {
|
|
Shinya Kitaoka |
120a6e |
m_freezeButton->show();
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// If there is not, then newly make it
|
|
Shinya Kitaoka |
120a6e |
TPanel *panel = qobject_cast<tpanel *="">(parentWidget());</tpanel>
|
|
Shinya Kitaoka |
120a6e |
if (panel) {
|
|
Shinya Kitaoka |
120a6e |
TPanelTitleBar *titleBar = panel->getTitleBar();
|
|
shun-iwasawa |
e6b124 |
m_freezeButton = new TPanelTitleBarButton(
|
|
shun-iwasawa |
481b59 |
titleBar, getIconThemePath("actions/20/pane_freeze.svg"));
|
|
Shinya Kitaoka |
120a6e |
m_freezeButton->setToolTip("Freeze");
|
|
Kite |
74744b |
titleBar->add(QPoint(-64, 0), m_freezeButton);
|
|
Shinya Kitaoka |
120a6e |
connect(m_freezeButton, SIGNAL(toggled(bool)), this, SLOT(freeze(bool)));
|
|
Kite |
74744b |
QPoint p(titleBar->width() - 64, 0);
|
|
Shinya Kitaoka |
120a6e |
m_freezeButton->move(p);
|
|
Shinya Kitaoka |
120a6e |
m_freezeButton->show();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::freeze(bool on) {
|
|
Shinya Kitaoka |
120a6e |
if (on)
|
|
Shinya Kitaoka |
120a6e |
freezePreview();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
unfreezePreview();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::focusInEvent(QFocusEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->makeCurrent();
|
|
Shinya Kitaoka |
120a6e |
QWidget::focusInEvent(e);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
enum { eBegin, eIncrement, eEnd };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
bb1d04 |
static DVGui::ProgressDialog *Pd = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class ProgressBarMessager final : public TThread::Message {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
int m_choice;
|
|
Shinya Kitaoka |
120a6e |
int m_val;
|
|
Shinya Kitaoka |
120a6e |
QString m_str;
|
|
Shinya Kitaoka |
120a6e |
ProgressBarMessager(int choice, int val, const QString &str = "")
|
|
Shinya Kitaoka |
120a6e |
: m_choice(choice), m_val(val), m_str(str) {}
|
|
Shinya Kitaoka |
473e70 |
void onDeliver() override {
|
|
Shinya Kitaoka |
120a6e |
switch (m_choice) {
|
|
Shinya Kitaoka |
120a6e |
case eBegin:
|
|
Shinya Kitaoka |
120a6e |
if (!Pd)
|
|
Shinya Kitaoka |
120a6e |
Pd = new DVGui::ProgressDialog(
|
|
Shinya Kitaoka |
120a6e |
QObject::tr("Saving previewed frames...."), QObject::tr("Cancel"),
|
|
Shinya Kitaoka |
120a6e |
0, m_val);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
Pd->setMaximum(m_val);
|
|
Shinya Kitaoka |
120a6e |
Pd->show();
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case eIncrement:
|
|
Shinya Kitaoka |
120a6e |
if (Pd->wasCanceled()) {
|
|
Shinya Kitaoka |
120a6e |
delete Pd;
|
|
Shinya Kitaoka |
120a6e |
Pd = 0;
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
// if (m_val==Pd->maximum()) Pd->hide();
|
|
Shinya Kitaoka |
120a6e |
Pd->setValue(m_val);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
case eEnd: {
|
|
Shinya Kitaoka |
120a6e |
DVGui::info(m_str);
|
|
Shinya Kitaoka |
120a6e |
delete Pd;
|
|
Shinya Kitaoka |
120a6e |
Pd = 0;
|
|
Shinya Kitaoka |
120a6e |
} break;
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
TThread::Message *clone() const override {
|
|
Shinya Kitaoka |
38fd86 |
return new ProgressBarMessager(*this);
|
|
Shinya Kitaoka |
38fd86 |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
LoadImagesPopup::LoadImagesPopup(FlipBook *flip)
|
|
Shinya Kitaoka |
120a6e |
: FileBrowserPopup(tr("Load Images"), Options(WITH_APPLY_BUTTON),
|
|
Shinya Kitaoka |
120a6e |
tr("Append"), new QFrame(0))
|
|
Shinya Kitaoka |
120a6e |
, m_flip(flip)
|
|
Shinya Kitaoka |
120a6e |
, m_minFrame(0)
|
|
Shinya Kitaoka |
120a6e |
, m_maxFrame(1000000)
|
|
Shinya Kitaoka |
120a6e |
, m_step(1)
|
|
Shinya Kitaoka |
120a6e |
, m_shrink(1) {
|
|
Shinya Kitaoka |
120a6e |
QFrame *frameRangeFrame = (QFrame *)m_customWidget;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
frameRangeFrame->setObjectName("customFrame");
|
|
Shinya Kitaoka |
120a6e |
frameRangeFrame->setFrameStyle(QFrame::StyledPanel);
|
|
Shinya Kitaoka |
120a6e |
// frameRangeFrame->setFixedHeight(30);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_fromField = new DVGui::LineEdit(this);
|
|
Shinya Kitaoka |
120a6e |
m_toField = new DVGui::LineEdit(this);
|
|
Shinya Kitaoka |
120a6e |
m_stepField = new DVGui::LineEdit("1", this);
|
|
Shinya Kitaoka |
120a6e |
m_shrinkField = new DVGui::LineEdit("1", this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Define the append/load filter types
|
|
Shinya Kitaoka |
120a6e |
m_appendFilterTypes << "3gp"
|
|
Shinya Kitaoka |
120a6e |
<< "mov"
|
|
Shinya Kitaoka |
120a6e |
<< "jpg"
|
|
Shinya Kitaoka |
120a6e |
<< "png"
|
|
Shinya Kitaoka |
120a6e |
<< "tga"
|
|
Shinya Kitaoka |
120a6e |
<< "tif"
|
|
Shinya Kitaoka |
120a6e |
<< "tiff"
|
|
Shinya Kitaoka |
120a6e |
<< "bmp"
|
|
Shinya Kitaoka |
120a6e |
<< "sgi"
|
|
Shinya Kitaoka |
120a6e |
<< "rgb"
|
|
Shinya Kitaoka |
120a6e |
<< "nol";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Shinya Kitaoka |
120a6e |
m_appendFilterTypes << "avi";
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_loadFilterTypes << "tlv"
|
|
Shinya Kitaoka |
120a6e |
<< "pli" << m_appendFilterTypes;
|
|
Shinya Kitaoka |
120a6e |
m_appendFilterTypes << "psd";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// layout
|
|
Shinya Kitaoka |
120a6e |
QHBoxLayout *frameRangeLayout = new QHBoxLayout();
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->setMargin(5);
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->setSpacing(5);
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(new QLabel(tr("From:")), 0);
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(m_fromField, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(new QLabel(tr("To:")), 0);
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(m_toField, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addSpacing(10);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(new QLabel(tr("Step:")), 0);
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(m_stepField, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addSpacing(5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(new QLabel(tr("Shrink:")));
|
|
Shinya Kitaoka |
120a6e |
frameRangeLayout->addWidget(m_shrinkField, 0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
frameRangeFrame->setLayout(frameRangeLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Make signal-slot connections
|
|
Shinya Kitaoka |
120a6e |
bool ret = true;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_fromField, SIGNAL(editingFinished()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onEditingFinished()));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_toField, SIGNAL(editingFinished()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onEditingFinished()));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_stepField, SIGNAL(editingFinished()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onEditingFinished()));
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(m_shrinkField, SIGNAL(editingFinished()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(onEditingFinished()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ret = ret && connect(this, SIGNAL(filePathClicked(const TFilePath &)),
|
|
Shinya Kitaoka |
120a6e |
SLOT(onFilePathClicked(const TFilePath &)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setOkText(tr("Load"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
setWindowTitle(tr("Load / Append Images"));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LoadImagesPopup::onEditingFinished() {
|
|
Shinya Kitaoka |
120a6e |
int val;
|
|
Shinya Kitaoka |
120a6e |
val = m_fromField->text().toInt();
|
|
Shinya Kitaoka |
120a6e |
m_from = (val < m_minFrame) ? m_minFrame : val;
|
|
Shinya Kitaoka |
120a6e |
val = m_toField->text().toInt();
|
|
Shinya Kitaoka |
120a6e |
m_to = (val > m_maxFrame) ? m_maxFrame : val;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_to < m_from) m_to = m_from;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
val = m_stepField->text().toInt();
|
|
Shinya Kitaoka |
120a6e |
m_step = (val < 1) ? 1 : val;
|
|
Shinya Kitaoka |
120a6e |
val = m_shrinkField->text().toInt();
|
|
Shinya Kitaoka |
120a6e |
m_shrink = (val < 1) ? 1 : val;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_fromField->setText(QString::number(m_from));
|
|
Shinya Kitaoka |
120a6e |
m_toField->setText(QString::number(m_to));
|
|
Shinya Kitaoka |
120a6e |
m_stepField->setText(QString::number(m_step));
|
|
Shinya Kitaoka |
120a6e |
m_shrinkField->setText(QString::number(m_shrink));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool LoadImagesPopup::execute() { return doLoad(false); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Append images with apply button
|
|
shun-iwasawa |
cea18b |
*/
|
|
Shinya Kitaoka |
120a6e |
bool LoadImagesPopup::executeApply() { return doLoad(true); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool LoadImagesPopup::doLoad(bool append) {
|
|
Shinya Kitaoka |
120a6e |
if (m_selectedPaths.empty()) return false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
::viewFile(*m_selectedPaths.begin(), m_from, m_to, m_step, m_shrink, 0,
|
|
Shinya Kitaoka |
120a6e |
m_flip, append);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// register recent files
|
|
Shinya Kitaoka |
120a6e |
std::set<tfilepath>::const_iterator pt;</tfilepath>
|
|
Shinya Kitaoka |
120a6e |
for (pt = m_selectedPaths.begin(); pt != m_selectedPaths.end(); ++pt) {
|
|
Shinya Kitaoka |
120a6e |
RecentFiles::instance()->addFilePath(
|
|
Shinya Kitaoka |
120a6e |
toQString(
|
|
Shinya Kitaoka |
120a6e |
TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(
|
|
Shinya Kitaoka |
120a6e |
(*pt))),
|
|
Shinya Kitaoka |
120a6e |
RecentFiles::Flip);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LoadImagesPopup::onFilePathClicked(const TFilePath &fp) {
|
|
Shinya Kitaoka |
120a6e |
TLevel::Iterator it;
|
|
Shinya Kitaoka |
120a6e |
TLevelP level;
|
|
Shinya Kitaoka |
120a6e |
TLevelReaderP lr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (fp == TFilePath()) goto clear;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
lr = TLevelReaderP(fp);
|
|
Shinya Kitaoka |
120a6e |
if (!lr) goto clear;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
level = lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!level || level->getFrameCount() == 0) goto clear;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Kite |
521c84 |
it = level->begin();
|
|
Rozhuk Ivan |
823a31 |
m_to = m_from = it->first.getNumber();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (; it != level->end(); ++it) m_to = it->first.getNumber();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_from == -2 && m_to == -2) m_from = m_to = 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_minFrame = m_from;
|
|
Shinya Kitaoka |
120a6e |
m_maxFrame = m_to;
|
|
Shinya Kitaoka |
120a6e |
m_fromField->setText(QString::number(m_from));
|
|
Shinya Kitaoka |
120a6e |
m_toField->setText(QString::number(m_to));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
clear:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_minFrame = 0;
|
|
Shinya Kitaoka |
120a6e |
m_maxFrame = 10000000;
|
|
Shinya Kitaoka |
120a6e |
m_fromField->setText("");
|
|
Shinya Kitaoka |
120a6e |
m_toField->setText("");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SaveImagesPopup::SaveImagesPopup(FlipBook *flip)
|
|
Shinya Kitaoka |
120a6e |
: FileBrowserPopup(tr("Save Flipbook Images")), m_flip(flip) {
|
|
Shinya Kitaoka |
120a6e |
setOkText(tr("Save"));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool SaveImagesPopup::execute() {
|
|
Shinya Kitaoka |
120a6e |
if (m_selectedPaths.empty()) return false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return m_flip->doSaveImages(*m_selectedPaths.begin());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::loadImages() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_loadPopup) {
|
|
Shinya Kitaoka |
120a6e |
m_loadPopup = new LoadImagesPopup(this); //, frameRangeFrame);
|
|
Shinya Kitaoka |
120a6e |
// move the initial folder to the project root
|
|
Shinya Kitaoka |
120a6e |
m_loadPopup->setFolder(
|
|
Shinya Kitaoka |
120a6e |
TProjectManager::instance()->getCurrentProjectPath().getParentDir());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_loadPopup->show();
|
|
Shinya Kitaoka |
120a6e |
m_loadPopup->raise();
|
|
Shinya Kitaoka |
120a6e |
m_loadPopup->activateWindow();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool FlipBook::canAppend() {
|
|
Shinya Kitaoka |
120a6e |
// Images can be appended if:
|
|
Shinya Kitaoka |
120a6e |
// a) There is a name (in particular, an extension) representing currently
|
|
Shinya Kitaoka |
120a6e |
// held ones.
|
|
Shinya Kitaoka |
120a6e |
// b) This flipbook is not holding a preview (inappropriate and problematic).
|
|
Shinya Kitaoka |
120a6e |
// c) The level has no palette. Otherwise, appended images may have a
|
|
Shinya Kitaoka |
120a6e |
// different palette.
|
|
Shinya Kitaoka |
120a6e |
return !m_levels.empty() && !m_previewedFx && !m_palette;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::saveImages() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_savePopup) m_savePopup = new SaveImagesPopup(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// initialize the default path every time
|
|
Shinya Kitaoka |
120a6e |
TOutputProperties *op = TApp::instance()
|
|
Shinya Kitaoka |
120a6e |
->getCurrentScene()
|
|
Shinya Kitaoka |
120a6e |
->getScene()
|
|
Shinya Kitaoka |
120a6e |
->getProperties()
|
|
Shinya Kitaoka |
120a6e |
->getOutputProperties();
|
|
shun-iwasawa |
cea18b |
m_savePopup->setFolder(TApp::instance()
|
|
shun-iwasawa |
cea18b |
->getCurrentScene()
|
|
shun-iwasawa |
cea18b |
->getScene()
|
|
shun-iwasawa |
cea18b |
->decodeFilePath(op->getPath())
|
|
shun-iwasawa |
cea18b |
.getParentDir());
|
|
Shinya Kitaoka |
120a6e |
m_savePopup->setFilename(op->getPath().withFrame().withoutParentDir());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_savePopup->show();
|
|
Shinya Kitaoka |
120a6e |
m_savePopup->raise();
|
|
Shinya Kitaoka |
120a6e |
m_savePopup->activateWindow();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FlipBook::~FlipBook() {
|
|
Shinya Kitaoka |
120a6e |
if (m_loadPopup) delete m_loadPopup;
|
|
Shinya Kitaoka |
120a6e |
if (m_savePopup) delete m_savePopup;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool FlipBook::doSaveImages(TFilePath fp) {
|
|
Shinya Kitaoka |
120a6e |
QStringList formats;
|
|
Shinya Kitaoka |
120a6e |
TLevelWriter::getSupportedFormats(formats, true);
|
|
Shinya Kitaoka |
120a6e |
Tiio::Writer::getSupportedFormats(formats, true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
|
|
Shinya Kitaoka |
120a6e |
TOutputProperties *outputSettings =
|
|
Shinya Kitaoka |
120a6e |
scene->getProperties()->getOutputProperties();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::string ext = fp.getType();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Open a notice that the previewFx is rendered in 8bpc regardless of the
|
|
Shinya Kitaoka |
120a6e |
// output settings.
|
|
Shinya Kitaoka |
120a6e |
if (m_isPreviewFx && outputSettings->getRenderSettings().m_bpp == 64) {
|
|
Shinya Kitaoka |
120a6e |
QString question =
|
|
Shinya Kitaoka |
120a6e |
"Save previewed images :\nImages will be saved in 8 bit per channel "
|
|
Shinya Kitaoka |
120a6e |
"with this command.\nDo you want to save images?";
|
|
Shinya Kitaoka |
120a6e |
int ret =
|
|
Shinya Kitaoka |
120a6e |
DVGui::MsgBox(question, QObject::tr("Save"), QObject::tr("Cancel"), 0);
|
|
Shinya Kitaoka |
120a6e |
if (ret == 2 || ret == 0) return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Shinya Kitaoka |
120a6e |
if (ext == "avi") {
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup *props = outputSettings->getFileFormatProperties(ext);
|
|
Shinya Kitaoka |
120a6e |
std::string codecName = props->getProperty(0)->getValueAsString();
|
|
Shinya Kitaoka |
120a6e |
TDimension res = scene->getCurrentCamera()->getRes();
|
|
Shinya Kitaoka |
120a6e |
if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) {
|
|
Shinya Kitaoka |
120a6e |
QString msg(
|
|
Shinya Kitaoka |
120a6e |
QObject::tr("The resolution of the output camera does not fit with "
|
|
Shinya Kitaoka |
120a6e |
"the options chosen for the output file format."));
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(msg);
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
3bfa54 |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (ext == "") {
|
|
Shinya Kitaoka |
120a6e |
ext = outputSettings->getPath().getType();
|
|
Shinya Kitaoka |
120a6e |
fp = fp.withType(ext);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (fp.getName() == "") {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(
|
|
Shinya Kitaoka |
120a6e |
tr("The file name cannot be empty or contain any of the following "
|
|
Shinya Kitaoka |
120a6e |
"characters:(new line) \\ / : * ? \" |"));
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!formats.contains(QString::fromStdString(ext))) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(
|
|
Shinya Kitaoka |
120a6e |
tr("It is not possible to save because the selected file format is not "
|
|
Shinya Kitaoka |
120a6e |
"supported."));
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int from, to, step;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->getFrameRange(from, to, step);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_currentFrameToSave != 0) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::info("Already saving!");
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (TFileType::getInfo(fp) == TFileType::RASTER_IMAGE || ext == "pct" ||
|
|
Shinya Kitaoka |
120a6e |
ext == "pic" || ext == "pict") // pct e' un formato"livello" (ha i
|
|
Shinya Kitaoka |
120a6e |
// settings di quicktime) ma fatto di
|
|
Shinya Kitaoka |
120a6e |
// diversi frames
|
|
Shinya Kitaoka |
120a6e |
fp = fp.withFrame(TFrameId::EMPTY_FRAME);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
fp = scene->decodeFilePath(fp);
|
|
Shinya Kitaoka |
120a6e |
bool exists = TFileStatus(fp.getParentDir()).doesExist();
|
|
Shinya Kitaoka |
120a6e |
if (!exists) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
TFilePath parent = fp.getParentDir();
|
|
Shinya Kitaoka |
120a6e |
TSystem::mkDir(parent);
|
|
Shinya Kitaoka |
120a6e |
DvDirModel::instance()->refreshFolder(parent.getParentDir());
|
|
Shinya Kitaoka |
120a6e |
} catch (TException &e) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::error("Cannot create " + toQString(fp.getParentDir()) + " : " +
|
|
Shinya Kitaoka |
120a6e |
QString(::to_string(e.getMessage()).c_str()));
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::error("Cannot create " + toQString(fp.getParentDir()));
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (TSystem::doesExistFileOrLevel(fp)) {
|
|
Shinya Kitaoka |
120a6e |
QString question(tr("File %1 already exists.\nDo you want to overwrite it?")
|
|
Shinya Kitaoka |
120a6e |
.arg(toQString(fp)));
|
|
Shinya Kitaoka |
120a6e |
int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"),
|
|
Shinya Kitaoka |
120a6e |
QObject::tr("Cancel"));
|
|
Shinya Kitaoka |
120a6e |
if (ret == 2) return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
m_lw = TLevelWriterP(fp,
|
|
Shinya Kitaoka |
120a6e |
outputSettings->getFileFormatProperties(fp.getType()));
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::error("It is not possible to save Flipbook content.");
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_lw->setFrameRate(outputSettings->getFrameRate());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_currentFrameToSave = 1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ProgressBarMessager(eBegin, m_framesCount).sendBlocking();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTimer::singleShot(50, this, SLOT(saveImage()));
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::saveImage() {
|
|
Shinya Kitaoka |
120a6e |
static int savedFrames = 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(Pd);
|
|
Shinya Kitaoka |
120a6e |
int from, to, step;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->getFrameRange(from, to, step);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
for (; m_currentFrameToSave <= m_framesCount; m_currentFrameToSave++) {
|
|
Shinya Kitaoka |
120a6e |
ProgressBarMessager(eIncrement, m_currentFrameToSave).sendBlocking();
|
|
Shinya Kitaoka |
120a6e |
if (!Pd) break;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int actualFrame = from + (m_currentFrameToSave - 1) * step;
|
|
Shinya Kitaoka |
120a6e |
TImageP img = getCurrentImage(actualFrame);
|
|
Shinya Kitaoka |
120a6e |
if (!img) continue;
|
|
Shinya Kitaoka |
120a6e |
TImageWriterP writer = m_lw->getFrameWriter(TFrameId(actualFrame));
|
|
Shinya Kitaoka |
120a6e |
bool failureOnSaving = false;
|
|
Shinya Kitaoka |
120a6e |
if (!writer) continue;
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
writer->save(img);
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
QString str(tr("It is not possible to save Flipbook content."));
|
|
Shinya Kitaoka |
120a6e |
ProgressBarMessager(eEnd, 0, str).send();
|
|
Shinya Kitaoka |
120a6e |
m_currentFrameToSave = 0;
|
|
Shinya Kitaoka |
120a6e |
m_lw = TLevelWriterP();
|
|
Shinya Kitaoka |
120a6e |
savedFrames = 0;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
savedFrames++;
|
|
Shinya Kitaoka |
120a6e |
// if (!m_pb->changeFraction(m_currentFrameToSave,
|
|
Shinya Kitaoka |
38fd86 |
// TApp::instance()->getCurrentXsheet()->getXsheet()->getFrameCount()))
|
|
Shinya Kitaoka |
120a6e |
// break;
|
|
Shinya Kitaoka |
120a6e |
m_currentFrameToSave++;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTimer::singleShot(50, this, SLOT(saveImage()));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QString str = tr("Saved %1 frames out of %2 in %3")
|
|
Shinya Kitaoka |
120a6e |
.arg(std::to_string(savedFrames).c_str())
|
|
Shinya Kitaoka |
120a6e |
.arg(std::to_string(m_framesCount).c_str())
|
|
Shinya Kitaoka |
120a6e |
.arg(::to_string(m_lw->getFilePath()).c_str());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!Pd) str = "Canceled! " + str;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ProgressBarMessager(eEnd, 0, str).send();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_currentFrameToSave = 0;
|
|
Shinya Kitaoka |
120a6e |
m_lw = TLevelWriterP();
|
|
Shinya Kitaoka |
120a6e |
savedFrames = 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::onButtonPressed(FlipConsole::EGadget button) {
|
|
Shinya Kitaoka |
120a6e |
switch (button) {
|
|
Shinya Kitaoka |
120a6e |
case FlipConsole::eSound:
|
|
Shinya Kitaoka |
120a6e |
m_playSound = !m_playSound;
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
case FlipConsole::eHisto:
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->showHistogram();
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
case FlipConsole::eSaveImg: {
|
|
Shinya Kitaoka |
120a6e |
TRect loadbox = m_loadbox;
|
|
Shinya Kitaoka |
120a6e |
m_loadbox = TRect();
|
|
Shinya Kitaoka |
120a6e |
TImageP img = getCurrentImage(m_flipConsole->getCurrentFrame());
|
|
Shinya Kitaoka |
120a6e |
m_loadbox = loadbox;
|
|
Shinya Kitaoka |
120a6e |
if (!img) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(tr("There are no rendered images to save."));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
} else if ((TVectorImageP)img) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(
|
|
Shinya Kitaoka |
120a6e |
tr("It is not possible to take or compare snapshots for Toonz vector "
|
|
Shinya Kitaoka |
120a6e |
"levels."));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
TRasterImageP ri(img);
|
|
Shinya Kitaoka |
120a6e |
TToonzImageP ti(img);
|
|
Shinya Kitaoka |
120a6e |
TImageP clonedImg;
|
|
Shinya Kitaoka |
120a6e |
if (ri)
|
|
Shinya Kitaoka |
120a6e |
clonedImg = TRasterImageP(ri->getRaster()->clone());
|
|
shun-iwasawa |
9da5bf |
else {
|
|
Shinya Kitaoka |
120a6e |
clonedImg = TToonzImageP(ti->getRaster()->clone(), ti->getSavebox());
|
|
shun-iwasawa |
9da5bf |
clonedImg->setPalette(ti->getPalette());
|
|
shun-iwasawa |
9da5bf |
}
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->add(QString("TnzCompareImg"), clonedImg);
|
|
shun-iwasawa |
d5045c |
// to update the histogram of compare snapshot image
|
|
shun-iwasawa |
d5045c |
m_imageViewer->invalidateCompHisto();
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
case FlipConsole::eCompare:
|
|
shun-iwasawa |
d5045c |
if (m_flipConsole->isChecked(FlipConsole::eCompare) &&
|
|
shun-iwasawa |
d5045c |
(TVectorImageP)getCurrentImage(m_flipConsole->getCurrentFrame())) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(
|
|
Shinya Kitaoka |
120a6e |
tr("It is not possible to take or compare snapshots for Toonz vector "
|
|
Shinya Kitaoka |
120a6e |
"levels."));
|
|
shun-iwasawa |
d5045c |
// cancel the button pressing
|
|
shun-iwasawa |
d5045c |
m_flipConsole->pressButton(FlipConsole::eCompare);
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
case FlipConsole::eSave:
|
|
Shinya Kitaoka |
120a6e |
saveImages();
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Rozhuk Ivan |
823a31 |
default:
|
|
Rozhuk Ivan |
823a31 |
break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
// FlipBookPool
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! \class FlipBookPool
|
|
Shinya Kitaoka |
120a6e |
\brief The FlipBookPool class is used to store used flipbook
|
|
Shinya Kitaoka |
120a6e |
viewers.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Flipbooks are generally intended as temporary but friendly floating widgets,
|
|
Toshihiro Shimizu |
890ddd |
that gets displayed when a rendered scene or image needs to be shown.
|
|
Toshihiro Shimizu |
890ddd |
Since a user may require that the geometry of a flipbook is to be remembered
|
|
Toshihiro Shimizu |
890ddd |
between rendering tasks - perhaps even between different Toonz sessions -
|
|
Toshihiro Shimizu |
890ddd |
flipbooks are always stored for later use in a \b FlipBookPool class.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
This class implements the basical features to \b pop a flipbook from the
|
|
Shinya Kitaoka |
120a6e |
pool
|
|
Toshihiro Shimizu |
890ddd |
or \b push a used one; plus, it provides the \b save and \b load functions
|
|
Toshihiro Shimizu |
890ddd |
for persistent storage between Toonz sessions.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa FlipBook class.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FlipBookPool::FlipBookPool() : m_overallFlipCount(0) {
|
|
Shinya Kitaoka |
120a6e |
qRegisterMetaType<imagepainter::visualsettings>(</imagepainter::visualsettings>
|
|
Shinya Kitaoka |
120a6e |
"ImagePainter::VisualSettings");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FlipBookPool::~FlipBookPool() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FlipBookPool *FlipBookPool::instance() {
|
|
Shinya Kitaoka |
120a6e |
static FlipBookPool poolInstance;
|
|
Shinya Kitaoka |
120a6e |
return &poolInstance;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBookPool::push(FlipBook *flipbook) {
|
|
Shinya Kitaoka |
120a6e |
m_pool.insert(pair<int, *="" flipbook="">(flipbook->getPoolIndex(), flipbook));</int,>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Extracts the first unused flipbook from the flipbook pool.
|
|
Shinya Kitaoka |
120a6e |
//! If all known flipbooks are shown, allocates a new flipbook with the
|
|
Shinya Kitaoka |
120a6e |
//! first unused flipbook geometry in a geometry pool.
|
|
Shinya Kitaoka |
120a6e |
//! Again, if all recorded geometry are used by some existing flipbook, a
|
|
Shinya Kitaoka |
120a6e |
//! default geometry is used.
|
|
Shinya Kitaoka |
120a6e |
FlipBook *FlipBookPool::pop() {
|
|
Shinya Kitaoka |
120a6e |
FlipBook *flipbook;
|
|
Shinya Kitaoka |
120a6e |
TPanel *panel;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TMainWindow *currentRoom = TApp::instance()->getCurrentRoom();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_pool.empty()) {
|
|
Shinya Kitaoka |
120a6e |
panel = TPanelFactory::createPanel(currentRoom, "FlipBook");
|
|
Shinya Kitaoka |
120a6e |
panel->setFloating(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
flipbook = static_cast<flipbook *="">(panel->widget());</flipbook>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Set geometry
|
|
Shinya Kitaoka |
120a6e |
static int x = 0, y = 0;
|
|
Shinya Kitaoka |
120a6e |
if (m_geometryPool.empty()) {
|
|
Shinya Kitaoka |
120a6e |
panel->setGeometry(x += 50, y += 50, 400, 300);
|
|
Shinya Kitaoka |
120a6e |
flipbook->setPoolIndex(m_overallFlipCount);
|
|
Shinya Kitaoka |
120a6e |
m_overallFlipCount++;
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
flipbook->setPoolIndex(m_geometryPool.begin()->first);
|
|
Shinya Kitaoka |
120a6e |
QRect geometry(m_geometryPool.begin()->second);
|
|
Shinya Kitaoka |
120a6e |
panel->setGeometry(geometry);
|
|
Shinya Kitaoka |
120a6e |
if ((geometry & QApplication::desktop()->availableGeometry(panel))
|
|
Shinya Kitaoka |
120a6e |
.isEmpty())
|
|
Shinya Kitaoka |
120a6e |
panel->move(x += 50, y += 50);
|
|
Shinya Kitaoka |
120a6e |
m_geometryPool.erase(m_geometryPool.begin());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
flipbook = m_pool.begin()->second;
|
|
Shinya Kitaoka |
120a6e |
panel = (TPanel *)flipbook->parent();
|
|
Shinya Kitaoka |
120a6e |
m_pool.erase(m_pool.begin());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// The panel need to be added to currentRoom's layout control.
|
|
Shinya Kitaoka |
120a6e |
currentRoom->addDockWidget(panel);
|
|
Shinya Kitaoka |
120a6e |
panel->raise();
|
|
Shinya Kitaoka |
120a6e |
panel->show();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return flipbook;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Saves the content of this flipbook pool.
|
|
Shinya Kitaoka |
120a6e |
void FlipBookPool::save() const {
|
|
Shinya Kitaoka |
120a6e |
QSettings history(toQString(m_historyPath), QSettings::IniFormat);
|
|
Shinya Kitaoka |
120a6e |
history.setValue("count", m_overallFlipCount);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
history.beginGroup("flipbooks");
|
|
shun-iwasawa |
481b59 |
// clear all contents in the group
|
|
shun-iwasawa |
481b59 |
history.remove("");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::map<int, *="" flipbook="">::const_iterator it;</int,>
|
|
Shinya Kitaoka |
120a6e |
for (it = m_pool.begin(); it != m_pool.end(); ++it) {
|
|
Shinya Kitaoka |
120a6e |
history.beginGroup(QString::number(it->first));
|
|
Shinya Kitaoka |
120a6e |
TPanel *panel = static_cast<tpanel *="">(it->second->parent());</tpanel>
|
|
Shinya Kitaoka |
120a6e |
history.setValue("geometry", panel->geometry());
|
|
Shinya Kitaoka |
120a6e |
history.endGroup();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::map<int, qrect="">::const_iterator jt;</int,>
|
|
Shinya Kitaoka |
120a6e |
for (jt = m_geometryPool.begin(); jt != m_geometryPool.end(); ++jt) {
|
|
Shinya Kitaoka |
120a6e |
history.beginGroup(QString::number(jt->first));
|
|
Shinya Kitaoka |
120a6e |
history.setValue("geometry", jt->second);
|
|
Shinya Kitaoka |
120a6e |
history.endGroup();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
history.endGroup();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Loads the pool from input history
|
|
Shinya Kitaoka |
120a6e |
void FlipBookPool::load(const TFilePath &historyPath) {
|
|
Shinya Kitaoka |
120a6e |
QSettings history(toQString(historyPath), QSettings::IniFormat);
|
|
Shinya Kitaoka |
120a6e |
m_historyPath = historyPath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_pool.clear();
|
|
Shinya Kitaoka |
120a6e |
m_geometryPool.clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_overallFlipCount = history.value("count").toInt();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
history.beginGroup("flipbooks");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QStringList flipBooks(history.childGroups());
|
|
Shinya Kitaoka |
120a6e |
QStringList::iterator it;
|
|
Shinya Kitaoka |
120a6e |
for (it = flipBooks.begin(); it != flipBooks.end(); ++it) {
|
|
Shinya Kitaoka |
120a6e |
history.beginGroup(*it);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Retrieve flipbook geometry
|
|
Shinya Kitaoka |
120a6e |
QVariant geom = history.value("geometry");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Insert geometry
|
|
Shinya Kitaoka |
120a6e |
m_geometryPool.insert(pair<int, qrect="">(it->toInt(), geom.toRect()));</int,>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
history.endGroup();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
history.endGroup();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Returns the level frame number corresponding to passed flipbook index
|
|
Shinya Kitaoka |
120a6e |
TFrameId FlipBook::Level::flipbookIndexToLevelFrame(int index) {
|
|
Shinya Kitaoka |
120a6e |
TLevel::Iterator it;
|
|
Shinya Kitaoka |
120a6e |
int levelPos;
|
|
Shinya Kitaoka |
120a6e |
if (m_incrementalIndexing) {
|
|
Shinya Kitaoka |
120a6e |
levelPos = (index - 1) * m_step;
|
|
Shinya Kitaoka |
120a6e |
it = m_level->getTable()->find(m_fromIndex);
|
|
Shinya Kitaoka |
120a6e |
advance(it, levelPos);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
levelPos = m_fromIndex + (index - 1) * m_step;
|
|
Shinya Kitaoka |
120a6e |
it = m_level->getTable()->find(levelPos);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (it == m_level->end()) return TFrameId();
|
|
Shinya Kitaoka |
120a6e |
return it->first;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Returns the number of flipbook indexes available for this level
|
|
Shinya Kitaoka |
120a6e |
int FlipBook::Level::getIndexesCount() {
|
|
Shinya Kitaoka |
120a6e |
return m_incrementalIndexing ? (m_level->getFrameCount() - 1) / m_step + 1
|
|
Shinya Kitaoka |
120a6e |
: (m_toIndex - m_fromIndex) / m_step + 1;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool FlipBook::isSavable() const {
|
|
Shinya Kitaoka |
120a6e |
if (m_levels.empty()) return false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < m_levels.size(); i++)
|
|
Shinya Kitaoka |
120a6e |
if (m_levels[i].m_fp != TFilePath() &&
|
|
Shinya Kitaoka |
120a6e |
(m_levels[i].m_fp.getType() == "tlv" ||
|
|
Shinya Kitaoka |
120a6e |
m_levels[i].m_fp.getType() == "pli"))
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Set the level contained in \b fp to FlipBook; if level exist show in image
|
|
Shinya Kitaoka |
120a6e |
viewer its first frame, set current frame to 1.
|
|
Shinya Kitaoka |
120a6e |
It's possible to change level palette, in fact if \b palette is
|
|
Shinya Kitaoka |
120a6e |
different
|
|
Shinya Kitaoka |
120a6e |
from 0 set level palette to \b palette.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setLevel(const TFilePath &fp, TPalette *palette, int from,
|
|
Shinya Kitaoka |
120a6e |
int to, int step, int shrink, TSoundTrack *snd,
|
|
Shinya Kitaoka |
120a6e |
bool append, bool isToonzOutput) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
if (!append) {
|
|
Shinya Kitaoka |
120a6e |
clearCache();
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.clear();
|
|
Shinya Kitaoka |
120a6e |
m_levels.clear();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_snd = 0;
|
|
Shinya Kitaoka |
120a6e |
m_xl = 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableProgressBar(false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setProgressBarStatus(0);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eSound, snd != 0);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eDefineLoadBox, true);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eUseLoadBox, true);
|
|
Shinya Kitaoka |
120a6e |
if (fp == TFilePath()) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_shrink = shrink;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (fp.getDots() == ".." && fp.getType() != "noext")
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.push_back(toQString(fp.withoutParentDir().withFrame()));
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.push_back(toQString(fp.withoutParentDir()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_snd = snd;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (TSystem::doesExistFileOrLevel(fp)) // is a viewfile
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
// m_flipConsole->enableButton(FlipConsole::eCheckBg,
|
|
Shinya Kitaoka |
120a6e |
// true);//fp.getType()!="pli");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_lr = TLevelReaderP(fp);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool supportsRandomAccess = doesSupportRandomAccess(fp, isToonzOutput);
|
|
Shinya Kitaoka |
120a6e |
if (supportsRandomAccess) m_lr->enableRandomAccessRead(isToonzOutput);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool randomAccessRead = supportsRandomAccess && isToonzOutput;
|
|
Shinya Kitaoka |
120a6e |
bool incrementalIndexing = m_isPreviewFx ? true : false;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TLevelP level = m_lr->loadInfo();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!level || level->getFrameCount() == 0) {
|
|
Shinya Kitaoka |
120a6e |
if (m_flags & eDontKeepFilesOpened) m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// For the color model, get the reference fids from palette and delete
|
|
Shinya Kitaoka |
120a6e |
// unneeded from the table
|
|
Shinya Kitaoka |
120a6e |
if (m_imageViewer->isColorModel() && palette) {
|
|
Shinya Kitaoka |
120a6e |
std::vector<tframeid> fids = palette->getRefLevelFids();</tframeid>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// when loading a single-frame, standard raster image into the
|
|
Shinya Kitaoka |
120a6e |
// ColorModel, skip here.
|
|
Shinya Kitaoka |
120a6e |
// If the fid == NO_FRAME(=-2), fids stores 0.
|
|
Shinya Kitaoka |
120a6e |
if (!fids.empty() && !(fids.size() == 1 && fids[0].getNumber() == 0)) {
|
|
Shinya Kitaoka |
120a6e |
// make the fid list to be deleted
|
|
Shinya Kitaoka |
120a6e |
std::vector<tframeid> deleteList;</tframeid>
|
|
Shinya Kitaoka |
120a6e |
TLevel::Iterator it;
|
|
Shinya Kitaoka |
120a6e |
for (it = level->begin(); it != level->end(); it++) {
|
|
Shinya Kitaoka |
120a6e |
// If the fid is not included in the reference list, then delete it
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < (int)fids.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
if (fids[i].getNumber() == it->first.getNumber()) break;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (i == fids.size()) {
|
|
Shinya Kitaoka |
120a6e |
deleteList.push_back(it->first);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
// delete list items here
|
|
Shinya Kitaoka |
120a6e |
if (!deleteList.empty())
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < (int)deleteList.size(); i++)
|
|
Shinya Kitaoka |
120a6e |
level->getTable()->erase(deleteList[i]);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int fromIndex, toIndex;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// in order to avoid that the current frame unexpectedly moves to 1 on the
|
|
Shinya Kitaoka |
120a6e |
// Color Model once editing the style
|
|
Shinya Kitaoka |
120a6e |
int current = -1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (from == -1 && to == -1) {
|
|
Shinya Kitaoka |
120a6e |
fromIndex = level->begin()->first.getNumber();
|
|
Shinya Kitaoka |
120a6e |
toIndex = (--level->end())->first.getNumber();
|
|
Shinya Kitaoka |
120a6e |
if (m_imageViewer->isColorModel())
|
|
shun-iwasawa |
215a5b |
current = m_flipConsole->getCurrentFrame();
|
|
Shinya Kitaoka |
120a6e |
incrementalIndexing = true;
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
TLevel::Iterator it = level->begin();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Adjust the frame interval to read. There is one special case:
|
|
Shinya Kitaoka |
120a6e |
// If the level read did not support random access, *AND* the level to
|
|
Shinya Kitaoka |
120a6e |
// show was just rendered,
|
|
Shinya Kitaoka |
120a6e |
// we have to assume that no level update happened, and the
|
|
Shinya Kitaoka |
120a6e |
// from-to-step infos are lost.
|
|
Shinya Kitaoka |
120a6e |
// So, shift the requested interval from 1 and place step to 1.
|
|
Shinya Kitaoka |
120a6e |
fromIndex = from;
|
|
Shinya Kitaoka |
120a6e |
toIndex = to;
|
|
Shinya Kitaoka |
120a6e |
if (isToonzOutput && !supportsRandomAccess) {
|
|
Shinya Kitaoka |
120a6e |
fromIndex = 1;
|
|
Shinya Kitaoka |
120a6e |
toIndex = level->getFrameCount();
|
|
Shinya Kitaoka |
120a6e |
step = 1;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (level->begin()->first.getNumber() != TFrameId::NO_FRAME) {
|
|
Shinya Kitaoka |
120a6e |
fromIndex = std::max(fromIndex, level->begin()->first.getNumber());
|
|
Shinya Kitaoka |
120a6e |
toIndex = std::min(toIndex, (--level->end())->first.getNumber());
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
fromIndex = level->begin()->first.getNumber();
|
|
Shinya Kitaoka |
120a6e |
toIndex = (--level->end())->first.getNumber();
|
|
Shinya Kitaoka |
120a6e |
incrementalIndexing = true;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Workaround to display simple background images when loading from
|
|
Shinya Kitaoka |
120a6e |
// the right-click menu context
|
|
Shinya Kitaoka |
120a6e |
fromIndex = std::min(fromIndex, toIndex);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
Level levelToPush(level, fp, fromIndex, toIndex, step);
|
|
Shinya Kitaoka |
120a6e |
levelToPush.m_randomAccessRead = randomAccessRead;
|
|
Shinya Kitaoka |
120a6e |
levelToPush.m_incrementalIndexing = incrementalIndexing;
|
|
shun-iwasawa |
e6b124 |
|
|
shun-iwasawa |
e6b124 |
int formatIdx = Preferences::instance()->matchLevelFormat(fp);
|
|
shun-iwasawa |
481b59 |
if (formatIdx >= 0) {
|
|
shun-iwasawa |
481b59 |
LevelOptions options =
|
|
shun-iwasawa |
481b59 |
Preferences::instance()->levelFormat(formatIdx).m_options;
|
|
shun-iwasawa |
e6b124 |
|
|
shun-iwasawa |
481b59 |
levelToPush.m_premultiply = options.m_premultiply;
|
|
shun-iwasawa |
481b59 |
levelToPush.m_colorSpaceGamma = options.m_colorSpaceGamma;
|
|
shun-iwasawa |
481b59 |
}
|
|
Shinya Kitaoka |
120a6e |
m_levels.push_back(levelToPush);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Get the frames count to be shown in this flipbook level
|
|
Shinya Kitaoka |
120a6e |
m_framesCount = levelToPush.getIndexesCount();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(m_framesCount <= level->getFrameCount());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// this value will be used in loadAndCacheAllTlvImages later
|
|
Shinya Kitaoka |
120a6e |
int addingFrameAmount = m_framesCount;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (append && !m_levels.empty()) {
|
|
Shinya Kitaoka |
120a6e |
int oldFrom, oldTo, oldStep;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->getFrameRange(oldFrom, oldTo, oldStep);
|
|
Shinya Kitaoka |
120a6e |
assert(oldFrom == 1);
|
|
Shinya Kitaoka |
120a6e |
assert(oldStep == 1);
|
|
Shinya Kitaoka |
120a6e |
m_framesCount += oldTo;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRange(1, m_framesCount, 1, current);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (palette && level->getPalette() != palette) level->setPalette(palette);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_palette = level->getPalette();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
const TImageInfo *ii = m_lr->getImageInfo();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (ii) m_dim = TDimension(ii->m_lx / m_shrink, ii->m_ly / m_shrink);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int levelFrameCount = 0;
|
|
Shinya Kitaoka |
120a6e |
for (int lev = 0; lev < m_levels.size(); lev++)
|
|
Shinya Kitaoka |
120a6e |
levelFrameCount += m_levels[lev].m_level->getFrameCount();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (levelFrameCount == 1)
|
|
Shinya Kitaoka |
120a6e |
m_title = " :: 1 Frame";
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_title = " :: " + QString::number(levelFrameCount) + " Frames";
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// color model does not concern about the pixel size
|
|
Shinya Kitaoka |
120a6e |
if (ii && !m_imageViewer->isColorModel())
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: " + QString::number(ii->m_lx) + "x" +
|
|
Shinya Kitaoka |
120a6e |
QString::number(ii->m_ly) + " Pixels";
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (shrink > 1)
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: " + "Shrink: " + QString::number(shrink);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// when using the flip module, this signal is to show the loaded level
|
|
Shinya Kitaoka |
120a6e |
// names in application's title bar
|
|
Shinya Kitaoka |
120a6e |
QString arg = QString("Flip : %1").arg(m_levelNames[0]);
|
|
Shinya Kitaoka |
120a6e |
emit imageLoaded(arg);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// When viewing the tlv, try to cache all frames at the beginning.
|
|
Shinya Kitaoka |
120a6e |
if (!m_imageViewer->isColorModel() && fp.getType() == "tlv" &&
|
|
Shinya Kitaoka |
120a6e |
!(m_flags & eDontKeepFilesOpened) && !m_isPreviewFx) {
|
|
Shinya Kitaoka |
120a6e |
loadAndCacheAllTlvImages(levelToPush,
|
|
Shinya Kitaoka |
120a6e |
m_framesCount - addingFrameAmount + 1, // from
|
|
Shinya Kitaoka |
120a6e |
m_framesCount); // to
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
luz paz |
5d417b |
// An old archived bug says that simultaneous open for read of the same
|
|
Shinya Kitaoka |
120a6e |
// tlv are not allowed...
|
|
Shinya Kitaoka |
120a6e |
// if(m_lr && m_lr->getFilePath().getType()=="tlv")
|
|
Shinya Kitaoka |
120a6e |
// m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
} else // is a render
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eCheckBg, true);
|
|
Shinya Kitaoka |
120a6e |
m_previewedFx = 0;
|
|
Shinya Kitaoka |
120a6e |
m_previewXsh = 0;
|
|
Shinya Kitaoka |
120a6e |
m_levels.clear();
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRange(from, to, step);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_framesCount = (to - from) / step + 1;
|
|
Shinya Kitaoka |
120a6e |
m_title = tr("Rendered Frames :: From %1 To %2 :: Step %3")
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::number(from))
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::number(to))
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::number(step));
|
|
Shinya Kitaoka |
120a6e |
if (shrink > 1)
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + tr(" :: Shrink ") + QString::number(shrink);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// parentWidget()->setWindowTitle(m_title);
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramEnable(true);
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramTitle(m_levelNames[0]);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eSave, isSavable());
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->showCurrentFrame();
|
|
Shinya Kitaoka |
120a6e |
if (m_flags & eDontKeepFilesOpened) m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setTitle(const QString &title) {
|
|
Shinya Kitaoka |
120a6e |
m_viewerTitle = title;
|
|
Shinya Kitaoka |
120a6e |
if (!m_previewedFx && !m_levelNames.empty())
|
|
Shinya Kitaoka |
120a6e |
m_title = m_viewerTitle + " :: " + m_levelNames[0];
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_title = m_viewerTitle;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setLevel(TXshSimpleLevel *xl) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
clearCache();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_xl = xl;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.push_back(QString::fromStdWString(xl->getName()));
|
|
Shinya Kitaoka |
120a6e |
m_snd = 0;
|
|
Shinya Kitaoka |
120a6e |
m_previewedFx = 0;
|
|
Shinya Kitaoka |
120a6e |
m_previewXsh = 0;
|
|
Shinya Kitaoka |
120a6e |
m_levels.clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eSound, false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_shrink = 1;
|
|
Shinya Kitaoka |
120a6e |
int step = 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_framesCount = (m_xl->getFrameCount() - 1) / step + 1;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRange(1, m_framesCount, step);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableProgressBar(false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setProgressBarStatus(0);
|
|
Shinya Kitaoka |
120a6e |
m_palette = m_xl->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const LevelProperties *p = m_xl->getProperties();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_title = m_viewerTitle + " :: " + m_levelNames[0];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_framesCount == 1)
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: 1 Frame";
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: " + QString::number(m_framesCount) + " Frames";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (p) m_dim = p->getImageRes();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (p)
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: " + QString::number(p->getImageRes().lx) +
|
|
Shinya Kitaoka |
120a6e |
"x" + QString::number(p->getImageRes().ly) + " Pixels";
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_shrink > 1)
|
|
Shinya Kitaoka |
120a6e |
m_title = m_title + " :: " + "Shrink: " + QString::number(m_shrink);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramEnable(true);
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramTitle(m_levelNames[0]);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->showCurrentFrame();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setLevel(TFx *previewedFx, TXsheet *xsh, TLevel *level,
|
|
Shinya Kitaoka |
120a6e |
TPalette *palette, int from, int to, int step,
|
|
Shinya Kitaoka |
120a6e |
int currentFrame, TSoundTrack *snd) {
|
|
Shinya Kitaoka |
120a6e |
m_xl = 0;
|
|
Shinya Kitaoka |
120a6e |
m_previewedFx = previewedFx;
|
|
Shinya Kitaoka |
120a6e |
m_previewXsh = xsh;
|
|
Shinya Kitaoka |
120a6e |
m_isPreviewFx = true;
|
|
Shinya Kitaoka |
120a6e |
m_levels.clear();
|
|
Shinya Kitaoka |
120a6e |
m_levels.push_back(Level(level, TFilePath(), from - 1, to - 1, step));
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.clear();
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.push_back(QString::fromStdString(level->getName()));
|
|
Shinya Kitaoka |
120a6e |
m_title = m_viewerTitle;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRange(from, to, step, currentFrame);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableProgressBar(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eDefineLoadBox, false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eUseLoadBox, false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eSound, snd != 0);
|
|
Shinya Kitaoka |
120a6e |
m_snd = snd;
|
|
Shinya Kitaoka |
120a6e |
m_framesCount = (to - from) / step + 1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramEnable(true);
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setHistogramTitle(m_levelNames[0]);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->showCurrentFrame();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TFx *FlipBook::getPreviewedFx() const {
|
|
Shinya Kitaoka |
120a6e |
return m_isPreviewFx ? m_previewedFx.getPointer() : 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TXsheet *FlipBook::getPreviewXsheet() const {
|
|
Shinya Kitaoka |
120a6e |
return m_isPreviewFx ? m_previewXsh.getPointer() : 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRectD FlipBook::getPreviewedImageGeometry() const {
|
|
Shinya Kitaoka |
120a6e |
if (!m_isPreviewFx) return TRectD();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Build viewer's geometry
|
|
Shinya Kitaoka |
120a6e |
QRect viewerGeom(m_imageViewer->geometry());
|
|
Shinya Kitaoka |
120a6e |
viewerGeom.adjust(-1, -1, 1, 1);
|
|
Shinya Kitaoka |
120a6e |
TRectD viewerGeomD(viewerGeom.left(), viewerGeom.top(),
|
|
Shinya Kitaoka |
120a6e |
viewerGeom.right() + 1, viewerGeom.bottom() + 1);
|
|
Shinya Kitaoka |
120a6e |
TPointD viewerCenter((viewerGeomD.x0 + viewerGeomD.x1) * 0.5,
|
|
Shinya Kitaoka |
120a6e |
(viewerGeomD.y0 + viewerGeomD.y1) * 0.5);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// NOTE: The above adjust() is imposed to counter the geometry removal
|
|
Shinya Kitaoka |
120a6e |
// specified in function
|
|
Shinya Kitaoka |
120a6e |
// FlipBook::onDoubleClick.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Build viewer-to-camera affine
|
|
Shinya Kitaoka |
120a6e |
TAffine viewToCam(m_imageViewer->getViewAff().inv() *
|
|
Shinya Kitaoka |
120a6e |
TTranslation(-viewerCenter));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return viewToCam * viewerGeomD;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::schedulePreviewedFxUpdate() {
|
|
Shinya Kitaoka |
120a6e |
if (m_previewedFx)
|
|
Shinya Kitaoka |
120a6e |
m_previewUpdateTimer.start(
|
|
Shinya Kitaoka |
120a6e |
1000); // The effective fx update will happen in 1 msec.
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::performFxUpdate() {
|
|
Shinya Kitaoka |
120a6e |
// refresh only when the subcamera is active
|
|
Shinya Kitaoka |
120a6e |
if (PreviewFxManager::instance()->isSubCameraActive(m_previewedFx))
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->refreshView(m_previewedFx);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::regenerate() {
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->reset(TFxP(m_previewedFx));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::regenerateFrame() {
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->reset(m_previewedFx, getCurrentFrame() - 1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::clonePreview() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_previewedFx) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FlipBook *newFlip =
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->showNewPreview(m_previewedFx, true);
|
|
Shinya Kitaoka |
120a6e |
newFlip->m_imageViewer->setViewAff(m_imageViewer->getViewAff());
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->refreshView(m_previewedFx);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::freezePreview() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_previewedFx) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->freeze(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_freezed = true;
|
|
Toshihiro Shimizu |
890ddd |
|
|
luz paz |
6454c4 |
// sync the button state when triggered by shortcut
|
|
Shinya Kitaoka |
120a6e |
if (m_freezeButton) m_freezeButton->setPressed(true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::unfreezePreview() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_previewedFx) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->unfreeze(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_freezed = false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
luz paz |
6454c4 |
// sync the button state when triggered by shortcut
|
|
Shinya Kitaoka |
120a6e |
if (m_freezeButton) m_freezeButton->setPressed(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setProgressBarStatus(const std::vector<uchar> *pbStatus) {</uchar>
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setProgressBarStatus(pbStatus);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const std::vector<uchar> *FlipBook::getProgressBarStatus() const {</uchar>
|
|
Shinya Kitaoka |
120a6e |
return m_flipConsole->getProgressBarStatus();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::showFrame(int frame) {
|
|
Shinya Kitaoka |
120a6e |
if (frame < 0) return;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setCurrentFrame(frame);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->showCurrentFrame();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::playAudioFrame(int frame) {
|
|
Shinya Kitaoka |
120a6e |
static bool first = true;
|
|
Shinya Kitaoka |
120a6e |
static bool audioCardInstalled;
|
|
Shinya Kitaoka |
120a6e |
if (!m_snd || !m_playSound) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (first) {
|
|
Shinya Kitaoka |
120a6e |
audioCardInstalled = TSoundOutputDevice::installed();
|
|
Shinya Kitaoka |
120a6e |
first = false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!audioCardInstalled) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!m_player) {
|
|
Shinya Kitaoka |
120a6e |
m_player = new TSoundOutputDevice();
|
|
Shinya Kitaoka |
120a6e |
m_player->attach(this);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (m_player) {
|
|
Shinya Kitaoka |
120a6e |
// Flipbook does not currently support double fps - thus, casting to int in
|
|
Shinya Kitaoka |
120a6e |
// soundtrack playback, too
|
|
Shinya Kitaoka |
120a6e |
int fps = TApp::instance()
|
|
Shinya Kitaoka |
120a6e |
->getCurrentScene()
|
|
Shinya Kitaoka |
120a6e |
->getScene()
|
|
Shinya Kitaoka |
120a6e |
->getProperties()
|
|
Shinya Kitaoka |
120a6e |
->getOutputProperties()
|
|
Shinya Kitaoka |
120a6e |
->getFrameRate();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int samplePerFrame = int(m_snd->getSampleRate()) / fps;
|
|
Shinya Kitaoka |
120a6e |
TINT32 firstSample = (frame - 1) * samplePerFrame;
|
|
Shinya Kitaoka |
120a6e |
TINT32 lastSample = firstSample + samplePerFrame;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
m_player->play(m_snd, firstSample, lastSample, false, false);
|
|
Shinya Kitaoka |
120a6e |
} catch (TSoundDeviceException &e) {
|
|
Shinya Kitaoka |
120a6e |
std::string msg;
|
|
Shinya Kitaoka |
120a6e |
if (e.getType() == TSoundDeviceException::UnsupportedFormat) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
TSoundTrackFormat fmt =
|
|
Shinya Kitaoka |
120a6e |
m_player->getPreferredFormat(m_snd->getFormat());
|
|
Shinya Kitaoka |
120a6e |
m_player->play(TSop::convert(m_snd, fmt), firstSample, lastSample,
|
|
Shinya Kitaoka |
120a6e |
false, false);
|
|
Shinya Kitaoka |
120a6e |
} catch (TSoundDeviceException &ex) {
|
|
Shinya Kitaoka |
120a6e |
throw TException(ex.getMessage());
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageP FlipBook::getCurrentImage(int frame) {
|
|
Shinya Kitaoka |
120a6e |
std::string id = "";
|
|
Shinya Kitaoka |
120a6e |
TFrameId fid;
|
|
Shinya Kitaoka |
120a6e |
TFilePath fp;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool randomAccessRead = false;
|
|
Shinya Kitaoka |
120a6e |
bool incrementalIndexing = false;
|
|
shun-iwasawa |
e6b124 |
bool premultiply = false;
|
|
shun-iwasawa |
481b59 |
TSceneProperties *sp =
|
|
shun-iwasawa |
481b59 |
TApp::instance()->getCurrentScene()->getScene()->getProperties();
|
|
shun-iwasawa |
481b59 |
double colorSpaceGamma = LevelOptions::DefaultColorSpaceGamma;
|
|
Shinya Kitaoka |
120a6e |
if (m_xl) // is an xsheet level
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
if (m_xl->getFrameCount() <= 0) return 0;
|
|
Shinya Kitaoka |
120a6e |
return m_xl->getFrame(m_xl->index2fid(frame - 1), false);
|
|
Shinya Kitaoka |
120a6e |
} else if (!m_levels.empty()) // is a viewfile or a previewFx
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
TLevelP level;
|
|
Shinya Kitaoka |
120a6e |
QString levelName;
|
|
Shinya Kitaoka |
120a6e |
int from, to, step;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->getFrameRange(from, to, step);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int frameIndex = m_previewedFx ? ((frame - from) / step) + 1 : frame;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int i = 0;
|
|
Shinya Kitaoka |
120a6e |
// Search all subsequent levels on the flipbook and retrieve the one
|
|
Shinya Kitaoka |
120a6e |
// containing the required frame
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_levels.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
int frameIndexesCount = m_levels[i].getIndexesCount();
|
|
Shinya Kitaoka |
120a6e |
if (frameIndex > 0 && frameIndex <= frameIndexesCount) break;
|
|
Shinya Kitaoka |
120a6e |
frameIndex -= frameIndexesCount;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (i == m_levels.size() || frame < 0) return 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
frame--;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Now, get the right frame from the level
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
level = m_levels[i].m_level;
|
|
Shinya Kitaoka |
120a6e |
fp = m_levels[i].m_fp; // fp=empty when previewing fx
|
|
Shinya Kitaoka |
120a6e |
randomAccessRead = m_levels[i].m_randomAccessRead;
|
|
Shinya Kitaoka |
120a6e |
incrementalIndexing = m_levels[i].m_incrementalIndexing;
|
|
Shinya Kitaoka |
120a6e |
levelName = m_levelNames[i];
|
|
Shinya Kitaoka |
120a6e |
fid = m_levels[i].flipbookIndexToLevelFrame(frameIndex);
|
|
shun-iwasawa |
e6b124 |
premultiply = m_levels[i].m_premultiply;
|
|
shun-iwasawa |
481b59 |
colorSpaceGamma = m_levels[i].m_colorSpaceGamma;
|
|
shun-iwasawa |
481b59 |
|
|
Shinya Kitaoka |
120a6e |
if (fid == TFrameId()) return 0;
|
|
Shinya Kitaoka |
120a6e |
id = levelName.toStdString() + fid.expand(TFrameId::NO_PAD) +
|
|
Shinya Kitaoka |
120a6e |
((m_isPreviewFx) ? "" : ::to_string(this));
|
|
Shinya Kitaoka |
120a6e |
|
|
shun-iwasawa |
481b59 |
if (!m_isPreviewFx) {
|
|
Shinya Kitaoka |
120a6e |
m_title1 = m_viewerTitle + " :: " + fp.withoutParentDir().withFrame(fid);
|
|
shun-iwasawa |
481b59 |
if (fp.getType() == "exr")
|
|
shun-iwasawa |
481b59 |
m_title1 += " :: " + tr("Gamma : %1").arg(colorSpaceGamma);
|
|
shun-iwasawa |
481b59 |
} else
|
|
Shinya Kitaoka |
120a6e |
m_title1 = "";
|
|
Shinya Kitaoka |
120a6e |
} else if (m_levelNames.empty())
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Shinya Kitaoka |
120a6e |
else // is a render
|
|
Shinya Kitaoka |
120a6e |
id = m_levelNames[0].toStdString() + std::to_string(frame);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool showSub = m_flipConsole->isChecked(FlipConsole::eUseLoadBox);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (TImageCache::instance()->isCached(id)) {
|
|
Shinya Kitaoka |
120a6e |
TRect loadbox;
|
|
Shinya Kitaoka |
120a6e |
std::map<std::string, trect="">::const_iterator it = m_loadboxes.find(id);</std::string,>
|
|
Shinya Kitaoka |
120a6e |
if (it != m_loadboxes.end()) loadbox = it->second;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Resubmit the image to the cache as the 'last one' seen by the flipbook.
|
|
Shinya Kitaoka |
120a6e |
// TImageCache::instance()->add(toString(m_poolIndex) + "lastFlipFrame",
|
|
Shinya Kitaoka |
120a6e |
// img);
|
|
Shinya Kitaoka |
120a6e |
// m_lastViewedFrame = frame+1;
|
|
Shinya Kitaoka |
120a6e |
if ((showSub && m_loadbox == loadbox) || (!showSub && loadbox == TRect()))
|
|
Shinya Kitaoka |
120a6e |
return TImageCache::instance()->get(id, false);
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->remove(id);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (fp != TFilePath() && !m_isPreviewFx) {
|
|
Shinya Kitaoka |
120a6e |
int lx = 0, oriLx = 0;
|
|
Shinya Kitaoka |
120a6e |
// TLevelReaderP lr(fp);
|
|
Shinya Kitaoka |
120a6e |
if (!m_lr || (fp != m_lr->getFilePath())) {
|
|
Shinya Kitaoka |
120a6e |
m_lr = TLevelReaderP(fp);
|
|
Shinya Kitaoka |
120a6e |
m_lr->enableRandomAccessRead(randomAccessRead);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (!m_lr) return 0;
|
|
Shinya Kitaoka |
120a6e |
// try to get image info only when loading tlv or pli as it is quite time
|
|
Shinya Kitaoka |
120a6e |
// consuming
|
|
Shinya Kitaoka |
120a6e |
if (fp.getType() == "tlv" || fp.getType() == "pli") {
|
|
Shinya Kitaoka |
120a6e |
if (m_lr->getImageInfo()) lx = oriLx = m_lr->getImageInfo()->m_lx;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
TImageReaderP ir = m_lr->getFrameReader(fid);
|
|
Shinya Kitaoka |
120a6e |
ir->setShrink(m_shrink);
|
|
shun-iwasawa |
481b59 |
ir->setColorSpaceGamma(colorSpaceGamma);
|
|
Shinya Kitaoka |
120a6e |
if (m_loadbox != TRect() && showSub) {
|
|
Shinya Kitaoka |
120a6e |
ir->setRegion(m_loadbox);
|
|
Shinya Kitaoka |
120a6e |
lx = m_loadbox.getLx();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
shun-iwasawa |
215a5b |
if (Preferences::instance()->is30bitDisplayEnabled())
|
|
shun-iwasawa |
215a5b |
ir->enable16BitRead(true);
|
|
shun-iwasawa |
215a5b |
|
|
shun-iwasawa |
481b59 |
// always enable to load float-format images
|
|
shun-iwasawa |
481b59 |
ir->enableFloatRead(true);
|
|
shun-iwasawa |
481b59 |
|
|
Shinya Kitaoka |
120a6e |
TImageP img = ir->load();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (img) {
|
|
Shinya Kitaoka |
120a6e |
TRasterImageP ri = ((TRasterImageP)img);
|
|
Shinya Kitaoka |
120a6e |
TToonzImageP ti = ((TToonzImageP)img);
|
|
shun-iwasawa |
e6b124 |
if (premultiply) {
|
|
shun-iwasawa |
e6b124 |
if (ri)
|
|
shun-iwasawa |
e6b124 |
TRop::premultiply(ri->getRaster());
|
|
shun-iwasawa |
e6b124 |
else if (ti)
|
|
shun-iwasawa |
e6b124 |
TRop::premultiply(ti->getRaster());
|
|
shun-iwasawa |
e6b124 |
}
|
|
shun-iwasawa |
e6b124 |
|
|
Shinya Kitaoka |
120a6e |
// se e' stata caricata una sottoimmagine alcuni formati in realta'
|
|
Shinya Kitaoka |
120a6e |
// caricano tutto il raster e fanno extract, non si ha quindi alcun
|
|
Shinya Kitaoka |
120a6e |
// risparmio di occupazione di memoria; alloco un raster grande
|
|
Shinya Kitaoka |
120a6e |
// giusto copio la region e butto quello originale.
|
|
Shinya Kitaoka |
120a6e |
if (ri && showSub && m_loadbox != TRect() &&
|
|
Shinya Kitaoka |
120a6e |
ri->getRaster()->getLx() == oriLx) // questo serve perche' per avi e
|
|
Shinya Kitaoka |
120a6e |
// mov la setRegion e'
|
|
Shinya Kitaoka |
120a6e |
// completamente ignorata...
|
|
Shinya Kitaoka |
120a6e |
ri->setRaster(ri->getRaster()->extract(m_loadbox)->clone());
|
|
Shinya Kitaoka |
120a6e |
else if (ri && ri->getRaster()->getWrap() > ri->getRaster()->getLx())
|
|
Shinya Kitaoka |
120a6e |
ri->setRaster(ri->getRaster()->clone());
|
|
Shinya Kitaoka |
120a6e |
else if (ti && ti->getCMapped()->getWrap() > ti->getCMapped()->getLx())
|
|
Shinya Kitaoka |
120a6e |
ti->setCMapped(ti->getCMapped()->clone());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if ((fp.getType() == "tlv" || fp.getType() == "pli") && m_shrink > 1 &&
|
|
Shinya Kitaoka |
120a6e |
(lx == 0 || (ri && ri->getRaster()->getLx() == lx) ||
|
|
Shinya Kitaoka |
120a6e |
(ti && ti->getRaster()->getLx() == lx))) {
|
|
Shinya Kitaoka |
120a6e |
if (ri)
|
|
Shinya Kitaoka |
120a6e |
ri->setRaster(TRop::shrink(ri->getRaster(), m_shrink));
|
|
Shinya Kitaoka |
120a6e |
else if (ti)
|
|
Shinya Kitaoka |
120a6e |
ti->setCMapped(TRop::shrink(ti->getRaster(), m_shrink));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TPalette *palette = img->getPalette();
|
|
Shinya Kitaoka |
120a6e |
if (m_palette && (!palette || palette != m_palette))
|
|
Shinya Kitaoka |
120a6e |
img->setPalette(m_palette);
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->add(id, img);
|
|
Shinya Kitaoka |
120a6e |
m_loadboxes[id] = showSub ? m_loadbox : TRect();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
luz paz |
5d417b |
// An old archived bug says that simultaneous open for read of the same tlv
|
|
Shinya Kitaoka |
120a6e |
// are not allowed...
|
|
Shinya Kitaoka |
120a6e |
// if(fp.getType()=="tlv")
|
|
Shinya Kitaoka |
120a6e |
// m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
if (m_flags & eDontKeepFilesOpened) m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
return img;
|
|
Shinya Kitaoka |
120a6e |
} else if (fp == TFilePath() && m_isPreviewFx) {
|
|
Shinya Kitaoka |
120a6e |
if (!TImageCache::instance()->isCached(id)) {
|
|
Shinya Kitaoka |
120a6e |
/*string lastFrameCacheId(toString(m_poolIndex) + "lastFlipFrame");
|
|
Shinya Kitaoka |
120a6e |
if(TImageCache::instance()->isCached(lastFrameCacheId))
|
|
Shinya Kitaoka |
120a6e |
return TImageCache::instance()->get(lastFrameCacheId, false);
|
|
Shinya Kitaoka |
120a6e |
else*/
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Shinya Kitaoka |
120a6e |
// showFrame(m_lastViewedFrame);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Set current level frame to image viewer. Add the view image in cache.
|
|
shun-iwasawa |
cea18b |
*/
|
|
shun-iwasawa |
fe0983 |
void FlipBook::onDrawFrame(int frame, const ImagePainter::VisualSettings &vs,
|
|
shun-iwasawa |
fe0983 |
QElapsedTimer *timer, qint64 targetInstant) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setVisual(vs);
|
|
shun-iwasawa |
fe0983 |
m_imageViewer->setTimerAndTargetInstant(timer, targetInstant);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageP img = getCurrentImage(frame);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!img) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
481b59 |
// gain control ( for now the result is not cached )
|
|
shun-iwasawa |
481b59 |
if (vs.m_gainStep != 0) {
|
|
shun-iwasawa |
481b59 |
TImageP gainedImg = img->cloneImage();
|
|
shun-iwasawa |
481b59 |
TSceneProperties *sp =
|
|
shun-iwasawa |
481b59 |
TApp::instance()->getCurrentScene()->getScene()->getProperties();
|
|
shun-iwasawa |
481b59 |
double colorSpaceGamma =
|
|
shun-iwasawa |
481b59 |
sp->getPreviewProperties()->getRenderSettings().m_colorSpaceGamma;
|
|
shun-iwasawa |
481b59 |
TRop::adjustGain(gainedImg->raster(), vs.m_gainStep, colorSpaceGamma);
|
|
shun-iwasawa |
481b59 |
|
|
shun-iwasawa |
481b59 |
m_imageViewer->setImage(gainedImg, img);
|
|
shun-iwasawa |
481b59 |
} else
|
|
shun-iwasawa |
481b59 |
m_imageViewer->setImage(img);
|
|
Shinya Kitaoka |
120a6e |
} catch (...) {
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setImage(TImageP());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_playSound && !vs.m_drawBlankFrame) playAudioFrame(frame);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::swapBuffers() { m_imageViewer->doSwapBuffers(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::changeSwapBehavior(bool enable) {
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->changeSwapBehavior(enable);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::setLoadbox(const TRect &box) {
|
|
Shinya Kitaoka |
120a6e |
m_loadbox =
|
|
Shinya Kitaoka |
120a6e |
(m_dim.lx > 0) ? box * TRect(0, 0, m_dim.lx - 1, m_dim.ly - 1) : box;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::clearCache() {
|
|
Shinya Kitaoka |
120a6e |
TLevel::Iterator it;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (m_levelNames.empty()) return;
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!m_levels.empty()) // is a viewfile
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < m_levels.size(); i++)
|
|
Shinya Kitaoka |
120a6e |
for (it = m_levels[i].m_level->begin(); it != m_levels[i].m_level->end();
|
|
Shinya Kitaoka |
120a6e |
++it)
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->remove(
|
|
shun-iwasawa |
481b59 |
m_levelNames[i].toStdString() + it->first.expand(TFrameId::NO_PAD) +
|
|
Shinya Kitaoka |
120a6e |
((m_isPreviewFx) ? "" : ::to_string(this)));
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
int from, to, step;
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->getFrameRange(from, to, step);
|
|
Shinya Kitaoka |
120a6e |
for (int i = from; i <= to; i += step) // is a render
|
|
Shinya Kitaoka |
120a6e |
// color model may loading a part of frames in the level
|
|
Shinya Kitaoka |
120a6e |
if (m_imageViewer->isColorModel() && m_palette) {
|
|
Shinya Kitaoka |
120a6e |
// get the actually-loaded frame list
|
|
Shinya Kitaoka |
120a6e |
std::vector<tframeid> fids(m_palette->getRefLevelFids());</tframeid>
|
|
Shinya Kitaoka |
120a6e |
if (!fids.empty() && (int)fids.size() >= i) {
|
|
Shinya Kitaoka |
120a6e |
int frame = fids[i - 1].getNumber();
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->remove(m_levelNames[0].toStdString() +
|
|
Shinya Kitaoka |
120a6e |
std::to_string(frame));
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->remove(m_levelNames[0].toStdString() +
|
|
Shinya Kitaoka |
120a6e |
std::to_string(i));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->remove(m_levelNames[0].toStdString() +
|
|
Shinya Kitaoka |
120a6e |
std::to_string(i));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::onCloseButtonPressed() {
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setActive(false);
|
|
Shinya Kitaoka |
120a6e |
closeFlipBook(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
reset();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// hide freeze button in preview fx window
|
|
Shinya Kitaoka |
120a6e |
if (m_freezeButton) {
|
|
Shinya Kitaoka |
120a6e |
m_freezeButton->hide();
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setIsRemakingPreviewFx(false);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Return the flipbook to the pool in case it was popped from it.
|
|
Shinya Kitaoka |
120a6e |
if (m_poolIndex >= 0) FlipBookPool::instance()->push(this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void ImageViewer::showHistogram() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_isHistogramEnable) return;
|
|
shun-iwasawa |
2cda63 |
|
|
shun-iwasawa |
2cda63 |
// close the popup when using the command while open
|
|
Shinya Kitaoka |
120a6e |
if (m_histogramPopup->isVisible())
|
|
shun-iwasawa |
2cda63 |
m_histogramPopup->hide();
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
shun-iwasawa |
2cda63 |
m_histogramPopup->moveNextToWidget(this);
|
|
Shinya Kitaoka |
120a6e |
m_histogramPopup->setImage(getImage());
|
|
Shinya Kitaoka |
120a6e |
m_histogramPopup->show();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::dragEnterEvent(QDragEnterEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
const QMimeData *mimeData = e->mimeData();
|
|
manongjohn |
0036c5 |
bool isResourceDrop = acceptResourceDrop(mimeData->urls());
|
|
manongjohn |
0036c5 |
if (!isResourceDrop &&
|
|
Shinya Kitaoka |
120a6e |
!mimeData->hasFormat("application/vnd.toonz.drawings") &&
|
|
Shinya Kitaoka |
120a6e |
!mimeData->hasFormat(CastItems::getMimeFormat()))
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
|
|
otakuto |
dfe1cf |
for (const QUrl &url : mimeData->urls()) {
|
|
Shinya Kitaoka |
120a6e |
TFilePath fp(url.toLocalFile().toStdWString());
|
|
Shinya Kitaoka |
120a6e |
std::string type = fp.getType();
|
|
Shinya Kitaoka |
120a6e |
if (type == "tzp" || type == "tzu" || type == "tnz" || type == "scr" ||
|
|
Shinya Kitaoka |
120a6e |
type == "mesh")
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (mimeData->hasFormat(CastItems::getMimeFormat())) {
|
|
Shinya Kitaoka |
120a6e |
const CastItems *items = dynamic_cast<const *="" castitems="">(mimeData);</const>
|
|
Shinya Kitaoka |
120a6e |
if (!items) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < items->getItemCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
CastItem *item = items->getItem(i);
|
|
Shinya Kitaoka |
120a6e |
TXshSimpleLevel *sl = item->getSimpleLevel();
|
|
Shinya Kitaoka |
120a6e |
if (!sl) return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
manongjohn |
0036c5 |
if (isResourceDrop) {
|
|
manongjohn |
0036c5 |
// Force CopyAction
|
|
manongjohn |
0036c5 |
e->setDropAction(Qt::CopyAction);
|
|
manongjohn |
0036c5 |
// For files, don't accept original proposed action in case it's a move
|
|
manongjohn |
0036c5 |
e->accept();
|
|
manongjohn |
0036c5 |
} else
|
|
manongjohn |
0036c5 |
e->acceptProposedAction();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::dropEvent(QDropEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
const QMimeData *mimeData = e->mimeData();
|
|
manongjohn |
0036c5 |
bool isResourceDrop = acceptResourceDrop(mimeData->urls());
|
|
Shinya Kitaoka |
120a6e |
if (mimeData->hasUrls()) {
|
|
otakuto |
dfe1cf |
for (const QUrl &url : mimeData->urls()) {
|
|
Shinya Kitaoka |
120a6e |
TFilePath fp(url.toLocalFile().toStdWString());
|
|
Shinya Kitaoka |
120a6e |
if (TFileType::getInfo(fp) != TFileType::UNKNOW_FILE) setLevel(fp);
|
|
manongjohn |
0036c5 |
if (isResourceDrop) {
|
|
manongjohn |
0036c5 |
// Force CopyAction
|
|
manongjohn |
0036c5 |
e->setDropAction(Qt::CopyAction);
|
|
manongjohn |
0036c5 |
// For files, don't accept original proposed action in case it's a move
|
|
manongjohn |
0036c5 |
e->accept();
|
|
manongjohn |
0036c5 |
} else
|
|
manongjohn |
0036c5 |
e->acceptProposedAction();
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (mimeData->hasFormat(
|
|
Shinya Kitaoka |
120a6e |
"application/vnd.toonz.drawings")) // drag-drop from film
|
|
Shinya Kitaoka |
120a6e |
// strip
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
TFilmstripSelection *s =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<tfilmstripselection *="">(TSelection::getCurrent());</tfilmstripselection>
|
|
Shinya Kitaoka |
120a6e |
TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();
|
|
Shinya Kitaoka |
120a6e |
if (!s || !sl) return;
|
|
Shinya Kitaoka |
120a6e |
TXshSimpleLevel *newSl = new TXshSimpleLevel();
|
|
Shinya Kitaoka |
120a6e |
newSl->setScene(sl->getScene());
|
|
Shinya Kitaoka |
120a6e |
newSl->setType(sl->getType());
|
|
Shinya Kitaoka |
120a6e |
newSl->setPalette(sl->getPalette());
|
|
Shinya Kitaoka |
120a6e |
newSl->clonePropertiesFrom(sl);
|
|
Shinya Kitaoka |
120a6e |
const std::set<tframeid> &fids = s->getSelectedFids();</tframeid>
|
|
Shinya Kitaoka |
120a6e |
std::set<tframeid>::const_iterator it;</tframeid>
|
|
Shinya Kitaoka |
120a6e |
for (it = fids.begin(); it != fids.end(); ++it)
|
|
Shinya Kitaoka |
120a6e |
newSl->setFrame(*it, sl->getFrame(*it, false)->cloneImage());
|
|
Shinya Kitaoka |
120a6e |
setLevel(newSl);
|
|
Shinya Kitaoka |
120a6e |
} else if (mimeData->hasFormat(
|
|
Shinya Kitaoka |
120a6e |
CastItems::getMimeFormat())) // Drag-Drop from castviewer
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
const CastItems *items = dynamic_cast<const *="" castitems="">(mimeData);</const>
|
|
Shinya Kitaoka |
120a6e |
if (!items) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < items->getItemCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
CastItem *item = items->getItem(i);
|
|
Shinya Kitaoka |
120a6e |
if (TXshSimpleLevel *sl = item->getSimpleLevel()) setLevel(sl);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->makeCurrent();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::reset() {
|
|
Shinya Kitaoka |
120a6e |
if (!m_isPreviewFx) // The cache is owned by the PreviewFxManager otherwise
|
|
Shinya Kitaoka |
120a6e |
clearCache();
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
PreviewFxManager::instance()->detach(this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_levelNames.clear();
|
|
Shinya Kitaoka |
120a6e |
m_levels.clear();
|
|
Shinya Kitaoka |
120a6e |
m_framesCount = 0;
|
|
Shinya Kitaoka |
120a6e |
m_palette = 0;
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setImage(TImageP());
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->hideHistogram();
|
|
Shinya Kitaoka |
120a6e |
m_isPreviewFx = false;
|
|
Shinya Kitaoka |
120a6e |
m_previewedFx = 0;
|
|
Shinya Kitaoka |
120a6e |
m_previewXsh = 0;
|
|
Shinya Kitaoka |
120a6e |
m_freezed = false;
|
|
Shinya Kitaoka |
120a6e |
// sync the freeze button
|
|
Shinya Kitaoka |
120a6e |
if (m_freezeButton) m_freezeButton->setPressed(false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->pressButton(FlipConsole::ePause);
|
|
Shinya Kitaoka |
120a6e |
if (m_playSound) m_flipConsole->pressButton(FlipConsole::eSound);
|
|
Shinya Kitaoka |
120a6e |
if (m_player) m_player->stop();
|
|
Shinya Kitaoka |
120a6e |
if (m_flipConsole->isChecked(FlipConsole::eDefineLoadBox))
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->pressButton(FlipConsole::eDefineLoadBox);
|
|
Shinya Kitaoka |
120a6e |
if (m_flipConsole->isChecked(FlipConsole::eUseLoadBox))
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->pressButton(FlipConsole::eUseLoadBox);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eDefineLoadBox, true);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableButton(FlipConsole::eUseLoadBox, true);
|
|
shun-iwasawa |
481b59 |
m_flipConsole->resetGain(true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_lr = TLevelReaderP();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_dim = TDimension();
|
|
Shinya Kitaoka |
120a6e |
m_loadbox = TRect();
|
|
Shinya Kitaoka |
120a6e |
m_loadboxes.clear();
|
|
Shinya Kitaoka |
120a6e |
// m_lastViewedFrame = -1;
|
|
Shinya Kitaoka |
120a6e |
// TImageCache::instance()->remove(toString(m_poolIndex) + "lastFlipFrame");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->enableProgressBar(false);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setProgressBarStatus(0);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setFrameRange(1, 1, 1);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
setTitle(tr("Flipbook"));
|
|
Shinya Kitaoka |
120a6e |
parentWidget()->setWindowTitle(m_title);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::showEvent(QShowEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene();
|
|
Shinya Kitaoka |
120a6e |
connect(sceneHandle, SIGNAL(sceneChanged()), m_imageViewer, SLOT(update()));
|
|
Shinya Kitaoka |
120a6e |
// for updating the blank frame button
|
|
Shinya Kitaoka |
120a6e |
if (!m_imageViewer->isColorModel()) {
|
|
shun_iwasawa |
1f4a70 |
connect(sceneHandle, SIGNAL(preferenceChanged(const QString &)),
|
|
shun_iwasawa |
1f4a70 |
m_flipConsole, SLOT(onPreferenceChanged(const QString &)));
|
|
shun_iwasawa |
1f4a70 |
m_flipConsole->onPreferenceChanged("");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setActive(true);
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::hideEvent(QHideEvent *e) {
|
|
Shinya Kitaoka |
120a6e |
TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene();
|
|
Shinya Kitaoka |
120a6e |
disconnect(sceneHandle, SIGNAL(sceneChanged()), m_imageViewer,
|
|
Shinya Kitaoka |
120a6e |
SLOT(update()));
|
|
shun_iwasawa |
1f4a70 |
if (!m_imageViewer->isColorModel()) {
|
|
shun_iwasawa |
1f4a70 |
disconnect(sceneHandle, SIGNAL(preferenceChanged(const QString &)),
|
|
shun_iwasawa |
1f4a70 |
m_flipConsole, SLOT(onPreferenceChanged(const QString &)));
|
|
shun_iwasawa |
1f4a70 |
}
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->setActive(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::resizeEvent(QResizeEvent *e) { schedulePreviewedFxUpdate(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::adaptGeometry(const TRect &interestingImgRect,
|
|
Shinya Kitaoka |
120a6e |
const TRect &imgRect) {
|
|
Shinya Kitaoka |
120a6e |
TRectD imgRectD(imgRect.x0, imgRect.y0, imgRect.x1 + 1, imgRect.y1 + 1);
|
|
Shinya Kitaoka |
120a6e |
TRectD interestingImgRectD(interestingImgRect.x0, interestingImgRect.y0,
|
|
Shinya Kitaoka |
120a6e |
interestingImgRect.x1 + 1,
|
|
Shinya Kitaoka |
120a6e |
interestingImgRect.y1 + 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TAffine toWidgetRef(m_imageViewer->getImgToWidgetAffine(imgRectD));
|
|
Shinya Kitaoka |
120a6e |
TRectD interestGeomD(toWidgetRef * interestingImgRectD);
|
|
Shinya Kitaoka |
120a6e |
TRectD imageGeomD(toWidgetRef * imgRectD);
|
|
Shinya Kitaoka |
120a6e |
adaptWidGeometry(
|
|
Shinya Kitaoka |
120a6e |
TRect(tceil(interestGeomD.x0), tceil(interestGeomD.y0),
|
|
Shinya Kitaoka |
120a6e |
tfloor(interestGeomD.x1) - 1, tfloor(interestGeomD.y1) - 1),
|
|
Shinya Kitaoka |
120a6e |
TRect(tceil(imageGeomD.x0), tceil(imageGeomD.y0),
|
|
Shinya Kitaoka |
120a6e |
tfloor(imageGeomD.x1) - 1, tfloor(imageGeomD.y1) - 1),
|
|
Shinya Kitaoka |
120a6e |
true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
/*! When Fx preview is called without the subcamera, render the full region
|
|
Shinya Kitaoka |
120a6e |
of camera by resize flipbook and zoom-out the rendered image.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::adaptGeometryForFullPreview(const TRect &imgRect) {
|
|
Shinya Kitaoka |
120a6e |
TRectD imgRectD(imgRect.x0, imgRect.y0, imgRect.x1 + 1, imgRect.y1 + 1);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Get screen geometry
|
|
Shinya Kitaoka |
120a6e |
TPanel *panel = static_cast<tpanel *="">(parentWidget());</tpanel>
|
|
Shinya Kitaoka |
120a6e |
if (!panel->isFloating()) return;
|
|
Shinya Kitaoka |
120a6e |
QDesktopWidget *desk =
|
|
Shinya Kitaoka |
120a6e |
static_cast<qapplication *="">(QApplication::instance())->desktop();</qapplication>
|
|
Shinya Kitaoka |
120a6e |
QRect screenGeom = desk->availableGeometry(panel);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
while (1) {
|
|
Shinya Kitaoka |
120a6e |
TAffine toWidgetRef(m_imageViewer->getImgToWidgetAffine(imgRectD));
|
|
Shinya Kitaoka |
120a6e |
TRectD imageGeomD(toWidgetRef * imgRectD);
|
|
Shinya Kitaoka |
120a6e |
TRect imageGeom(tceil(imageGeomD.x0) - 1, tceil(imageGeomD.y0) - 1,
|
|
Shinya Kitaoka |
120a6e |
tfloor(imageGeomD.x1) + 1, tfloor(imageGeomD.y1) + 1);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (imageGeom.getLx() <= screenGeom.width() &&
|
|
Shinya Kitaoka |
120a6e |
imageGeom.getLy() <= screenGeom.height()) {
|
|
Shinya Kitaoka |
120a6e |
adaptWidGeometry(imageGeom, imageGeom, false);
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->zoomQt(false, false);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Adapts panel geometry to that of passed rect.
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::adaptWidGeometry(const TRect &interestWidGeom,
|
|
Shinya Kitaoka |
120a6e |
const TRect &imgWidGeom, bool keepPosition) {
|
|
Shinya Kitaoka |
120a6e |
TPanel *panel = static_cast<tpanel *="">(parentWidget());</tpanel>
|
|
Shinya Kitaoka |
120a6e |
if (!panel->isFloating()) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Extract image position in screen coordinates
|
|
Shinya Kitaoka |
120a6e |
QRect qgeom(interestWidGeom.x0, interestWidGeom.y0, interestWidGeom.getLx(),
|
|
Shinya Kitaoka |
120a6e |
interestWidGeom.getLy());
|
|
Shinya Kitaoka |
120a6e |
QRect interestGeom(m_imageViewer->mapToGlobal(qgeom.topLeft()),
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->mapToGlobal(qgeom.bottomRight()));
|
|
Shinya Kitaoka |
120a6e |
qgeom = QRect(imgWidGeom.x0, imgWidGeom.y0, imgWidGeom.getLx(),
|
|
Shinya Kitaoka |
120a6e |
imgWidGeom.getLy());
|
|
Shinya Kitaoka |
120a6e |
QRect imageGeom(m_imageViewer->mapToGlobal(qgeom.topLeft()),
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->mapToGlobal(qgeom.bottomRight()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// qDebug("tgeom= [%d, %d] x [%d, %d]", tgeom.x0, tgeom.x1, tgeom.y0,
|
|
Shinya Kitaoka |
120a6e |
// tgeom.y1);
|
|
Shinya Kitaoka |
120a6e |
// qDebug("imagegeom= [%d, %d] x [%d, %d]", imageGeom.left(),
|
|
Shinya Kitaoka |
120a6e |
// imageGeom.right(),
|
|
Shinya Kitaoka |
120a6e |
// imageGeom.top(), imageGeom.bottom());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Get screen geometry
|
|
Shinya Kitaoka |
120a6e |
QDesktopWidget *desk =
|
|
Shinya Kitaoka |
120a6e |
static_cast<qapplication *="">(QApplication::instance())->desktop();</qapplication>
|
|
Shinya Kitaoka |
120a6e |
QRect screenGeom = desk->availableGeometry(panel);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Get panel margin measures
|
|
Shinya Kitaoka |
120a6e |
QRect margins;
|
|
Shinya Kitaoka |
120a6e |
QRect currView(m_imageViewer->geometry());
|
|
Shinya Kitaoka |
120a6e |
currView.moveTo(m_imageViewer->mapToGlobal(currView.topLeft()));
|
|
Shinya Kitaoka |
120a6e |
QRect panelGeom(panel->geometry());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
margins.setLeft(panelGeom.left() - currView.left());
|
|
Shinya Kitaoka |
120a6e |
margins.setRight(panelGeom.right() - currView.right());
|
|
Shinya Kitaoka |
120a6e |
margins.setTop(panelGeom.top() - currView.top());
|
|
Shinya Kitaoka |
120a6e |
margins.setBottom(panelGeom.bottom() - currView.bottom());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Build the minimum flipbook geometry. Adjust the interesting geometry
|
|
Shinya Kitaoka |
120a6e |
// according to it.
|
|
Shinya Kitaoka |
120a6e |
QSize flipMinimumSize(panel->minimumSize());
|
|
Shinya Kitaoka |
120a6e |
flipMinimumSize -=
|
|
Shinya Kitaoka |
120a6e |
QSize(margins.right() - margins.left(), margins.bottom() - margins.top());
|
|
Shinya Kitaoka |
120a6e |
QSize minAddition(
|
|
Shinya Kitaoka |
120a6e |
tceil(std::max(0, flipMinimumSize.width() - interestGeom.width()) * 0.5),
|
|
Shinya Kitaoka |
120a6e |
tceil(std::max(0, flipMinimumSize.height() - interestGeom.height()) *
|
|
Shinya Kitaoka |
120a6e |
0.5));
|
|
Shinya Kitaoka |
120a6e |
interestGeom.adjust(-minAddition.width(), -minAddition.height(),
|
|
Shinya Kitaoka |
120a6e |
minAddition.width(), minAddition.height());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Translate to keep the current view top-left corner, if required
|
|
Shinya Kitaoka |
120a6e |
if (keepPosition) {
|
|
Shinya Kitaoka |
120a6e |
QPoint shift(currView.topLeft() - interestGeom.topLeft());
|
|
Shinya Kitaoka |
120a6e |
interestGeom.translate(shift);
|
|
Shinya Kitaoka |
120a6e |
imageGeom.translate(shift);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Intersect with the screen geometry
|
|
Shinya Kitaoka |
120a6e |
QRect newViewerGeom(screenGeom);
|
|
Shinya Kitaoka |
120a6e |
newViewerGeom.adjust(-margins.left(), -margins.top(), -margins.right(),
|
|
Shinya Kitaoka |
120a6e |
-margins.bottom());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// when fx previewing in full size (i.e. keepPosition is false ),
|
|
Shinya Kitaoka |
120a6e |
// try to translate geometry and keep the image inside the viewer as much as
|
|
Shinya Kitaoka |
120a6e |
// posiible
|
|
Shinya Kitaoka |
120a6e |
if (keepPosition)
|
|
Shinya Kitaoka |
120a6e |
newViewerGeom &= interestGeom;
|
|
Shinya Kitaoka |
120a6e |
else if (newViewerGeom.intersects(interestGeom)) {
|
|
Shinya Kitaoka |
120a6e |
int d_ns = 0;
|
|
Shinya Kitaoka |
120a6e |
int d_ew = 0;
|
|
Shinya Kitaoka |
120a6e |
if (interestGeom.top() < newViewerGeom.top())
|
|
Shinya Kitaoka |
120a6e |
d_ns = newViewerGeom.top() - interestGeom.top();
|
|
Shinya Kitaoka |
120a6e |
else if (interestGeom.bottom() > newViewerGeom.bottom())
|
|
Shinya Kitaoka |
120a6e |
d_ns = newViewerGeom.bottom() - interestGeom.bottom();
|
|
Shinya Kitaoka |
120a6e |
if (interestGeom.left() < newViewerGeom.left())
|
|
Shinya Kitaoka |
120a6e |
d_ew = newViewerGeom.left() - interestGeom.left();
|
|
Shinya Kitaoka |
120a6e |
else if (interestGeom.right() > newViewerGeom.right())
|
|
Shinya Kitaoka |
120a6e |
d_ew = newViewerGeom.right() - interestGeom.right();
|
|
Shinya Kitaoka |
120a6e |
if (d_ns || d_ew) {
|
|
Shinya Kitaoka |
120a6e |
interestGeom.translate(d_ew, d_ns);
|
|
Shinya Kitaoka |
120a6e |
imageGeom.translate(d_ew, d_ns);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
newViewerGeom &= interestGeom;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// qDebug("new Viewer= [%d, %d] x [%d, %d]", newViewerGeom.left(),
|
|
Shinya Kitaoka |
120a6e |
// newViewerGeom.right(),
|
|
Shinya Kitaoka |
120a6e |
// newViewerGeom.top(), newViewerGeom.bottom());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Calculate the pan of content image in order to compensate for our geometry
|
|
Shinya Kitaoka |
120a6e |
// change
|
|
Shinya Kitaoka |
120a6e |
QPointF imageGeomCenter((imageGeom.left() + imageGeom.right() + 1) * 0.5,
|
|
Shinya Kitaoka |
120a6e |
(imageGeom.top() + imageGeom.bottom() + 1) * 0.5);
|
|
Shinya Kitaoka |
120a6e |
QPointF newViewerGeomCenter(
|
|
Shinya Kitaoka |
120a6e |
(newViewerGeom.left() + newViewerGeom.right() + 1) * 0.5,
|
|
Shinya Kitaoka |
120a6e |
(newViewerGeom.top() + newViewerGeom.bottom() + 1) * 0.5);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*QPointF imageGeomCenter(
|
|
Shinya Kitaoka |
120a6e |
(imageGeom.width()) * 0.5,
|
|
Shinya Kitaoka |
120a6e |
(imageGeom.height()) * 0.5
|
|
Shinya Kitaoka |
120a6e |
);
|
|
Shinya Kitaoka |
120a6e |
QPointF newViewerGeomCenter(
|
|
Shinya Kitaoka |
120a6e |
(newViewerGeom.width()) * 0.5,
|
|
Shinya Kitaoka |
120a6e |
(newViewerGeom.height()) * 0.5
|
|
Shinya Kitaoka |
120a6e |
);*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// NOTE: If delta == (0,0) the image is at center. Typically happens when
|
|
Shinya Kitaoka |
120a6e |
// imageGeom doesn't intersect
|
|
Shinya Kitaoka |
120a6e |
// the screen geometry.
|
|
Shinya Kitaoka |
120a6e |
QPointF delta(imageGeomCenter - newViewerGeomCenter);
|
|
Shinya Kitaoka |
120a6e |
TAffine aff(m_imageViewer->getViewAff());
|
|
Shinya Kitaoka |
120a6e |
aff.a13 = delta.x();
|
|
Shinya Kitaoka |
120a6e |
aff.a23 = -delta.y();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Calculate new panel geometry
|
|
Shinya Kitaoka |
120a6e |
newViewerGeom.adjust(margins.left(), margins.top(), margins.right(),
|
|
Shinya Kitaoka |
120a6e |
margins.bottom());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Apply changes
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setViewAff(aff);
|
|
Shinya Kitaoka |
120a6e |
panel->setGeometry(newViewerGeom);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
b272a7 |
void FlipBook::adaptGeometryToCurrentSize() {
|
|
Shinya Kitaoka |
120a6e |
TImageP img(m_imageViewer->getImage());
|
|
Shinya Kitaoka |
120a6e |
if (!img) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TAffine toWidgetRef(m_imageViewer->getImgToWidgetAffine());
|
|
shun-iwasawa |
f2e168 |
TRectD pixGeomD(TScale(1.0 / (double)getDevicePixelRatio(this)) *
|
|
shun-iwasawa |
f2e168 |
toWidgetRef * getImageBoundsD(img));
|
|
shun_iwasawa |
0e4be6 |
// TRectD pixGeomD(toWidgetRef * getImageBoundsD(img));
|
|
Shinya Kitaoka |
120a6e |
TRect pixGeom(tceil(pixGeomD.x0), tceil(pixGeomD.y0), tfloor(pixGeomD.x1) - 1,
|
|
Shinya Kitaoka |
120a6e |
tfloor(pixGeomD.y1) - 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// NOTE: The previous line has ceils and floor inverted on purpose. The reason
|
|
Shinya Kitaoka |
120a6e |
// is the following:
|
|
Shinya Kitaoka |
120a6e |
// As the viewer's zoom level is arbitrary, the image is likely to have a not
|
|
Shinya Kitaoka |
120a6e |
// integer geometry
|
|
Shinya Kitaoka |
120a6e |
// with respect to the widget - the problem is, we cannot take the closest
|
|
Shinya Kitaoka |
120a6e |
// integer rect ENCLOSING ours,
|
|
Shinya Kitaoka |
120a6e |
// or the ImageViewer class adds blank lines on image rendering.
|
|
Shinya Kitaoka |
120a6e |
// So, we do the converse - take the closest ENCLOSED one - eventually to be
|
|
Shinya Kitaoka |
120a6e |
// compensated when
|
|
Shinya Kitaoka |
120a6e |
// performing the inverse.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
adaptWidGeometry(pixGeom, pixGeom, false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
b272a7 |
void FlipBook::onDoubleClick(QMouseEvent *me) { adaptGeometryToCurrentSize(); }
|
|
shun-iwasawa |
b272a7 |
|
|
shun-iwasawa |
b272a7 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
b272a7 |
|
|
shun-iwasawa |
b272a7 |
void FlipBook::zoomAndAdaptGeometry(bool forward) {
|
|
shun-iwasawa |
b272a7 |
m_imageViewer->zoomQt(forward, false);
|
|
shun-iwasawa |
b272a7 |
adaptGeometryToCurrentSize();
|
|
shun-iwasawa |
b272a7 |
}
|
|
shun-iwasawa |
b272a7 |
|
|
shun-iwasawa |
b272a7 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
b272a7 |
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::minimize(bool doMinimize) {
|
|
Shinya Kitaoka |
120a6e |
m_imageViewer->setVisible(!doMinimize);
|
|
Shinya Kitaoka |
120a6e |
m_flipConsole->showHideAllParts(!doMinimize);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! When viewing the tlv, try to cache all frames at the beginning.
|
|
Shinya Kitaoka |
120a6e |
NOTE : fromFrame and toFrame are frame numbers displayed on the flipbook
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
void FlipBook::loadAndCacheAllTlvImages(Level level, int fromFrame,
|
|
Shinya Kitaoka |
120a6e |
int toFrame) {
|
|
shun-iwasawa |
215a5b |
TFilePath fp = level.m_fp;
|
|
Shinya Kitaoka |
120a6e |
if (!m_lr || (fp != m_lr->getFilePath())) m_lr = TLevelReaderP(fp);
|
|
Shinya Kitaoka |
120a6e |
if (!m_lr) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// show the wait cursor when loading a level with more than 50 frames
|
|
Shinya Kitaoka |
120a6e |
if (toFrame - fromFrame > 50) QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int lx = 0, oriLx = 0;
|
|
Shinya Kitaoka |
120a6e |
if (m_lr->getImageInfo()) lx = oriLx = m_lr->getImageInfo()->m_lx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::string fileName = toQString(fp.withoutParentDir()).toStdString();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int f = fromFrame; f <= toFrame; f++) {
|
|
Shinya Kitaoka |
120a6e |
TFrameId fid = level.flipbookIndexToLevelFrame(f);
|
|
Shinya Kitaoka |
120a6e |
if (fid == TFrameId()) continue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::string id =
|
|
Shinya Kitaoka |
120a6e |
fileName + fid.expand(TFrameId::NO_PAD) + ::to_string(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageReaderP ir = m_lr->getFrameReader(fid);
|
|
Shinya Kitaoka |
120a6e |
ir->setShrink(m_shrink);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageP img = ir->load();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!img) continue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TToonzImageP ti = ((TToonzImageP)img);
|
|
Shinya Kitaoka |
120a6e |
if (!ti) continue;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (ti->getCMapped()->getWrap() > ti->getCMapped()->getLx())
|
|
Shinya Kitaoka |
120a6e |
ti->setCMapped(ti->getCMapped()->clone());
|
|
Shinya Kitaoka |
120a6e |
if (m_shrink > 1 && (lx == 0 || ti->getRaster()->getLx() == lx))
|
|
Shinya Kitaoka |
120a6e |
ti->setCMapped(TRop::shrink(ti->getRaster(), m_shrink));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPalette *palette = img->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (m_palette && (!palette || palette != m_palette))
|
|
Shinya Kitaoka |
120a6e |
img->setPalette(m_palette);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageCache::instance()->add(id, img);
|
|
Shinya Kitaoka |
120a6e |
m_loadboxes[id] = TRect();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// revert the cursor
|
|
Shinya Kitaoka |
120a6e |
if (toFrame - fromFrame > 50) QApplication::restoreOverrideCursor();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// Utility
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Displays the passed file on a Flipbook, supporting a wide range of options.
|
|
Toshihiro Shimizu |
890ddd |
//! Possible options include:
|
|
Toshihiro Shimizu |
890ddd |
//! \li The range, step and shrink parameters for the loaded level
|
|
Toshihiro Shimizu |
890ddd |
//! \li A soundtrack to accompany the level's images
|
|
Shinya Kitaoka |
120a6e |
//! \li The flipbook where the file is to be opened. If none, a new one is
|
|
Shinya Kitaoka |
120a6e |
//! created.
|
|
Shinya Kitaoka |
120a6e |
//! \li Whether the level must replace an existing one on the flipbook, or it
|
|
Shinya Kitaoka |
120a6e |
//! must
|
|
Toshihiro Shimizu |
890ddd |
//! rather be appended at its end
|
|
Shinya Kitaoka |
120a6e |
//! \li In case the file has a movie format and it is known to be a toonz
|
|
Shinya Kitaoka |
120a6e |
//! output,
|
|
Shinya Kitaoka |
120a6e |
//! some additional random access information may be retrieved (i.e. images may
|
|
Shinya Kitaoka |
120a6e |
//! map
|
|
Toshihiro Shimizu |
890ddd |
//! to specific frames).
|
|
shun_iwasawa |
cc002f |
// returns pointer to the opened flipbook to control modality.
|
|
shun_iwasawa |
cc002f |
FlipBook *viewFile(const TFilePath &path, int from, int to, int step,
|
|
shun_iwasawa |
cc002f |
int shrink, TSoundTrack *snd, FlipBook *flipbook,
|
|
shun_iwasawa |
cc002f |
bool append, bool isToonzOutput) {
|
|
luz paz |
6454c4 |
// In case the step and shrink information is invalid, load them from
|
|
Shinya Kitaoka |
120a6e |
// preferences
|
|
Shinya Kitaoka |
120a6e |
if (step == -1 || shrink == -1) {
|
|
Shinya Kitaoka |
120a6e |
int _step = 1, _shrink = 1;
|
|
Shinya Kitaoka |
120a6e |
Preferences::instance()->getViewValues(_shrink, _step);
|
|
shun-iwasawa |
215a5b |
if (step == -1) step = _step;
|
|
Shinya Kitaoka |
120a6e |
if (shrink == -1) shrink = _shrink;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Movie files must not have the ".." extension
|
|
Shinya Kitaoka |
120a6e |
if ((path.getType() == "mov" || path.getType() == "avi" ||
|
|
Shinya Kitaoka |
120a6e |
path.getType() == "3gp") &&
|
|
Shinya Kitaoka |
120a6e |
path.isLevelName()) {
|
|
Shinya Kitaoka |
120a6e |
DVGui::warning(QObject::tr("%1 has an invalid extension format.")
|
|
Shinya Kitaoka |
120a6e |
.arg(QString::fromStdString(path.getLevelName())));
|
|
shun_iwasawa |
cc002f |
return NULL;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Windows Screen Saver - avoid
|
|
shun_iwasawa |
cc002f |
if (path.getType() == "scr") return NULL;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Avi and movs may be viewed by an external viewer, depending on preferences
|
|
Rozhuk Ivan |
823a31 |
if ((path.getType() == "mov" || path.getType() == "avi") && !flipbook) {
|
|
Shinya Kitaoka |
120a6e |
QString str;
|
|
Shinya Kitaoka |
120a6e |
QSettings().value("generatedMovieViewEnabled", str);
|
|
Shinya Kitaoka |
120a6e |
if (str.toInt() != 0) {
|
|
Shinya Kitaoka |
120a6e |
TSystem::showDocument(path);
|
|
shun_iwasawa |
cc002f |
return NULL;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Retrieve a blank flipbook
|
|
Shinya Kitaoka |
120a6e |
if (!flipbook)
|
|
Shinya Kitaoka |
120a6e |
flipbook = FlipBookPool::instance()->pop();
|
|
Shinya Kitaoka |
120a6e |
else if (!append)
|
|
Shinya Kitaoka |
120a6e |
flipbook->reset();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Assign the passed level with associated infos
|
|
Shinya Kitaoka |
120a6e |
flipbook->setLevel(path, 0, from, to, step, shrink, snd, append,
|
|
Shinya Kitaoka |
120a6e |
isToonzOutput);
|
|
shun_iwasawa |
cc002f |
return flipbook;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|