Permalink
Browse files

Merge pull request #764 from pencil2d/feature/camera-tween

Feature/camera tween
  • Loading branch information...
chchwy committed Sep 23, 2017
2 parents c03eca4 + 0a9d393 commit 8fd508104389c097a83e7bc9d9a1ed32a85f9f9a
@@ -463,7 +463,6 @@ QStringList JlCompress::extractDir(QString fileCompressed, QString dir) {
}
do {
QString name = zip.getCurrentFileName();
qDebug() << "Name=" << name;
QString absFilePath = directory.absoluteFilePath(name);
if (!extractFile(&zip, "", absFilePath)) {
removeFile(extracted);
View
@@ -39,6 +39,7 @@ GNU General Public License for more details.
#include "bitmapimage.h"
#include "vectorimage.h"
#include "soundclip.h"
#include "camera.h"
#include "movieexporter.h"
#include "filedialogex.h"
@@ -272,11 +273,11 @@ void ActionCommands::addNewKey()
{
KeyFrame* key = mEditor->addNewKey();
SoundClip* clip = dynamic_cast< SoundClip* >( key );
SoundClip* clip = dynamic_cast<SoundClip*>(key);
if ( clip )
{
FileDialog fileDialog( mParent );
QString strSoundFile = fileDialog.openFile( FileType::SOUND );
QString strSoundFile = fileDialog.openFile(FileType::SOUND);
if ( strSoundFile.isEmpty() )
{
@@ -286,6 +287,16 @@ void ActionCommands::addNewKey()
Status st = mEditor->sound()->loadSound( clip, strSoundFile );
Q_ASSERT( st.ok() );
}
Camera* cam = dynamic_cast<Camera*>(key);
if (cam)
{
auto camLayer = static_cast<LayerCamera*>(mEditor->layers()->currentLayer());
Q_ASSERT(camLayer);
camLayer->LinearInterpolateTransform(cam);
mEditor->view()->updateViewTransforms();
}
}
void ActionCommands::removeKey()
View
@@ -26,13 +26,9 @@ GNU General Public License for more details.
#include <QList>
#include <QMenu>
#include <QFile>
#include <QScopedPointer>
#include <QMessageBox>
#include <QProgressDialog>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QGraphicsDropShadowEffect>
#include <QStatusBar>
#include <QFileIconProvider>
#include "pencildef.h"
@@ -513,7 +509,6 @@ bool MainWindow2::openObject( QString strFilePath )
{
progress.setValue( (int)( f * 100.f ) );
QApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
} );
Object* object = fm.load( strFilePath );
@@ -1087,7 +1082,8 @@ void MainWindow2::helpBox()
void MainWindow2::makeConnections( Editor* editor )
{
connect( editor, &Editor::updateBackup, this, &MainWindow2::updateSaveState );
connect(editor, &Editor::updateBackup, this, &MainWindow2::updateSaveState);
connect(editor->layers(), &LayerManager::currentLayerChanged, this, &MainWindow2::currentLayerChanged);
}
void MainWindow2::makeConnections( Editor* editor, ColorBox* colorBox )
@@ -1208,3 +1204,16 @@ void MainWindow2::changePlayState( bool isPlaying )
}
update();
}
void MainWindow2::currentLayerChanged()
{
Layer* currLayer = mEditor->layers()->currentLayer();
if (currLayer->type() == Layer::CAMERA)
{
mEditor->view()->setCameraLayer(currLayer);
}
else
{
mEditor->view()->setCameraLayer(nullptr);
}
}
View
@@ -128,6 +128,7 @@ public slots:
void writeSettings();
void changePlayState( bool isPlaying );
void currentLayerChanged();
void makeConnections( Editor* );
void makeConnections( Editor*, ColorBox* );
Oops, something went wrong.

0 comments on commit 8fd5081

Please sign in to comment.