More updates
This commit is contained in:
parent
7f34a026b6
commit
63e824b224
9 changed files with 321 additions and 32 deletions
|
@ -28,6 +28,7 @@
|
|||
<menu title="Export">
|
||||
<command>MI_SoundTrack</command>
|
||||
<command>MI_ExportXDTS</command>
|
||||
<command>MI_StopMotionExportImageSequence</command>
|
||||
</menu>
|
||||
<separator/>
|
||||
<command>MI_PrintXsheet</command>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "penciltestpopup.h"
|
||||
#include "tlevel_io.h"
|
||||
#include "toutputproperties.h"
|
||||
#include "filebrowserpopup.h"
|
||||
|
||||
#include "toonz/namebuilder.h"
|
||||
#include "toonz/preferences.h"
|
||||
|
@ -571,6 +572,13 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
std::pair<std::string, QAction *>(shortcut, action));
|
||||
action = NULL;
|
||||
}
|
||||
shortcut = "Return";
|
||||
action = comm->getActionFromShortcut(shortcut);
|
||||
if (action) {
|
||||
m_oldActionMap.insert(
|
||||
std::pair<std::string, QAction*>(shortcut, action));
|
||||
action = NULL;
|
||||
}
|
||||
shortcut = "*";
|
||||
action = comm->getActionFromShortcut(shortcut);
|
||||
if (action) {
|
||||
|
@ -578,6 +586,13 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
std::pair<std::string, QAction *>(shortcut, action));
|
||||
action = NULL;
|
||||
}
|
||||
shortcut = ".";
|
||||
action = comm->getActionFromShortcut(shortcut);
|
||||
if (action) {
|
||||
m_oldActionMap.insert(
|
||||
std::pair<std::string, QAction*>(shortcut, action));
|
||||
action = NULL;
|
||||
}
|
||||
|
||||
// now set all new shortcuts
|
||||
action = comm->getAction(MI_PrevDrawing);
|
||||
|
@ -617,7 +632,7 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
}
|
||||
action = comm->getAction(MI_StopMotionCapture);
|
||||
if (action) {
|
||||
action->setShortcut(QKeySequence("Enter"));
|
||||
action->setShortcut(QKeySequence("Return"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionToggleLiveView);
|
||||
|
@ -630,6 +645,11 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
action->setShortcut(QKeySequence("*"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionPickFocusCheck);
|
||||
if (action) {
|
||||
action->setShortcut(QKeySequence("."));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_ShortPlay);
|
||||
if (action) {
|
||||
action->setShortcut(QKeySequence("6"));
|
||||
|
@ -706,6 +726,12 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
QKeySequence(comm->getShortcutFromAction(action).c_str()));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionPickFocusCheck);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(comm->getShortcutFromAction(action).c_str()));
|
||||
action = NULL;
|
||||
}
|
||||
|
||||
// now put back the old shortcuts
|
||||
auto it = m_oldActionMap.begin();
|
||||
|
@ -735,33 +761,107 @@ void StopMotion::toggleNumpadShortcuts(bool on) {
|
|||
void StopMotion::toggleNumpadForFocusCheck(bool on) {
|
||||
|
||||
CommandManager* comm = CommandManager::instance();
|
||||
|
||||
if (on) {
|
||||
m_oldFocusCheckMap.clear();
|
||||
// if turning it on, get all old shortcuts
|
||||
std::string shortcut;
|
||||
QAction* action;
|
||||
for (int i = 0; i <= 9; i++) {
|
||||
shortcut = QString::number(i).toStdString();
|
||||
action = comm->getActionFromShortcut(shortcut);
|
||||
if (m_useNumpadShortcuts) {
|
||||
if (on) {
|
||||
QAction* action;
|
||||
action = comm->getAction(MI_PrevDrawing);
|
||||
if (action) {
|
||||
m_oldFocusCheckMap.insert(
|
||||
std::pair<std::string, QAction*>(shortcut, action));
|
||||
comm->setShortcut(action, "", false);
|
||||
action->setShortcut(QKeySequence(""));
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_NextDrawing);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionJumpToCamera);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_Loop);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_Play);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionToggleLiveView);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_ShortPlay);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionCapture);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence(""));
|
||||
action = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if (m_oldFocusCheckMap.size() > 0) {
|
||||
// now put back the old shortcuts
|
||||
auto it = m_oldFocusCheckMap.begin();
|
||||
while (it != m_oldFocusCheckMap.end()) {
|
||||
comm->setShortcut(it->second, it->first.c_str(), false);
|
||||
it->second->setShortcut(QKeySequence(it->first.c_str()));
|
||||
it++;
|
||||
else {
|
||||
QAction* action;
|
||||
action = comm->getAction(MI_PrevDrawing);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("1"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_NextDrawing);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("2"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionJumpToCamera);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("3"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_Loop);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("8"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_Play);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("0"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionToggleLiveView);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("5"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_ShortPlay);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("6"));
|
||||
action = NULL;
|
||||
}
|
||||
action = comm->getAction(MI_StopMotionCapture);
|
||||
if (action) {
|
||||
action->setShortcut(
|
||||
QKeySequence("Return"));
|
||||
action = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1795,6 +1895,153 @@ bool StopMotion::loadXmlFile() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool StopMotion::exportImageSequence() {
|
||||
TApp* app = TApp::instance();
|
||||
ToonzScene* scene = app->getCurrentScene()->getScene();
|
||||
TXsheet* xsh = scene->getXsheet();
|
||||
|
||||
std::wstring levelName = m_levelName.toStdWString();
|
||||
|
||||
if (levelName.empty()) {
|
||||
DVGui::error(
|
||||
tr("No level name specified: please choose a valid level name"));
|
||||
return false;
|
||||
}
|
||||
int frameNumber = m_frameNumber;
|
||||
|
||||
TFilePath parentDir = scene->decodeFilePath(TFilePath(m_filePath));
|
||||
TFilePath fullResFolder = scene->decodeFilePath(
|
||||
TFilePath(m_filePath) + TFilePath(levelName + L"_FullRes"));
|
||||
TFilePath liveViewFolder = scene->decodeFilePath(
|
||||
TFilePath(m_filePath) + TFilePath(levelName + L"_LiveView"));
|
||||
|
||||
TFilePath levelFp = TFilePath(m_filePath) +
|
||||
TFilePath(levelName + L".." + m_fileType.toStdWString());
|
||||
TFilePath actualLevelFp = scene->decodeFilePath(levelFp);
|
||||
|
||||
TFilePath fullResFp =
|
||||
scene->decodeFilePath(fullResFolder + TFilePath(levelName + L"..jpg"));
|
||||
TFilePath fullResFile(fullResFp.withFrame(frameNumber));
|
||||
|
||||
TFilePath liveViewFp =
|
||||
scene->decodeFilePath(liveViewFolder + TFilePath(levelName + L"..jpg"));
|
||||
TFilePath liveViewFile(liveViewFp.withFrame(frameNumber));
|
||||
|
||||
TFilePath tempFile = parentDir + "temp.jpg";
|
||||
|
||||
TXshSimpleLevel* sl = 0;
|
||||
TXshLevel* level = scene->getLevelSet()->getLevel(levelName);
|
||||
|
||||
|
||||
if (level == NULL) {
|
||||
DVGui::error(
|
||||
tr("No level exists with the current name."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if the existing level is not a raster level, then return */
|
||||
if (level->getType() != OVL_XSHLEVEL) {
|
||||
DVGui::error(
|
||||
tr("This is not an image level."));
|
||||
return false;
|
||||
}
|
||||
if (!level->getSimpleLevel()->getProperties()->isStopMotionLevel()) {
|
||||
DVGui::error(
|
||||
tr("This is not a stop motion level."));
|
||||
return false;
|
||||
}
|
||||
sl = level->getSimpleLevel();
|
||||
|
||||
if (scene->decodeFilePath(sl->getPath()) != actualLevelFp) {
|
||||
DVGui::error(
|
||||
tr("The save in path specified does not match with the existing "
|
||||
"level."));
|
||||
return false;
|
||||
}
|
||||
|
||||
//find which column the level is on.
|
||||
// check with the first column
|
||||
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
|
||||
int r0, r1, row;
|
||||
xsh->getColumn(col)->getRange(r0, r1);
|
||||
TXshSimpleLevel* colLevel = xsh->getCell(r0, col).getSimpleLevel();
|
||||
if (colLevel != sl) {
|
||||
int cols = xsh->getColumnCount();
|
||||
for (int i = 0; i < cols; i++) {
|
||||
xsh->getColumn(col)->getRange(r0, r1);
|
||||
colLevel = xsh->getCell(r0, col).getSimpleLevel();
|
||||
if (colLevel == sl) {
|
||||
col = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DVGui::error(
|
||||
tr("Could not find an xsheet level with the current level"));
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
row = r0;
|
||||
xsh->getColumn(col)->getLevelRange(row, r0, r1);
|
||||
|
||||
|
||||
GenericSaveFilePopup* m_saveSequencePopup =
|
||||
new GenericSaveFilePopup("Export Image Sequence");
|
||||
m_saveSequencePopup->setFileMode(true);
|
||||
TFilePath fp = m_saveSequencePopup->getPath();
|
||||
if (fp == TFilePath()) {
|
||||
DVGui::error(
|
||||
tr("No export path given."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
TFilePath sourceFile;
|
||||
TFilePath exportFilePath =
|
||||
scene->decodeFilePath(fp + TFilePath(levelName + L"..jpg"));
|
||||
TFilePath exportFile;
|
||||
int exportFrameNumber = 1;
|
||||
for (int i = r0; i <= r1; i++) {
|
||||
int cellNumber = xsh->getCell(i, col).getFrameId().getNumber();
|
||||
fullResFile = fullResFp.withFrame(cellNumber);
|
||||
if (TFileStatus(fullResFile).doesExist()) {
|
||||
sourceFile = fullResFile;
|
||||
}
|
||||
else {
|
||||
sourceFile = actualLevelFp.withFrame(cellNumber);
|
||||
}
|
||||
|
||||
if (!TFileStatus(sourceFile).doesExist()) {
|
||||
DVGui::error(
|
||||
tr("Could not find the source file."));
|
||||
return false;
|
||||
}
|
||||
exportFile = exportFilePath.withFrame(exportFrameNumber);
|
||||
if (TFileStatus(exportFile).doesExist()) {
|
||||
QString question =
|
||||
tr("Overwrite existing files?");
|
||||
int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"),
|
||||
QObject::tr("Cancel"));
|
||||
if (ret == 0 || ret == 2) return false;
|
||||
}
|
||||
TSystem::copyFile(exportFile, sourceFile);
|
||||
exportFrameNumber++;
|
||||
if (!TFileStatus(exportFile).doesExist()) {
|
||||
DVGui::error(
|
||||
tr("An error occurred. Aborting."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QString message1 = tr("Successfully exported ");
|
||||
QString message2 = tr(" images.");
|
||||
QString finalMessage = message1 + QString::number(exportFrameNumber - 1) + message2;
|
||||
DVGui::MsgBoxInPopup(DVGui::MsgType(DVGui::INFORMATION), finalMessage);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Refresh information that how many & which frames are saved for the current
|
||||
// level
|
||||
void StopMotion::refreshFrameInfo() {
|
||||
|
@ -3000,6 +3247,9 @@ QString StopMotion::getCurrentBatteryLevel() {
|
|||
result = tr("Full");
|
||||
}
|
||||
else {
|
||||
// at least the 60D reports battery values as 59, 49. . .
|
||||
// round up
|
||||
if (data % 10 == 9) data += 1;
|
||||
result = QString::number(data) + "%";
|
||||
}
|
||||
return result;
|
||||
|
@ -4372,4 +4622,28 @@ public:
|
|||
StopMotion *sm = StopMotion::instance();
|
||||
sm->jumpToCameraFrame();
|
||||
}
|
||||
} StopMotionJumpToCameraCommand;
|
||||
} StopMotionJumpToCameraCommand;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class StopMotionPickFocusCheck : public MenuItemHandler {
|
||||
public:
|
||||
StopMotionPickFocusCheck()
|
||||
: MenuItemHandler(MI_StopMotionPickFocusCheck) {}
|
||||
void execute() {
|
||||
StopMotion* sm = StopMotion::instance();
|
||||
sm->toggleZoomPicking();
|
||||
}
|
||||
} StopMotionPickFocusCheck;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class StopMotionExportImageSequence : public MenuItemHandler {
|
||||
public:
|
||||
StopMotionExportImageSequence()
|
||||
: MenuItemHandler(MI_StopMotionExportImageSequence) {}
|
||||
void execute() {
|
||||
StopMotion* sm = StopMotion::instance();
|
||||
sm->exportImageSequence();
|
||||
}
|
||||
} StopMotionExportImageSequence;
|
|
@ -95,7 +95,6 @@ private:
|
|||
|
||||
QTimer* m_reviewTimer;
|
||||
std::map<std::string, QAction*> m_oldActionMap;
|
||||
std::map<std::string, QAction*> m_oldFocusCheckMap;
|
||||
|
||||
// Webcam Properties
|
||||
QList<QCameraInfo> m_webcams;
|
||||
|
@ -247,6 +246,7 @@ public:
|
|||
bool loadLineUpImage();
|
||||
void saveXmlFile();
|
||||
bool loadXmlFile();
|
||||
bool exportImageSequence();
|
||||
|
||||
// Webcam Commands
|
||||
QList<QCameraInfo> getWebcams();
|
||||
|
|
|
@ -1673,11 +1673,11 @@ void StopMotionController::hideEvent(QHideEvent *event) {
|
|||
fh->lastFrame();
|
||||
event->accept();
|
||||
}
|
||||
else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
else if (!m_stopMotion->m_pickLiveViewZoom && (key == Qt::Key_Return || key == Qt::Key_Enter)) {
|
||||
m_captureButton->animateClick();
|
||||
event->accept();
|
||||
}
|
||||
else if (event->key() == Qt::Key_Escape && m_stopMotion->m_pickLiveViewZoom) {
|
||||
else if (m_stopMotion->m_pickLiveViewZoom && (key == Qt::Key_Escape || key == Qt::Key_Enter || key == Qt::Key_Return )) {
|
||||
m_stopMotion->toggleZoomPicking();
|
||||
}
|
||||
|
||||
|
|
|
@ -467,13 +467,13 @@ bool GenericSaveFilePopup::execute() {
|
|||
// (yep, even if a DIFFERENT type was specified - next time do it right :P)
|
||||
const QStringList &extList = m_browser->getFilterTypes();
|
||||
|
||||
if (!extList.contains(QString::fromStdString(path.getType()))) {
|
||||
if (!m_isDirectoryOnly && !extList.contains(QString::fromStdString(path.getType()))) {
|
||||
path =
|
||||
TFilePath(path.getWideString() + L"." + extList.first().toStdWString());
|
||||
}
|
||||
|
||||
// Ask for user permission to overwrite if necessary
|
||||
if (TFileStatus(path).doesExist()) {
|
||||
if (!m_isDirectoryOnly && TFileStatus(path).doesExist()) {
|
||||
const QString &question =
|
||||
QObject::tr("File %1 already exists.\nDo you want to overwrite it?")
|
||||
.arg(toQString(path));
|
||||
|
|
|
@ -1620,6 +1620,9 @@ void MainWindow::defineActions() {
|
|||
createMenuRenderAction(MI_FastRender, tr("&Fast Render to MP4"), "Alt+R");
|
||||
createMenuRenderAction(MI_Preview, tr("&Preview"), "Ctrl+R");
|
||||
createMenuFileAction(MI_SoundTrack, tr("&Export Soundtrack"), "");
|
||||
#ifdef WITH_STOPMOTION
|
||||
createMenuFileAction(MI_StopMotionExportImageSequence, tr("&Export Stop Motion Image Sequence"), "");
|
||||
#endif
|
||||
createMenuRenderAction(MI_SavePreviewedFrames, tr("&Save Previewed Frames"),
|
||||
"");
|
||||
createRightClickMenuAction(MI_RegeneratePreview, tr("&Regenerate Preview"),
|
||||
|
@ -2017,7 +2020,6 @@ void MainWindow::defineActions() {
|
|||
#ifdef WITH_STOPMOTION
|
||||
createMenuWindowsAction(MI_OpenStopMotionPanel, tr("&Stop Motion Controls"),
|
||||
"");
|
||||
|
||||
#endif
|
||||
createMenuWindowsAction(MI_OpenLevelView, tr("&Viewer"), "");
|
||||
#ifdef LINETEST
|
||||
|
@ -2370,6 +2372,7 @@ void MainWindow::defineActions() {
|
|||
createAction(MI_StopMotionToggleLiveView, tr("Toggle Stop Motion Live View"),
|
||||
"");
|
||||
createAction(MI_StopMotionToggleZoom, tr("Toggle Stop Motion Zoom"), "");
|
||||
createAction(MI_StopMotionPickFocusCheck, tr("Pick Focus Check Location"), "");
|
||||
createAction(MI_StopMotionLowerSubsampling,
|
||||
tr("Lower Stop Motion Level Subsampling"), "");
|
||||
createAction(MI_StopMotionRaiseSubsampling,
|
||||
|
|
|
@ -1105,6 +1105,9 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
|||
{
|
||||
addMenuItem(exportMenu, MI_SoundTrack);
|
||||
addMenuItem(exportMenu, MI_ExportXDTS);
|
||||
#ifdef WITH_STOPMOTION
|
||||
addMenuItem(exportMenu, MI_StopMotionExportImageSequence);
|
||||
#endif
|
||||
}
|
||||
fileMenu->addSeparator();
|
||||
addMenuItem(fileMenu, MI_PrintXsheet);
|
||||
|
|
|
@ -361,6 +361,8 @@
|
|||
#define MI_StopMotionLowerSubsampling "MI_StopMotionLowerSubsampling"
|
||||
#define MI_StopMotionRaiseSubsampling "MI_StopMotionRaiseSubsampling"
|
||||
#define MI_StopMotionJumpToCamera "MI_StopMotionJumpToCamera"
|
||||
#define MI_StopMotionPickFocusCheck "MI_StopMotionPickFocusCheck"
|
||||
#define MI_StopMotionExportImageSequence "MI_StopMotionExportImageSequence"
|
||||
|
||||
#define MI_OpenOnlineManual "MI_OpenOnlineManual"
|
||||
#define MI_OpenWhatsNew "MI_OpenWhatsNew"
|
||||
|
|
|
@ -1181,11 +1181,17 @@ bool SceneViewer::event(QEvent *e) {
|
|||
e->accept();
|
||||
return true;
|
||||
}
|
||||
else if (key == Qt::Key_Escape && m_stopMotion->m_pickLiveViewZoom) {
|
||||
else if (m_stopMotion->m_pickLiveViewZoom && (key == Qt::Key_Escape || key == Qt::Key_Enter || key == Qt::Key_Return)) {
|
||||
m_stopMotion->toggleZoomPicking();
|
||||
e->accept();
|
||||
return true;
|
||||
}
|
||||
else if (m_stopMotion->m_liveViewStatus == 2 && (key == Qt::Key_Enter || key == Qt::Key_Return)) {
|
||||
m_stopMotion->captureImage();
|
||||
e->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue