Skip to content

Commit dad9c25

Browse files
committed
Merge branch 'stop_motion_improvements' by turtletooth
2 parents 8d48c17 + d2fdd5f commit dad9c25

File tree

10 files changed

+33
-196
lines changed

10 files changed

+33
-196
lines changed

toonz/sources/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ find_package(Qt5 REQUIRED
253253
LinguistTools
254254
Multimedia
255255
MultimediaWidgets
256-
SerialPort
257256
)
258257

259258
set(QT_MINIMUM_VERSION 5.5.0)

toonz/sources/stopmotion/canon.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,10 +1328,10 @@ EdsError Canon::handlePropertyEvent(EdsPropertyEvent event,
13281328
EdsError Canon::handleStateEvent(EdsStateEvent event, EdsUInt32 parameter,
13291329
EdsVoid* context) {
13301330
if (event == kEdsStateEvent_Shutdown) {
1331-
instance()->m_sessionOpen = false;
1332-
instance()->releaseCamera();
1331+
instance()->m_sessionOpen = false;
1332+
instance()->releaseCamera();
13331333
if (instance()->m_sessionOpen && instance()->getCameraCount() > 0) {
1334-
//instance()->closeCameraSession();
1334+
// instance()->closeCameraSession();
13351335
}
13361336
StopMotion::instance()->m_liveViewStatus = 0;
13371337
emit(instance()->canonCameraChanged(QString("")));

toonz/sources/stopmotion/stopmotion.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ StopMotion::StopMotion() {
207207

208208
m_webcam = new Webcam();
209209
m_canon = Canon::instance();
210-
m_serial = new StopMotionSerial();
211210
m_light = new StopMotionLight();
212211

213212
m_alwaysLiveView = StopMotionAlwaysLiveView;
@@ -309,7 +308,7 @@ void StopMotion::onSceneSwitched() {
309308
setXSheetFrameNumber(xsh->getFrameCount() + 1);
310309
loadXmlFile();
311310
buildLiveViewMap(sl);
312-
m_sl = sl;
311+
m_sl = sl;
313312
found = true;
314313
break;
315314
}
@@ -1001,7 +1000,6 @@ void StopMotion::setXSheetFrameNumber(int frameNumber) {
10011000
TApp::instance()->getCurrentFrame()->setFrame(frameNumber - 1);
10021001
loadLineUpImage();
10031002
emit(xSheetFrameNumberChanged(m_xSheetFrameNumber));
1004-
m_serial->sendSerialData();
10051003
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
10061004
}
10071005

toonz/sources/stopmotion/stopmotion.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "webcam.h"
2121
#include "jpgconverter.h"
2222
#include "canon.h"
23-
#include "stopmotionserial.h"
2423
#include "stopmotionlight.h"
2524

2625
#include "toonz/txshsimplelevel.h"
@@ -78,7 +77,6 @@ class StopMotion : public QObject { // Singleton
7877

7978
Webcam* m_webcam;
8079
Canon* m_canon;
81-
StopMotionSerial* m_serial;
8280
StopMotionLight* m_light;
8381

8482
bool m_usingWebcam = false;

toonz/sources/stopmotion/stopmotioncontroller.cpp

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#include <QTimer>
5454
#include <QToolButton>
5555
#include <QToolTip>
56-
#include <QSerialPort>
5756

5857
#ifdef _WIN32
5958
#include <dshow.h>
@@ -184,12 +183,10 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
184183
m_tabBar->addSimpleTab(tr("Settings"));
185184
m_tabBar->addSimpleTab(tr("Options"));
186185
m_tabBar->addSimpleTab(tr("Light"));
187-
m_tabBar->addSimpleTab(tr("Motion"));
188186
m_tabBarContainer = new TabBarContainter(this);
189187
m_mainControlsPage = new QFrame(this);
190188
m_cameraSettingsPage = new QFrame(this);
191189
m_optionsPage = new QFrame(this);
192-
m_motionPage = new QFrame(this);
193190
m_lightPage = new QFrame(this);
194191

195192
// **********************
@@ -853,44 +850,22 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
853850
if (m_stopMotion->m_light->m_screenCount < 3) m_screen3Box->hide();
854851
if (m_stopMotion->m_light->m_screenCount < 2) m_screen2Box->hide();
855852

856-
QVBoxLayout *motionOutsideLayout = new QVBoxLayout;
857-
// QGridLayout* motionInsideLayout = new QGridLayout;
858-
m_controlDeviceCombo = new QComboBox(this);
859-
m_controlDeviceCombo->addItems(
860-
m_stopMotion->m_serial->getAvailableSerialPorts());
861-
862-
QGroupBox *motionBox = new QGroupBox(tr("Motion Control"), this);
863-
QGridLayout *motionLayout = new QGridLayout;
864-
motionLayout->addWidget(new QLabel(tr("Port: ")), 0, 0, Qt::AlignRight);
865-
motionLayout->addWidget(m_controlDeviceCombo, 0, 1, Qt::AlignLeft);
866-
motionLayout->setColumnStretch(1, 30);
867-
motionBox->setLayout(motionLayout);
868-
motionBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
869-
motionOutsideLayout->addWidget(motionBox, Qt::AlignCenter);
870-
motionOutsideLayout->addStretch();
871-
872-
// motionOutsideLayout->addLayout(motionInsideLayout);
873-
m_motionPage->setLayout(motionOutsideLayout);
874-
875853
QScrollArea *mainArea = makeChooserPageWithoutScrollBar(m_mainControlsPage);
876854
QScrollArea *settingsArea =
877855
makeChooserPageWithoutScrollBar(m_cameraSettingsPage);
878856
QScrollArea *optionsArea = makeChooserPageWithoutScrollBar(m_optionsPage);
879857
QScrollArea *lightArea = makeChooserPageWithoutScrollBar(m_lightPage);
880-
QScrollArea *motionArea = makeChooserPageWithoutScrollBar(m_motionPage);
881858

882859
mainArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
883860
settingsArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
884861
optionsArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
885862
lightArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
886-
motionArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
887863

888864
m_stackedChooser = new QStackedWidget(this);
889865
m_stackedChooser->addWidget(mainArea);
890866
m_stackedChooser->addWidget(settingsArea);
891867
m_stackedChooser->addWidget(optionsArea);
892868
m_stackedChooser->addWidget(lightArea);
893-
m_stackedChooser->addWidget(motionArea);
894869
m_stackedChooser->setFocusPolicy(Qt::NoFocus);
895870

896871
QFrame *opacityFrame = new QFrame();
@@ -1218,10 +1193,6 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
12181193
ret = ret && connect(m_stopMotion->m_light, SIGNAL(blackCaptureSignal(bool)),
12191194
this, SLOT(onBlackCaptureSignal(bool)));
12201195

1221-
// Serial Port Connections
1222-
ret = ret && connect(m_controlDeviceCombo, SIGNAL(currentIndexChanged(int)),
1223-
this, SLOT(serialPortChanged(int)));
1224-
12251196
// Time Lapse
12261197
ret = ret && connect(m_timerCB, SIGNAL(toggled(bool)), this,
12271198
SLOT(onIntervalTimerCBToggled(bool)));
@@ -1265,6 +1236,7 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
12651236
onSceneSwitched();
12661237
m_stopMotion->setToNextNewLevel();
12671238
m_saveInFileFld->setPath(m_stopMotion->getFilePath());
1239+
updateLightsEnabled();
12681240

12691241
#ifndef _WIN32
12701242
m_directShowCB->hide();
@@ -1322,9 +1294,7 @@ void StopMotionController::onBlackScreenForCaptureChanged(int checked) {
13221294
void StopMotionController::onBlackCaptureSignal(bool on) {
13231295
m_blackScreenForCapture->blockSignals(true);
13241296
m_blackScreenForCapture->setChecked(on);
1325-
m_screen1Box->setDisabled(on);
1326-
m_screen2Box->setDisabled(on);
1327-
m_screen3Box->setDisabled(on);
1297+
updateLightsEnabled();
13281298
m_blackScreenForCapture->blockSignals(false);
13291299
}
13301300

@@ -1396,6 +1366,7 @@ void StopMotionController::onScreen3ColorChanged(TPixel32 color) {
13961366
void StopMotionController::onScreen1OverlayChanged(bool on) {
13971367
m_screen1Box->blockSignals(true);
13981368
m_screen1Box->setChecked(on);
1369+
updateLightsEnabled();
13991370
m_screen1Box->blockSignals(false);
14001371
}
14011372

@@ -1404,6 +1375,7 @@ void StopMotionController::onScreen1OverlayChanged(bool on) {
14041375
void StopMotionController::onScreen2OverlayChanged(bool on) {
14051376
m_screen2Box->blockSignals(true);
14061377
m_screen2Box->setChecked(on);
1378+
updateLightsEnabled();
14071379
m_screen2Box->blockSignals(false);
14081380
}
14091381

@@ -1412,6 +1384,7 @@ void StopMotionController::onScreen2OverlayChanged(bool on) {
14121384
void StopMotionController::onScreen3OverlayChanged(bool on) {
14131385
m_screen3Box->blockSignals(true);
14141386
m_screen3Box->setChecked(on);
1387+
updateLightsEnabled();
14151388
m_screen3Box->blockSignals(false);
14161389
}
14171390

@@ -1430,6 +1403,24 @@ void StopMotionController::onTestLightsTimeout() {
14301403

14311404
//-----------------------------------------------------------------------------
14321405

1406+
void StopMotionController::updateLightsEnabled() {
1407+
bool enabled = true;
1408+
if (m_blackScreenForCapture->isChecked()) {
1409+
enabled = false;
1410+
}
1411+
m_screen1Box->setEnabled(enabled);
1412+
m_screen2Box->setEnabled(enabled);
1413+
m_screen3Box->setEnabled(enabled);
1414+
if (m_blackScreenForCapture->isChecked() || m_screen1Box->isChecked() ||
1415+
m_screen2Box->isChecked() || m_screen3Box->isChecked()) {
1416+
m_testLightsButton->setEnabled(true);
1417+
} else {
1418+
m_testLightsButton->setEnabled(false);
1419+
}
1420+
}
1421+
1422+
//-----------------------------------------------------------------------------
1423+
14331424
void StopMotionController::onPlaceOnXSheetChanged(int checked) {
14341425
m_stopMotion->setPlaceOnXSheet(checked);
14351426
}
@@ -2760,10 +2751,4 @@ void StopMotionController::onSceneSwitched() {
27602751

27612752
//-----------------------------------------------------------------------------
27622753

2763-
void StopMotionController::serialPortChanged(int index) {
2764-
m_stopMotion->m_serial->setSerialPort(m_controlDeviceCombo->currentText());
2765-
}
2766-
2767-
//-----------------------------------------------------------------------------
2768-
27692754
void StopMotionController::updateStopMotion() {}

toonz/sources/stopmotion/stopmotioncontroller.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class StopMotionController final : public QWidget {
6767
QFrame *m_mainControlsPage;
6868
QFrame *m_cameraSettingsPage;
6969
QFrame *m_optionsPage;
70-
QFrame *m_motionPage;
7170
QFrame *m_lightPage;
7271
QFrame *m_dslrFrame;
7372
QFrame *m_webcamFrame;
@@ -123,6 +122,7 @@ class StopMotionController final : public QWidget {
123122
// void mousePressEvent(QMouseEvent *event) override;
124123
// void keyPressEvent(QKeyEvent *event);
125124
void keyPressEvent(QKeyEvent *event) override;
125+
void updateLightsEnabled();
126126

127127
protected slots:
128128
void refreshCameraList(QString activeCamera = "");
@@ -164,9 +164,6 @@ protected slots:
164164
void onNextXSheetFrame();
165165
void setToCurrentXSheetFrame();
166166

167-
// motion control
168-
void serialPortChanged(int);
169-
170167
// time lapse
171168
void onIntervalTimerCBToggled(bool);
172169
void onIntervalSliderValueChanged(bool);

toonz/sources/stopmotion/stopmotionserial.cpp

Lines changed: 0 additions & 106 deletions
This file was deleted.

toonz/sources/stopmotion/stopmotionserial.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)