Merged in opentoonz master to resolve conflicts
This commit is contained in:
commit
825aea606b
133 changed files with 3887 additions and 1341 deletions
|
@ -3,8 +3,10 @@ pushd thirdparty/tiff-4.0.3
|
|||
./configure && make
|
||||
popd
|
||||
cd toonz && mkdir build && cd build
|
||||
QTVERSION=`ls /usr/local/Cellar/qt`
|
||||
echo "QT Version detected: $QTVERSION"
|
||||
cmake ../sources \
|
||||
-DQT_PATH=/usr/local/Cellar/qt/5.12.2/lib/ \
|
||||
-DQT_PATH=/usr/local/Cellar/qt/$QTVERSION/lib/ \
|
||||
-DTIFF_INCLUDE_DIR=../../thirdparty/tiff-4.0.3/libtiff/ \
|
||||
-DSUPERLU_INCLUDE_DIR=../../thirdparty/superlu/SuperLU_4.1/include/
|
||||
make -j 2
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@ PencilTestPopup {
|
|||
}
|
||||
|
||||
#LargeSizedText {
|
||||
font-size: 17;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
@ -46,7 +46,7 @@ QDialog {
|
|||
background-color: @prefs-tree-bg-color;
|
||||
alternate-background-color: @prefs-tree-bg-color;
|
||||
border: 1 solid @accent;
|
||||
font-size: 13;
|
||||
font-size: 13px;
|
||||
&::item {
|
||||
border: 0; // remove indent on hover
|
||||
padding: 3;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -203,7 +203,7 @@ elseif(BUILD_ENV_UNIXLIKE)
|
|||
|
||||
find_package(Qt5Widgets)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -lstdc++ -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++ -std=c++11")
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
|
|
|
@ -101,8 +101,7 @@ void Tokenizer::setBuffer(std::string buffer) {
|
|||
|
||||
const std::string ss[] = {"==", "!=", ">=", "<=", "||", "&&"};
|
||||
|
||||
const int m = tArrayCount(ss);
|
||||
if (std::find(ss, ss + m, token) != ss + m)
|
||||
if (std::find(std::begin(ss), std::end(ss), token) != std::end(ss))
|
||||
i += 2;
|
||||
else
|
||||
token = std::string(1, s[i++]);
|
||||
|
@ -167,4 +166,4 @@ Token Tokenizer::getTokenFromPos(int pos) const {
|
|||
|
||||
//===================================================================
|
||||
|
||||
} // TSyntax
|
||||
} // namespace TSyntax
|
||||
|
|
|
@ -492,6 +492,9 @@ void TMacroFx::loadData(TIStream &is) {
|
|||
m_fxs.push_back(fx);
|
||||
}
|
||||
}
|
||||
// collecting params just after loading nodes since they may need on
|
||||
// loading "super" tag in case it is linked with another macro fx
|
||||
collectParams(this);
|
||||
} else if (tagName == "ports") {
|
||||
int i = 0;
|
||||
while (is.matchTag(tagName)) {
|
||||
|
@ -533,7 +536,6 @@ void TMacroFx::loadData(TIStream &is) {
|
|||
throw TException("unexpected tag " + tagName);
|
||||
is.closeChild();
|
||||
}
|
||||
collectParams(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
|
|
@ -312,21 +312,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
Iterator find(const RowKey &r, const ColKey &c) {
|
||||
Iterator result(this);
|
||||
result.m_rowIt = m_table.find(r);
|
||||
if (result.m_rowIt == m_table.end()) return;
|
||||
result.m_it = result.m_rowIt->second.find(c);
|
||||
if (result.m_it == result.m_rowIt->second.end())
|
||||
result.m_rowIt = m_table.end();
|
||||
return result;
|
||||
}
|
||||
|
||||
Iterator erase(const RowKey &r, const ColKey &c) {
|
||||
Iterator it(find(r, c));
|
||||
return erase(it);
|
||||
}
|
||||
|
||||
Iterator erase(const Iterator &it) {
|
||||
Iterator result(it);
|
||||
Row &row = it.m_rowIt->second;
|
||||
|
|
|
@ -135,7 +135,7 @@ const int TAG_IMAGE_UNIQUE_ID = 0xA420;
|
|||
|
||||
typedef struct {
|
||||
unsigned short Tag;
|
||||
char *Desc;
|
||||
const char *Desc;
|
||||
} TagTable_t;
|
||||
|
||||
const TagTable_t TagTable[] = {
|
||||
|
@ -253,7 +253,7 @@ const int TAG_TABLE_SIZE = (sizeof(TagTable) / sizeof(TagTable_t));
|
|||
|
||||
const int TRUE = 1;
|
||||
const int FALSE = 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Convert a 16 bit unsigned value from file's native byte order
|
||||
|
|
|
@ -126,11 +126,11 @@ void TSpectrumParam::removeObserver(TParamObserver *obs) {
|
|||
|
||||
//---------------------------------------------------------
|
||||
|
||||
TSpectrumParam::TSpectrumParam(int keyCount, TSpectrum::ColorKey keys[])
|
||||
TSpectrumParam::TSpectrumParam(std::vector<TSpectrum::ColorKey> const &keys)
|
||||
: m_imp(new TSpectrumParamImp(this)) {
|
||||
for (int i = 0; i < keyCount; i++) {
|
||||
double v = keys[i].first;
|
||||
TPixel32 pix = keys[i].second;
|
||||
for (auto const &key : keys) {
|
||||
double v = key.first;
|
||||
TPixel32 pix = key.second;
|
||||
TDoubleParamP dp(v);
|
||||
TPixelParamP pp(pix);
|
||||
pp->enableMatte(m_imp->m_isMatteEnabled);
|
||||
|
|
|
@ -135,7 +135,7 @@ void drawControlPoints(const TVectorRenderData &rd, TStroke *stroke,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void drawArrows(TStroke *stroke, bool onlyFirstPoint) {
|
||||
static void drawArrows(TStroke *stroke, bool onlyFirstPoint) {
|
||||
double length = stroke->getLength(0.0, 1.0);
|
||||
int points = length / 20;
|
||||
if (points < 2) points += 1;
|
||||
|
@ -179,7 +179,8 @@ void drawArrows(TStroke *stroke, bool onlyFirstPoint) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Used for Guided Drawing
|
||||
void drawFirstControlPoint(const TVectorRenderData &rd, TStroke *stroke) {
|
||||
static void drawFirstControlPoint(const TVectorRenderData &rd,
|
||||
TStroke *stroke) {
|
||||
TPointD p = stroke->getPoint(0.0);
|
||||
double length = stroke->getLength(0.0, 1.0);
|
||||
int msecs = QTime::currentTime().msec();
|
||||
|
@ -434,7 +435,7 @@ bool isOThick(const TStroke *s) {
|
|||
if (s->getControlPoint(i).thick != 0) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void tglDraw(const TVectorRenderData &rd, const TStroke *s, bool pushAttribs) {
|
||||
assert(s);
|
||||
|
@ -676,7 +677,7 @@ rdRegions.m_alphaChannel = rdRegions.m_antiAliasing = false;*/
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -193,7 +193,8 @@ TPalette::TPalette()
|
|||
, m_mutex(QMutex::Recursive)
|
||||
, m_isLocked(false)
|
||||
, m_askOverwriteFlag(false)
|
||||
, m_shortcutScopeIndex(0) {
|
||||
, m_shortcutScopeIndex(0)
|
||||
, m_currentStyleId(1) {
|
||||
QString tempName(QObject::tr("colors"));
|
||||
std::wstring pageName = tempName.toStdWString();
|
||||
Page *page = addPage(pageName);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ttwain_statePD.h"
|
||||
|
||||
int TTWAIN_LoadSourceManagerPD(void) { return 0; }
|
||||
int TTWAIN_UnloadSourceManagerPD(void) { return 1; }
|
||||
|
||||
|
|
|
@ -168,8 +168,6 @@ inline std::ostream &operator<<(std::ostream &out, const std::string &s) {
|
|||
return out << s.c_str();
|
||||
}
|
||||
|
||||
#define tArrayCount(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
|
||||
|
||||
const std::string styleNameEasyInputWordsFileName = "stylename_easyinput.ini";
|
||||
|
||||
#endif //__T_COMMON_INCLUDED
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "tgeometry.h"
|
||||
#include <QStack>
|
||||
#include <QList>
|
||||
|
||||
#undef DVAPI
|
||||
#undef DVVAR
|
||||
|
|
|
@ -474,6 +474,21 @@ protected slots:
|
|||
void onColorModeChanged(int);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// FullColorFillToolOptionsBox
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class FullColorFillToolOptionsBox final : public ToolOptionsBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FullColorFillToolOptionsBox(QWidget *parent, TTool *tool,
|
||||
TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// FillToolOptionsBox
|
||||
|
@ -700,6 +715,48 @@ protected slots:
|
|||
void updateColors();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// ZoomToolOptionsBox
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class ZoomToolOptionsBox final : public ToolOptionsBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ZoomToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// RotateToolOptionsBox
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class RotateToolOptionsBox final : public ToolOptionsBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RotateToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// HandToolOptionsBox
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class HandToolOptionsBox final : public ToolOptionsBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HandToolOptionsBox(QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class DVAPI ToolOptions final : public QFrame {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#endif
|
||||
|
||||
class KeyframesUndo;
|
||||
class TSceneHandle;
|
||||
|
||||
class DVAPI KeyframeSetter {
|
||||
TDoubleParamP m_param;
|
||||
|
@ -101,7 +102,8 @@ public:
|
|||
}
|
||||
static void removeKeyframeAt(TDoubleParam *curve, double frame);
|
||||
|
||||
static void enableCycle(TDoubleParam *curve, bool enabled);
|
||||
static void enableCycle(TDoubleParam *curve, bool enabled,
|
||||
TSceneHandle *sceneHandle = nullptr);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -81,6 +81,9 @@ void DVAPI rectFillInk(const TRasterCM32P &ras, const TRect &r, int color);
|
|||
void DVAPI fillautoInks(TRasterCM32P &r, TRect &rect,
|
||||
const TRasterCM32P &rbefore, TPalette *plt);
|
||||
|
||||
void DVAPI fullColorFill(const TRaster32P &ras, const FillParameters ¶ms,
|
||||
TTileSaverFullColor *saver = 0);
|
||||
|
||||
//=============================================================================
|
||||
//! The class AreaFiller allows to fill a raster area, delimited by rect or
|
||||
//! spline.
|
||||
|
|
|
@ -49,7 +49,8 @@ public:
|
|||
// Current Palette (PaletteController) methods
|
||||
virtual TColorStyle *getCurrentLevelStyle() const = 0;
|
||||
virtual int getCurrentLevelStyleIndex() const = 0;
|
||||
virtual void setCurrentLevelStyleIndex(int index) = 0;
|
||||
virtual void setCurrentLevelStyleIndex(int index,
|
||||
bool forceUpdate = false) = 0;
|
||||
};
|
||||
|
||||
#endif // TAPPLICATION_H
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
TColorStyle *getStyle() const;
|
||||
|
||||
void setPalette(TPalette *palette, int styleIndex = 1);
|
||||
void setPalette(TPalette *palette, int styleIndex = -1);
|
||||
|
||||
void setStyleIndex(int index, bool forceEmit = false);
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@ public:
|
|||
void add(const TRasterP &ras, TRect rect) override;
|
||||
|
||||
const Tile *getTile(int index) const;
|
||||
Tile *editTile(int index) const;
|
||||
|
||||
TTileSetFullColor *clone() const override;
|
||||
};
|
||||
|
|
|
@ -170,7 +170,6 @@ protected:
|
|||
|
||||
class DVAPI Dialog : public QDialog {
|
||||
Q_OBJECT
|
||||
static QSettings *m_settings;
|
||||
// If the dialog has button then is modal too.
|
||||
bool m_hasButton;
|
||||
QString m_name;
|
||||
|
@ -183,7 +182,6 @@ protected:
|
|||
QHBoxLayout *m_buttonLayout;
|
||||
QList<QLabel *> m_labelList;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void moveEvent(QMoveEvent *e) override;
|
||||
|
||||
public:
|
||||
QVBoxLayout *m_topLayout;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#ifndef FUNCTION_SEGMENT_VIEWER_H
|
||||
#define FUNCTION_SEGMENT_VIEWER_H
|
||||
|
||||
#include <array>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
|
@ -31,7 +32,7 @@ namespace DVGui {
|
|||
class MeasuredDoubleLineEdit;
|
||||
class ExpressionField;
|
||||
class FileField;
|
||||
}
|
||||
} // namespace DVGui
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -51,8 +52,8 @@ class FunctionSegmentViewer final : public QFrame, public TParamObserver {
|
|||
DVGui::LineEdit *m_stepFld;
|
||||
QStackedWidget *m_parametersPanel;
|
||||
|
||||
FunctionSegmentPage *m_pages[9];
|
||||
int m_typeId[9];
|
||||
std::array<FunctionSegmentPage *, 9> m_pages;
|
||||
std::array<int, 9> m_typeId;
|
||||
|
||||
FunctionSheet *m_sheet;
|
||||
TXsheetHandle *m_xshHandle;
|
||||
|
|
|
@ -124,6 +124,11 @@ public:
|
|||
int getColumnIndexByCurve(TDoubleParam *param) const;
|
||||
bool anyWidgetHasFocus();
|
||||
|
||||
// Obtains a pointer to the stage object containing the
|
||||
// parameter of specified column. Returns nullptr for
|
||||
// fx parameter columns.
|
||||
TStageObject *getStageObject(int column);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *e) override;
|
||||
void hideEvent(QHideEvent *e) override;
|
||||
|
|
|
@ -336,6 +336,31 @@ public:
|
|||
void refresh() override;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class StageObjectChannelGroup final : public FunctionTreeModel::ChannelGroup {
|
||||
public:
|
||||
TStageObject *m_stageObject; //!< (not owned) Referenced stage object
|
||||
FunctionTreeModel::ChannelGroup
|
||||
*m_plasticGroup; //!< (not owned) Eventual plastic channels group
|
||||
|
||||
public:
|
||||
StageObjectChannelGroup(TStageObject *pegbar);
|
||||
~StageObjectChannelGroup();
|
||||
|
||||
QString getShortName() const override;
|
||||
QString getLongName() const override;
|
||||
|
||||
QString getIdName() const override;
|
||||
|
||||
void *getInternalPointer() const override {
|
||||
return static_cast<void *>(m_stageObject);
|
||||
}
|
||||
|
||||
TStageObject *getStageObject() const { return m_stageObject; }
|
||||
QVariant data(int role) const override;
|
||||
};
|
||||
|
||||
//*****************************************************************************************
|
||||
// FunctionTreeView declaration
|
||||
//*****************************************************************************************
|
||||
|
|
|
@ -120,6 +120,8 @@ public:
|
|||
void clearFocusColumnsAndGraph();
|
||||
bool columnsOrGraphHasFocus();
|
||||
void setSceneHandle(TSceneHandle *sceneHandle);
|
||||
TSceneHandle *getSceneHandle() const { return m_sceneHandle; }
|
||||
|
||||
// SaveLoadQSettings
|
||||
virtual void save(QSettings &settings) const override;
|
||||
virtual void load(QSettings &settings) override;
|
||||
|
|
|
@ -365,6 +365,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
};
|
||||
|
||||
//*****************************************************
|
||||
|
@ -384,6 +385,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
};
|
||||
|
||||
//*****************************************************
|
||||
|
@ -408,6 +410,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
|
||||
protected slots:
|
||||
|
||||
|
@ -441,6 +444,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
|
||||
protected slots:
|
||||
|
||||
|
@ -479,6 +483,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
|
||||
private:
|
||||
void renameObject(const TStageObjectId &id, std::string name);
|
||||
|
@ -517,6 +522,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
|
||||
protected slots:
|
||||
|
||||
|
@ -575,6 +581,7 @@ public:
|
|||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *me) override;
|
||||
QPointF computePos() const;
|
||||
|
||||
protected slots:
|
||||
|
|
|
@ -190,6 +190,7 @@ class DVAPI ParamViewer final : public QFrame {
|
|||
Q_OBJECT
|
||||
|
||||
TFxP m_fx;
|
||||
TFxP m_actualFx;
|
||||
|
||||
QStackedWidget *m_tablePageSet;
|
||||
QMap<std::string, int> m_tableFxIndex;
|
||||
|
@ -253,6 +254,7 @@ class DVAPI FxSettings final : public QSplitter {
|
|||
bool m_isCameraModeView;
|
||||
|
||||
int m_container_height;
|
||||
int m_container_width;
|
||||
|
||||
public:
|
||||
FxSettings(QWidget *parent, const TPixel32 &checkCol1,
|
||||
|
|
|
@ -140,7 +140,8 @@ void DVAPI assignFillingInformation(TVectorImage &vi,
|
|||
const std::vector<TFilledRegionInf> ®s);
|
||||
|
||||
void DVAPI getStrokeStyleInformationInArea(
|
||||
const TVectorImageP &vi, std::vector<std::pair<int, int>>
|
||||
const TVectorImageP &vi,
|
||||
std::vector<std::pair<int, int>>
|
||||
&strokesInfo, // pair:strokeIndex, styleIndex
|
||||
const TRectD &area);
|
||||
|
||||
|
@ -221,7 +222,7 @@ public:
|
|||
protected:
|
||||
virtual bool zoom(
|
||||
bool zoomin,
|
||||
bool resetZoom) = 0; //!< Handler for zoom commands. Required.
|
||||
bool resetView) = 0; //!< Handler for zoom commands. Required.
|
||||
virtual bool fit() {
|
||||
return false;
|
||||
} //!< Handler for 'fit to image' commands.
|
||||
|
@ -234,6 +235,15 @@ protected:
|
|||
virtual bool setFlipY() {
|
||||
return false;
|
||||
} //!< Handler for 'flip viewer horizontally' commands.
|
||||
virtual bool resetZoom() {
|
||||
return false;
|
||||
} //!< Handler for 'reset zoom' commands.
|
||||
virtual bool resetRotation() {
|
||||
return false;
|
||||
} //!< Handler for 'reset rotation' commands.
|
||||
virtual bool resetPosition() {
|
||||
return false;
|
||||
} //!< Handler for 'reset position' commands.
|
||||
virtual bool toggleFullScreen(
|
||||
bool quit = false) //! Handler for 'toggle fullscreen' commands.
|
||||
{
|
||||
|
|
|
@ -60,7 +60,8 @@ enum CommandType {
|
|||
ToolModifierCommandType,
|
||||
ZoomCommandType,
|
||||
MiscCommandType,
|
||||
MenuCommandType
|
||||
MenuCommandType,
|
||||
VisualizationButtonCommandType
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -162,6 +162,8 @@ protected slots:
|
|||
|
||||
void onNameDisplayMode(QAction *);
|
||||
void setIsLocked(bool lock);
|
||||
|
||||
void onSwitchToPage(int pageIndex);
|
||||
};
|
||||
|
||||
#endif // PALETTEVIEWER_H
|
||||
|
|
|
@ -211,6 +211,7 @@ private:
|
|||
|
||||
signals:
|
||||
void changeWindowTitleSignal();
|
||||
void switchToPage(int);
|
||||
};
|
||||
|
||||
//****************************************************************************
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
// Qt includes
|
||||
#include <QOpenGLWidget>
|
||||
#include <QTouchDevice>
|
||||
|
||||
#undef DVAPI
|
||||
#undef DVVAR
|
||||
|
@ -30,6 +31,8 @@
|
|||
class TRasterImageP;
|
||||
class TToonzImageP;
|
||||
class TVectorImageP;
|
||||
class QTouchEvent;
|
||||
class QGestureEvent;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
@ -61,6 +64,18 @@ obsolete class until the shader fx being overhauled. 2016/6/22 Shun
|
|||
*/
|
||||
|
||||
class DVAPI PlaneViewer : public GLWidgetForHighDpi {
|
||||
Q_OBJECT
|
||||
bool m_touchActive = false;
|
||||
bool m_gestureActive = false;
|
||||
QTouchDevice::DeviceType m_touchDevice = QTouchDevice::TouchScreen;
|
||||
bool m_zooming = false;
|
||||
bool m_panning = false;
|
||||
double m_scaleFactor; // used for zoom gesture
|
||||
|
||||
bool m_stylusUsed = false;
|
||||
|
||||
bool m_firstDraw;
|
||||
|
||||
public:
|
||||
PlaneViewer(QWidget *parent);
|
||||
|
||||
|
@ -99,8 +114,6 @@ public:
|
|||
TAffine &viewAff() { return m_aff; }
|
||||
const TAffine &viewAff() const { return m_aff; }
|
||||
|
||||
void resetView();
|
||||
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
|
||||
|
@ -123,6 +136,11 @@ public:
|
|||
TRaster32P rasterBuffer();
|
||||
void flushRasterBuffer();
|
||||
|
||||
public slots:
|
||||
|
||||
void resetView();
|
||||
void fitView();
|
||||
|
||||
protected:
|
||||
int m_xpos, m_ypos; //!< Mouse position on mouse operations.
|
||||
TAffine m_aff; //!< Affine transform from world to widget coords.
|
||||
|
@ -135,13 +153,25 @@ protected:
|
|||
|
||||
double m_zoomRange[2]; //!< Viewport zoom range (default: [-1024, 1024]).
|
||||
|
||||
TRect m_imageBounds;
|
||||
|
||||
double m_dpiX, m_dpiY;
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||
virtual void hideEvent(QHideEvent *event) override;
|
||||
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
virtual void tabletEvent(QTabletEvent *e) override;
|
||||
void touchEvent(QTouchEvent *e, int type);
|
||||
void gestureEvent(QGestureEvent *e);
|
||||
virtual bool event(QEvent *e) override;
|
||||
|
||||
void initializeGL() override final;
|
||||
void resizeGL(int width, int height) override final;
|
||||
|
||||
|
@ -150,6 +180,7 @@ private:
|
|||
bool m_firstResize;
|
||||
int m_width;
|
||||
int m_height;
|
||||
QPointF m_firstPanPoint;
|
||||
};
|
||||
|
||||
#endif // PLANE_VIEWER_H
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
SchematicSceneViewer(QWidget *parent);
|
||||
~SchematicSceneViewer();
|
||||
|
||||
void zoomQt(bool zoomin, bool resetZoom);
|
||||
void zoomQt(bool zoomin, bool resetView);
|
||||
|
||||
QPointF getOldScenePos() { return m_oldScenePos; }
|
||||
|
||||
|
@ -120,10 +120,13 @@ protected:
|
|||
|
||||
protected slots:
|
||||
|
||||
void fitScene();
|
||||
void centerOnCurrent();
|
||||
void reorderScene();
|
||||
|
||||
public slots:
|
||||
|
||||
void normalizeScene();
|
||||
void fitScene();
|
||||
|
||||
private:
|
||||
Qt::MouseButton m_buttonState;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "tthread.h"
|
||||
#include "trop.h"
|
||||
|
||||
#include <QTouchDevice>
|
||||
|
||||
using namespace TThread;
|
||||
|
||||
#undef DVAPI
|
||||
|
@ -28,6 +30,13 @@ using namespace TThread;
|
|||
#define DVVAR DV_IMPORT_VAR
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward declarations
|
||||
|
||||
class QTouchEvent;
|
||||
class QGestureEvent;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
class DVAPI BgPainter {
|
||||
|
@ -113,6 +122,7 @@ class DVAPI SwatchViewer final : public QWidget {
|
|||
TPointD m_pointPosDelta;
|
||||
|
||||
bool m_enabled;
|
||||
bool m_firstEnabled;
|
||||
int m_frame;
|
||||
TThread::Executor m_executor;
|
||||
TThread::Mutex m_mutex;
|
||||
|
@ -129,6 +139,15 @@ class DVAPI SwatchViewer final : public QWidget {
|
|||
|
||||
bool m_computing;
|
||||
|
||||
bool m_touchActive = false;
|
||||
bool m_gestureActive = false;
|
||||
QTouchDevice::DeviceType m_touchDevice = QTouchDevice::TouchScreen;
|
||||
bool m_zooming = false;
|
||||
bool m_panning = false;
|
||||
double m_scaleFactor; // used for zoom gesture
|
||||
|
||||
bool m_stylusUsed = false;
|
||||
|
||||
friend class ContentRender;
|
||||
|
||||
public:
|
||||
|
@ -179,6 +198,8 @@ public slots:
|
|||
void setEnable(bool enabled);
|
||||
void updateSize(const QSize &size);
|
||||
void setBgPainter(TPixel32 color1, TPixel32 color2 = TPixel32());
|
||||
void resetView();
|
||||
void fitView();
|
||||
|
||||
protected:
|
||||
void computeContent();
|
||||
|
@ -186,6 +207,7 @@ protected:
|
|||
TPointD win2world(const TPoint &p) const;
|
||||
void zoom(const TPoint &pos, double factor);
|
||||
void zoom(bool forward, bool reset);
|
||||
void pan(const TPoint &delta);
|
||||
|
||||
void updateRaster();
|
||||
|
||||
|
@ -194,6 +216,7 @@ protected:
|
|||
|
||||
void setAff(const TAffine &aff);
|
||||
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
@ -203,6 +226,15 @@ protected:
|
|||
void resizeEvent(QResizeEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void tabletEvent(QTabletEvent *e) override;
|
||||
void touchEvent(QTouchEvent *e, int type);
|
||||
void gestureEvent(QGestureEvent *e);
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
private:
|
||||
QPointF m_firstPanPoint;
|
||||
|
||||
signals:
|
||||
void pointPositionChanged(int index, const TPointD &p);
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#ifndef VIEWCOMMANDIDS_H
|
||||
#define VIEWCOMMANDIDS_H
|
||||
|
||||
#define V_ViewReset "T_ViewReset"
|
||||
#define V_ZoomIn "T_Zoomin" // Can't change prefix due to retrocompatibility
|
||||
#define V_ZoomOut "T_Zoomout"
|
||||
#define V_ZoomReset "T_ZoomReset"
|
||||
|
@ -11,5 +12,17 @@
|
|||
#define V_ActualPixelSize "T_ActualPixelSize"
|
||||
#define V_FlipX "T_FlipX"
|
||||
#define V_FlipY "T_FlipY"
|
||||
#define V_RotateReset "T_RotateReset"
|
||||
#define V_PositionReset "T_PositionReset"
|
||||
|
||||
// folloing command ids are for command bar
|
||||
#define VB_ViewReset "VB_ViewReset"
|
||||
#define VB_ZoomFit "VB_ZoomFit"
|
||||
#define VB_ZoomReset "VB_ZoomReset"
|
||||
#define VB_RotateReset "VB_RotateReset"
|
||||
#define VB_PositionReset "VB_PositionReset"
|
||||
#define VB_ActualPixelSize "VB_ActualPixelSize"
|
||||
#define VB_FlipX "VB_FlipX"
|
||||
#define VB_FlipY "VB_FlipY"
|
||||
|
||||
#endif // VIEWCOMMANDIDS_H
|
||||
|
|
|
@ -214,6 +214,8 @@ private:
|
|||
|
||||
int m_shortcutScopeIndex;
|
||||
|
||||
int m_currentStyleId;
|
||||
|
||||
public:
|
||||
TPalette();
|
||||
~TPalette();
|
||||
|
@ -425,6 +427,9 @@ between RGBA color components.
|
|||
|
||||
void nextShortcutScope(bool invert);
|
||||
|
||||
void setCurrentStyleId(int id) { m_currentStyleId = id; }
|
||||
int getCurrentStyleId() const { return m_currentStyleId; }
|
||||
|
||||
public:
|
||||
// Deprecated functions
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class DVAPI TSpectrumParam final : public TParam {
|
|||
|
||||
public:
|
||||
TSpectrumParam();
|
||||
TSpectrumParam(int keyCount, TSpectrum::ColorKey keys[]);
|
||||
TSpectrumParam(std::vector<TSpectrum::ColorKey> const &keys);
|
||||
TSpectrumParam(const TSpectrumParam &);
|
||||
~TSpectrumParam();
|
||||
|
||||
|
@ -102,9 +102,9 @@ class DVAPI TSpectrumParamP final
|
|||
: public TDerivedSmartPointerT<TSpectrumParam, TParam> {
|
||||
public:
|
||||
TSpectrumParamP() {}
|
||||
TSpectrumParamP(int keyCount, TSpectrum::ColorKey keys[])
|
||||
TSpectrumParamP(std::vector<TSpectrum::ColorKey> const &keys)
|
||||
: TDerivedSmartPointerT<TSpectrumParam, TParam>(
|
||||
new TSpectrumParam(keyCount, keys)) {}
|
||||
new TSpectrumParam(keys)) {}
|
||||
TSpectrumParamP(TSpectrumParam *p)
|
||||
: TDerivedSmartPointerT<TSpectrumParam, TParam>(p) {}
|
||||
TSpectrumParamP(const TParamP &p)
|
||||
|
|
|
@ -28,10 +28,10 @@ public:
|
|||
bindParam(this, "min", m_min);
|
||||
bindParam(this, "max", m_max);
|
||||
bindParam(this, "evolution", m_evol);
|
||||
TSpectrum::ColorKey colors[] = {
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(1, TPixel32::Transparent)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
bindParam(this, "colors", m_colors);
|
||||
m_size->setValueRange(0, 200);
|
||||
m_min->setValueRange(0, 1.0);
|
||||
|
|
|
@ -13,13 +13,14 @@ class DiamondGradientFx final : public TStandardZeraryFx {
|
|||
|
||||
public:
|
||||
DiamondGradientFx() : m_size(100.0) {
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.2, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(0.4, TPixel32::Blue),
|
||||
TSpectrum::ColorKey(0.6, TPixel32::Green),
|
||||
TSpectrum::ColorKey(0.8, TPixel32::Magenta),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
m_size->setMeasureName("fxLength");
|
||||
bindParam(this, "colors", m_colors);
|
||||
bindParam(this, "size", m_size);
|
||||
|
|
|
@ -25,6 +25,7 @@ typedef int int32_t;
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
extern void pri_funct_cv_start(int32_t i32_ys);
|
||||
extern void pri_funct_cv_run(int32_t i32_y);
|
||||
extern void pri_funct_cv_end(void);
|
||||
|
@ -33,6 +34,7 @@ extern void pri_funct_set_cp_title(const char *cp_title);
|
|||
extern void pri_funct_msg_ttvr(const char* fmt, ...);
|
||||
extern void pri_funct_msg_vr(const char* fmt, ...);
|
||||
extern void pri_funct_err_bttvr(const char* fmt, ...);
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1046,7 +1048,7 @@ double calculator_geometry::get_d_radian(double d_xv, double d_yv) {
|
|||
}
|
||||
/* 第2象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||
else if ((d_xv <= 0.0) && (0.0 < d_yv)) {
|
||||
d_radian = atan(-d_xv / d_yv) + M_PI_2;
|
||||
d_radian = atan(-d_xv / d_yv) + M_PI / 2.0;
|
||||
}
|
||||
/* 第3象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||
else if ((d_xv < 0.0) && (d_yv <= 0.0)) {
|
||||
|
@ -1054,7 +1056,7 @@ double calculator_geometry::get_d_radian(double d_xv, double d_yv) {
|
|||
}
|
||||
/* 第4象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||
else if ((0.0 <= d_xv) && (d_yv < 0.0)) {
|
||||
d_radian = atan(d_xv / -d_yv) + M_PI + M_PI_2;
|
||||
d_radian = atan(d_xv / -d_yv) + M_PI + M_PI / 2.0;
|
||||
}
|
||||
return d_radian;
|
||||
}
|
||||
|
@ -1712,10 +1714,9 @@ int pixel_line_node::expand_line(pixel_point_root *clp_pixel_point_root) {
|
|||
/* 始点が端点ならば先へ伸ばす */
|
||||
i32_body_point_count = this->_i32_point_count;
|
||||
if (NULL == clp_one->get_clp_link_near(1)) { /* 2点目がないなら端点 */
|
||||
if (OK !=
|
||||
this->_expand_line_from_one(clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(),
|
||||
this->get_clp_link_another(),
|
||||
if (OK != this->_expand_line_from_one(
|
||||
clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(), this->get_clp_link_another(),
|
||||
d_radian_one)) {
|
||||
pri_funct_err_bttvr(
|
||||
"Error : this->_expand_line_from_one(-) returns NULL.");
|
||||
|
@ -1725,8 +1726,7 @@ int pixel_line_node::expand_line(pixel_point_root *clp_pixel_point_root) {
|
|||
|
||||
/* 終点が端点ならば先へ伸ばす */
|
||||
if (NULL == clp_another->get_clp_link_near(1)) { /* 2点目がないなら端点 */
|
||||
if (OK !=
|
||||
this->_expand_line_from_another(
|
||||
if (OK != this->_expand_line_from_another(
|
||||
clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(), this->get_clp_link_another(),
|
||||
d_radian_another)) {
|
||||
|
@ -5624,8 +5624,7 @@ int igs_line_blur_brush_curve_blur_subpixel_(
|
|||
}
|
||||
|
||||
int igs_line_blur_brush_curve_blur_all_(
|
||||
bool mv_sw, bool pv_sw, bool cv_sw,
|
||||
brush_curve_blur &cl_brush_curve_blur,
|
||||
bool mv_sw, bool pv_sw, bool cv_sw, brush_curve_blur &cl_brush_curve_blur,
|
||||
pixel_select_curve_blur_root &cl_pixel_select_curve_blur_root,
|
||||
pixel_line_root &cl_pixel_line_root
|
||||
|
||||
|
@ -6082,7 +6081,7 @@ void igs_line_blur_image_get_(const bool mv_sw, const bool cv_sw,
|
|||
pri_funct_cv_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
@ -6099,7 +6098,8 @@ void igs::line_blur::convert(
|
|||
,
|
||||
const int width // no_margin
|
||||
,
|
||||
const int channels, const int bits
|
||||
const int channels,
|
||||
const int bits
|
||||
|
||||
/* Action */
|
||||
,
|
||||
|
@ -6253,8 +6253,7 @@ void igs::line_blur::convert(
|
|||
/****** ベクトルリスト処理 start ******/
|
||||
|
||||
/* 細線化した画像をリストにする */
|
||||
if (OK !=
|
||||
cl_pixel_point_root.alloc_mem_and_list_node(
|
||||
if (OK != cl_pixel_point_root.alloc_mem_and_list_node(
|
||||
cl_thinnest_ui16_image.get_i32_xs(),
|
||||
cl_thinnest_ui16_image.get_i32_ys(),
|
||||
cl_thinnest_ui16_image.get_ui16p_src_channel())) {
|
||||
|
@ -6281,8 +6280,7 @@ void igs::line_blur::convert(
|
|||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_another_point(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_not_include(&(cl_pixel_point_root),
|
||||
if (OK != cl_pixel_line_root.save_not_include(&(cl_pixel_point_root),
|
||||
"tmp11_not_include.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_not_include(-) returns NG");
|
||||
|
@ -6335,14 +6333,12 @@ void igs::line_blur::convert(
|
|||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_expand_lines(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_one_expand_point(
|
||||
if (OK != cl_pixel_line_root.save_one_expand_point(
|
||||
"tmp16_one_expand_point.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_one_expand_point(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_another_expand_point(
|
||||
if (OK != cl_pixel_line_root.save_another_expand_point(
|
||||
"tmp17_another_expand_point.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_another_expand_point(-) returns NG");
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef igs_line_blur_h
|
||||
#define igs_line_blur_h
|
||||
|
||||
|
@ -20,7 +18,8 @@ IGS_LINE_BLUR_EXPORT void convert(
|
|||
,
|
||||
const int width // no_margin
|
||||
,
|
||||
const int channels, const int bits
|
||||
const int channels,
|
||||
const int bits
|
||||
|
||||
/* Action Geometry */
|
||||
,
|
||||
|
@ -61,6 +60,6 @@ IGS_LINE_BLUR_EXPORT void convert(
|
|||
const int brush_action /* 0 =Curve Blur ,1=Smudge Brush */
|
||||
);
|
||||
}
|
||||
}
|
||||
} // namespace igs
|
||||
|
||||
#endif /* !igs_line_blur_h */
|
||||
|
|
|
@ -20,7 +20,8 @@ IGS_LINE_BLUR_EXPORT void convert(
|
|||
,
|
||||
const int width // no_margin
|
||||
,
|
||||
const int channels, const int bits
|
||||
const int channels,
|
||||
const int bits
|
||||
|
||||
/* Action Geometry */
|
||||
,
|
||||
|
@ -61,7 +62,7 @@ IGS_LINE_BLUR_EXPORT void convert(
|
|||
const int brush_action /* 0 =Curve Blur ,1=Smudge Brush */
|
||||
);
|
||||
}
|
||||
}
|
||||
} // namespace igs
|
||||
|
||||
#endif /* !igs_line_blur_h */
|
||||
|
||||
|
@ -253,6 +254,7 @@ void pri_funct_err_bttvr(const char *fmt, ...) {
|
|||
|
||||
#ifndef _list_node_h_
|
||||
#define _list_node_h_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class list_node {
|
||||
|
@ -761,9 +763,9 @@ public:
|
|||
void mem_free(void);
|
||||
|
||||
private:
|
||||
int _i_mv_sw, /* Method Verbose */
|
||||
_i_pv_sw, /* Parameter Verbose */
|
||||
_i_cv_sw; /* Counter Verbose */
|
||||
bool _i_mv_sw; /* Method Verbose */
|
||||
bool _i_pv_sw; /* Parameter Verbose */
|
||||
bool _i_cv_sw; /* Counter Verbose */
|
||||
|
||||
int32_t _i32_size_by_pixel, _i32_subpixel_divide;
|
||||
double _d_ratio;
|
||||
|
@ -1780,10 +1782,9 @@ int pixel_line_node::expand_line(pixel_point_root *clp_pixel_point_root) {
|
|||
/* 始点が端点ならば先へ伸ばす */
|
||||
i32_body_point_count = this->_i32_point_count;
|
||||
if (NULL == clp_one->get_clp_link_near(1)) { /* 2点目がないなら端点 */
|
||||
if (OK !=
|
||||
this->_expand_line_from_one(clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(),
|
||||
this->get_clp_link_another(),
|
||||
if (OK != this->_expand_line_from_one(
|
||||
clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(), this->get_clp_link_another(),
|
||||
d_radian_one)) {
|
||||
pri_funct_err_bttvr(
|
||||
"Error : this->_expand_line_from_one(-) returns NULL.");
|
||||
|
@ -1793,8 +1794,7 @@ int pixel_line_node::expand_line(pixel_point_root *clp_pixel_point_root) {
|
|||
|
||||
/* 終点が端点ならば先へ伸ばす */
|
||||
if (NULL == clp_another->get_clp_link_near(1)) { /* 2点目がないなら端点 */
|
||||
if (OK !=
|
||||
this->_expand_line_from_another(
|
||||
if (OK != this->_expand_line_from_another(
|
||||
clp_pixel_point_root, i32_body_point_count,
|
||||
this->get_clp_link_one(), this->get_clp_link_another(),
|
||||
d_radian_another)) {
|
||||
|
@ -5692,8 +5692,7 @@ int igs_line_blur_brush_curve_blur_subpixel_(
|
|||
}
|
||||
|
||||
int igs_line_blur_brush_curve_blur_all_(
|
||||
bool mv_sw, bool pv_sw, bool cv_sw,
|
||||
brush_curve_blur &cl_brush_curve_blur,
|
||||
bool mv_sw, bool pv_sw, bool cv_sw, brush_curve_blur &cl_brush_curve_blur,
|
||||
pixel_select_curve_blur_root &cl_pixel_select_curve_blur_root,
|
||||
pixel_line_root &cl_pixel_line_root
|
||||
|
||||
|
@ -6150,11 +6149,10 @@ void igs_line_blur_image_get_(const bool mv_sw, const bool cv_sw,
|
|||
pri_funct_cv_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "igs_line_blur.h" // "thinnest_ui16_image.h" "pixel_point_root.h" "pixel_line_root.h" "brush_curve_blur.h" "brush_smudge_circle.h" "pixel_select_same_way.h" "pixel_select_curve_blur.h" "igs_line_blur.h"
|
||||
|
||||
void igs::line_blur::convert(
|
||||
|
@ -6168,7 +6166,8 @@ void igs::line_blur::convert(
|
|||
,
|
||||
const int width // no_margin
|
||||
,
|
||||
const int channels, const int bits
|
||||
const int channels,
|
||||
const int bits
|
||||
|
||||
/* Action */
|
||||
,
|
||||
|
@ -6322,8 +6321,7 @@ void igs::line_blur::convert(
|
|||
/****** ベクトルリスト処理 start ******/
|
||||
|
||||
/* 細線化した画像をリストにする */
|
||||
if (OK !=
|
||||
cl_pixel_point_root.alloc_mem_and_list_node(
|
||||
if (OK != cl_pixel_point_root.alloc_mem_and_list_node(
|
||||
cl_thinnest_ui16_image.get_i32_xs(),
|
||||
cl_thinnest_ui16_image.get_i32_ys(),
|
||||
cl_thinnest_ui16_image.get_ui16p_src_channel())) {
|
||||
|
@ -6350,8 +6348,7 @@ void igs::line_blur::convert(
|
|||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_another_point(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_not_include(&(cl_pixel_point_root),
|
||||
if (OK != cl_pixel_line_root.save_not_include(&(cl_pixel_point_root),
|
||||
"tmp11_not_include.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_not_include(-) returns NG");
|
||||
|
@ -6404,14 +6401,12 @@ void igs::line_blur::convert(
|
|||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_expand_lines(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_one_expand_point(
|
||||
if (OK != cl_pixel_line_root.save_one_expand_point(
|
||||
"tmp16_one_expand_point.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_one_expand_point(-) returns NG");
|
||||
}
|
||||
if (OK !=
|
||||
cl_pixel_line_root.save_another_expand_point(
|
||||
if (OK != cl_pixel_line_root.save_another_expand_point(
|
||||
"tmp17_another_expand_point.txt")) {
|
||||
throw std::domain_error(
|
||||
"Error : cl_pixel_line_root.save_another_expand_point(-) returns NG");
|
||||
|
@ -6459,70 +6454,57 @@ void igs::line_blur::convert(
|
|||
cl_thinnest_ui16_image.mem_free();
|
||||
}
|
||||
|
||||
//=====================
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
#include <sstream> /* std::ostringstream */
|
||||
#include "tfxparam.h"
|
||||
#include "stdfx.h"
|
||||
#include "tfxattributes.h"
|
||||
|
||||
#include "ino_common.h"
|
||||
#include "igs_line_blur.h"
|
||||
//------------------------------------------------------------
|
||||
|
||||
class ino_line_blur final : public TStandardRasterFx {
|
||||
FX_PLUGIN_DECLARATION(ino_line_blur)
|
||||
|
||||
TRasterFxPort m_input;
|
||||
|
||||
TIntEnumParamP m_b_action_mode;
|
||||
|
||||
TDoubleParamP m_b_blur_count;
|
||||
TDoubleParamP m_b_blur_power;
|
||||
TIntEnumParamP m_b_blur_subpixel;
|
||||
TDoubleParamP m_b_blur_near_ref;
|
||||
TDoubleParamP m_b_blur_near_len;
|
||||
|
||||
TDoubleParamP m_v_smooth_retry;
|
||||
TDoubleParamP m_v_near_ref;
|
||||
TDoubleParamP m_v_near_len;
|
||||
|
||||
TDoubleParamP m_b_smudge_thick;
|
||||
TDoubleParamP m_b_smudge_remain;
|
||||
|
||||
public:
|
||||
ino_line_blur()
|
||||
: m_b_action_mode(new TIntEnumParam(0, "Blur"))
|
||||
|
||||
, m_b_blur_count(51)
|
||||
, m_b_blur_power(1.0)
|
||||
, m_b_blur_subpixel(new TIntEnumParam())
|
||||
, m_b_blur_near_ref(5)
|
||||
, m_b_blur_near_len(160)
|
||||
|
||||
, m_v_smooth_retry(100)
|
||||
, m_v_near_ref(4)
|
||||
, m_v_near_len(160)
|
||||
|
||||
, m_b_smudge_thick(7)
|
||||
, m_b_smudge_remain(0.85) {
|
||||
addInputPort("Source", this->m_input);
|
||||
|
||||
bindParam(this, "action_mode", this->m_b_action_mode);
|
||||
|
||||
bindParam(this, "blur_count", this->m_b_blur_count);
|
||||
bindParam(this, "blur_power", this->m_b_blur_power);
|
||||
bindParam(this, "blur_subpixel", this->m_b_blur_subpixel);
|
||||
bindParam(this, "blur_near_ref", this->m_b_blur_near_ref);
|
||||
bindParam(this, "blur_near_len", this->m_b_blur_near_len);
|
||||
|
||||
bindParam(this, "vector_smooth_retry", this->m_v_smooth_retry);
|
||||
bindParam(this, "vector_near_ref", this->m_v_near_ref);
|
||||
bindParam(this, "vector_near_len", this->m_v_near_len);
|
||||
|
||||
bindParam(this, "smudge_thick", this->m_b_smudge_thick);
|
||||
bindParam(this, "smudge_remain", this->m_b_smudge_remain);
|
||||
|
||||
this->m_b_action_mode->addItem(1, "Smudge");
|
||||
|
||||
this->m_b_blur_count->setValueRange(1, 100);
|
||||
this->m_b_blur_power->setValueRange(0.1, 10.0);
|
||||
this->m_b_blur_subpixel->addItem(1, "1");
|
||||
|
@ -6532,27 +6514,41 @@ public:
|
|||
this->m_b_blur_subpixel->setValue(2);
|
||||
this->m_b_blur_near_ref->setValueRange(1, 100);
|
||||
this->m_b_blur_near_len->setValueRange(1, 1000);
|
||||
|
||||
this->m_v_smooth_retry->setValueRange(1, 1000);
|
||||
this->m_v_near_ref->setValueRange(1, 100);
|
||||
this->m_v_near_len->setValueRange(1, 1000);
|
||||
|
||||
// this->m_b_smudge_thick->setMeasureName("fxLength");
|
||||
this->m_b_smudge_thick->setValueRange(1, 100);
|
||||
this->m_b_smudge_remain->setValueRange(0.0, 1.0);
|
||||
}
|
||||
//------------------------------------------------------------
|
||||
double get_render_real_radius(const double frame, const TAffine affine) {
|
||||
double rad = this->m_b_blur_count->getValue(frame);
|
||||
/*--- 単位について考察必要 ---*/
|
||||
// rad *= ino::pixel_per_mm();
|
||||
/*--- Geometryを反映させる ---*/
|
||||
// TAffine aff(affine);
|
||||
return rad;
|
||||
}
|
||||
void get_render_enlarge(const double frame, const TAffine affine,
|
||||
TRectD &bBox) {
|
||||
const int margin =
|
||||
static_cast<int>(ceil(this->get_render_real_radius(frame, affine)));
|
||||
if (0 < margin) {
|
||||
bBox = bBox.enlarge(static_cast<double>(margin));
|
||||
}
|
||||
}
|
||||
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info) {
|
||||
if (false == this->m_input.isConnected()) {
|
||||
bBox = TRectD();
|
||||
return false;
|
||||
}
|
||||
const bool ret = this->m_input->doGetBBox(frame, bBox, info);
|
||||
this->get_render_enlarge(frame, info.m_affine, bBox);
|
||||
return ret;
|
||||
}
|
||||
int getMemoryRequirement(const TRectD &rect, double frame,
|
||||
const TRenderSettings &info) {
|
||||
TRectD bBox(rect);
|
||||
this->get_render_enlarge(frame, info.m_affine, bBox);
|
||||
return TRasterFx::memorySize(bBox, info.m_bpp);
|
||||
}
|
||||
void transform(double frame, int port, const TRectD &rectOnOutput,
|
||||
|
@ -6560,6 +6556,7 @@ public:
|
|||
TRenderSettings &infoOnInput) {
|
||||
rectOnInput = rectOnOutput;
|
||||
infoOnInput = infoOnOutput;
|
||||
this->get_render_enlarge(frame, infoOnOutput.m_affine, rectOnInput);
|
||||
}
|
||||
bool canHandle(const TRenderSettings &info, double frame) {
|
||||
// return true;/* geometry処理済の画像に加工することになる */
|
||||
|
@ -6567,36 +6564,23 @@ public:
|
|||
}
|
||||
void doCompute(TTile &tile, double frame, const TRenderSettings &rend_sets);
|
||||
};
|
||||
|
||||
FX_PLUGIN_IDENTIFIER(ino_line_blur, "inoLineBlurFx");
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
void fx_(const TRasterP in_ras // with margin
|
||||
void fx_(const TRasterP in_ras // no margin
|
||||
,
|
||||
TRasterP out_ras // no margin
|
||||
|
||||
,
|
||||
const int action_mode
|
||||
|
||||
,
|
||||
const int blur_count, const double blur_power, const int blur_subpixel,
|
||||
const int blur_near_ref, const int blur_near_len
|
||||
|
||||
,
|
||||
const int vector_smooth_retry, const int vector_near_ref,
|
||||
const int vector_near_len
|
||||
|
||||
,
|
||||
const int action_mode, const int blur_count, const double blur_power,
|
||||
const int blur_subpixel, const int blur_near_ref,
|
||||
const int blur_near_len, const int vector_smooth_retry,
|
||||
const int vector_near_ref, const int vector_near_len,
|
||||
const int smudge_thick, const double smudge_remain) {
|
||||
TRasterGR8P out_buffer(out_ras->getLy(),
|
||||
out_ras->getLx() * ino::channels() *
|
||||
((TRaster64P)in_ras ? sizeof(unsigned short)
|
||||
: sizeof(unsigned char)));
|
||||
out_buffer->lock();
|
||||
igs::line_blur::convert(
|
||||
in_ras->getRawData() // const void *in_no_margin (BGRA)
|
||||
,
|
||||
out_buffer->getRawData() // void *out_no_margin (BGRA)
|
||||
|
||||
out_ras->getRawData() // void *out_no_margin (BGRA)
|
||||
,
|
||||
in_ras->getLy() // const int height_no_margin
|
||||
,
|
||||
|
@ -6605,18 +6589,10 @@ void fx_(const TRasterP in_ras // with margin
|
|||
ino::channels() // const int channels
|
||||
,
|
||||
ino::bits(in_ras) // const int bits
|
||||
|
||||
,
|
||||
blur_count, blur_power, blur_subpixel, blur_near_ref, blur_near_len
|
||||
|
||||
,
|
||||
smudge_thick, smudge_remain
|
||||
|
||||
,
|
||||
vector_smooth_retry, vector_near_ref, vector_near_len
|
||||
|
||||
,
|
||||
false /* bool mv_sw false=OFF */
|
||||
blur_count, blur_power, blur_subpixel, blur_near_ref, blur_near_len,
|
||||
smudge_thick, smudge_remain, vector_smooth_retry, vector_near_ref,
|
||||
vector_near_len, false /* bool mv_sw false=OFF */
|
||||
,
|
||||
false /* bool pv_sw false=OFF */
|
||||
,
|
||||
|
@ -6627,130 +6603,72 @@ void fx_(const TRasterP in_ras // with margin
|
|||
false /* bool debug_save_sw false=OFF */
|
||||
,
|
||||
action_mode);
|
||||
ino::arr_to_ras(out_buffer->getRawData(), ino::channels(), out_ras, 0);
|
||||
out_buffer->unlock();
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------
|
||||
void ino_line_blur::doCompute(TTile &tile, double frame,
|
||||
const TRenderSettings &rend_sets) {
|
||||
/*------ 接続していなければ処理しない ----------------------*/
|
||||
} // namespace
|
||||
|
||||
void ino_line_blur::doCompute(
|
||||
TTile &tile /* 注意:doGetBBox(-)が返す範囲の画像 */
|
||||
,
|
||||
double frame, const TRenderSettings &rend_sets) {
|
||||
/*--- 接続していなければ処理しない -------------------------*/
|
||||
if (!this->m_input.isConnected()) {
|
||||
tile.getRaster()->clear(); /* 塗りつぶしクリア */
|
||||
return;
|
||||
}
|
||||
/*------ サポートしていないPixelタイプはエラーを投げる -----*/
|
||||
/*--- サポートしていないPixelタイプはエラーを投げる --------*/
|
||||
if (!((TRaster32P)tile.getRaster()) && !((TRaster64P)tile.getRaster())) {
|
||||
throw TRopException("unsupported input pixel type");
|
||||
}
|
||||
|
||||
/*------ パラメータを得る ------*/
|
||||
/*--- パラメータを得る -------------------------------------*/
|
||||
const int action_mode = this->m_b_action_mode->getValue();
|
||||
|
||||
const int blur_count = this->m_b_blur_count->getValue(frame);
|
||||
const double blur_power = this->m_b_blur_power->getValue(frame);
|
||||
const int blur_subpixel = this->m_b_blur_subpixel->getValue();
|
||||
const int blur_near_ref = this->m_b_blur_near_ref->getValue(frame);
|
||||
const int blur_near_len = this->m_b_blur_near_len->getValue(frame);
|
||||
|
||||
const int vector_smooth_retry = this->m_v_smooth_retry->getValue(frame);
|
||||
const int vector_near_ref = this->m_v_near_ref->getValue(frame);
|
||||
const int vector_near_len = this->m_v_near_len->getValue(frame);
|
||||
|
||||
const int smudge_thick = this->m_b_smudge_thick->getValue(frame);
|
||||
const double smudge_remain = this->m_b_smudge_remain->getValue(frame);
|
||||
|
||||
/*------ 表示の範囲を得る ----------------------------------*/
|
||||
/*--- 表示の範囲を得る -------------------------------------*/
|
||||
TRectD bBox =
|
||||
TRectD(tile.m_pos /* Render画像上(Pixel単位)の位置 */
|
||||
,
|
||||
TDimensionD(/* Render画像上(Pixel単位)のサイズ */
|
||||
tile.getRaster()->getLx(), tile.getRaster()->getLy()));
|
||||
|
||||
/* ------ marginなし画像生成 ------------------------------ */
|
||||
TTile enlarge_tile;
|
||||
/*--- doGetBBox(-)が返す範囲の画像を生成 -------------------*/
|
||||
TTile in_tile;
|
||||
this->m_input->allocateAndCompute(
|
||||
enlarge_tile, bBox.getP00(),
|
||||
in_tile, bBox.getP00(),
|
||||
TDimensionI(/* Pixel単位に四捨五入 */
|
||||
static_cast<int>(bBox.getLx() + 0.5),
|
||||
static_cast<int>(bBox.getLy() + 0.5)),
|
||||
tile.getRaster(), frame, rend_sets);
|
||||
|
||||
/* ------ 保存すべき画像メモリを塗りつぶしクリア ---------- */
|
||||
tile.getRaster()->clear(); /* 塗りつぶしクリア */
|
||||
|
||||
/* ------ (app_begin)log記憶 ------------------------------ */
|
||||
const bool log_sw = ino::log_enable_sw();
|
||||
|
||||
if (log_sw) {
|
||||
std::ostringstream os;
|
||||
os << "params"
|
||||
|
||||
<< " action_mode " << action_mode
|
||||
|
||||
<< " blur_count " << blur_count << " blur_power " << blur_power
|
||||
<< " blur_subpixel " << blur_subpixel << " blur_near_ref "
|
||||
<< blur_near_ref << " blur_near_len " << blur_near_len
|
||||
|
||||
<< " vector_smooth_retry " << vector_smooth_retry
|
||||
<< " vector_near_ref " << vector_near_ref << " vector_near_len "
|
||||
<< vector_near_len
|
||||
|
||||
<< " smudge_thick " << smudge_thick << " smudge_remain "
|
||||
<< smudge_remain
|
||||
|
||||
<< " tile"
|
||||
<< " pos " << tile.m_pos << " w " << tile.getRaster()->getLx() << " h "
|
||||
<< tile.getRaster()->getLy() << " in_tile"
|
||||
<< " w " << enlarge_tile.getRaster()->getLx() << " h "
|
||||
<< enlarge_tile.getRaster()->getLy() << " pixbits "
|
||||
<< ino::pixel_bits(tile.getRaster()) << " frame " << frame
|
||||
<< " m_affine " << rend_sets.m_affine;
|
||||
}
|
||||
/* ------ fx処理 ------------------------------------------ */
|
||||
/*--- 保存すべき画像メモリを塗りつぶしクリア ---------------*/
|
||||
tile.getRaster()->clear();
|
||||
/*--- 画像処理 ---------------------------------------------*/
|
||||
try {
|
||||
tile.getRaster()->lock();
|
||||
fx_(enlarge_tile.getRaster() // in with margin
|
||||
fx_(in_tile.getRaster() // in no margin
|
||||
,
|
||||
tile.getRaster() // out with no margin
|
||||
|
||||
,
|
||||
action_mode
|
||||
|
||||
,
|
||||
blur_count, blur_power, blur_subpixel, blur_near_ref, blur_near_len
|
||||
|
||||
,
|
||||
vector_smooth_retry, vector_near_ref, vector_near_len
|
||||
|
||||
tile.getRaster() // out no margin
|
||||
,
|
||||
action_mode, blur_count, blur_power, blur_subpixel, blur_near_ref,
|
||||
blur_near_len, vector_smooth_retry, vector_near_ref, vector_near_len,
|
||||
smudge_thick, smudge_remain);
|
||||
tile.getRaster()->unlock();
|
||||
}
|
||||
/* ------ error処理 --------------------------------------- */
|
||||
/*--- error処理 --------------------------------------------*/
|
||||
catch (std::bad_alloc &e) {
|
||||
tile.getRaster()->unlock();
|
||||
if (log_sw) {
|
||||
std::string str("std::bad_alloc <");
|
||||
str += e.what();
|
||||
str += '>';
|
||||
}
|
||||
throw;
|
||||
} catch (std::exception &e) {
|
||||
tile.getRaster()->unlock();
|
||||
if (log_sw) {
|
||||
std::string str("exception <");
|
||||
str += e.what();
|
||||
str += '>';
|
||||
}
|
||||
throw;
|
||||
} catch (...) {
|
||||
tile.getRaster()->unlock();
|
||||
if (log_sw) {
|
||||
std::string str("other exception");
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -250,18 +250,20 @@ Iwa_TiledParticlesFx::Iwa_TiledParticlesFx()
|
|||
animation_val->addItem(ANIM_SR_CYCLE, "Column Swing - Random Start");
|
||||
bindParam(this, "step", step_val);
|
||||
step_val->setValueRange(1, (std::numeric_limits<int>::max)());
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::Red),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Red),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
gencol_val = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
gencol_val = TSpectrumParamP(colors);
|
||||
bindParam(this, "birth_color", gencol_val);
|
||||
bindParam(this, "birth_color_ctrl", gencol_ctrl_val);
|
||||
bindParam(this, "birth_color_spread", gencol_spread_val);
|
||||
gencol_spread_val->setValueRange(0.0, (std::numeric_limits<int>::max)());
|
||||
bindParam(this, "birth_color_fade", genfadecol_val);
|
||||
genfadecol_val->setValueRange(0.0, 100.0);
|
||||
TSpectrum::ColorKey colors1[] = {TSpectrum::ColorKey(0, TPixel32::Green),
|
||||
std::vector<TSpectrum::ColorKey> colors1 = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Green),
|
||||
TSpectrum::ColorKey(1, TPixel32::Green)};
|
||||
fincol_val = TSpectrumParamP(tArrayCount(colors1), colors1);
|
||||
fincol_val = TSpectrumParamP(colors1);
|
||||
bindParam(this, "fadein_color", fincol_val);
|
||||
bindParam(this, "fadein_color_ctrl", fincol_ctrl_val);
|
||||
bindParam(this, "fadein_color_spread", fincol_spread_val);
|
||||
|
@ -270,9 +272,10 @@ Iwa_TiledParticlesFx::Iwa_TiledParticlesFx()
|
|||
finrangecol_val->setValueRange(0.0, (std::numeric_limits<double>::max)());
|
||||
bindParam(this, "fadein_color_fade", finfadecol_val);
|
||||
finfadecol_val->setValueRange(0.0, 100.0);
|
||||
TSpectrum::ColorKey colors2[] = {TSpectrum::ColorKey(0, TPixel32::Blue),
|
||||
std::vector<TSpectrum::ColorKey> colors2 = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Blue),
|
||||
TSpectrum::ColorKey(1, TPixel32::Blue)};
|
||||
foutcol_val = TSpectrumParamP(tArrayCount(colors2), colors2);
|
||||
foutcol_val = TSpectrumParamP(colors2);
|
||||
bindParam(this, "fadeout_color", foutcol_val);
|
||||
bindParam(this, "fadeout_color_ctrl", foutcol_ctrl_val);
|
||||
bindParam(this, "fadeout_color_spread", foutcol_spread_val);
|
||||
|
|
|
@ -195,11 +195,11 @@ public:
|
|||
TRasterP rasIn = tileIn.getRaster();
|
||||
|
||||
// Compute the warper tile
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.5, TPixel32::Black),
|
||||
TSpectrum::ColorKey(1, TPixel32::White)};
|
||||
|
||||
TSpectrumParamP wavecolors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
TSpectrumParamP wavecolors = TSpectrumParamP(colors);
|
||||
|
||||
// Build the multiradial
|
||||
warperInfo.m_affine = warperInfo.m_affine * TRotation(angle);
|
||||
|
|
|
@ -12,10 +12,11 @@ class MultiToneFx final : public TStandardRasterFx {
|
|||
|
||||
public:
|
||||
MultiToneFx() {
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.5, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
bool ret = m_colors->isKeyframe(0);
|
||||
bindParam(this, "colors", m_colors);
|
||||
|
||||
|
|
|
@ -228,18 +228,20 @@ ParticlesFx::ParticlesFx()
|
|||
animation_val->addItem(ANIM_SR_CYCLE, "Column Swing - Random Start");
|
||||
bindParam(this, "step", step_val);
|
||||
step_val->setValueRange(1, (std::numeric_limits<int>::max)());
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::Red),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Red),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
gencol_val = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
gencol_val = TSpectrumParamP(colors);
|
||||
bindParam(this, "birth_color", gencol_val);
|
||||
bindParam(this, "birth_color_ctrl", gencol_ctrl_val);
|
||||
bindParam(this, "birth_color_spread", gencol_spread_val);
|
||||
gencol_spread_val->setValueRange(0.0, (std::numeric_limits<int>::max)());
|
||||
bindParam(this, "birth_color_fade", genfadecol_val);
|
||||
genfadecol_val->setValueRange(0.0, 100.0);
|
||||
TSpectrum::ColorKey colors1[] = {TSpectrum::ColorKey(0, TPixel32::Green),
|
||||
std::vector<TSpectrum::ColorKey> colors1 = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Green),
|
||||
TSpectrum::ColorKey(1, TPixel32::Green)};
|
||||
fincol_val = TSpectrumParamP(tArrayCount(colors1), colors1);
|
||||
fincol_val = TSpectrumParamP(colors1);
|
||||
bindParam(this, "fadein_color", fincol_val);
|
||||
bindParam(this, "fadein_color_ctrl", fincol_ctrl_val);
|
||||
bindParam(this, "fadein_color_spread", fincol_spread_val);
|
||||
|
@ -248,9 +250,10 @@ ParticlesFx::ParticlesFx()
|
|||
finrangecol_val->setValueRange(0.0, (std::numeric_limits<double>::max)());
|
||||
bindParam(this, "fadein_color_fade", finfadecol_val);
|
||||
finfadecol_val->setValueRange(0.0, 100.0);
|
||||
TSpectrum::ColorKey colors2[] = {TSpectrum::ColorKey(0, TPixel32::Blue),
|
||||
std::vector<TSpectrum::ColorKey> colors2 = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Blue),
|
||||
TSpectrum::ColorKey(1, TPixel32::Blue)};
|
||||
foutcol_val = TSpectrumParamP(tArrayCount(colors2), colors2);
|
||||
foutcol_val = TSpectrumParamP(colors2);
|
||||
bindParam(this, "fadeout_color", foutcol_val);
|
||||
bindParam(this, "fadeout_color_ctrl", foutcol_ctrl_val);
|
||||
bindParam(this, "fadeout_color_spread", foutcol_spread_val);
|
||||
|
|
|
@ -191,10 +191,10 @@ public:
|
|||
TRasterP rasIn = tileIn.getRaster();
|
||||
|
||||
// Compute the warper tile
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(1, TPixel32::Black)};
|
||||
|
||||
TSpectrumParamP cloudscolors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
TSpectrumParamP cloudscolors = TSpectrumParamP(colors);
|
||||
|
||||
// Build the warper
|
||||
warperInfo.m_affine = warperInfo.m_affine;
|
||||
|
|
|
@ -197,11 +197,11 @@ public:
|
|||
TRasterP rasIn = tileIn.getRaster();
|
||||
|
||||
// Compute the warper tile
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.5, TPixel32::Black),
|
||||
TSpectrum::ColorKey(1, TPixel32::White)};
|
||||
|
||||
TSpectrumParamP ripplecolors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
TSpectrumParamP ripplecolors = TSpectrumParamP(colors);
|
||||
|
||||
// Build the multiradial
|
||||
warperInfo.m_affine = warperInfo.m_affine * TTranslation(center) *
|
||||
|
|
|
@ -17,11 +17,11 @@ class SquareGradientFx final : public TStandardZeraryFx {
|
|||
public:
|
||||
SquareGradientFx() : m_size(200.0) {
|
||||
m_size->setMeasureName("fxLength");
|
||||
TSpectrum::ColorKey colors[] = {
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
// TSpectrum::ColorKey(0.5,TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
bindParam(this, "colors", m_colors);
|
||||
bindParam(this, "size", m_size);
|
||||
m_size->setValueRange(0, std::numeric_limits<double>::max());
|
||||
|
|
|
@ -89,13 +89,13 @@ TPixel32 colors[] = {
|
|||
TPixel32::Yellow,
|
||||
transparent};
|
||||
*/
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::Magenta),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::Magenta),
|
||||
TSpectrum::ColorKey(0.25, TPixel32::Black),
|
||||
TSpectrum::ColorKey(0.5, TPixel32::Red),
|
||||
TSpectrum::ColorKey(0.75, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(1, transparent)};
|
||||
|
||||
m_spectrum = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_spectrum = TSpectrumParamP(colors);
|
||||
|
||||
bindParam(this, "colors", m_spectrum);
|
||||
bindParam(this, "freq", m_freq);
|
||||
|
@ -141,7 +141,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,
|
|||
}
|
||||
raster->unlock();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//==================================================================
|
||||
|
||||
|
@ -184,11 +184,12 @@ public:
|
|||
, m_wave_phase(0.0) // args, "Cycle")
|
||||
// , m_colors (0) //args, "Colors")
|
||||
{
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.33, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(0.66, TPixel32::Red),
|
||||
TSpectrum::ColorKey(1, TPixel32::White)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
|
||||
bindParam(this, "period", m_period);
|
||||
bindParam(this, "count", m_count);
|
||||
|
@ -321,7 +322,7 @@ void doComputeT(TRasterPT<T> ras, TPointD posTrasf,
|
|||
}
|
||||
ras->unlock();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//==================================================================
|
||||
|
||||
|
@ -337,10 +338,10 @@ void LinearGradientFx::doCompute(TTile &tile, double frame,
|
|||
double w_phase = m_wave_phase->getValue(frame);
|
||||
w_freq *= 0.01 * M_PI_180;
|
||||
|
||||
TSpectrum::ColorKey colors[] = {
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, m_color1->getValue(frame)),
|
||||
TSpectrum::ColorKey(1, m_color2->getValue(frame))};
|
||||
TSpectrumParamP m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
TSpectrumParamP m_colors = TSpectrumParamP(colors);
|
||||
|
||||
TAffine aff = ri.m_affine.inv();
|
||||
TPointD posTrasf = aff * tile.m_pos;
|
||||
|
@ -465,12 +466,12 @@ public:
|
|||
// , m_colors (0) //args, "Colors")
|
||||
{
|
||||
m_period->setMeasureName("fxLength");
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.33, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(0.66, TPixel32::Red),
|
||||
TSpectrum::ColorKey(1, TPixel32::White)};
|
||||
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
|
||||
bindParam(this, "period", m_period);
|
||||
bindParam(this, "count", m_count);
|
||||
|
@ -533,11 +534,11 @@ void RadialGradientFx::doCompute(TTile &tile, double frame,
|
|||
inner = innerperiod / period;
|
||||
else
|
||||
inner = 1 - TConsts::epsilon;
|
||||
TSpectrum::ColorKey colors[] = {
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, m_color1->getValue(frame)),
|
||||
TSpectrum::ColorKey(inner, m_color1->getValue(frame)),
|
||||
TSpectrum::ColorKey(1, m_color2->getValue(frame))};
|
||||
TSpectrumParamP m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
TSpectrumParamP m_colors = TSpectrumParamP(colors);
|
||||
TAffine aff = ri.m_affine.inv();
|
||||
TPointD posTrasf = aff * tile.m_pos;
|
||||
multiRadial(tile.getRaster(), posTrasf, m_colors, period, count, cycle, aff,
|
||||
|
@ -640,7 +641,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,
|
|||
}
|
||||
raster->unlock();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//==================================================================
|
||||
|
||||
|
|
|
@ -43,10 +43,11 @@ public:
|
|||
bindParam(this, "int", m_int);
|
||||
bindParam(this, "range", m_range);
|
||||
bindParam(this, "bool", m_bool);
|
||||
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
|
||||
std::vector<TSpectrum::ColorKey> colors = {
|
||||
TSpectrum::ColorKey(0, TPixel32::White),
|
||||
TSpectrum::ColorKey(0.5, TPixel32::Yellow),
|
||||
TSpectrum::ColorKey(1, TPixel32::Red)};
|
||||
m_colors = TSpectrumParamP(tArrayCount(colors), colors);
|
||||
m_colors = TSpectrumParamP(colors);
|
||||
bindParam(this, "spectrum", m_colors);
|
||||
bindParam(this, "string", m_string);
|
||||
addInputPort("Source", m_input);
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include "tvectorrenderdata.h"
|
||||
#include "tofflinegl.h"
|
||||
|
||||
#if defined(LINUX)
|
||||
#include <QGuiApplication>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace TCli;
|
||||
|
||||
|
@ -355,6 +359,10 @@ void convert(const TFilePath &source, const TFilePath &dest,
|
|||
//------------------------------------------------------------------------
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
#if defined(LINUX)
|
||||
QGuiApplication app(argc, argv);
|
||||
#endif
|
||||
|
||||
TEnv::setRootVarName(rootVarName);
|
||||
TEnv::setSystemVarPrefix(systemVarPrefix);
|
||||
TFilePath fp = TEnv::getStuffDir();
|
||||
|
|
|
@ -3,6 +3,7 @@ set(MOC_HEADERS
|
|||
edittoolgadgets.h
|
||||
filltool.h
|
||||
fullcolorbrushtool.h
|
||||
fullcolorfilltool.h
|
||||
plastictool.h
|
||||
skeletonsubtools.h
|
||||
tooloptionscontrols.h
|
||||
|
@ -58,6 +59,7 @@ set(SOURCES
|
|||
filltool.cpp
|
||||
fullcolorbrushtool.cpp
|
||||
fullcolorerasertool.cpp
|
||||
fullcolorfilltool.cpp
|
||||
geometrictool.cpp
|
||||
hooktool.cpp
|
||||
hookselection.cpp
|
||||
|
|
|
@ -143,6 +143,9 @@ FullColorBrushTool::FullColorBrushTool(std::string name)
|
|||
m_prop.bind(m_preset);
|
||||
|
||||
m_preset.setId("BrushPreset");
|
||||
m_modifierEraser.setId("RasterEraser");
|
||||
m_modifierLockAlpha.setId("LockAlpha");
|
||||
m_pressure.setId("PressureSensitivity");
|
||||
|
||||
m_brushTimer.start();
|
||||
}
|
||||
|
|
223
toonz/sources/tnztools/fullcolorfilltool.cpp
Normal file
223
toonz/sources/tnztools/fullcolorfilltool.cpp
Normal file
|
@ -0,0 +1,223 @@
|
|||
#include "fullcolorfilltool.h"
|
||||
|
||||
#include "toonz/stage2.h"
|
||||
#include "tools/cursors.h"
|
||||
#include "toonz/txshlevelhandle.h"
|
||||
#include "toonz/trasterimageutils.h"
|
||||
#include "toonz/ttileset.h"
|
||||
#include "toonz/ttilesaver.h"
|
||||
#include "toonz/levelproperties.h"
|
||||
#include "toonz/preferences.h"
|
||||
#include "toonz/txsheethandle.h"
|
||||
|
||||
#include "tools/toolhandle.h"
|
||||
#include "tools/toolutils.h"
|
||||
|
||||
#include "tenv.h"
|
||||
#include "tpalette.h"
|
||||
#include "tsystem.h"
|
||||
|
||||
using namespace ToolUtils;
|
||||
|
||||
TEnv::IntVar FullColorMinFillDepth("InknpaintFullColorMinFillDepth", 4);
|
||||
TEnv::IntVar FullColorMaxFillDepth("InknpaintFullColorMaxFillDepth", 12);
|
||||
|
||||
namespace {
|
||||
|
||||
//=============================================================================
|
||||
// FullColorFillUndo
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class FullColorFillUndo final : public TFullColorRasterUndo {
|
||||
FillParameters m_params;
|
||||
bool m_saveboxOnly;
|
||||
|
||||
public:
|
||||
FullColorFillUndo(TTileSetFullColor *tileSet, const FillParameters ¶ms,
|
||||
TXshSimpleLevel *sl, const TFrameId &fid, bool saveboxOnly)
|
||||
: TFullColorRasterUndo(tileSet, sl, fid, false, false, 0)
|
||||
, m_params(params)
|
||||
, m_saveboxOnly(saveboxOnly) {}
|
||||
|
||||
void redo() const override {
|
||||
TRasterImageP image = getImage();
|
||||
if (!image) return;
|
||||
TRaster32P r;
|
||||
if (m_saveboxOnly) {
|
||||
TRectD temp = image->getBBox();
|
||||
TRect ttemp = convert(temp);
|
||||
r = image->getRaster()->extract(ttemp);
|
||||
} else
|
||||
r = image->getRaster();
|
||||
|
||||
fullColorFill(r, m_params);
|
||||
|
||||
TTool::Application *app = TTool::getApplication();
|
||||
if (app) {
|
||||
app->getCurrentXsheet()->notifyXsheetChanged();
|
||||
notifyImageChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int getSize() const override {
|
||||
return sizeof(*this) + TFullColorRasterUndo::getSize();
|
||||
}
|
||||
|
||||
QString getToolName() override {
|
||||
return QString("Fill Tool : %1")
|
||||
.arg(QString::fromStdWString(m_params.m_fillType));
|
||||
}
|
||||
int getHistoryType() override { return HistoryType::FillTool; }
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// doFill
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void doFill(const TImageP &img, const TPointD &pos, FillParameters ¶ms,
|
||||
bool isShiftFill, TXshSimpleLevel *sl, const TFrameId &fid) {
|
||||
TTool::Application *app = TTool::getApplication();
|
||||
if (!app || !sl) return;
|
||||
|
||||
if (TRasterImageP ri = TRasterImageP(img)) {
|
||||
TPoint offs(0, 0);
|
||||
TRaster32P ras = ri->getRaster();
|
||||
// only accept 32bpp images for now
|
||||
if (!ras.getPointer() || ras->isEmpty()) return;
|
||||
|
||||
ras->lock();
|
||||
|
||||
TTileSetFullColor *tileSet = new TTileSetFullColor(ras->getSize());
|
||||
TTileSaverFullColor tileSaver(ras, tileSet);
|
||||
TDimension imageSize = ras->getSize();
|
||||
TPointD p(imageSize.lx % 2 ? 0.0 : 0.5, imageSize.ly % 2 ? 0.0 : 0.5);
|
||||
|
||||
/*-- params.m_p = convert(pos-p)では、マイナス座標でずれが生じる --*/
|
||||
TPointD tmp_p = pos - p;
|
||||
params.m_p = TPoint((int)floor(tmp_p.x + 0.5), (int)floor(tmp_p.y + 0.5));
|
||||
|
||||
params.m_p += ras->getCenter();
|
||||
params.m_p -= offs;
|
||||
params.m_shiftFill = isShiftFill;
|
||||
|
||||
TRect rasRect(ras->getSize());
|
||||
if (!rasRect.contains(params.m_p)) {
|
||||
ras->unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
fullColorFill(ras, params, &tileSaver);
|
||||
|
||||
if (tileSaver.getTileSet()->getTileCount() != 0) {
|
||||
static int count = 0;
|
||||
TSystem::outputDebug("RASTERFILL" + std::to_string(count++) + "\n");
|
||||
if (offs != TPoint())
|
||||
for (int i = 0; i < tileSet->getTileCount(); i++) {
|
||||
TTileSet::Tile *t = tileSet->editTile(i);
|
||||
t->m_rasterBounds = t->m_rasterBounds + offs;
|
||||
}
|
||||
TUndoManager::manager()->add(
|
||||
new FullColorFillUndo(tileSet, params, sl, fid,
|
||||
Preferences::instance()->getFillOnlySavebox()));
|
||||
}
|
||||
|
||||
sl->getProperties()->setDirtyFlag(true);
|
||||
|
||||
ras->unlock();
|
||||
}
|
||||
|
||||
TTool *t = app->getCurrentTool()->getTool();
|
||||
if (t) t->notifyImageChanged();
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// FullColorFillTool
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FullColorFillTool::FullColorFillTool()
|
||||
: TTool("T_Fill"), m_fillDepth("Fill Depth", 0, 15, 4, 12) {
|
||||
bind(TTool::RasterImage);
|
||||
m_prop.bind(m_fillDepth);
|
||||
}
|
||||
|
||||
void FullColorFillTool::updateTranslation() {
|
||||
m_fillDepth.setQStringName(tr("Fill Depth"));
|
||||
}
|
||||
|
||||
FillParameters FullColorFillTool::getFillParameters() const {
|
||||
FillParameters params;
|
||||
int styleId = TTool::getApplication()->getCurrentLevelStyleIndex();
|
||||
params.m_styleId = styleId;
|
||||
params.m_minFillDepth = (int)m_fillDepth.getValue().first;
|
||||
params.m_maxFillDepth = (int)m_fillDepth.getValue().second;
|
||||
|
||||
if (m_level) params.m_palette = m_level->getPalette();
|
||||
return params;
|
||||
}
|
||||
|
||||
void FullColorFillTool::leftButtonDown(const TPointD &pos,
|
||||
const TMouseEvent &e) {
|
||||
m_clickPoint = pos;
|
||||
TXshLevel *xl = TTool::getApplication()->getCurrentLevel()->getLevel();
|
||||
m_level = xl ? xl->getSimpleLevel() : 0;
|
||||
FillParameters params = getFillParameters();
|
||||
doFill(getImage(true), pos, params, e.isShiftPressed(), m_level.getPointer(),
|
||||
getCurrentFid());
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void FullColorFillTool::leftButtonDrag(const TPointD &pos,
|
||||
const TMouseEvent &e) {
|
||||
FillParameters params = getFillParameters();
|
||||
if (m_clickPoint == pos) return;
|
||||
if (!m_level || !params.m_palette) return;
|
||||
TImageP img = getImage(true);
|
||||
TPixel32 fillColor =
|
||||
params.m_palette->getStyle(params.m_styleId)->getMainColor();
|
||||
if (TRasterImageP ri = img) {
|
||||
TRaster32P ras = ri->getRaster();
|
||||
if (!ras) return;
|
||||
TPointD center = ras->getCenterD();
|
||||
TPoint ipos = convert(pos + center);
|
||||
if (!ras->getBounds().contains(ipos)) return;
|
||||
TPixel32 pix = ras->pixels(ipos.y)[ipos.x];
|
||||
if (pix == fillColor) {
|
||||
invalidate();
|
||||
return;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
doFill(img, pos, params, e.isShiftPressed(), m_level.getPointer(),
|
||||
getCurrentFid());
|
||||
invalidate();
|
||||
}
|
||||
|
||||
bool FullColorFillTool::onPropertyChanged(std::string propertyName) {
|
||||
// Fill Depth
|
||||
if (propertyName == m_fillDepth.getName()) {
|
||||
FullColorMinFillDepth = (int)m_fillDepth.getValue().first;
|
||||
FullColorMaxFillDepth = (int)m_fillDepth.getValue().second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FullColorFillTool::onActivate() {
|
||||
static bool firstTime = true;
|
||||
if (firstTime) {
|
||||
m_fillDepth.setValue(TDoublePairProperty::Value(FullColorMinFillDepth,
|
||||
FullColorMaxFillDepth));
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
|
||||
int FullColorFillTool::getCursorId() const {
|
||||
int ret = ToolCursor::FillCursor;
|
||||
if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg)
|
||||
ret = ret | ToolCursor::Ex_Negate;
|
||||
return ret;
|
||||
}
|
||||
|
||||
FullColorFillTool FullColorRasterFillTool;
|
45
toonz/sources/tnztools/fullcolorfilltool.h
Normal file
45
toonz/sources/tnztools/fullcolorfilltool.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef FULLCOLORFILLTOOL_H
|
||||
#define FULLCOLORFILLTOOL_H
|
||||
|
||||
// TnzCore includes
|
||||
#include "tproperty.h"
|
||||
|
||||
// TnzTools includes
|
||||
#include "tools/tool.h"
|
||||
#include "toonz/fill.h"
|
||||
#include "toonz/txshsimplelevel.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QObject>
|
||||
|
||||
class FullColorFillTool final : public QObject, public TTool {
|
||||
Q_DECLARE_TR_FUNCTIONS(FullColorFillTool)
|
||||
|
||||
TXshSimpleLevelP m_level;
|
||||
TDoublePairProperty m_fillDepth;
|
||||
TPropertyGroup m_prop;
|
||||
TPointD m_clickPoint;
|
||||
|
||||
public:
|
||||
FullColorFillTool();
|
||||
|
||||
ToolType getToolType() const override { return TTool::LevelWriteTool; }
|
||||
|
||||
void updateTranslation() override;
|
||||
|
||||
TPropertyGroup *getProperties(int targetType) override { return &m_prop; }
|
||||
|
||||
FillParameters getFillParameters() const;
|
||||
|
||||
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
||||
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
||||
|
||||
bool onPropertyChanged(std::string propertyName) override;
|
||||
|
||||
void onActivate() override;
|
||||
int getCursorId() const override;
|
||||
};
|
||||
|
||||
#endif // FULLCOLORFILLTOOL_H
|
|
@ -401,18 +401,11 @@ bool PaintBrushTool::onPropertyChanged(std::string propertyName) {
|
|||
|
||||
// Selective
|
||||
else if (propertyName == m_onlyEmptyAreas.getName()) {
|
||||
if (m_onlyEmptyAreas.getValue() && m_colorType.getValue() == LINES) {
|
||||
m_colorType.setValue(AREAS);
|
||||
PaintBrushColorType = ::to_string(m_colorType.getValue());
|
||||
}
|
||||
PaintBrushSelective = (int)(m_onlyEmptyAreas.getValue());
|
||||
}
|
||||
|
||||
// Areas, Lines etc.
|
||||
else if (propertyName == m_colorType.getName()) {
|
||||
if (m_colorType.getValue() == LINES) {
|
||||
PaintBrushSelective = (int)(m_onlyEmptyAreas.getValue());
|
||||
}
|
||||
PaintBrushColorType = ::to_string(m_colorType.getValue());
|
||||
/*--- ColorModelのCursor更新のためにSIGNALを出す ---*/
|
||||
TTool::getApplication()->getCurrentTool()->notifyToolChanged();
|
||||
|
|
|
@ -63,14 +63,15 @@ StylePickerTool::StylePickerTool()
|
|||
void StylePickerTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {
|
||||
m_oldStyleId = m_currentStyleId =
|
||||
getApplication()->getCurrentLevelStyleIndex();
|
||||
pick(pos, e);
|
||||
pick(pos, e, false);
|
||||
}
|
||||
|
||||
void StylePickerTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
|
||||
pick(pos, e);
|
||||
}
|
||||
|
||||
void StylePickerTool::pick(const TPointD &pos, const TMouseEvent &e) {
|
||||
void StylePickerTool::pick(const TPointD &pos, const TMouseEvent &e,
|
||||
bool isDragging) {
|
||||
// Area = 0, Line = 1, All = 2
|
||||
int modeValue = m_colorType.getIndex();
|
||||
|
||||
|
@ -132,7 +133,8 @@ void StylePickerTool::pick(const TPointD &pos, const TMouseEvent &e) {
|
|||
->getSelection()
|
||||
->selectNone();
|
||||
/*-- StyleIdの移動 --*/
|
||||
getApplication()->setCurrentLevelStyleIndex(superPicked_StyleId);
|
||||
getApplication()->setCurrentLevelStyleIndex(superPicked_StyleId,
|
||||
!isDragging);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +183,12 @@ void StylePickerTool::pick(const TPointD &pos, const TMouseEvent &e) {
|
|||
if (styleSelection) styleSelection->selectNone();
|
||||
}
|
||||
|
||||
getApplication()->setCurrentLevelStyleIndex(styleId);
|
||||
// When clicking and switching between studio palette and level palette, the
|
||||
// signal broadcastColorStyleSwitched is not emitted if the picked style is
|
||||
// previously selected one.
|
||||
// Therefore here I set the "forceEmit" flag to true in order to emit the
|
||||
// signal whenever the picking with mouse press.
|
||||
getApplication()->setCurrentLevelStyleIndex(styleId, !isDragging);
|
||||
}
|
||||
|
||||
void StylePickerTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
||||
|
||||
void pick(const TPointD &pos, const TMouseEvent &e);
|
||||
void pick(const TPointD &pos, const TMouseEvent &e, bool isDragging = true);
|
||||
|
||||
void mouseMove(const TPointD &pos, const TMouseEvent &e) override;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "toonzqt/gutil.h"
|
||||
#include "toonzqt/dvscrollwidget.h"
|
||||
#include "toonzqt/lutcalibrator.h"
|
||||
#include "toonzqt/viewcommandids.h"
|
||||
|
||||
// TnzLib includes
|
||||
#include "toonz/tobjecthandle.h"
|
||||
|
@ -124,7 +125,8 @@ ToolOptionsBox::ToolOptionsBox(QWidget *parent, bool isScrollable)
|
|||
ToolOptionsBox::~ToolOptionsBox() {
|
||||
std::for_each(m_controls.begin(), m_controls.end(),
|
||||
std::default_delete<ToolOptionControl>());
|
||||
std::for_each(m_labels.begin(), m_labels.end(), std::default_delete<QLabel>());
|
||||
std::for_each(m_labels.begin(), m_labels.end(),
|
||||
std::default_delete<QLabel>());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -217,6 +219,17 @@ void ToolOptionControlBuilder::visit(TDoubleProperty *p) {
|
|||
control->addAction(a);
|
||||
QObject::connect(a, SIGNAL(triggered()), control, SLOT(decrease()));
|
||||
}
|
||||
if (p->getName() == "ModifierSize") {
|
||||
QAction *a;
|
||||
a = cm->getAction("A_IncreaseMaxBrushThickness");
|
||||
control->addAction(a);
|
||||
QObject::connect(a, SIGNAL(triggered()), control,
|
||||
SLOT(increaseFractional()));
|
||||
a = cm->getAction("A_DecreaseMaxBrushThickness");
|
||||
control->addAction(a);
|
||||
QObject::connect(a, SIGNAL(triggered()), control,
|
||||
SLOT(decreaseFractional()));
|
||||
}
|
||||
if (p->getName() == "Hardness:") {
|
||||
QAction *a;
|
||||
a = cm->getAction("A_IncreaseBrushHardness");
|
||||
|
@ -1609,7 +1622,7 @@ PaintbrushToolOptionsBox::PaintbrushToolOptionsBox(QWidget *parent, TTool *tool,
|
|||
dynamic_cast<ToolOptionCheckbox *>(m_controls.value("Selective"));
|
||||
|
||||
if (m_colorMode->getProperty()->getValue() == L"Lines")
|
||||
m_selectiveMode->setEnabled(false);
|
||||
m_selectiveMode->setVisible(false);
|
||||
|
||||
bool ret = connect(m_colorMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onColorModeChanged(int)));
|
||||
|
@ -1629,7 +1642,26 @@ void PaintbrushToolOptionsBox::updateStatus() {
|
|||
void PaintbrushToolOptionsBox::onColorModeChanged(int index) {
|
||||
const TEnumProperty::Range &range = m_colorMode->getProperty()->getRange();
|
||||
bool enabled = range[index] != L"Lines";
|
||||
m_selectiveMode->setEnabled(enabled);
|
||||
m_selectiveMode->setVisible(enabled);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// FullColorFillToolOptionsBox
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
FullColorFillToolOptionsBox::FullColorFillToolOptionsBox(
|
||||
QWidget *parent, TTool *tool, TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle)
|
||||
: ToolOptionsBox(parent) {
|
||||
TPropertyGroup *props = tool->getProperties(0);
|
||||
assert(props->getPropertyCount() > 0);
|
||||
|
||||
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
||||
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
|
||||
|
||||
m_layout->addStretch(0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -2365,7 +2397,8 @@ protected:
|
|||
p.setPen(Qt::black);
|
||||
p.setBrush(Qt::NoBrush);
|
||||
|
||||
p.drawText(rect(), Qt::AlignCenter, QString("R:%1 G:%2 B:%3")
|
||||
p.drawText(rect(), Qt::AlignCenter,
|
||||
QString("R:%1 G:%2 B:%3")
|
||||
.arg(m_color.red())
|
||||
.arg(m_color.green())
|
||||
.arg(m_color.blue()));
|
||||
|
@ -2636,6 +2669,74 @@ void ShiftTraceToolOptionBox::onAfterRadioBtnClicked() {
|
|||
stTool->setCurrentGhostIndex(1);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// ZoomToolOptionBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ZoomToolOptionsBox::ZoomToolOptionsBox(QWidget *parent, TTool *tool,
|
||||
TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle)
|
||||
: ToolOptionsBox(parent) {
|
||||
setFrameStyle(QFrame::StyledPanel);
|
||||
setFixedHeight(26);
|
||||
|
||||
QAction *resetZoomAction = CommandManager::instance()->getAction(V_ZoomReset);
|
||||
|
||||
QPushButton *button = new QPushButton(tr("Reset Zoom"));
|
||||
button->setFixedHeight(20);
|
||||
button->addAction(resetZoomAction);
|
||||
connect(button, SIGNAL(clicked()), resetZoomAction, SLOT(trigger()));
|
||||
|
||||
m_layout->addStretch(1);
|
||||
m_layout->addWidget(button, 0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// RotateToolOptionBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
RotateToolOptionsBox::RotateToolOptionsBox(QWidget *parent, TTool *tool,
|
||||
TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle)
|
||||
: ToolOptionsBox(parent) {
|
||||
setFrameStyle(QFrame::StyledPanel);
|
||||
setFixedHeight(26);
|
||||
|
||||
QAction *resetRotationAction =
|
||||
CommandManager::instance()->getAction(V_RotateReset);
|
||||
|
||||
QPushButton *button = new QPushButton(tr("Reset Rotation"));
|
||||
button->setFixedHeight(20);
|
||||
button->addAction(resetRotationAction);
|
||||
connect(button, SIGNAL(clicked()), resetRotationAction, SLOT(trigger()));
|
||||
|
||||
m_layout->addStretch(1);
|
||||
m_layout->addWidget(button, 0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// HandToolOptionBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
HandToolOptionsBox::HandToolOptionsBox(QWidget *parent, TTool *tool,
|
||||
TPaletteHandle *pltHandle,
|
||||
ToolHandle *toolHandle)
|
||||
: ToolOptionsBox(parent) {
|
||||
setFrameStyle(QFrame::StyledPanel);
|
||||
setFixedHeight(26);
|
||||
|
||||
QAction *resetPositionAction =
|
||||
CommandManager::instance()->getAction(V_PositionReset);
|
||||
|
||||
QPushButton *button = new QPushButton(tr("Reset Position"));
|
||||
button->setFixedHeight(20);
|
||||
button->addAction(resetPositionAction);
|
||||
connect(button, SIGNAL(clicked()), resetPositionAction, SLOT(trigger()));
|
||||
|
||||
m_layout->addStretch(1);
|
||||
m_layout->addWidget(button, 0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// ToolOptions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2727,9 +2828,13 @@ void ToolOptions::onToolSwitched() {
|
|||
panel = new TypeToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_PaintBrush)
|
||||
panel = new PaintbrushToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_Fill)
|
||||
else if (tool->getName() == T_Fill) {
|
||||
if (tool->getTargetType() & TTool::RasterImage)
|
||||
panel =
|
||||
new FullColorFillToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else
|
||||
panel = new FillToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_Eraser)
|
||||
} else if (tool->getName() == T_Eraser)
|
||||
panel = new EraserToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_Tape)
|
||||
panel = new TapeToolOptionsBox(0, tool, currPalette, currTool);
|
||||
|
@ -2746,6 +2851,12 @@ void ToolOptions::onToolSwitched() {
|
|||
app->getPaletteController());
|
||||
else if (tool->getName() == "T_ShiftTrace")
|
||||
panel = new ShiftTraceToolOptionBox(this, tool);
|
||||
else if (tool->getName() == T_Zoom)
|
||||
panel = new ZoomToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_Rotate)
|
||||
panel = new RotateToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else if (tool->getName() == T_Hand)
|
||||
panel = new HandToolOptionsBox(0, tool, currPalette, currTool);
|
||||
else
|
||||
panel = tool->createOptionsBox(); // Only this line should remain out
|
||||
// of that if/else monstrosity
|
||||
|
|
|
@ -192,7 +192,7 @@ void ToolOptionSlider::onValueChanged(bool isDragging) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ToolOptionSlider::increase() {
|
||||
void ToolOptionSlider::increase(double step) {
|
||||
if (m_toolHandle && m_toolHandle->getTool() != m_tool) return;
|
||||
// active only if the belonging combo-viewer is visible
|
||||
if (!isInVisibleViewer(this)) return;
|
||||
|
@ -201,7 +201,7 @@ void ToolOptionSlider::increase() {
|
|||
double minValue, maxValue;
|
||||
getRange(minValue, maxValue);
|
||||
|
||||
value += 1;
|
||||
value += step;
|
||||
if (value > maxValue) value = maxValue;
|
||||
|
||||
setValue(value);
|
||||
|
@ -213,7 +213,11 @@ void ToolOptionSlider::increase() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ToolOptionSlider::decrease() {
|
||||
void ToolOptionSlider::increaseFractional() { increase(0.06); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ToolOptionSlider::decrease(double step) {
|
||||
if (m_toolHandle && m_toolHandle->getTool() != m_tool) return;
|
||||
// active only if the belonging combo-viewer is visible
|
||||
if (!isInVisibleViewer(this)) return;
|
||||
|
@ -222,7 +226,7 @@ void ToolOptionSlider::decrease() {
|
|||
double minValue, maxValue;
|
||||
getRange(minValue, maxValue);
|
||||
|
||||
value -= 1;
|
||||
value -= step;
|
||||
if (value < minValue) value = minValue;
|
||||
|
||||
setValue(value);
|
||||
|
@ -232,6 +236,10 @@ void ToolOptionSlider::decrease() {
|
|||
repaint();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ToolOptionSlider::decreaseFractional() { decrease(0.06); }
|
||||
|
||||
//=============================================================================
|
||||
|
||||
ToolOptionPairSlider::ToolOptionPairSlider(TTool *tool,
|
||||
|
|
|
@ -119,8 +119,10 @@ public:
|
|||
protected slots:
|
||||
|
||||
void onValueChanged(bool isDragging);
|
||||
void increase();
|
||||
void decrease();
|
||||
void increase(double step = 1.0);
|
||||
void decrease(double step = 1.0);
|
||||
void increaseFractional();
|
||||
void decreaseFractional();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -244,7 +244,7 @@ void ColorModelViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
menu.addSeparator();
|
||||
|
||||
QString shortcut = QString::fromStdString(
|
||||
CommandManager::instance()->getShortcutFromId(V_ZoomReset));
|
||||
CommandManager::instance()->getShortcutFromId(V_ViewReset));
|
||||
QAction *reset = menu.addAction(tr("Reset View") + "\t " + shortcut);
|
||||
connect(reset, SIGNAL(triggered()), m_imageViewer, SLOT(resetView()));
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ void TColumnSelection::explodeChild() {
|
|||
static bool canMergeColumns(int column, int mColumn, bool forMatchlines) {
|
||||
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||
|
||||
if (xsh->getColumn(column)->isLocked()) return false;
|
||||
if (!xsh || !xsh->getColumn(column) || xsh->getColumn(column)->isLocked())
|
||||
return false;
|
||||
|
||||
int start, end;
|
||||
xsh->getCellRange(column, start, end);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "toonz/palettecontroller.h"
|
||||
#include "toonz/toonzfolders.h"
|
||||
#include "toonz/preferences.h"
|
||||
#include "toonz/tproject.h"
|
||||
|
||||
// TnzQt includes
|
||||
#include "toonzqt/menubarcommand.h"
|
||||
|
@ -616,11 +617,13 @@ void ComboViewerPanel::changeWindowTitle() {
|
|||
|
||||
// if the frame type is "scene editing"
|
||||
if (app->getCurrentFrame()->isEditingScene()) {
|
||||
TProject *project = scene->getProject();
|
||||
QString projectName = QString::fromStdString(project->getName().getName());
|
||||
QString sceneName = QString::fromStdWString(scene->getSceneName());
|
||||
if (sceneName.isEmpty()) sceneName = tr("Untitled");
|
||||
|
||||
if (app->getCurrentScene()->getDirtyFlag()) sceneName += QString("*");
|
||||
name = tr("Scene: ") + sceneName;
|
||||
name = tr("Scene: ") + sceneName + tr(" :: Project: ") + projectName;
|
||||
if (frame >= 0)
|
||||
name =
|
||||
name + tr(" :: Frame: ") + tr(std::to_string(frame + 1).c_str());
|
||||
|
|
|
@ -316,7 +316,7 @@ CommandBarListTree::CommandBarListTree(QWidget* parent) : QTreeWidget(parent) {
|
|||
addFolder(ShortcutTree::tr("Right-click Menu Commands"),
|
||||
RightClickMenuCommandType);
|
||||
addFolder(ShortcutTree::tr("Tool Modifiers"), ToolModifierCommandType);
|
||||
addFolder(ShortcutTree::tr("Visualization"), ZoomCommandType);
|
||||
addFolder(ShortcutTree::tr("Visualization"), VisualizationButtonCommandType);
|
||||
addFolder(ShortcutTree::tr("Misc"), MiscCommandType);
|
||||
addFolder(ShortcutTree::tr("RGBA Channels"), RGBACommandType);
|
||||
|
||||
|
|
|
@ -70,9 +70,8 @@ void doUpdateXSheet(TXshSimpleLevel *sl, std::vector<TFrameId> oldFids,
|
|||
cells[i].m_level->getType() == CHILD_XSHLEVEL) {
|
||||
TXshChildLevel *level = cells[i].m_level->getChildLevel();
|
||||
// make sure we haven't already checked the level
|
||||
if (level &&
|
||||
std::find(childLevels.begin(), childLevels.end(), level) ==
|
||||
childLevels.end()) {
|
||||
if (level && std::find(childLevels.begin(), childLevels.end(),
|
||||
level) == childLevels.end()) {
|
||||
childLevels.push_back(level);
|
||||
TXsheet *subXsh = level->getXsheet();
|
||||
doUpdateXSheet(sl, oldFids, newFids, subXsh, childLevels);
|
||||
|
@ -101,7 +100,7 @@ void doUpdateXSheet(TXshSimpleLevel *sl, std::vector<TFrameId> oldFids,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void updateXSheet(TXshSimpleLevel *sl, std::vector<TFrameId> oldFids,
|
||||
static void updateXSheet(TXshSimpleLevel *sl, std::vector<TFrameId> oldFids,
|
||||
std::vector<TFrameId> newFids) {
|
||||
std::vector<TXshChildLevel *> childLevels;
|
||||
TXsheet *xsh =
|
||||
|
|
|
@ -137,6 +137,7 @@ TPanel *OpenFloatingPanel::getOrOpenFloatingPanel(
|
|||
QString::fromStdString(panelType));
|
||||
if (!panel) return 0; // it should never happen
|
||||
// panel->setWindowTitle(QObject::tr(m_title.toStdString().c_str()));
|
||||
panel->restoreFloatingPanelState();
|
||||
panel->setFloating(true);
|
||||
panel->show();
|
||||
panel->raise();
|
||||
|
|
|
@ -59,6 +59,7 @@ FxParamEditorPopup::FxParamEditorPopup()
|
|||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
OpenPopupCommandHandler<FxParamEditorPopup> openFxParamEditorPopup(
|
||||
MI_FxParamEditor);
|
||||
*/
|
|
@ -39,6 +39,7 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QGestureEvent>
|
||||
|
||||
//===================================================================================
|
||||
|
||||
|
@ -118,8 +119,8 @@ class FlipZoomer final : public ImageUtils::ShortcutZoomer {
|
|||
public:
|
||||
FlipZoomer(ImageViewer *parent) : ShortcutZoomer(parent) {}
|
||||
|
||||
bool zoom(bool zoomin, bool resetZoom) override {
|
||||
static_cast<ImageViewer *>(getWidget())->zoomQt(zoomin, resetZoom);
|
||||
bool zoom(bool zoomin, bool resetView) override {
|
||||
static_cast<ImageViewer *>(getWidget())->zoomQt(zoomin, resetView);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -128,6 +129,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool resetZoom() override {
|
||||
static_cast<ImageViewer *>(getWidget())->resetZoom();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool toggleFullScreen(bool quit) override {
|
||||
if (ImageUtils::FullScreenWidget *fsWidget =
|
||||
dynamic_cast<ImageUtils::FullScreenWidget *>(
|
||||
|
@ -218,7 +224,8 @@ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook,
|
|||
, m_isColorModel(false)
|
||||
, m_histogramPopup(0)
|
||||
, m_isRemakingPreviewFx(false)
|
||||
, m_rectRGBPick(false) {
|
||||
, m_rectRGBPick(false)
|
||||
, m_firstImage(true) {
|
||||
m_visualSettings.m_sceneProperties =
|
||||
TApp::instance()->getCurrentScene()->getScene()->getProperties();
|
||||
m_visualSettings.m_drawExternalBG = true;
|
||||
|
@ -227,6 +234,11 @@ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook,
|
|||
|
||||
setMouseTracking(true);
|
||||
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
grabGesture(Qt::SwipeGesture);
|
||||
grabGesture(Qt::PanGesture);
|
||||
grabGesture(Qt::PinchGesture);
|
||||
|
||||
if (m_isHistogramEnable)
|
||||
m_histogramPopup = new HistogramPopup(tr("Flipbook Histogram"));
|
||||
|
||||
|
@ -237,8 +249,6 @@ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
||||
if (!m_flipbook) return;
|
||||
|
||||
QAction *action;
|
||||
|
||||
if (m_isColorModel) {
|
||||
|
@ -248,6 +258,7 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
||||
if (m_flipbook) {
|
||||
if (m_flipbook->getPreviewedFx()) {
|
||||
if (!(windowState() & Qt::WindowFullScreen)) {
|
||||
action = menu->addAction(tr("Clone Preview"));
|
||||
|
@ -260,7 +271,8 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
action = menu->addAction(tr("Unfreeze Preview"));
|
||||
action->setShortcut(QKeySequence(
|
||||
CommandManager::instance()->getKeyFromId(MI_FreezePreview)));
|
||||
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(unfreezePreview()));
|
||||
connect(action, SIGNAL(triggered()), m_flipbook,
|
||||
SLOT(unfreezePreview()));
|
||||
} else {
|
||||
action = menu->addAction(tr("Freeze Preview"));
|
||||
action->setShortcut(QKeySequence(
|
||||
|
@ -294,10 +306,11 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(saveImages()));
|
||||
}
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
QAction *reset = menu->addAction(tr("Reset View"));
|
||||
reset->setShortcut(
|
||||
QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomReset)));
|
||||
QKeySequence(CommandManager::instance()->getKeyFromId(V_ViewReset)));
|
||||
connect(reset, SIGNAL(triggered()), SLOT(resetView()));
|
||||
|
||||
QAction *fit = menu->addAction(tr("Fit To Window"));
|
||||
|
@ -305,8 +318,8 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomFit)));
|
||||
connect(fit, SIGNAL(triggered()), SLOT(fitView()));
|
||||
|
||||
if (m_flipbook) {
|
||||
#ifdef _WIN32
|
||||
|
||||
if (ImageUtils::FullScreenWidget *fsWidget =
|
||||
dynamic_cast<ImageUtils::FullScreenWidget *>(parentWidget())) {
|
||||
bool isFullScreen = (fsWidget->windowState() & Qt::WindowFullScreen) != 0;
|
||||
|
@ -336,11 +349,14 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|||
action = menu->addAction(tr("Swap Compared Images"));
|
||||
connect(action, SIGNAL(triggered()), SLOT(swapCompared()));
|
||||
}
|
||||
}
|
||||
|
||||
menu->exec(event->globalPos());
|
||||
|
||||
if (m_flipbook) {
|
||||
action = CommandManager::instance()->getAction(MI_LoadRecentImage);
|
||||
action->setParent(0);
|
||||
}
|
||||
|
||||
delete menu;
|
||||
update();
|
||||
|
@ -376,6 +392,15 @@ ImageViewer::~ImageViewer() {
|
|||
void ImageViewer::setImage(TImageP image) {
|
||||
m_image = image;
|
||||
|
||||
if (m_image && m_firstImage) {
|
||||
m_firstImage = false;
|
||||
fitView();
|
||||
// when the viewer size is large enough, limit the zoom ratio to 100% so
|
||||
// that the image is shown in actual pixel size without jaggies due to
|
||||
// resampling.
|
||||
if (fabs(m_viewAff.det()) > 1.0) resetView();
|
||||
}
|
||||
|
||||
if (m_isHistogramEnable && m_histogramPopup->isVisible())
|
||||
m_histogramPopup->setImage(image);
|
||||
if (!isColorModel())
|
||||
|
@ -660,6 +685,14 @@ void ImageViewer::zoomQt(bool forward, bool reset) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImageViewer::resetZoom() {
|
||||
double oldZoomScale = sqrt(m_viewAff.det());
|
||||
setViewAff(TScale(1.0 / oldZoomScale) * m_viewAff);
|
||||
update();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImageViewer::dragCompare(const QPoint &dp) {
|
||||
if (m_compareSettings.m_dragCompareX)
|
||||
m_compareSettings.m_compareX += ((double)dp.x()) / width();
|
||||
|
@ -733,6 +766,12 @@ void ImageViewer::updateCursor(const TPoint &curPos) {
|
|||
*/
|
||||
void ImageViewer::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (!m_image) return;
|
||||
|
||||
if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen &&
|
||||
!m_stylusUsed) {
|
||||
return;
|
||||
}
|
||||
|
||||
QPoint curQPos = event->pos() * getDevPixRatio();
|
||||
|
||||
TPoint curPos = TPoint(curQPos.x(), curQPos.y());
|
||||
|
@ -939,6 +978,13 @@ int ImageViewer::getDragType(const TPoint &pos, const TRect &loadbox) {
|
|||
//-------------------------------------------------------------------------------
|
||||
void ImageViewer::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
if (!m_image) return;
|
||||
// qDebug() << "[mouseDoubleClickEvent]";
|
||||
if (m_gestureActive && !m_stylusUsed) {
|
||||
m_gestureActive = false;
|
||||
fitView();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_visualSettings.m_defineLoadbox && m_flipbook) {
|
||||
m_flipbook->setLoadbox(TRect());
|
||||
update();
|
||||
|
@ -950,6 +996,13 @@ void ImageViewer::mouseDoubleClickEvent(QMouseEvent *event) {
|
|||
|
||||
void ImageViewer::mousePressEvent(QMouseEvent *event) {
|
||||
if (!m_image) return;
|
||||
|
||||
// qDebug() << "[mousePressEvent]";
|
||||
if (m_gestureActive && m_touchDevice == QTouchDevice::TouchScreen &&
|
||||
!m_stylusUsed) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pos = event->pos() * getDevPixRatio();
|
||||
m_pressedMousePos = TPoint(m_pos.x(), m_pos.y());
|
||||
m_mouseButton = event->button();
|
||||
|
@ -1026,6 +1079,11 @@ void ImageViewer::mouseReleaseEvent(QMouseEvent *event) {
|
|||
m_mouseButton = Qt::NoButton;
|
||||
m_compareSettings.m_dragCompareX = m_compareSettings.m_dragCompareY = false;
|
||||
|
||||
m_gestureActive = false;
|
||||
m_zooming = false;
|
||||
m_panning = false;
|
||||
m_stylusUsed = false;
|
||||
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
@ -1035,11 +1093,51 @@ void ImageViewer::mouseReleaseEvent(QMouseEvent *event) {
|
|||
void ImageViewer::wheelEvent(QWheelEvent *event) {
|
||||
if (!m_image) return;
|
||||
if (event->orientation() == Qt::Horizontal) return;
|
||||
int delta = 0;
|
||||
switch (event->source()) {
|
||||
case Qt::MouseEventNotSynthesized: {
|
||||
if (event->modifiers() & Qt::AltModifier)
|
||||
delta = event->angleDelta().x();
|
||||
else
|
||||
delta = event->angleDelta().y();
|
||||
break;
|
||||
}
|
||||
|
||||
case Qt::MouseEventSynthesizedBySystem: {
|
||||
QPoint numPixels = event->pixelDelta();
|
||||
QPoint numDegrees = event->angleDelta() / 8;
|
||||
if (!numPixels.isNull()) {
|
||||
delta = event->pixelDelta().y();
|
||||
} else if (!numDegrees.isNull()) {
|
||||
QPoint numSteps = numDegrees / 15;
|
||||
delta = numSteps.y();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: // Qt::MouseEventSynthesizedByQt,
|
||||
// Qt::MouseEventSynthesizedByApplication
|
||||
{
|
||||
std::cout << "not supported event: Qt::MouseEventSynthesizedByQt, "
|
||||
"Qt::MouseEventSynthesizedByApplication"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
} // end switch
|
||||
|
||||
if (abs(delta) > 0) {
|
||||
if ((m_gestureActive == true &&
|
||||
m_touchDevice == QTouchDevice::TouchScreen) ||
|
||||
m_gestureActive == false) {
|
||||
int delta = event->delta() > 0 ? 120 : -120;
|
||||
QPoint center(event->pos().x() * getDevPixRatio() - width() / 2,
|
||||
-event->pos().y() * getDevPixRatio() + height() / 2);
|
||||
zoomQt(center, exp(0.001 * delta));
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -1168,6 +1266,179 @@ void ImageViewer::onContextAboutToBeDestroyed() {
|
|||
doneCurrent();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void ImageViewer::tabletEvent(QTabletEvent *e) {
|
||||
// qDebug() << "[tabletEvent]";
|
||||
if (e->type() == QTabletEvent::TabletPress) {
|
||||
m_stylusUsed = e->pointerType() ? true : false;
|
||||
} else if (e->type() == QTabletEvent::TabletRelease) {
|
||||
m_stylusUsed = false;
|
||||
}
|
||||
|
||||
e->accept();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void ImageViewer::gestureEvent(QGestureEvent *e) {
|
||||
// qDebug() << "[gestureEvent]";
|
||||
m_gestureActive = false;
|
||||
if (QGesture *swipe = e->gesture(Qt::SwipeGesture)) {
|
||||
m_gestureActive = true;
|
||||
} else if (QGesture *pan = e->gesture(Qt::PanGesture)) {
|
||||
m_gestureActive = true;
|
||||
}
|
||||
if (QGesture *pinch = e->gesture(Qt::PinchGesture)) {
|
||||
QPinchGesture *gesture = static_cast<QPinchGesture *>(pinch);
|
||||
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
|
||||
QPoint firstCenter = gesture->centerPoint().toPoint();
|
||||
if (m_touchDevice == QTouchDevice::TouchScreen)
|
||||
firstCenter = mapFromGlobal(firstCenter);
|
||||
|
||||
if (gesture->state() == Qt::GestureStarted) {
|
||||
m_gestureActive = true;
|
||||
} else if (gesture->state() == Qt::GestureFinished) {
|
||||
m_gestureActive = false;
|
||||
m_zooming = false;
|
||||
m_scaleFactor = 0.0;
|
||||
} else {
|
||||
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
|
||||
double scaleFactor = gesture->scaleFactor();
|
||||
// the scale factor makes for too sensitive scaling
|
||||
// divide the change in half
|
||||
if (scaleFactor > 1) {
|
||||
double decimalValue = scaleFactor - 1;
|
||||
decimalValue /= 1.5;
|
||||
scaleFactor = 1 + decimalValue;
|
||||
} else if (scaleFactor < 1) {
|
||||
double decimalValue = 1 - scaleFactor;
|
||||
decimalValue /= 1.5;
|
||||
scaleFactor = 1 - decimalValue;
|
||||
}
|
||||
if (!m_zooming) {
|
||||
double delta = scaleFactor - 1;
|
||||
m_scaleFactor += delta;
|
||||
if (m_scaleFactor > .2 || m_scaleFactor < -.2) {
|
||||
m_zooming = true;
|
||||
}
|
||||
}
|
||||
if (m_zooming) {
|
||||
const QPoint center(
|
||||
firstCenter.x() * getDevPixRatio() - width() / 2,
|
||||
-firstCenter.y() * getDevPixRatio() + height() / 2);
|
||||
zoomQt(center, scaleFactor);
|
||||
m_panning = false;
|
||||
}
|
||||
m_gestureActive = true;
|
||||
}
|
||||
|
||||
if (changeFlags & QPinchGesture::CenterPointChanged) {
|
||||
QPointF centerDelta = (gesture->centerPoint() * getDevPixRatio()) -
|
||||
(gesture->lastCenterPoint() * getDevPixRatio());
|
||||
if (centerDelta.manhattanLength() > 1) {
|
||||
// panQt(centerDelta.toPoint());
|
||||
}
|
||||
m_gestureActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
|
||||
void ImageViewer::touchEvent(QTouchEvent *e, int type) {
|
||||
// qDebug() << "[touchEvent]";
|
||||
if (type == QEvent::TouchBegin) {
|
||||
m_touchActive = true;
|
||||
m_firstPanPoint = e->touchPoints().at(0).pos();
|
||||
// obtain device type
|
||||
m_touchDevice = e->device()->type();
|
||||
} else if (m_touchActive) {
|
||||
// touchpads must have 2 finger panning for tools and navigation to be
|
||||
// functional on other devices, 1 finger panning is preferred
|
||||
if ((e->touchPoints().count() == 2 &&
|
||||
m_touchDevice == QTouchDevice::TouchPad) ||
|
||||
(e->touchPoints().count() == 1 &&
|
||||
m_touchDevice == QTouchDevice::TouchScreen)) {
|
||||
QTouchEvent::TouchPoint panPoint = e->touchPoints().at(0);
|
||||
if (!m_panning) {
|
||||
QPointF deltaPoint = panPoint.pos() - m_firstPanPoint;
|
||||
// minimize accidental and jerky zooming/rotating during 2 finger
|
||||
// panning
|
||||
if ((deltaPoint.manhattanLength() > 100) && !m_zooming) {
|
||||
m_panning = true;
|
||||
}
|
||||
}
|
||||
if (m_panning) {
|
||||
QPoint curPos = panPoint.pos().toPoint() * getDevPixRatio();
|
||||
QPoint lastPos = panPoint.lastPos().toPoint() * getDevPixRatio();
|
||||
QPoint centerDelta = curPos - lastPos;
|
||||
panQt(centerDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type == QEvent::TouchEnd || type == QEvent::TouchCancel) {
|
||||
m_touchActive = false;
|
||||
m_panning = false;
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
|
||||
bool ImageViewer::event(QEvent *e) {
|
||||
/*
|
||||
switch (e->type()) {
|
||||
case QEvent::TabletPress: {
|
||||
QTabletEvent *te = static_cast<QTabletEvent *>(e);
|
||||
qDebug() << "[event] TabletPress: pointerType(" << te->pointerType()
|
||||
<< ") device(" << te->device() << ")";
|
||||
} break;
|
||||
case QEvent::TabletRelease:
|
||||
qDebug() << "[event] TabletRelease";
|
||||
break;
|
||||
case QEvent::TouchBegin:
|
||||
qDebug() << "[event] TouchBegin";
|
||||
break;
|
||||
case QEvent::TouchEnd:
|
||||
qDebug() << "[event] TouchEnd";
|
||||
break;
|
||||
case QEvent::TouchCancel:
|
||||
qDebug() << "[event] TouchCancel";
|
||||
break;
|
||||
case QEvent::MouseButtonPress:
|
||||
qDebug() << "[event] MouseButtonPress";
|
||||
break;
|
||||
case QEvent::MouseButtonDblClick:
|
||||
qDebug() << "[event] MouseButtonDblClick";
|
||||
break;
|
||||
case QEvent::MouseButtonRelease:
|
||||
qDebug() << "[event] MouseButtonRelease";
|
||||
break;
|
||||
case QEvent::Gesture:
|
||||
qDebug() << "[event] Gesture";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
if (e->type() == QEvent::Gesture && CommandManager::instance()
|
||||
->getAction(MI_TouchGestureControl)
|
||||
->isChecked()) {
|
||||
gestureEvent(static_cast<QGestureEvent *>(e));
|
||||
return true;
|
||||
}
|
||||
if ((e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd ||
|
||||
e->type() == QEvent::TouchCancel || e->type() == QEvent::TouchUpdate) &&
|
||||
CommandManager::instance()
|
||||
->getAction(MI_TouchGestureControl)
|
||||
->isChecked()) {
|
||||
touchEvent(static_cast<QTouchEvent *>(e), e->type());
|
||||
m_gestureActive = true;
|
||||
return true;
|
||||
}
|
||||
return GLWidgetForHighDpi::event(e);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*! load image from history
|
||||
*/
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "toonz/imagepainter.h"
|
||||
#include "toonzqt/glwidget_for_highdpi.h"
|
||||
|
||||
#include <QTouchDevice>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward declarations
|
||||
|
@ -13,7 +15,8 @@ class FlipBook;
|
|||
class HistogramPopup;
|
||||
class QOpenGLFramebufferObject;
|
||||
class LutCalibrator;
|
||||
|
||||
class QTouchEvent;
|
||||
class QGestureEvent;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//====================
|
||||
|
@ -50,6 +53,7 @@ class ImageViewer final : public GLWidgetForHighDpi {
|
|||
QPoint m_pos;
|
||||
bool m_isHistogramEnable;
|
||||
HistogramPopup *m_histogramPopup;
|
||||
bool m_firstImage;
|
||||
|
||||
bool m_isColorModel;
|
||||
// when fx parameter is modified with showing the fx preview,
|
||||
|
@ -60,6 +64,15 @@ class ImageViewer final : public GLWidgetForHighDpi {
|
|||
QOpenGLFramebufferObject *m_fbo = NULL;
|
||||
LutCalibrator *m_lutCalibrator = NULL;
|
||||
|
||||
bool m_touchActive = false;
|
||||
bool m_gestureActive = false;
|
||||
QTouchDevice::DeviceType m_touchDevice = QTouchDevice::TouchScreen;
|
||||
bool m_zooming = false;
|
||||
bool m_panning = false;
|
||||
double m_scaleFactor; // used for zoom gesture
|
||||
|
||||
bool m_stylusUsed = false;
|
||||
|
||||
int getDragType(const TPoint &pos, const TRect &loadBox);
|
||||
void updateLoadbox(const TPoint &curPos);
|
||||
void updateCursor(const TPoint &curPos);
|
||||
|
@ -96,6 +109,7 @@ public:
|
|||
*/
|
||||
void hideHistogram();
|
||||
void zoomQt(bool forward, bool reset);
|
||||
void resetZoom();
|
||||
|
||||
void setIsRemakingPreviewFx(bool on) {
|
||||
m_isRemakingPreviewFx = on;
|
||||
|
@ -127,6 +141,11 @@ protected:
|
|||
|
||||
void dragCompare(const QPoint &dp);
|
||||
|
||||
void tabletEvent(QTabletEvent *e);
|
||||
void touchEvent(QTouchEvent *e, int type);
|
||||
void gestureEvent(QGestureEvent *e);
|
||||
bool event(QEvent *e);
|
||||
|
||||
public slots:
|
||||
|
||||
void updateImageViewer();
|
||||
|
@ -135,6 +154,9 @@ public slots:
|
|||
void showHistogram();
|
||||
void swapCompared();
|
||||
void onContextAboutToBeDestroyed();
|
||||
|
||||
private:
|
||||
QPointF m_firstPanPoint;
|
||||
};
|
||||
|
||||
#endif // IMAGEVIEWER_INCLUDE
|
||||
|
|
|
@ -1376,21 +1376,45 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
|
|||
|
||||
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
|
||||
|
||||
TXsheet *xsheet = 0;
|
||||
if (saveSubxsheet) xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||
|
||||
// If the scene will be saved in the different folder, check out the scene
|
||||
// cast.
|
||||
// if the cast contains the level specified with $scenefolder alias,
|
||||
// open a warning popup notifying that such level will lose link.
|
||||
|
||||
// in case of saving subxsheet, the current scene will not be switched to the
|
||||
// saved one
|
||||
// so the level paths are needed to be reverted after saving
|
||||
QHash<TXshLevel *, TFilePath> orgLevelPaths;
|
||||
auto revertOrgLevelPaths = [&] {
|
||||
QHash<TXshLevel *, TFilePath>::const_iterator i =
|
||||
orgLevelPaths.constBegin();
|
||||
while (i != orgLevelPaths.constEnd()) {
|
||||
if (TXshSimpleLevel *sil = i.key()->getSimpleLevel())
|
||||
sil->setPath(i.value(), true);
|
||||
else if (TXshPaletteLevel *pal = i.key()->getPaletteLevel())
|
||||
pal->setPath(i.value());
|
||||
else if (TXshSoundLevel *sol = i.key()->getSoundLevel())
|
||||
sol->setPath(i.value());
|
||||
++i;
|
||||
}
|
||||
};
|
||||
|
||||
if (!overwrite) {
|
||||
bool ret = takeCareSceneFolderItemsOnSaveSceneAs(scene, scenePath);
|
||||
if (!ret) return false;
|
||||
bool ret = takeCareSceneFolderItemsOnSaveSceneAs(scene, scenePath, xsheet,
|
||||
orgLevelPaths);
|
||||
if (!ret) {
|
||||
revertOrgLevelPaths();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
TFilePath oldFullPath = scene->decodeFilePath(scene->getScenePath());
|
||||
TFilePath newFullPath = scene->decodeFilePath(scenePath);
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
TXsheet *xsheet = 0;
|
||||
if (saveSubxsheet) xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||
if (app->getCurrentScene()->getDirtyFlag())
|
||||
scene->getContentHistory(true)->modifiedNow();
|
||||
|
||||
|
@ -1414,11 +1438,6 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
|
|||
|
||||
try {
|
||||
scene->save(scenePath, xsheet);
|
||||
TApp::instance()
|
||||
->getPaletteController()
|
||||
->getCurrentLevelPalette()
|
||||
->notifyPaletteChanged(); // non toglieva l'asterisco alla
|
||||
// paletta...forse non va qua? vinz
|
||||
} catch (const TSystemException &se) {
|
||||
DVGui::warning(QString::fromStdWString(se.getMessage()));
|
||||
} catch (...) {
|
||||
|
@ -1427,7 +1446,11 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
|
|||
|
||||
cp->assign(&oldCP);
|
||||
|
||||
if (!overwrite) app->getCurrentScene()->notifyNameSceneChange();
|
||||
// in case of saving subxsheet, revert the level paths after saving
|
||||
revertOrgLevelPaths();
|
||||
|
||||
if (!overwrite && !saveSubxsheet)
|
||||
app->getCurrentScene()->notifyNameSceneChange();
|
||||
FileBrowser::refreshFolder(scenePath.getParentDir());
|
||||
IconGenerator::instance()->invalidate(scenePath);
|
||||
|
||||
|
@ -1440,8 +1463,13 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) {
|
|||
app->getCurrentScene()->setDirtyFlag(false);
|
||||
|
||||
History::instance()->addItem(scenePath);
|
||||
RecentFiles::instance()->addFilePath(toQString(scenePath),
|
||||
RecentFiles::Scene);
|
||||
RecentFiles::instance()->addFilePath(
|
||||
toQString(scenePath), RecentFiles::Scene,
|
||||
QString::fromStdString(app->getCurrentScene()
|
||||
->getScene()
|
||||
->getProject()
|
||||
->getName()
|
||||
.getName()));
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
|
@ -1823,8 +1851,7 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
|
|||
// import if needed
|
||||
TProjectManager *pm = TProjectManager::instance();
|
||||
TProjectP currentProject = pm->getCurrentProject();
|
||||
if (!scene->getProject() ||
|
||||
scene->getProject()->getProjectPath() !=
|
||||
if (!scene->getProject() || scene->getProject()->getProjectPath() !=
|
||||
currentProject->getProjectPath()) {
|
||||
ResourceImportDialog resourceLoader;
|
||||
// resourceLoader.setImportEnabled(true);
|
||||
|
@ -1884,8 +1911,9 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
|
|||
TApp::instance()->getCurrentScene()->setDirtyFlag(false);
|
||||
History::instance()->addItem(scenePath);
|
||||
if (updateRecentFile)
|
||||
RecentFiles::instance()->addFilePath(toQString(scenePath),
|
||||
RecentFiles::Scene);
|
||||
RecentFiles::instance()->addFilePath(
|
||||
toQString(scenePath), RecentFiles::Scene,
|
||||
QString::fromStdString(scene->getProject()->getName().getName()));
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
int forbiddenLevelCount = 0;
|
||||
|
@ -2574,34 +2602,78 @@ bool IoCmd::importLipSync(TFilePath levelPath, QList<TFrameId> frameList,
|
|||
// if the cast contains the level specified with $scenefolder alias,
|
||||
// open a warning popup notifying that such level will lose link.
|
||||
// return false if cancelled.
|
||||
bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(ToonzScene *scene,
|
||||
const TFilePath &newPath) {
|
||||
TFilePath oldFullPath = scene->decodeFilePath(scene->getScenePath());
|
||||
TFilePath newFullPath = scene->decodeFilePath(newPath);
|
||||
bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(
|
||||
ToonzScene *scene, const TFilePath &newPath, TXsheet *subxsh,
|
||||
QHash<TXshLevel *, TFilePath> &orgLevelPaths) {
|
||||
auto setPathToLevel = [&](TXshLevel *level, TFilePath fp) {
|
||||
// in case of saving subxsheet, the current scene will not be switched to
|
||||
// the saved one
|
||||
// so the level paths are needed to be reverted after saving
|
||||
if (subxsh) orgLevelPaths.insert(level, level->getPath());
|
||||
if (TXshSimpleLevel *sil = level->getSimpleLevel())
|
||||
sil->setPath(fp, true);
|
||||
else if (TXshPaletteLevel *pal = level->getPaletteLevel())
|
||||
pal->setPath(fp);
|
||||
else if (TXshSoundLevel *sol = level->getSoundLevel())
|
||||
sol->setPath(fp);
|
||||
};
|
||||
|
||||
TFilePath oldSceneFolder =
|
||||
scene->decodeFilePath(scene->getScenePath()).getParentDir();
|
||||
TFilePath newSceneFolder = scene->decodeFilePath(newPath).getParentDir();
|
||||
|
||||
// in case of saving in the same folder
|
||||
if (oldFullPath.getParentDir() == newFullPath.getParentDir()) return true;
|
||||
if (oldSceneFolder == newSceneFolder) return true;
|
||||
|
||||
TLevelSet *levelSet = scene->getLevelSet();
|
||||
std::vector<TXshLevel *> levels;
|
||||
QList<TXshLevel *> sceneFolderLevels;
|
||||
|
||||
// in case of saving subxsheet, checking only used levels.
|
||||
if (subxsh) {
|
||||
std::set<TXshLevel *> saveSet;
|
||||
subxsh->getUsedLevels(saveSet);
|
||||
levels = std::vector<TXshLevel *>(saveSet.begin(), saveSet.end());
|
||||
}
|
||||
// in case of saving the scene (i.e. top xsheet)
|
||||
else
|
||||
levelSet->listLevels(levels);
|
||||
|
||||
QList<TXshLevel *> sceneFolderLevels;
|
||||
QString str;
|
||||
for (int i = 0; i < levels.size(); i++) {
|
||||
TXshLevel *level = levels.at(i);
|
||||
int count = 0;
|
||||
for (TXshLevel *level : levels) {
|
||||
if (!level->getPath().isEmpty() &&
|
||||
TFilePath("$scenefolder").isAncestorOf(level->getPath())) {
|
||||
TFilePath levelFullPath = scene->decodeFilePath(level->getPath());
|
||||
// check if the path can be re-coded with the new scene folder path
|
||||
if (newSceneFolder.isAncestorOf(levelFullPath)) {
|
||||
// just replace the path without warning
|
||||
TFilePath fp =
|
||||
TFilePath("$scenefolder") + (levelFullPath - newSceneFolder);
|
||||
setPathToLevel(level, fp);
|
||||
}
|
||||
// if re-coding is not possible, then it needs to ask user's preference
|
||||
else {
|
||||
sceneFolderLevels.append(level);
|
||||
if (count < 10) {
|
||||
str.append(" " + QString::fromStdWString(level->getName()) + " (" +
|
||||
level->getPath().getQString() + ")\n");
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// list maximum 10 levels
|
||||
if (count > 10)
|
||||
str.append(QObject::tr(" + %1 more level(s) \n").arg(count - 10));
|
||||
|
||||
// in case there is no items with $scenefolder
|
||||
if (sceneFolderLevels.isEmpty()) return true;
|
||||
|
||||
str = QObject::tr(
|
||||
"The following level(s) use path with $scenefolder alias.\n\n") +
|
||||
str + QObject::tr(
|
||||
str +
|
||||
QObject::tr(
|
||||
"\nThey will not be opened properly when you load the "
|
||||
"scene next time.\nWhat do you want to do?");
|
||||
|
||||
|
@ -2616,7 +2688,7 @@ bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(ToonzScene *scene,
|
|||
for (int i = 0; i < sceneFolderLevels.size(); i++) {
|
||||
TXshLevel *level = sceneFolderLevels.at(i);
|
||||
TFilePath fp = level->getPath() - TFilePath("$scenefolder");
|
||||
fp = fp.withParentDir(newFullPath.getParentDir());
|
||||
fp = fp.withParentDir(newSceneFolder);
|
||||
// check the level existence
|
||||
if (TSystem::doesExistFileOrLevel(fp)) {
|
||||
bool overwrite = (policy == YES_FOR_ALL);
|
||||
|
@ -2663,15 +2735,7 @@ bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(ToonzScene *scene,
|
|||
// decode and code again
|
||||
TFilePath fp =
|
||||
scene->codeFilePath(scene->decodeFilePath(level->getPath()));
|
||||
TXshSimpleLevel *sil = level->getSimpleLevel();
|
||||
TXshPaletteLevel *pal = level->getPaletteLevel();
|
||||
TXshSoundLevel *sol = level->getSoundLevel();
|
||||
if (sil)
|
||||
sil->setPath(fp);
|
||||
else if (pal)
|
||||
pal->setPath(fp);
|
||||
else if (sol)
|
||||
sol->setPath(fp);
|
||||
setPathToLevel(level, fp);
|
||||
}
|
||||
Preferences::instance()->setPathAliasPriority(oldPriority);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ class TXshSoundLevel;
|
|||
class ToonzScene;
|
||||
class TCamera;
|
||||
class TPropertyGroup;
|
||||
class TXsheet;
|
||||
|
||||
namespace DVGui {
|
||||
class ProgressDialog;
|
||||
|
@ -221,9 +222,8 @@ int loadResources(
|
|||
//! access and finalization.
|
||||
//!< Loads a group of resources by path.
|
||||
//! \return The actually loaded levels count.
|
||||
int xFrom = -1,
|
||||
int xTo = -1, std::wstring levelName = L"", int step = -1, int inc = -1,
|
||||
int frameCount = -1, bool doesFileActuallyExist = true,
|
||||
int xFrom = -1, int xTo = -1, std::wstring levelName = L"", int step = -1,
|
||||
int inc = -1, int frameCount = -1, bool doesFileActuallyExist = true,
|
||||
CacheTlvBehavior cachingBehavior = ON_DEMAND);
|
||||
|
||||
int loadResourceFolders(
|
||||
|
@ -256,8 +256,9 @@ bool importLipSync(TFilePath levelPath, QList<TFrameId> frameList,
|
|||
// cast.
|
||||
// if the cast contains the level specified with $scenefolder alias,
|
||||
// open a warning popup notifying that such level will lose link.
|
||||
bool takeCareSceneFolderItemsOnSaveSceneAs(ToonzScene *scene,
|
||||
const TFilePath &newPath);
|
||||
bool takeCareSceneFolderItemsOnSaveSceneAs(
|
||||
ToonzScene *scene, const TFilePath &newPath, TXsheet *subxsh,
|
||||
QHash<TXshLevel *, TFilePath> &orgLevelPaths);
|
||||
|
||||
} // namespace IoCmd
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "toonz/tscenehandle.h"
|
||||
#include "toonz/toonzscene.h"
|
||||
#include "toonz/txshleveltypes.h"
|
||||
#include "toonz/tproject.h"
|
||||
|
||||
// TnzBase includes
|
||||
#include "tenv.h"
|
||||
|
@ -484,14 +485,19 @@ void MainWindow::changeWindowTitle() {
|
|||
ToonzScene *scene = app->getCurrentScene()->getScene();
|
||||
if (!scene) return;
|
||||
|
||||
QString name = QString::fromStdWString(scene->getSceneName());
|
||||
TProject *project = scene->getProject();
|
||||
QString projectName = QString::fromStdString(project->getName().getName());
|
||||
|
||||
QString sceneName = QString::fromStdWString(scene->getSceneName());
|
||||
|
||||
if (sceneName.isEmpty()) sceneName = tr("Untitled");
|
||||
if (app->getCurrentScene()->getDirtyFlag()) sceneName += QString("*");
|
||||
|
||||
/*--- レイアウトファイル名を頭に表示させる ---*/
|
||||
if (!m_layoutName.isEmpty()) name.prepend(m_layoutName + " : ");
|
||||
if (!m_layoutName.isEmpty()) sceneName.prepend(m_layoutName + " : ");
|
||||
|
||||
if (name.isEmpty()) name = tr("Untitled");
|
||||
|
||||
name += " : " + QString::fromStdString(TEnv::getApplicationFullName());
|
||||
QString name = sceneName + " [" + projectName + "] : " +
|
||||
QString::fromStdString(TEnv::getApplicationFullName());
|
||||
|
||||
setWindowTitle(name);
|
||||
}
|
||||
|
@ -1428,6 +1434,13 @@ QAction *MainWindow::createViewerAction(const char *id, const QString &name,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QAction *MainWindow::createVisualizationButtonAction(const char *id,
|
||||
const QString &name) {
|
||||
return createAction(id, name, "", VisualizationButtonCommandType);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QAction *MainWindow::createMiscAction(const char *id, const QString &name,
|
||||
const char *defaultShortcut) {
|
||||
QAction *action = new DVAction(name, this);
|
||||
|
@ -2094,8 +2107,11 @@ void MainWindow::defineActions() {
|
|||
|
||||
createViewerAction(V_ZoomIn, tr("Zoom In"), "+");
|
||||
createViewerAction(V_ZoomOut, tr("Zoom Out"), "-");
|
||||
createViewerAction(V_ZoomReset, tr("Reset View"), "Alt+0");
|
||||
createViewerAction(V_ViewReset, tr("Reset View"), "Alt+0");
|
||||
createViewerAction(V_ZoomFit, tr("Fit to Window"), "Alt+9");
|
||||
createViewerAction(V_ZoomReset, tr("Reset Zoom"), "");
|
||||
createViewerAction(V_RotateReset, tr("Reset Rotation"), "");
|
||||
createViewerAction(V_PositionReset, tr("Reset Position"), "");
|
||||
createViewerAction(V_ActualPixelSize, tr("Actual Pixel Size"), "N");
|
||||
createViewerAction(V_FlipX, tr("Flip Viewer Horizontally"), "");
|
||||
createViewerAction(V_FlipY, tr("Flip Viewer Vertically"), "");
|
||||
|
@ -2105,6 +2121,21 @@ void MainWindow::defineActions() {
|
|||
tr("Full Screen Mode"),
|
||||
tr("Exit Full Screen Mode"));
|
||||
|
||||
// Following actions are for adding "Visualization" menu items to the command
|
||||
// bar. They are separated from the original actions in order to avoid
|
||||
// assigning shortcut keys. They must be triggered only from pressing buttons
|
||||
// in the command bar. Assinging shortcut keys and registering as MenuItem
|
||||
// will break a logic of ShortcutZoomer. So here we register separate items
|
||||
// and bypass the command.
|
||||
createVisualizationButtonAction(VB_ViewReset, tr("Reset View"));
|
||||
createVisualizationButtonAction(VB_ZoomFit, tr("Fit to Window"));
|
||||
createVisualizationButtonAction(VB_ZoomReset, tr("Reset Zoom"));
|
||||
createVisualizationButtonAction(VB_RotateReset, tr("Reset Rotation"));
|
||||
createVisualizationButtonAction(VB_PositionReset, tr("Reset Position"));
|
||||
createVisualizationButtonAction(VB_ActualPixelSize, tr("Actual Pixel Size"));
|
||||
createVisualizationButtonAction(VB_FlipX, tr("Flip Viewer Horizontally"));
|
||||
createVisualizationButtonAction(VB_FlipY, tr("Flip Viewer Vertically"));
|
||||
|
||||
QAction *refreshAct =
|
||||
createMiscAction(MI_RefreshTree, tr("Refresh Folder Tree"), "");
|
||||
refreshAct->setIconText(tr("Refresh"));
|
||||
|
@ -2152,6 +2183,10 @@ void MainWindow::defineActions() {
|
|||
createToolOptionsAction("A_ToolOption_JoinVectors", tr("Join Vectors"), "");
|
||||
createToolOptionsAction("A_ToolOption_ShowOnlyActiveSkeleton",
|
||||
tr("Show Only Active Skeleton"), "");
|
||||
createToolOptionsAction("A_ToolOption_RasterEraser",
|
||||
tr("Brush Tool - Eraser (Raster option)"), "");
|
||||
createToolOptionsAction("A_ToolOption_LockAlpha",
|
||||
tr("Brush Tool - Lock Alpha"), "");
|
||||
|
||||
// Option Menu
|
||||
createToolOptionsAction("A_ToolOption_BrushPreset", tr("Brush Preset"), "");
|
||||
|
@ -2313,7 +2348,8 @@ void MainWindow::onQuit() { close(); }
|
|||
// RecentFiles
|
||||
//=============================================================================
|
||||
|
||||
RecentFiles::RecentFiles() : m_recentScenes(), m_recentLevels() {}
|
||||
RecentFiles::RecentFiles()
|
||||
: m_recentScenes(), m_recentSceneProjects(), m_recentLevels() {}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -2328,17 +2364,25 @@ RecentFiles::~RecentFiles() {}
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void RecentFiles::addFilePath(QString path, FileType fileType) {
|
||||
void RecentFiles::addFilePath(QString path, FileType fileType,
|
||||
QString projectName) {
|
||||
QList<QString> files =
|
||||
(fileType == Scene) ? m_recentScenes : (fileType == Level)
|
||||
? m_recentLevels
|
||||
: m_recentFlipbookImages;
|
||||
(fileType == Scene)
|
||||
? m_recentScenes
|
||||
: (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
|
||||
int i;
|
||||
for (i = 0; i < files.size(); i++)
|
||||
if (files.at(i) == path) files.removeAt(i);
|
||||
if (files.at(i) == path) {
|
||||
files.removeAt(i);
|
||||
if (fileType == Scene) m_recentSceneProjects.removeAt(i);
|
||||
}
|
||||
files.insert(0, path);
|
||||
if (fileType == Scene) m_recentSceneProjects.insert(0, projectName);
|
||||
int maxSize = 10;
|
||||
if (files.size() > maxSize) files.removeAt(maxSize);
|
||||
if (files.size() > maxSize) {
|
||||
files.removeAt(maxSize);
|
||||
if (fileType == Scene) m_recentSceneProjects.removeAt(maxSize);
|
||||
}
|
||||
|
||||
if (fileType == Scene)
|
||||
m_recentScenes = files;
|
||||
|
@ -2354,9 +2398,10 @@ void RecentFiles::addFilePath(QString path, FileType fileType) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void RecentFiles::moveFilePath(int fromIndex, int toIndex, FileType fileType) {
|
||||
if (fileType == Scene)
|
||||
if (fileType == Scene) {
|
||||
m_recentScenes.move(fromIndex, toIndex);
|
||||
else if (fileType == Level)
|
||||
m_recentSceneProjects.move(fromIndex, toIndex);
|
||||
} else if (fileType == Level)
|
||||
m_recentLevels.move(fromIndex, toIndex);
|
||||
else
|
||||
m_recentFlipbookImages.move(fromIndex, toIndex);
|
||||
|
@ -2366,9 +2411,10 @@ void RecentFiles::moveFilePath(int fromIndex, int toIndex, FileType fileType) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void RecentFiles::removeFilePath(int index, FileType fileType) {
|
||||
if (fileType == Scene)
|
||||
if (fileType == Scene) {
|
||||
m_recentScenes.removeAt(index);
|
||||
else if (fileType == Level)
|
||||
m_recentSceneProjects.removeAt(index);
|
||||
} else if (fileType == Level)
|
||||
m_recentLevels.removeAt(index);
|
||||
saveRecentFiles();
|
||||
}
|
||||
|
@ -2384,10 +2430,26 @@ QString RecentFiles::getFilePath(int index, FileType fileType) const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString RecentFiles::getFileProject(int index) const {
|
||||
if (index >= m_recentScenes.size() || index >= m_recentSceneProjects.size())
|
||||
return "-";
|
||||
return m_recentSceneProjects[index];
|
||||
}
|
||||
|
||||
QString RecentFiles::getFileProject(QString fileName) const {
|
||||
for (int index = 0; index < m_recentScenes.size(); index++)
|
||||
if (m_recentScenes[index] == fileName) return m_recentSceneProjects[index];
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void RecentFiles::clearRecentFilesList(FileType fileType) {
|
||||
if (fileType == Scene)
|
||||
if (fileType == Scene) {
|
||||
m_recentScenes.clear();
|
||||
else if (fileType == Level)
|
||||
m_recentSceneProjects.clear();
|
||||
} else if (fileType == Level)
|
||||
m_recentLevels.clear();
|
||||
else
|
||||
m_recentFlipbookImages.clear();
|
||||
|
@ -2411,6 +2473,22 @@ void RecentFiles::loadRecentFiles() {
|
|||
QString scene = settings.value(QString("Scenes")).toString();
|
||||
if (!scene.isEmpty()) m_recentScenes.append(scene);
|
||||
}
|
||||
|
||||
// Load scene's projects info. This is for display purposes only. For
|
||||
// backwards compatibility it is stored and maintained separately.
|
||||
QList<QVariant> sceneProjects =
|
||||
settings.value(QString("SceneProjects")).toList();
|
||||
if (!sceneProjects.isEmpty()) {
|
||||
for (i = 0; i < sceneProjects.size(); i++)
|
||||
m_recentSceneProjects.append(sceneProjects.at(i).toString());
|
||||
} else {
|
||||
QString sceneProject = settings.value(QString("SceneProjects")).toString();
|
||||
if (!sceneProject.isEmpty()) m_recentSceneProjects.append(sceneProject);
|
||||
}
|
||||
// Should be 1-to-1. If we're short, append projects list with "-".
|
||||
while (m_recentSceneProjects.size() < m_recentScenes.size())
|
||||
m_recentSceneProjects.append("-");
|
||||
|
||||
QList<QVariant> levels = settings.value(QString("Levels")).toList();
|
||||
if (!levels.isEmpty()) {
|
||||
for (i = 0; i < levels.size(); i++) {
|
||||
|
@ -2448,6 +2526,7 @@ void RecentFiles::saveRecentFiles() {
|
|||
TFilePath fp = ToonzFolder::getMyModuleDir() + TFilePath("RecentFiles.ini");
|
||||
QSettings settings(toQString(fp), QSettings::IniFormat);
|
||||
settings.setValue(QString("Scenes"), QVariant(m_recentScenes));
|
||||
settings.setValue(QString("SceneProjects"), QVariant(m_recentSceneProjects));
|
||||
settings.setValue(QString("Levels"), QVariant(m_recentLevels));
|
||||
settings.setValue(QString("FlipbookImages"),
|
||||
QVariant(m_recentFlipbookImages));
|
||||
|
@ -2457,9 +2536,9 @@ void RecentFiles::saveRecentFiles() {
|
|||
|
||||
QList<QString> RecentFiles::getFilesNameList(FileType fileType) {
|
||||
QList<QString> files =
|
||||
(fileType == Scene) ? m_recentScenes : (fileType == Level)
|
||||
? m_recentLevels
|
||||
: m_recentFlipbookImages;
|
||||
(fileType == Scene)
|
||||
? m_recentScenes
|
||||
: (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
|
||||
QList<QString> names;
|
||||
int i;
|
||||
for (i = 0; i < files.size(); i++) {
|
||||
|
@ -2486,9 +2565,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) {
|
|||
menu->setEnabled(false);
|
||||
else {
|
||||
CommandId clearActionId =
|
||||
(fileType == Scene) ? MI_ClearRecentScene : (fileType == Level)
|
||||
? MI_ClearRecentLevel
|
||||
: MI_ClearRecentImage;
|
||||
(fileType == Scene)
|
||||
? MI_ClearRecentScene
|
||||
: (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage;
|
||||
menu->setActions(names);
|
||||
menu->addSeparator();
|
||||
QAction *clearAction = CommandManager::instance()->getAction(clearActionId);
|
||||
|
|
|
@ -175,6 +175,9 @@ private:
|
|||
const QString &defaultShortcut);
|
||||
QAction *createViewerAction(const char *id, const QString &name,
|
||||
const QString &defaultShortcut);
|
||||
// For command bar, no shortcut keys
|
||||
QAction *createVisualizationButtonAction(const char *id, const QString &name);
|
||||
|
||||
QAction *createMiscAction(const char *id, const QString &name,
|
||||
const char *defaultShortcut);
|
||||
QAction *createToolOptionsAction(const char *id, const QString &name,
|
||||
|
@ -208,6 +211,7 @@ signals:
|
|||
class RecentFiles {
|
||||
friend class StartupPopup;
|
||||
QList<QString> m_recentScenes;
|
||||
QList<QString> m_recentSceneProjects;
|
||||
QList<QString> m_recentLevels;
|
||||
QList<QString> m_recentFlipbookImages;
|
||||
|
||||
|
@ -219,10 +223,12 @@ public:
|
|||
static RecentFiles *instance();
|
||||
~RecentFiles();
|
||||
|
||||
void addFilePath(QString path, FileType fileType);
|
||||
void addFilePath(QString path, FileType fileType, QString projectName = 0);
|
||||
void moveFilePath(int fromIndex, int toIndex, FileType fileType);
|
||||
void removeFilePath(int fromIndex, FileType fileType);
|
||||
QString getFilePath(int index, FileType fileType) const;
|
||||
QString getFileProject(QString fileName) const;
|
||||
QString getFileProject(int index) const;
|
||||
void clearRecentFilesList(FileType fileType);
|
||||
void loadRecentFiles();
|
||||
void saveRecentFiles();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "tapp.h"
|
||||
#include "mainwindow.h"
|
||||
#include "tenv.h"
|
||||
#include "saveloadqsettings.h"
|
||||
|
||||
#include "toonzqt/gutil.h"
|
||||
|
||||
|
@ -29,6 +30,7 @@
|
|||
#include <QFile>
|
||||
#include <qdrawutil.h>
|
||||
#include <assert.h>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
extern TEnv::StringVar EnvSafeAreaName;
|
||||
|
||||
|
@ -60,7 +62,22 @@ TPanel::TPanel(QWidget *parent, Qt::WindowFlags flags,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TPanel::~TPanel() {}
|
||||
TPanel::~TPanel() {
|
||||
// On quitting, save the floating panel's geomtry and state in order to
|
||||
// restore them when opening the floating panel next time
|
||||
if (isFloating()) {
|
||||
TFilePath savePath =
|
||||
ToonzFolder::getMyModuleDir() + TFilePath("popups.ini");
|
||||
QSettings settings(QString::fromStdWString(savePath.getWideString()),
|
||||
QSettings::IniFormat);
|
||||
settings.beginGroup("Panels");
|
||||
settings.beginGroup(QString::fromStdString(m_panelType));
|
||||
settings.setValue("geometry", geometry());
|
||||
if (SaveLoadQSettings *persistent =
|
||||
dynamic_cast<SaveLoadQSettings *>(widget()))
|
||||
persistent->save(settings);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -123,6 +140,32 @@ void TPanel::enterEvent(QEvent *event) {
|
|||
*/
|
||||
void TPanel::leaveEvent(QEvent *event) { widgetClearFocusOnLeave(); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*! load and restore previous geometry and state of the floating panel.
|
||||
called from the function OpenFloatingPanel::getOrOpenFloatingPanel()
|
||||
in floatingpanelcommand.cpp
|
||||
*/
|
||||
void TPanel::restoreFloatingPanelState() {
|
||||
TFilePath savePath = ToonzFolder::getMyModuleDir() + TFilePath("popups.ini");
|
||||
QSettings settings(QString::fromStdWString(savePath.getWideString()),
|
||||
QSettings::IniFormat);
|
||||
settings.beginGroup("Panels");
|
||||
|
||||
if (!settings.childGroups().contains(QString::fromStdString(m_panelType)))
|
||||
return;
|
||||
|
||||
settings.beginGroup(QString::fromStdString(m_panelType));
|
||||
|
||||
QRect geom = settings.value("geometry", saveGeometry()).toRect();
|
||||
// check if it can be visible in the current screen
|
||||
if (!(geom & QApplication::desktop()->availableGeometry(this)).isEmpty())
|
||||
setGeometry(geom);
|
||||
// load optional settings
|
||||
if (SaveLoadQSettings *persistent =
|
||||
dynamic_cast<SaveLoadQSettings *>(widget()))
|
||||
persistent->load(settings);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// TPanelTitleBarButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -181,9 +224,10 @@ void TPanelTitleBarButton::setPressed(bool pressed) {
|
|||
|
||||
void TPanelTitleBarButton::paintEvent(QPaintEvent *event) {
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(
|
||||
0, 0, m_pressed ? m_pressedPixmap : m_rollover ? m_rolloverPixmap
|
||||
: m_standardPixmap);
|
||||
painter.drawPixmap(0, 0,
|
||||
m_pressed
|
||||
? m_pressedPixmap
|
||||
: m_rollover ? m_rolloverPixmap : m_standardPixmap);
|
||||
painter.end();
|
||||
}
|
||||
|
||||
|
|
|
@ -232,6 +232,8 @@ public:
|
|||
return false;
|
||||
};
|
||||
|
||||
void restoreFloatingPanelState();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void enterEvent(QEvent *) override;
|
||||
|
|
|
@ -950,7 +950,14 @@ int FrameNumberLineEdit::getValue() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FrameNumberLineEdit::focusInEvent(QFocusEvent* e) {
|
||||
m_textOnFocusIn = text();
|
||||
}
|
||||
|
||||
void FrameNumberLineEdit::focusOutEvent(QFocusEvent* e) {
|
||||
// if the field is empty, then revert the last input
|
||||
if (text().isEmpty()) setText(m_textOnFocusIn);
|
||||
|
||||
LineEdit::focusOutEvent(e);
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1256,7 @@ QString formatString(QString inStr, int charNum) {
|
|||
}
|
||||
return numStr.rightJustified(charNum, '0') + postStr;
|
||||
}
|
||||
};
|
||||
}; // namespace
|
||||
|
||||
void PencilTestSaveInFolderPopup::updateSubFolderName() {
|
||||
if (!m_autoSubNameCB->isChecked()) return;
|
||||
|
@ -1419,10 +1426,10 @@ void PencilTestSaveInFolderPopup::updateParentFolder() {
|
|||
|
||||
PencilTestPopup::PencilTestPopup()
|
||||
// set the parent 0 in order to enable the popup behind the main window
|
||||
: Dialog(0, false, false, "PencilTest"),
|
||||
m_currentCamera(NULL),
|
||||
m_captureWhiteBGCue(false),
|
||||
m_captureCue(false) {
|
||||
: Dialog(0, false, false, "PencilTest")
|
||||
, m_currentCamera(NULL)
|
||||
, m_captureWhiteBGCue(false)
|
||||
, m_captureCue(false) {
|
||||
setWindowTitle(tr("Camera Capture"));
|
||||
|
||||
// add maximize button to the dialog
|
||||
|
@ -2256,7 +2263,8 @@ void PencilTestPopup::hideEvent(QHideEvent* event) {
|
|||
|
||||
void PencilTestPopup::keyPressEvent(QKeyEvent* event) {
|
||||
// override return (or enter) key as shortcut key for capturing
|
||||
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
int key = event->key();
|
||||
if (key == Qt::Key_Return || key == Qt::Key_Enter) {
|
||||
// show button-clicking animation followed by calling
|
||||
// onCaptureButtonClicked()
|
||||
m_captureButton->animateClick();
|
||||
|
@ -2267,6 +2275,23 @@ void PencilTestPopup::keyPressEvent(QKeyEvent* event) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool PencilTestPopup::event(QEvent* event) {
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
|
||||
int key = ke->key();
|
||||
if (key >= Qt::Key_0 && key <= Qt::Key_9) {
|
||||
if (!m_frameNumberEdit->hasFocus()) {
|
||||
m_frameNumberEdit->setFocus();
|
||||
m_frameNumberEdit->clear();
|
||||
}
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return DVGui::Dialog::event(event);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void PencilTestPopup::processImage(QImage& image) {
|
||||
/* "upside down" is not executed here. It will be done when capturing the
|
||||
* image */
|
||||
|
@ -2520,8 +2545,7 @@ bool PencilTestPopup::importImage(QImage image) {
|
|||
|
||||
/* if the loaded level does not match in pixel size, then return */
|
||||
sl = level->getSimpleLevel();
|
||||
if (!sl ||
|
||||
sl->getProperties()->getImageRes() !=
|
||||
if (!sl || sl->getProperties()->getImageRes() !=
|
||||
TDimension(image.width(), image.height())) {
|
||||
error(tr(
|
||||
"The captured image size does not match with the existing level."));
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace DVGui {
|
|||
class FileField;
|
||||
class IntField;
|
||||
class IntLineEdit;
|
||||
}
|
||||
} // namespace DVGui
|
||||
|
||||
class CameraCaptureLevelControl;
|
||||
|
||||
|
@ -190,6 +190,7 @@ class FrameNumberLineEdit : public DVGui::LineEdit {
|
|||
QRegExpValidator* m_regexpValidator;
|
||||
|
||||
void updateValidator();
|
||||
QString m_textOnFocusIn;
|
||||
|
||||
public:
|
||||
FrameNumberLineEdit(QWidget* parent = 0, int value = 1);
|
||||
|
@ -203,6 +204,7 @@ public:
|
|||
protected:
|
||||
/*! If focus is lost and current text value is out of range emit signal
|
||||
\b editingFinished.*/
|
||||
void focusInEvent(QFocusEvent*) override;
|
||||
void focusOutEvent(QFocusEvent*) override;
|
||||
void showEvent(QShowEvent* event) override { updateValidator(); }
|
||||
};
|
||||
|
@ -332,9 +334,10 @@ public:
|
|||
protected:
|
||||
void showEvent(QShowEvent* event);
|
||||
void hideEvent(QHideEvent* event);
|
||||
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
bool event(QEvent* e) override;
|
||||
|
||||
protected slots:
|
||||
void refreshCameraList();
|
||||
void onCameraListComboActivated(int index);
|
||||
|
|
|
@ -260,10 +260,10 @@ void PreferencesPopup::onPixelsOnlyChanged(int index) {
|
|||
QString tempUnit;
|
||||
int unitIndex;
|
||||
tempUnit = m_pref->getOldUnits();
|
||||
unitIndex = m_unitOm->findText(tempUnit);
|
||||
unitIndex = std::find(::units, ::units + ::unitsCount, tempUnit) - ::units;
|
||||
m_unitOm->setCurrentIndex(unitIndex);
|
||||
tempUnit = m_pref->getOldCameraUnits();
|
||||
unitIndex = m_cameraUnitOm->findText(tempUnit);
|
||||
unitIndex = std::find(::units, ::units + ::unitsCount, tempUnit) - ::units;
|
||||
m_cameraUnitOm->setCurrentIndex(unitIndex);
|
||||
m_unitOm->setDisabled(false);
|
||||
m_cameraUnitOm->setDisabled(false);
|
||||
|
|
|
@ -321,19 +321,20 @@ ProjectPopup::ProjectPopup(bool isModal)
|
|||
Qt::AlignRight | Qt::AlignVCenter);
|
||||
upperLayout->addWidget(ff, i + 2, 1);
|
||||
}
|
||||
struct {
|
||||
QString name;
|
||||
std::string folderName;
|
||||
} cbs[] = {{tr("Append $scenepath to +drawings"), TProject::Drawings},
|
||||
{tr("Append $scenepath to +inputs"), TProject::Inputs},
|
||||
{tr("Append $scenepath to +extras"), TProject::Extras}};
|
||||
std::vector<std::tuple<QString, std::string>> cbs = {
|
||||
std::make_tuple(tr("Append $scenepath to +drawings"),
|
||||
TProject::Drawings),
|
||||
std::make_tuple(tr("Append $scenepath to +inputs"), TProject::Inputs),
|
||||
std::make_tuple(tr("Append $scenepath to +extras"), TProject::Extras)};
|
||||
int currentRow = upperLayout->rowCount();
|
||||
|
||||
for (i = 0; i < tArrayCount(cbs); i++) {
|
||||
CheckBox *cb = new CheckBox(cbs[i].name);
|
||||
for (int i = 0; i < cbs.size(); ++i) {
|
||||
auto const &name = std::get<0>(cbs[i]);
|
||||
auto const &folderName = std::get<1>(cbs[i]);
|
||||
CheckBox *cb = new CheckBox(name);
|
||||
cb->setMaximumHeight(WidgetHeight);
|
||||
upperLayout->addWidget(cb, currentRow + i, 1);
|
||||
m_useScenePathCbs.append(qMakePair(cbs[i].folderName, cb));
|
||||
m_useScenePathCbs.append(qMakePair(folderName, cb));
|
||||
}
|
||||
m_topLayout->addLayout(upperLayout);
|
||||
}
|
||||
|
|
|
@ -81,3 +81,7 @@ void ReframePopup::getValues(int& step, int& blank) {
|
|||
step = m_step->getValue();
|
||||
blank = m_blank->getValue();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ReframePopup::showEvent(QShowEvent* event) { m_step->selectAll(); }
|
|
@ -32,6 +32,9 @@ public:
|
|||
ReframePopup();
|
||||
void getValues(int& step, int& blank);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
public slots:
|
||||
void updateBlankCellCount();
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "toonzqt/gutil.h"
|
||||
#include "toonzqt/imageutils.h"
|
||||
#include "toonzqt/lutcalibrator.h"
|
||||
#include "toonzqt/viewcommandids.h"
|
||||
|
||||
// TnzLib includes
|
||||
#include "toonz/tscenehandle.h"
|
||||
|
@ -451,6 +452,83 @@ public:
|
|||
}
|
||||
} resetShiftTraceCommand;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Following commands (VB_***) are registered for command bar buttons.
|
||||
// They are separatd from the original visalization commands
|
||||
// so that they will not break a logic of ShortcutZoomer.
|
||||
|
||||
class TViewResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TViewResetCommand() : MenuItemHandler(VB_ViewReset) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->resetSceneViewer();
|
||||
}
|
||||
} viewResetCommand;
|
||||
|
||||
class TZoomResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TZoomResetCommand() : MenuItemHandler(VB_ZoomReset) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->resetZoom();
|
||||
}
|
||||
} zoomResetCommand;
|
||||
|
||||
class TZoomFitCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TZoomFitCommand() : MenuItemHandler(VB_ZoomFit) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->fitToCamera();
|
||||
}
|
||||
} zoomFitCommand;
|
||||
|
||||
class TActualPixelSizeCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TActualPixelSizeCommand() : MenuItemHandler(VB_ActualPixelSize) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->setActualPixelSize();
|
||||
}
|
||||
} actualPixelSizeCommand;
|
||||
|
||||
class TFlipViewerXCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TFlipViewerXCommand() : MenuItemHandler(VB_FlipX) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->flipX();
|
||||
}
|
||||
} flipViewerXCommand;
|
||||
|
||||
class TFlipViewerYCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TFlipViewerYCommand() : MenuItemHandler(VB_FlipY) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->flipY();
|
||||
}
|
||||
} flipViewerYCommand;
|
||||
|
||||
class TRotateResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TRotateResetCommand() : MenuItemHandler(VB_RotateReset) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->resetRotation();
|
||||
}
|
||||
} rotateResetCommand;
|
||||
|
||||
class TPositionResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TPositionResetCommand() : MenuItemHandler(VB_PositionReset) {}
|
||||
void execute() override {
|
||||
if (TApp::instance()->getActiveViewer())
|
||||
TApp::instance()->getActiveViewer()->resetPosition();
|
||||
}
|
||||
} positionResetCommand;
|
||||
|
||||
//=============================================================================
|
||||
// SceneViewer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -511,8 +589,10 @@ SceneViewer::SceneViewer(ImageUtils::FullScreenWidget *parent)
|
|||
this->setTabletTracking(true);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < tArrayCount(m_viewAff); i++)
|
||||
for (int i = 0; i < m_viewAff.size(); ++i) {
|
||||
setViewMatrix(getNormalZoomScale(), i);
|
||||
m_rotationAngle[i] = 0.0;
|
||||
}
|
||||
|
||||
m_3DSideR = rasterFromQPixmap(svgToPixmap(":Resources/3Dside_r.svg"));
|
||||
m_3DSideL = rasterFromQPixmap(svgToPixmap(":Resources/3Dside_l.svg"));
|
||||
|
@ -1797,8 +1877,9 @@ void SceneViewer::zoomQt(bool forward, bool reset) {
|
|||
if (reset || ((m_zoomScale3D < 500 || !forward) &&
|
||||
(m_zoomScale3D > 0.01 || forward))) {
|
||||
double oldZoomScale = m_zoomScale3D;
|
||||
m_zoomScale3D = reset ? 1 : ImageUtils::getQuantizedZoomFactor(
|
||||
m_zoomScale3D, forward);
|
||||
m_zoomScale3D =
|
||||
reset ? 1
|
||||
: ImageUtils::getQuantizedZoomFactor(m_zoomScale3D, forward);
|
||||
|
||||
m_pan3D = -(m_zoomScale3D / oldZoomScale) * -m_pan3D;
|
||||
}
|
||||
|
@ -1828,8 +1909,9 @@ void SceneViewer::zoomQt(bool forward, bool reset) {
|
|||
if (reset || ((scale2 < 100000 || !forward) &&
|
||||
(scale2 > 0.001 * 0.05 || forward))) {
|
||||
double oldZoomScale = sqrt(scale2) * dpiFactor;
|
||||
double zoomScale = reset ? 1 : ImageUtils::getQuantizedZoomFactor(
|
||||
oldZoomScale, forward);
|
||||
double zoomScale =
|
||||
reset ? 1
|
||||
: ImageUtils::getQuantizedZoomFactor(oldZoomScale, forward);
|
||||
|
||||
// threshold value -0.001 is intended to absorb the error of calculation
|
||||
if ((oldZoomScale - zoomScaleFittingWithScreen) *
|
||||
|
@ -1995,8 +2077,18 @@ void SceneViewer::zoom(const TPointD ¢er, double factor) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::flipX() {
|
||||
m_viewAff[0] = m_viewAff[0] * TScale(-1, 1);
|
||||
m_viewAff[1] = m_viewAff[1] * TScale(-1, 1);
|
||||
double flipAngle0 = (m_rotationAngle[0] * -1) * 2;
|
||||
double flipAngle1 = (m_rotationAngle[1] * -1) * 2;
|
||||
m_rotationAngle[0] += flipAngle0;
|
||||
m_rotationAngle[1] += flipAngle1;
|
||||
if (m_isFlippedX != m_isFlippedY) {
|
||||
flipAngle0 = -flipAngle0;
|
||||
flipAngle1 = -flipAngle1;
|
||||
}
|
||||
m_viewAff[0] = m_viewAff[0] * TRotation(flipAngle0) * TScale(-1, 1);
|
||||
m_viewAff[1] = m_viewAff[1] * TRotation(flipAngle1) * TScale(-1, 1);
|
||||
m_viewAff[0].a13 *= -1;
|
||||
m_viewAff[1].a13 *= -1;
|
||||
m_isFlippedX = !m_isFlippedX;
|
||||
invalidateAll();
|
||||
emit onZoomChanged();
|
||||
|
@ -2005,8 +2097,18 @@ void SceneViewer::flipX() {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::flipY() {
|
||||
m_viewAff[0] = m_viewAff[0] * TScale(1, -1);
|
||||
m_viewAff[1] = m_viewAff[1] * TScale(1, -1);
|
||||
double flipAngle0 = (m_rotationAngle[0] * -1) * 2;
|
||||
double flipAngle1 = (m_rotationAngle[1] * -1) * 2;
|
||||
m_rotationAngle[0] += flipAngle0;
|
||||
m_rotationAngle[1] += flipAngle1;
|
||||
if (m_isFlippedX != m_isFlippedY) {
|
||||
flipAngle0 = -flipAngle0;
|
||||
flipAngle1 = -flipAngle1;
|
||||
}
|
||||
m_viewAff[0] = m_viewAff[0] * TRotation(flipAngle0) * TScale(1, -1);
|
||||
m_viewAff[1] = m_viewAff[1] * TRotation(flipAngle1) * TScale(1, -1);
|
||||
m_viewAff[0].a23 *= -1;
|
||||
m_viewAff[1].a23 *= -1;
|
||||
m_isFlippedY = !m_isFlippedY;
|
||||
invalidateAll();
|
||||
emit onZoomChanged();
|
||||
|
@ -2017,6 +2119,7 @@ void SceneViewer::flipY() {
|
|||
void SceneViewer::rotate(const TPointD ¢er, double angle) {
|
||||
if (angle == 0) return;
|
||||
if (m_isFlippedX != m_isFlippedY) angle = -angle;
|
||||
m_rotationAngle[m_viewMode] += angle;
|
||||
TPointD realCenter = m_viewAff[m_viewMode] * center;
|
||||
setViewMatrix(TRotation(realCenter, angle) * m_viewAff[m_viewMode],
|
||||
m_viewMode);
|
||||
|
@ -2109,8 +2212,10 @@ void SceneViewer::resetSceneViewer() {
|
|||
m_visualSettings.m_sceneProperties =
|
||||
TApp::instance()->getCurrentScene()->getScene()->getProperties();
|
||||
|
||||
for (int i = 0; i < tArrayCount(m_viewAff); i++)
|
||||
for (int i = 0; i < m_viewAff.size(); ++i) {
|
||||
setViewMatrix(getNormalZoomScale(), i);
|
||||
m_rotationAngle[i] = 0.0;
|
||||
}
|
||||
|
||||
m_pos = QPoint(0, 0);
|
||||
m_pan3D = TPointD(0, 0);
|
||||
|
@ -2125,6 +2230,45 @@ void SceneViewer::resetSceneViewer() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::resetZoom() {
|
||||
TPointD realCenter(m_viewAff[m_viewMode].a13, m_viewAff[m_viewMode].a23);
|
||||
TAffine aff =
|
||||
getNormalZoomScale() * TRotation(realCenter, m_rotationAngle[m_viewMode]);
|
||||
aff.a13 = realCenter.x;
|
||||
aff.a23 = realCenter.y;
|
||||
if (m_isFlippedX) aff = aff * TScale(-1, 1);
|
||||
if (m_isFlippedY) aff = aff * TScale(1, -1);
|
||||
setViewMatrix(aff, m_viewMode);
|
||||
invalidateAll();
|
||||
emit onZoomChanged();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::resetRotation() {
|
||||
double reverseRotatation = m_rotationAngle[m_viewMode] * -1;
|
||||
if (m_isFlippedX) reverseRotatation *= -1;
|
||||
if (m_isFlippedY) reverseRotatation *= -1;
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
TPointD center = m_viewAff[m_viewMode].inv() * TPointD(0, 0);
|
||||
if (tool->getName() == "T_Rotate" &&
|
||||
tool->getProperties(0)
|
||||
->getProperty("Rotate On Camera Center")
|
||||
->getValueAsString() == "1")
|
||||
center = TPointD(0, 0);
|
||||
rotate(center, reverseRotatation);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::resetPosition() {
|
||||
m_viewAff[m_viewMode].a13 = 0.0;
|
||||
m_viewAff[m_viewMode].a23 = 0.0;
|
||||
invalidateAll();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneViewer::setActualPixelSize() {
|
||||
TApp *app = TApp::instance();
|
||||
TXshLevel *l = app->getCurrentLevel()->getLevel();
|
||||
|
@ -2155,9 +2299,10 @@ void SceneViewer::setActualPixelSize() {
|
|||
TPointD tempScale = dpi;
|
||||
if (m_isFlippedX) tempScale.x = -tempScale.x;
|
||||
if (m_isFlippedY) tempScale.y = -tempScale.y;
|
||||
for (int i = 0; i < tArrayCount(m_viewAff); i++)
|
||||
setViewMatrix(dpi == TPointD(0, 0) ? tempAff : TScale(tempScale.x / inch,
|
||||
tempScale.y / inch),
|
||||
for (int i = 0; i < m_viewAff.size(); ++i)
|
||||
setViewMatrix(dpi == TPointD(0, 0)
|
||||
? tempAff
|
||||
: TScale(tempScale.x / inch, tempScale.y / inch),
|
||||
i);
|
||||
|
||||
m_pos = QPoint(0, 0);
|
||||
|
@ -2261,8 +2406,8 @@ int SceneViewer::pick(const TPointD &point) {
|
|||
assert(glGetError() == GL_NO_ERROR);
|
||||
GLint viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
GLuint selectBuffer[512];
|
||||
glSelectBuffer(tArrayCount(selectBuffer), selectBuffer);
|
||||
std::array<GLuint, 512> selectBuffer;
|
||||
glSelectBuffer(selectBuffer.size(), selectBuffer.data());
|
||||
glRenderMode(GL_SELECT);
|
||||
|
||||
// definisco la matrice di proiezione
|
||||
|
@ -2321,7 +2466,7 @@ int SceneViewer::pick(const TPointD &point) {
|
|||
// conto gli hits
|
||||
int ret = -1;
|
||||
int hitCount = glRenderMode(GL_RENDER);
|
||||
GLuint *p = selectBuffer;
|
||||
GLuint *p = selectBuffer.data();
|
||||
for (int i = 0; i < hitCount; ++i) {
|
||||
GLuint nameCount = *p++;
|
||||
GLuint zmin = *p++;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "pane.h"
|
||||
#include "previewer.h"
|
||||
|
||||
#include <array>
|
||||
#include <QMatrix4x4>
|
||||
#include <QTouchDevice>
|
||||
|
||||
|
@ -124,7 +125,7 @@ class SceneViewer final : public GLWidgetForHighDpi,
|
|||
|
||||
// current pan/zoom matrix (two different matrices are used for editing scenes
|
||||
// and leves)
|
||||
TAffine m_viewAff[2];
|
||||
std::array<TAffine, 2> m_viewAff;
|
||||
int m_viewMode;
|
||||
|
||||
TPointD m_dpiScale;
|
||||
|
@ -178,6 +179,8 @@ class SceneViewer final : public GLWidgetForHighDpi,
|
|||
// updated in drawScene() and used in GLInvalidateRect()
|
||||
TRectD m_guidedDrawingBBox;
|
||||
|
||||
double m_rotationAngle[2];
|
||||
|
||||
public:
|
||||
enum ReferenceMode {
|
||||
NORMAL_REFERENCE = 1,
|
||||
|
@ -394,6 +397,9 @@ protected:
|
|||
public slots:
|
||||
|
||||
void resetSceneViewer();
|
||||
void resetZoom();
|
||||
void resetRotation();
|
||||
void resetPosition();
|
||||
void setActualPixelSize();
|
||||
void flipX();
|
||||
void flipY();
|
||||
|
|
|
@ -81,12 +81,6 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
|
|||
parent->connect(action, SIGNAL(triggered()), SLOT(swapCompared()));
|
||||
}
|
||||
|
||||
// reset
|
||||
action = commandManager->createAction(V_ZoomReset, this);
|
||||
addAction(action);
|
||||
ret = ret &&
|
||||
parent->connect(action, SIGNAL(triggered()), SLOT(resetSceneViewer()));
|
||||
|
||||
if (!isEditingLevel) {
|
||||
// fit camera
|
||||
action = commandManager->createAction(V_ZoomFit, this);
|
||||
|
@ -95,6 +89,43 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
|
|||
parent->connect(action, SIGNAL(triggered()), SLOT(fitToCamera()));
|
||||
}
|
||||
|
||||
QMenu *flipViewMenu = addMenu(tr("Flip View"));
|
||||
|
||||
// flip horizontally
|
||||
action = commandManager->createAction(V_FlipX, this);
|
||||
flipViewMenu->addAction(action);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), SLOT(flipX()));
|
||||
|
||||
// flip vertically
|
||||
action = commandManager->createAction(V_FlipY, this);
|
||||
flipViewMenu->addAction(action);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), SLOT(flipY()));
|
||||
|
||||
QMenu *resetViewMenu = addMenu(tr("Reset View"));
|
||||
|
||||
// reset
|
||||
action = commandManager->createAction(V_ViewReset, this);
|
||||
resetViewMenu->addAction(action);
|
||||
ret = ret &&
|
||||
parent->connect(action, SIGNAL(triggered()), SLOT(resetSceneViewer()));
|
||||
|
||||
// reset zoom
|
||||
action = commandManager->createAction(V_ZoomReset, this);
|
||||
resetViewMenu->addAction(action);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), SLOT(resetZoom()));
|
||||
|
||||
// reset rotation
|
||||
action = commandManager->createAction(V_RotateReset, this);
|
||||
resetViewMenu->addAction(action);
|
||||
ret = ret &&
|
||||
parent->connect(action, SIGNAL(triggered()), SLOT(resetRotation()));
|
||||
|
||||
// reset position
|
||||
action = commandManager->createAction(V_PositionReset, this);
|
||||
resetViewMenu->addAction(action);
|
||||
ret = ret &&
|
||||
parent->connect(action, SIGNAL(triggered()), SLOT(resetPosition()));
|
||||
|
||||
// actual pixel size
|
||||
action = commandManager->createAction(V_ActualPixelSize, this);
|
||||
addAction(action);
|
||||
|
|
|
@ -279,6 +279,8 @@ void SceneViewer::tabletEvent(QTabletEvent *e) {
|
|||
initToonzEvent(mouseEvent, e, height(), m_pressure, getDevPixRatio());
|
||||
m_tabletState = Touched;
|
||||
onPress(mouseEvent);
|
||||
} else if (m_tabletState == Touched) {
|
||||
m_tabletState = StartStroke;
|
||||
}
|
||||
} else
|
||||
m_tabletEvent = false;
|
||||
|
@ -1108,8 +1110,7 @@ bool SceneViewer::event(QEvent *e) {
|
|||
break;
|
||||
}
|
||||
*/
|
||||
if (e->type() == QEvent::Gesture &&
|
||||
CommandManager::instance()
|
||||
if (e->type() == QEvent::Gesture && CommandManager::instance()
|
||||
->getAction(MI_TouchGestureControl)
|
||||
->isChecked()) {
|
||||
gestureEvent(static_cast<QGestureEvent *>(e));
|
||||
|
@ -1181,11 +1182,11 @@ class ViewerZoomer final : public ImageUtils::ShortcutZoomer {
|
|||
public:
|
||||
ViewerZoomer(SceneViewer *parent) : ShortcutZoomer(parent) {}
|
||||
|
||||
bool zoom(bool zoomin, bool resetZoom) override {
|
||||
bool zoom(bool zoomin, bool resetView) override {
|
||||
SceneViewer *sceneViewer = static_cast<SceneViewer *>(getWidget());
|
||||
|
||||
resetZoom ? sceneViewer->resetSceneViewer()
|
||||
: sceneViewer->zoomQt(zoomin, resetZoom);
|
||||
resetView ? sceneViewer->resetSceneViewer()
|
||||
: sceneViewer->zoomQt(zoomin, resetView);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1210,6 +1211,21 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool resetZoom() override {
|
||||
static_cast<SceneViewer *>(getWidget())->resetZoom();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool resetRotation() override {
|
||||
static_cast<SceneViewer *>(getWidget())->resetRotation();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool resetPosition() override {
|
||||
static_cast<SceneViewer *>(getWidget())->resetPosition();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool toggleFullScreen(bool quit) override {
|
||||
if (ImageUtils::FullScreenWidget *fsWidget =
|
||||
dynamic_cast<ImageUtils::FullScreenWidget *>(
|
||||
|
|
|
@ -95,9 +95,9 @@ StartupPopup::StartupPopup()
|
|||
: Dialog(TApp::instance()->getMainWindow(), true, true, "StartupPopup") {
|
||||
setWindowTitle(tr("OpenToonz Startup"));
|
||||
|
||||
m_projectBox = new QGroupBox(tr("Choose Project"), this);
|
||||
m_projectBox = new QGroupBox(tr("Current Project"), this);
|
||||
m_sceneBox = new QGroupBox(tr("Create a New Scene"), this);
|
||||
m_recentBox = new QGroupBox(tr("Open Scene"), this);
|
||||
m_recentBox = new QGroupBox(tr("Recent Scenes [Project]"), this);
|
||||
m_projectBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_nameFld = new LineEdit(this);
|
||||
m_pathFld = new FileField(this);
|
||||
|
@ -168,6 +168,7 @@ StartupPopup::StartupPopup()
|
|||
m_sceneBox->setMinimumWidth(480);
|
||||
m_projectBox->setMinimumWidth(480);
|
||||
m_buttonFrame->setFixedHeight(34);
|
||||
|
||||
//--- layout
|
||||
m_topLayout->setMargin(0);
|
||||
m_topLayout->setSpacing(0);
|
||||
|
@ -240,14 +241,15 @@ StartupPopup::StartupPopup()
|
|||
newSceneLay->addWidget(createButton, 7, 1, 1, 3, Qt::AlignLeft);
|
||||
}
|
||||
m_sceneBox->setLayout(newSceneLay);
|
||||
guiLay->addWidget(m_sceneBox, 2, 0, 4, 1, Qt::AlignLeft);
|
||||
guiLay->addWidget(m_sceneBox, 2, 0, 4, 1, Qt::AlignTop);
|
||||
|
||||
m_recentSceneLay->setMargin(5);
|
||||
m_recentSceneLay->setSpacing(2);
|
||||
{
|
||||
// Recent Scene List
|
||||
m_recentBox->setLayout(m_recentSceneLay);
|
||||
guiLay->addWidget(m_recentBox, 1, 1, 4, 1, Qt::AlignTop);
|
||||
guiLay->addWidget(m_recentBox, 1, 1, 4, 1,
|
||||
Qt::AlignTop | Qt::AlignHCenter);
|
||||
guiLay->addWidget(loadOtherSceneButton, 5, 1, 1, 1, Qt::AlignRight);
|
||||
}
|
||||
m_topLayout->addLayout(guiLay, 0);
|
||||
|
@ -409,10 +411,13 @@ void StartupPopup::refreshRecentScenes() {
|
|||
int i = 0;
|
||||
for (QString name : m_sceneNames) {
|
||||
if (i > 9) break; // box can hold 10 scenes
|
||||
QString justName = QString::fromStdString(TFilePath(name).getName());
|
||||
QString fileName =
|
||||
name.remove(0, name.indexOf(" ") + 1); // remove "#. " prefix
|
||||
QString projectName = RecentFiles::instance()->getFileProject(fileName);
|
||||
QString justName = QString::fromStdString(TFilePath(fileName).getName()) +
|
||||
(projectName != "-" ? " [" + projectName + "]" : "");
|
||||
m_recentNamesLabels[i] = new StartupLabel(justName, this, i);
|
||||
m_recentNamesLabels[i]->setToolTip(
|
||||
name.remove(0, name.indexOf(" ") + 1)); // remove "#. " prefix
|
||||
m_recentNamesLabels[i]->setToolTip(fileName);
|
||||
m_recentSceneLay->addWidget(m_recentNamesLabels[i], 0, Qt::AlignTop);
|
||||
i++;
|
||||
}
|
||||
|
@ -856,7 +861,33 @@ void StartupPopup::onRecentSceneClicked(int index) {
|
|||
DVGui::warning(msg);
|
||||
refreshRecentScenes();
|
||||
} else {
|
||||
IoCmd::loadScene(TFilePath(path.toStdWString()), false);
|
||||
if (RecentFiles::instance()->getFileProject(index) != "-") {
|
||||
QString projectName = RecentFiles::instance()->getFileProject(index);
|
||||
int projectIndex = m_projectsCB->findText(projectName);
|
||||
if (projectIndex >= 0) {
|
||||
TFilePath projectFp = m_projectPaths[projectIndex];
|
||||
TProjectManager::instance()->setCurrentProjectPath(projectFp);
|
||||
} else {
|
||||
QString msg = tr("The selected scene project '%1' is not in the "
|
||||
"Current Project list and may not open automatically.")
|
||||
.arg(projectName);
|
||||
DVGui::warning(msg);
|
||||
}
|
||||
}
|
||||
IoCmd::loadScene(TFilePath(path.toStdWString()), false, true);
|
||||
if (RecentFiles::instance()->getFileProject(index) == "-") {
|
||||
QString fileName =
|
||||
RecentFiles::instance()->getFilePath(index, RecentFiles::Scene);
|
||||
QString projectName = QString::fromStdString(TApp::instance()
|
||||
->getCurrentScene()
|
||||
->getScene()
|
||||
->getProject()
|
||||
->getName()
|
||||
.getName());
|
||||
RecentFiles::instance()->removeFilePath(index, RecentFiles::Scene);
|
||||
RecentFiles::instance()->addFilePath(fileName, RecentFiles::Scene,
|
||||
projectName);
|
||||
} else
|
||||
RecentFiles::instance()->moveFilePath(index, 0, RecentFiles::Scene);
|
||||
RecentFiles::instance()->refreshRecentFilesMenu(RecentFiles::Scene);
|
||||
hide();
|
||||
|
|
|
@ -267,8 +267,9 @@ int TApp::getCurrentLevelStyleIndex() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TApp::setCurrentLevelStyleIndex(int index) {
|
||||
m_paletteController->getCurrentLevelPalette()->setStyleIndex(index);
|
||||
void TApp::setCurrentLevelStyleIndex(int index, bool forceUpdate) {
|
||||
m_paletteController->getCurrentLevelPalette()->setStyleIndex(index,
|
||||
forceUpdate);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
|
||||
int getCurrentLevelStyleIndex() const override;
|
||||
|
||||
void setCurrentLevelStyleIndex(int index) override;
|
||||
void setCurrentLevelStyleIndex(int index, bool forceUpdate = false) override;
|
||||
|
||||
void setMainWindow(QMainWindow *mainWindow) { m_mainWindow = mainWindow; }
|
||||
/*!
|
||||
|
|
|
@ -324,7 +324,7 @@ void TaskSheet::update(TFarmTask *task) {
|
|||
m_commandLine->setText(task->getCommandLine());
|
||||
m_server->setText(task->m_server);
|
||||
m_submittedBy->setText(task->m_user);
|
||||
m_submittedOn->setText(task->m_submissionDate.toString());
|
||||
m_submittedOn->setText(task->m_callerMachineName);
|
||||
m_priority->setText(QString::number(task->m_priority));
|
||||
m_submitDate->setText(task->m_submissionDate.toString());
|
||||
m_startDate->setText(task->m_startDate.toString());
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "toonzqt/tselectionhandle.h"
|
||||
#include "toonzqt/tmessageviewer.h"
|
||||
#include "toonzqt/scriptconsole.h"
|
||||
#include "toonzqt/fxsettings.h"
|
||||
|
||||
// TnzLib includes
|
||||
#include "toonz/palettecontroller.h"
|
||||
|
@ -1358,3 +1359,52 @@ public:
|
|||
OpenFloatingPanel openHistoryPanelCommand(MI_OpenHistoryPanel, "HistoryPanel",
|
||||
QObject::tr("History"));
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// FxSettings
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FxSettingsPanel::FxSettingsPanel(QWidget *parent) : TPanel(parent) {
|
||||
TApp *app = TApp::instance();
|
||||
TSceneHandle *hScene = app->getCurrentScene();
|
||||
TPixel32 col1, col2;
|
||||
Preferences::instance()->getChessboardColors(col1, col2);
|
||||
|
||||
m_fxSettings = new FxSettings(this, col1, col2);
|
||||
m_fxSettings->setSceneHandle(hScene);
|
||||
m_fxSettings->setFxHandle(app->getCurrentFx());
|
||||
m_fxSettings->setFrameHandle(app->getCurrentFrame());
|
||||
m_fxSettings->setXsheetHandle(app->getCurrentXsheet());
|
||||
m_fxSettings->setLevelHandle(app->getCurrentLevel());
|
||||
m_fxSettings->setObjectHandle(app->getCurrentObject());
|
||||
|
||||
m_fxSettings->setCurrentFx();
|
||||
|
||||
setWidget(m_fxSettings);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// FxSettingsFactory
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class FxSettingsFactory final : public TPanelFactory {
|
||||
public:
|
||||
FxSettingsFactory() : TPanelFactory("FxSettings") {}
|
||||
|
||||
TPanel *createPanel(QWidget *parent) override {
|
||||
FxSettingsPanel *panel = new FxSettingsPanel(parent);
|
||||
panel->move(qApp->desktop()->screenGeometry(panel).center());
|
||||
panel->setObjectName(getPanelType());
|
||||
panel->setWindowTitle(QObject::tr("Fx Settings"));
|
||||
panel->setMinimumSize(390, 85);
|
||||
panel->allowMultipleInstances(false);
|
||||
return panel;
|
||||
}
|
||||
|
||||
void initialize(TPanel *panel) override { assert(0); }
|
||||
|
||||
} FxSettingsFactory;
|
||||
|
||||
//=============================================================================
|
||||
OpenFloatingPanel openFxSettingsCommand(MI_FxParamEditor, "FxSettings",
|
||||
QObject::tr("Fx Settings"));
|
||||
|
|
|
@ -25,6 +25,8 @@ class FunctionViewer;
|
|||
class FlipBook;
|
||||
class ToolOptions;
|
||||
class ComboViewerPanel;
|
||||
class FxSettings;
|
||||
|
||||
//=========================================================
|
||||
// PaletteViewerPanel
|
||||
//---------------------------------------------------------
|
||||
|
@ -267,4 +269,17 @@ protected:
|
|||
void widgetClearFocusOnLeave() override;
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// FxSettingsPanel
|
||||
//---------------------------------------------------------
|
||||
|
||||
class FxSettingsPanel final : public TPanel {
|
||||
Q_OBJECT
|
||||
|
||||
FxSettings *m_fxSettings;
|
||||
|
||||
public:
|
||||
FxSettingsPanel(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "toonz/tonionskinmaskhandle.h"
|
||||
#include "toutputproperties.h"
|
||||
#include "toonz/preferences.h"
|
||||
#include "toonz/tproject.h"
|
||||
|
||||
// TnzQt includes
|
||||
#include "toonzqt/menubarcommand.h"
|
||||
|
@ -521,10 +522,12 @@ void SceneViewerPanel::changeWindowTitle() {
|
|||
int frame = app->getCurrentFrame()->getFrame();
|
||||
QString name;
|
||||
if (app->getCurrentFrame()->isEditingScene()) {
|
||||
TProject *project = scene->getProject();
|
||||
QString projectName = QString::fromStdString(project->getName().getName());
|
||||
QString sceneName = QString::fromStdWString(scene->getSceneName());
|
||||
if (sceneName.isEmpty()) sceneName = tr("Untitled");
|
||||
if (app->getCurrentScene()->getDirtyFlag()) sceneName += QString("*");
|
||||
name = tr("Scene: ") + sceneName;
|
||||
name = tr("Scene: ") + sceneName + tr(" :: Project: ") + projectName;
|
||||
if (frame >= 0)
|
||||
name =
|
||||
name + tr(" :: Frame: ") + tr(std::to_string(frame + 1).c_str());
|
||||
|
|
|
@ -183,9 +183,6 @@ bool CellsMover::canMoveCells(const TPoint &pos) {
|
|||
while (i < m_rowCount * m_colCount) {
|
||||
TXshColumn::ColumnType srcType = getColumnTypeFromCell(i);
|
||||
int dstIndex = c + i;
|
||||
if (!m_orientation->isVerticalTimeline() &&
|
||||
dstIndex >= xsh->getColumnCount())
|
||||
return false;
|
||||
TXshColumn *dstColumn = xsh->getColumn(dstIndex);
|
||||
if (srcType == TXshColumn::eZeraryFxType ||
|
||||
srcType == TXshColumn::eSoundTextType)
|
||||
|
|
|
@ -318,44 +318,34 @@ bool isGlobalKeyFrameWithSameTypeDiffFromLinear(TStageObject *stageObject,
|
|||
TDoubleKeyframe::Type type =
|
||||
stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame).m_type;
|
||||
if (type == TDoubleKeyframe::Linear) return false;
|
||||
if (type !=
|
||||
stageObject->getParam(TStageObject::T_X)
|
||||
if (type != stageObject->getParam(TStageObject::T_X)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Y)
|
||||
type != stageObject->getParam(TStageObject::T_Y)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Z)
|
||||
type != stageObject->getParam(TStageObject::T_Z)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_SO)
|
||||
type != stageObject->getParam(TStageObject::T_SO)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ScaleX)
|
||||
type != stageObject->getParam(TStageObject::T_ScaleX)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ScaleY)
|
||||
type != stageObject->getParam(TStageObject::T_ScaleY)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Scale)
|
||||
type != stageObject->getParam(TStageObject::T_Scale)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Path)
|
||||
type != stageObject->getParam(TStageObject::T_Path)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ShearX)
|
||||
type != stageObject->getParam(TStageObject::T_ShearX)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ShearY)
|
||||
type != stageObject->getParam(TStageObject::T_ShearY)
|
||||
->getKeyframeAt(frame)
|
||||
.m_type)
|
||||
return false;
|
||||
|
@ -380,44 +370,34 @@ bool isGlobalKeyFrameWithSamePrevTypeDiffFromLinear(TStageObject *stageObject,
|
|||
->getKeyframeAt(frame)
|
||||
.m_prevType;
|
||||
if (type == TDoubleKeyframe::Linear) return false;
|
||||
if (type !=
|
||||
stageObject->getParam(TStageObject::T_X)
|
||||
if (type != stageObject->getParam(TStageObject::T_X)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Y)
|
||||
type != stageObject->getParam(TStageObject::T_Y)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Z)
|
||||
type != stageObject->getParam(TStageObject::T_Z)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_SO)
|
||||
type != stageObject->getParam(TStageObject::T_SO)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ScaleX)
|
||||
type != stageObject->getParam(TStageObject::T_ScaleX)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ScaleY)
|
||||
type != stageObject->getParam(TStageObject::T_ScaleY)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Scale)
|
||||
type != stageObject->getParam(TStageObject::T_Scale)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_Path)
|
||||
type != stageObject->getParam(TStageObject::T_Path)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ShearX)
|
||||
type != stageObject->getParam(TStageObject::T_ShearX)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType ||
|
||||
type !=
|
||||
stageObject->getParam(TStageObject::T_ShearY)
|
||||
type != stageObject->getParam(TStageObject::T_ShearY)
|
||||
->getKeyframeAt(frame)
|
||||
.m_prevType)
|
||||
return false;
|
||||
|
@ -828,7 +808,7 @@ void RenameCellField::renameCell() {
|
|||
}
|
||||
|
||||
TXshLevel *xl = cell.m_level.getPointer();
|
||||
if (!xl || (xl->getSimpleLevel() &&
|
||||
if (!xl || (xl->getSimpleLevel() && !xl->getSimpleLevel()->isEmpty() &&
|
||||
xl->getSimpleLevel()->getFirstFid() == TFrameId::NO_FRAME)) {
|
||||
cells.append(TXshCell());
|
||||
continue;
|
||||
|
@ -1897,7 +1877,8 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
|||
bool isSelected = cellSelection->isCellSelected(row, col) ||
|
||||
columnSelection->isColumnSelected(col);
|
||||
|
||||
if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame
|
||||
if (row > 0)
|
||||
prevCell = xsh->getCell(row - 1, col); // cell in previous frame
|
||||
// nothing to draw
|
||||
|
||||
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
|
||||
|
@ -2531,6 +2512,8 @@ public:
|
|||
void undo() const override {
|
||||
m_pegbar->enableCycle(!m_pegbar->isCycleEnabled());
|
||||
m_area->update();
|
||||
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
|
||||
TApp::instance()->getCurrentObject()->notifyObjectIdChanged(false);
|
||||
}
|
||||
void redo() const override { undo(); }
|
||||
int getSize() const override { return sizeof *this; }
|
||||
|
@ -2694,8 +2677,9 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
|
|||
} else if (isKeyframeFrame && row == k1 + 1 &&
|
||||
o->rect(PredefinedRect::LOOP_ICON)
|
||||
.contains(mouseInCell)) { // cycle toggle
|
||||
pegbar->enableCycle(!pegbar->isCycleEnabled());
|
||||
TUndoManager::manager()->add(new CycleUndo(pegbar, this));
|
||||
CycleUndo *undo = new CycleUndo(pegbar, this);
|
||||
undo->redo();
|
||||
TUndoManager::manager()->add(undo);
|
||||
accept = true;
|
||||
}
|
||||
if (accept) {
|
||||
|
@ -2709,11 +2693,16 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
|
|||
|
||||
if (m_levelExtenderRect.contains(pos.x, pos.y)) {
|
||||
m_viewer->getKeyframeSelection()->selectNone();
|
||||
setDragTool(XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer));
|
||||
if (event->modifiers() & Qt::ControlModifier)
|
||||
setDragTool(
|
||||
XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer, false));
|
||||
else
|
||||
setDragTool(XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer, true));
|
||||
} else if (event->modifiers() & Qt::ControlModifier &&
|
||||
m_upperLevelExtenderRect.contains(pos.x, pos.y)) {
|
||||
m_viewer->getKeyframeSelection()->selectNone();
|
||||
setDragTool(XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer, true));
|
||||
setDragTool(
|
||||
XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer, false, true));
|
||||
} else if ((!xsh->getCell(row, col).isEmpty()) &&
|
||||
o->rect(PredefinedRect::DRAG_AREA)
|
||||
.adjusted(0, 0, -frameAdj, 0)
|
||||
|
@ -2742,8 +2731,7 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
|
|||
setDragTool(XsheetGUI::DragTool::makeLevelMoverTool(m_viewer));
|
||||
} else {
|
||||
m_viewer->getKeyframeSelection()->selectNone();
|
||||
if (isSoundColumn &&
|
||||
o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||
if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||
.adjusted(0, 0, -frameAdj, 0)
|
||||
.contains(mouseInCell))
|
||||
setDragTool(XsheetGUI::DragTool::makeSoundScrubTool(
|
||||
|
@ -2879,8 +2867,7 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
|
|||
: QString::fromStdWString(levelName) + QString(" ") +
|
||||
QString::fromStdString(frameNumber));
|
||||
}
|
||||
} else if (isSoundColumn &&
|
||||
o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||
} else if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||
.adjusted(0, 0, -frameAdj, 0)
|
||||
.contains(mouseInCell))
|
||||
m_tooltip = tr("Click and drag to play");
|
||||
|
@ -3133,8 +3120,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
CommandManager *cmdManager = CommandManager::instance();
|
||||
|
||||
bool soundCellsSelected = m_viewer->areSoundCellsSelected();
|
||||
|
||||
if (m_viewer->areSoundTextCellsSelected()) return; // Magpies stop here
|
||||
bool soundTextCellsSelected = m_viewer->areSoundTextCellsSelected();
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
|
@ -3145,13 +3131,17 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
}
|
||||
|
||||
if (isCellSelected) {
|
||||
bool addSeparator = false;
|
||||
// open fx settings instead of level settings when clicked on zerary fx
|
||||
// level
|
||||
if (cell.m_level && cell.m_level->getZeraryFxLevel())
|
||||
if (cell.m_level && cell.m_level->getZeraryFxLevel()) {
|
||||
menu.addAction(cmdManager->getAction(MI_FxParamEditor));
|
||||
else
|
||||
addSeparator = true;
|
||||
} else if (!soundTextCellsSelected) {
|
||||
menu.addAction(cmdManager->getAction(MI_LevelSettings));
|
||||
menu.addSeparator();
|
||||
addSeparator = true;
|
||||
}
|
||||
if (addSeparator) menu.addSeparator();
|
||||
|
||||
if (!soundCellsSelected) {
|
||||
QMenu *reframeSubMenu = new QMenu(tr("Reframe"), this);
|
||||
|
@ -3183,6 +3173,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
}
|
||||
menu.addMenu(eachSubMenu);
|
||||
|
||||
if (!soundTextCellsSelected) {
|
||||
QMenu *editCellNumbersMenu = new QMenu(tr("Edit Cell Numbers"), this);
|
||||
{
|
||||
editCellNumbersMenu->addAction(cmdManager->getAction(MI_Reverse));
|
||||
|
@ -3196,12 +3187,16 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
cmdManager->getAction(MI_AutoInputCellNumber));
|
||||
}
|
||||
menu.addMenu(editCellNumbersMenu);
|
||||
}
|
||||
menu.addAction(cmdManager->getAction(MI_FillEmptyCell));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
if (!soundTextCellsSelected)
|
||||
menu.addAction(cmdManager->getAction(MI_Autorenumber));
|
||||
}
|
||||
|
||||
if (!soundTextCellsSelected) {
|
||||
QMenu *replaceLevelMenu = new QMenu(tr("Replace Level"), this);
|
||||
menu.addMenu(replaceLevelMenu);
|
||||
|
||||
|
@ -3231,7 +3226,8 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
levels[i]))
|
||||
continue;
|
||||
|
||||
QString tmpLevelName = QString::fromStdWString(levels[i]->getName());
|
||||
QString tmpLevelName =
|
||||
QString::fromStdWString(levels[i]->getName());
|
||||
QAction *tmpAction = new QAction(tmpLevelName, replaceMenu);
|
||||
tmpAction->setData(tmpLevelName);
|
||||
replaceMenu->addAction(tmpAction);
|
||||
|
@ -3239,7 +3235,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!soundCellsSelected) {
|
||||
if (!soundCellsSelected && !soundTextCellsSelected) {
|
||||
if (selectionContainTlvImage(m_viewer->getCellSelection(),
|
||||
m_viewer->getXsheet()))
|
||||
replaceLevelMenu->addAction(
|
||||
|
@ -3251,6 +3247,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
menu.addAction(cmdManager->getAction(MI_SetKeyframes));
|
||||
}
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
menu.addAction(cmdManager->getAction(MI_Cut));
|
||||
menu.addAction(cmdManager->getAction(MI_Copy));
|
||||
|
@ -3265,6 +3262,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
|||
|
||||
menu.addAction(cmdManager->getAction(MI_Clear));
|
||||
menu.addAction(cmdManager->getAction(MI_Insert));
|
||||
if (!soundTextCellsSelected)
|
||||
menu.addAction(cmdManager->getAction(MI_Duplicate));
|
||||
menu.addSeparator();
|
||||
|
||||
|
@ -3513,4 +3511,4 @@ void CellArea::onStepChanged(QAction *act) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
} // namespace XsheetGUI;
|
||||
} // namespace XsheetGUI
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue