Add Guided Drawing Controls Pane (#2992)
* guided drawings menu fix * Add Guided Drawing Controls Pane * Fix Guided Drawing Panel not opening * Add Flip Guide Stroke Direction commands * Restore Off to Guide Frame selection Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com>
This commit is contained in:
parent
ee1983a6f5
commit
233fcf81e3
26 changed files with 692 additions and 8024 deletions
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
|
@ -168,7 +168,12 @@ QMenu {
|
|||
}
|
||||
}
|
||||
&::indicator {
|
||||
&:extend(.CheckBox::indicator all);
|
||||
&:non-exclusive {
|
||||
&:extend(.CheckBox::indicator all);
|
||||
}
|
||||
&:exclusive {
|
||||
&:extend(.RadioButton::indicator all);
|
||||
}
|
||||
margin-left: 7;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -274,6 +274,8 @@
|
|||
<command>MI_NoShift</command>
|
||||
<command>MI_ResetShift</command>
|
||||
<separator/>
|
||||
<command>MI_VectorGuidedDrawing</command>
|
||||
<separator/>
|
||||
<command>MI_RasterizePli</command>
|
||||
</menu>
|
||||
<menu title="Windows">
|
||||
|
@ -314,6 +316,7 @@
|
|||
<command>MI_AudioRecording</command>
|
||||
<command>MI_OpenStopMotionPanel</command>
|
||||
<command>MI_StartupPopup</command>
|
||||
<command>MI_OpenGuidedDrawingControls</command>
|
||||
<separator/>
|
||||
<command>MI_MaximizePanel</command>
|
||||
<command>MI_FullScreenWindow</command>
|
||||
|
|
|
@ -222,6 +222,7 @@ MI_OpenFileBrowser2=
|
|||
MI_OpenFileViewer=
|
||||
MI_OpenFilmStrip=
|
||||
MI_OpenFunctionEditor=
|
||||
MI_OpenGuidedDrawingControls=
|
||||
MI_OpenHistoryPanel=Ctrl+H
|
||||
MI_OpenLevelView=
|
||||
MI_OpenOnlineManual=F1
|
||||
|
@ -323,9 +324,14 @@ MI_SelectAll=Ctrl+A
|
|||
MI_SelectAllKeyframes=
|
||||
MI_SelectAllKeyframesNotAfter=
|
||||
MI_SelectAllKeyframesNotBefore=
|
||||
MI_SelectBothGuideStrokes=
|
||||
MI_SelectColumnKeyframes=
|
||||
MI_SelectFollowingKeysInColumn=
|
||||
MI_SelectFollowingKeysInRow=
|
||||
MI_SelectGuidesAndTweenMode=
|
||||
MI_SelectGuideStrokeReset=
|
||||
MI_SelectNextGuideStroke=
|
||||
MI_SelectPrevGuideStroke=
|
||||
MI_SelectPreviousKeysInColumn=
|
||||
MI_SelectPreviousKeysInRow=
|
||||
MI_SelectRowKeyframes=
|
||||
|
@ -357,6 +363,8 @@ MI_ToggleLinkToStudioPalette=
|
|||
MI_ToggleXSheetToolbar=
|
||||
MI_TouchGestureControl=
|
||||
MI_Tracking=
|
||||
MI_TweenGuideStrokes=
|
||||
MI_TweenGuideStrokeToSelected=
|
||||
MI_Undo=Ctrl+Z
|
||||
MI_Ungroup=Ctrl+Shift+G
|
||||
MI_UnlockAllColumns=Ctrl+Alt+Shift+U
|
||||
|
@ -369,6 +377,7 @@ MI_UseExpressionInterpolation=
|
|||
MI_UseFileInterpolation=
|
||||
MI_UseLinearInterpolation=
|
||||
MI_UseSpeedInOutInterpolation=
|
||||
MI_VectorGuidedDrawing=
|
||||
MI_ViewBBox=
|
||||
MI_ViewCamera=
|
||||
MI_ViewColorcard=
|
||||
|
|
|
@ -222,6 +222,7 @@ MI_OpenFileBrowser2=
|
|||
MI_OpenFileViewer=
|
||||
MI_OpenFilmStrip=
|
||||
MI_OpenFunctionEditor=Alt+F
|
||||
MI_OpenGuidedDrawingControls=
|
||||
MI_OpenHistoryPanel=
|
||||
MI_OpenLevelView=
|
||||
MI_OpenOnlineManual=
|
||||
|
@ -323,9 +324,14 @@ MI_SelectAll=Shift+A
|
|||
MI_SelectAllKeyframes=
|
||||
MI_SelectAllKeyframesNotAfter=
|
||||
MI_SelectAllKeyframesNotBefore=
|
||||
MI_SelectBothGuideStrokes=
|
||||
MI_SelectColumnKeyframes=
|
||||
MI_SelectFollowingKeysInColumn=
|
||||
MI_SelectFollowingKeysInRow=
|
||||
MI_SelectGuidesAndTweenMode=
|
||||
MI_SelectGuideStrokeReset=
|
||||
MI_SelectNextGuideStroke=
|
||||
MI_SelectPrevGuideStroke=
|
||||
MI_SelectPreviousKeysInColumn=
|
||||
MI_SelectPreviousKeysInRow=
|
||||
MI_SelectRowKeyframes=
|
||||
|
@ -357,6 +363,8 @@ MI_ToggleLinkToStudioPalette=
|
|||
MI_ToggleXSheetToolbar=
|
||||
MI_TouchGestureControl=
|
||||
MI_Tracking=
|
||||
MI_TweenGuideStrokes=
|
||||
MI_TweenGuideStrokeToSelected=
|
||||
MI_Undo=Ctrl+Z
|
||||
MI_Ungroup=Ctrl+Shift+G
|
||||
MI_UnlockAllColumns=Ctrl+Alt+Shift+L
|
||||
|
@ -369,6 +377,7 @@ MI_UseExpressionInterpolation=
|
|||
MI_UseFileInterpolation=
|
||||
MI_UseLinearInterpolation=
|
||||
MI_UseSpeedInOutInterpolation=
|
||||
MI_VectorGuidedDrawing=
|
||||
MI_ViewBBox=
|
||||
MI_ViewCamera=
|
||||
MI_ViewColorcard=
|
||||
|
|
|
@ -222,6 +222,7 @@ MI_OpenFileBrowser2=
|
|||
MI_OpenFileViewer=
|
||||
MI_OpenFilmStrip=
|
||||
MI_OpenFunctionEditor=Alt+F
|
||||
MI_OpenGuidedDrawingControls=
|
||||
MI_OpenHistoryPanel=
|
||||
MI_OpenLevelView=
|
||||
MI_OpenOnlineManual=
|
||||
|
@ -323,9 +324,14 @@ MI_SelectAll=Ctrl+A
|
|||
MI_SelectAllKeyframes=
|
||||
MI_SelectAllKeyframesNotAfter=
|
||||
MI_SelectAllKeyframesNotBefore=
|
||||
MI_SelectBothGuideStrokes=
|
||||
MI_SelectColumnKeyframes=
|
||||
MI_SelectFollowingKeysInColumn=
|
||||
MI_SelectFollowingKeysInRow=
|
||||
MI_SelectGuidesAndTweenMode=
|
||||
MI_SelectGuideStrokeReset=
|
||||
MI_SelectNextGuideStroke=
|
||||
MI_SelectPrevGuideStroke=
|
||||
MI_SelectPreviousKeysInColumn=
|
||||
MI_SelectPreviousKeysInRow=
|
||||
MI_SelectRowKeyframes=
|
||||
|
@ -357,6 +363,8 @@ MI_ToggleLinkToStudioPalette=
|
|||
MI_ToggleXSheetToolbar=
|
||||
MI_TouchGestureControl=
|
||||
MI_Tracking=
|
||||
MI_TweenGuideStrokes=
|
||||
MI_TweenGuideStrokeToSelected=
|
||||
MI_Undo=Ctrl+Z
|
||||
MI_Ungroup=Ctrl+Shift+G
|
||||
MI_UnlockAllColumns=Ctrl+Alt+Shift+K
|
||||
|
@ -369,6 +377,7 @@ MI_UseExpressionInterpolation=
|
|||
MI_UseFileInterpolation=
|
||||
MI_UseLinearInterpolation=
|
||||
MI_UseSpeedInOutInterpolation=
|
||||
MI_VectorGuidedDrawing=
|
||||
MI_ViewBBox=
|
||||
MI_ViewCamera=
|
||||
MI_ViewColorcard=
|
||||
|
|
|
@ -222,6 +222,7 @@ MI_OpenFileBrowser2=
|
|||
MI_OpenFileViewer=
|
||||
MI_OpenFilmStrip=
|
||||
MI_OpenFunctionEditor=Alt+F
|
||||
MI_OpenGuidedDrawingControls=
|
||||
MI_OpenHistoryPanel=
|
||||
MI_OpenLevelView=
|
||||
MI_OpenOnlineManual=
|
||||
|
@ -323,9 +324,14 @@ MI_SelectAll=Shift+A
|
|||
MI_SelectAllKeyframes=
|
||||
MI_SelectAllKeyframesNotAfter=
|
||||
MI_SelectAllKeyframesNotBefore=
|
||||
MI_SelectBothGuideStrokes=
|
||||
MI_SelectColumnKeyframes=
|
||||
MI_SelectFollowingKeysInColumn=
|
||||
MI_SelectFollowingKeysInRow=
|
||||
MI_SelectGuidesAndTweenMode=
|
||||
MI_SelectGuideStrokeReset=
|
||||
MI_SelectNextGuideStroke=
|
||||
MI_SelectPrevGuideStroke=
|
||||
MI_SelectPreviousKeysInColumn=
|
||||
MI_SelectPreviousKeysInRow=
|
||||
MI_SelectRowKeyframes=
|
||||
|
@ -357,6 +363,8 @@ MI_ToggleLinkToStudioPalette=
|
|||
MI_ToggleXSheetToolbar=
|
||||
MI_TouchGestureControl=
|
||||
MI_Tracking=
|
||||
MI_TweenGuideStrokes=
|
||||
MI_TweenGuideStrokeToSelected=
|
||||
MI_Undo=Ctrl+Z
|
||||
MI_Ungroup=Ctrl+Shift+G
|
||||
MI_UnlockAllColumns=Ctrl+Alt+Shift+L
|
||||
|
@ -369,6 +377,7 @@ MI_UseExpressionInterpolation=
|
|||
MI_UseFileInterpolation=
|
||||
MI_UseLinearInterpolation=
|
||||
MI_UseSpeedInOutInterpolation=
|
||||
MI_VectorGuidedDrawing=
|
||||
MI_ViewBBox=
|
||||
MI_ViewCamera=
|
||||
MI_ViewColorcard=
|
||||
|
|
|
@ -523,6 +523,7 @@ transformation.
|
|||
|
||||
void tweenSelectedGuideStrokes();
|
||||
void tweenGuideStrokeToSelected();
|
||||
void flipGuideStrokeDirection(int mode);
|
||||
|
||||
public:
|
||||
struct CellOps {
|
||||
|
|
|
@ -461,7 +461,8 @@ public:
|
|||
// Shortcut popup settings
|
||||
QString getShortcutPreset() { return getStringValue(shortcutPreset); }
|
||||
// Viewer context menu
|
||||
int getGuidedDrawing() { return getIntValue(guidedDrawingType); }
|
||||
bool isGuidedDrawingEnabled() { return getIntValue(guidedDrawingType) > 0; }
|
||||
int getGuidedDrawingType() { return getIntValue(guidedDrawingType); }
|
||||
bool getGuidedAutoInbetween() { return getBoolValue(guidedAutoInbetween); }
|
||||
int getGuidedInterpolation() { return getIntValue(guidedInterpolationType); }
|
||||
#if defined(MACOSX) && defined(__LP64__)
|
||||
|
|
|
@ -1119,8 +1119,8 @@ public:
|
|||
stroke->getBBox());
|
||||
|
||||
bool strokeAdded = false;
|
||||
if ((Preferences::instance()->getGuidedDrawing() == 1 ||
|
||||
Preferences::instance()->getGuidedDrawing() == 2) &&
|
||||
if ((Preferences::instance()->getGuidedDrawingType() == 1 ||
|
||||
Preferences::instance()->getGuidedDrawingType() == 2) &&
|
||||
Preferences::instance()->getGuidedAutoInbetween()) {
|
||||
TTool *tool =
|
||||
TTool::getTool(T_Brush, TTool::ToolTargetType::VectorImage);
|
||||
|
|
|
@ -1068,6 +1068,8 @@ void TTool::setSelectedFrames(const std::set<TFrameId> &selectedFrames) {
|
|||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void TTool::Viewer::getGuidedFrameIdx(int *backIdx, int *frontIdx) {
|
||||
if (!Preferences::instance()->isGuidedDrawingEnabled()) return;
|
||||
|
||||
OnionSkinMask osMask =
|
||||
m_application->getCurrentOnionSkin()->getOnionSkinMask();
|
||||
|
||||
|
@ -1084,7 +1086,7 @@ void TTool::Viewer::getGuidedFrameIdx(int *backIdx, int *frontIdx) {
|
|||
int fosCount = osMask.getFosCount();
|
||||
|
||||
// Find onion-skinned drawing that is being used for guided auto inbetween
|
||||
if (Preferences::instance()->getGuidedDrawing() == 1) {
|
||||
if (Preferences::instance()->getGuidedDrawingType() == 1) {
|
||||
// Get closest moving unionskin
|
||||
for (int i = 0; i < mosCount; i++) {
|
||||
int cmos = osMask.getMos(i);
|
||||
|
@ -1111,7 +1113,7 @@ void TTool::Viewer::getGuidedFrameIdx(int *backIdx, int *frontIdx) {
|
|||
*frontIdx = fosFront;
|
||||
else if (fosFront != -1)
|
||||
*frontIdx = std::min(*frontIdx, fosFront);
|
||||
} else if (Preferences::instance()->getGuidedDrawing() ==
|
||||
} else if (Preferences::instance()->getGuidedDrawingType() ==
|
||||
2) { // Furthest drawing
|
||||
// Get moving unionskin
|
||||
for (int i = 0; i < mosCount; i++) {
|
||||
|
@ -1407,3 +1409,69 @@ void TTool::tweenGuideStrokeToSelected() {
|
|||
TUndoManager::manager()->endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void TTool::flipGuideStrokeDirection(int mode) {
|
||||
if (!mode) return;
|
||||
|
||||
TXshSimpleLevel *sl =
|
||||
m_application->getCurrentLevel()->getLevel()->getSimpleLevel();
|
||||
if (!sl) return;
|
||||
|
||||
int osBack = -1;
|
||||
int osFront = -1;
|
||||
int os = -1;
|
||||
int strokeIdx;
|
||||
|
||||
getViewer()->getGuidedFrameIdx(&osBack, &osFront);
|
||||
|
||||
if (mode < 0) { // Previous Frame
|
||||
os = osBack;
|
||||
strokeIdx = getViewer()->getGuidedBackStroke();
|
||||
} else if (mode > 0) { // Next Frame
|
||||
os = osFront;
|
||||
strokeIdx = getViewer()->getGuidedFrontStroke();
|
||||
}
|
||||
|
||||
if (os < 0) return;
|
||||
|
||||
TFrameHandle *currentFrame = getApplication()->getCurrentFrame();
|
||||
int row = currentFrame->getFrameIndex();
|
||||
TFrameId cFid = getCurrentFid();
|
||||
if (cFid.isEmptyFrame()) return;
|
||||
|
||||
TVectorImageP cvi = sl->getFrame(cFid, false);
|
||||
if (!cvi) return;
|
||||
|
||||
int cStrokeCount = cvi->getStrokeCount();
|
||||
|
||||
TFrameId fid;
|
||||
if (currentFrame->isEditingScene()) {
|
||||
TXsheet *xsh = getApplication()->getCurrentXsheet()->getXsheet();
|
||||
int col = getApplication()->getCurrentColumn()->getColumnIndex();
|
||||
if (xsh && col >= 0) {
|
||||
TXshCell cell = xsh->getCell(os, col);
|
||||
if (!cell.isEmpty()) fid = cell.getFrameId();
|
||||
}
|
||||
} else
|
||||
fid = sl->getFrameId(os);
|
||||
|
||||
if (fid.isEmptyFrame()) return;
|
||||
|
||||
TVectorImageP vi = sl->getFrame(fid, false);
|
||||
if (!vi) return;
|
||||
|
||||
int strokeCount = vi->getStrokeCount();
|
||||
if (!strokeCount) return;
|
||||
|
||||
if (strokeIdx == -1) strokeIdx = cStrokeCount;
|
||||
|
||||
if (strokeIdx >= strokeCount) return;
|
||||
|
||||
TStroke *stroke = vi->getStroke(strokeIdx);
|
||||
if (!stroke) return;
|
||||
|
||||
stroke->changeDirection();
|
||||
getViewer()->invalidateAll();
|
||||
}
|
||||
|
|
|
@ -982,8 +982,8 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos,
|
|||
|
||||
bool strokeAdded = false;
|
||||
|
||||
if ((Preferences::instance()->getGuidedDrawing() == 1 ||
|
||||
Preferences::instance()->getGuidedDrawing() == 2) &&
|
||||
if ((Preferences::instance()->getGuidedDrawingType() == 1 ||
|
||||
Preferences::instance()->getGuidedDrawingType() == 2) &&
|
||||
Preferences::instance()->getGuidedAutoInbetween()) {
|
||||
int fidx = getApplication()->getCurrentFrame()->getFrameIndex();
|
||||
TFrameId fId = getFrameId();
|
||||
|
|
|
@ -108,6 +108,7 @@ set(MOC_HEADERS
|
|||
toolbar.h
|
||||
tpanels.h
|
||||
trackerpopup.h
|
||||
vectorguideddrawingpane.h
|
||||
vectorizerpopup.h
|
||||
vectorizerswatch.h
|
||||
versioncontrol.h
|
||||
|
@ -276,6 +277,7 @@ set(SOURCES
|
|||
kis_tablet_support_win8.cpp
|
||||
timestretchpopup.cpp
|
||||
trackerpopup.cpp
|
||||
vectorguideddrawingpane.cpp
|
||||
vectorizerpopup.cpp
|
||||
vectorizerswatch.cpp
|
||||
versioncontrol.cpp
|
||||
|
|
|
@ -957,6 +957,7 @@ void MainWindow::onNewScene() {
|
|||
cm->setChecked(MI_ShiftTrace, false);
|
||||
cm->setChecked(MI_EditShift, false);
|
||||
cm->setChecked(MI_NoShift, false);
|
||||
cm->setChecked(MI_VectorGuidedDrawing, false);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1933,6 +1934,10 @@ void MainWindow::defineActions() {
|
|||
createAction(MI_ResetShift, tr("Reset Shift"), "", MenuViewCommandType);
|
||||
shiftTraceAction->setIcon(QIcon(":Resources/shift_and_trace_reset.svg"));
|
||||
|
||||
QAction *GuidedDrawingAction = createToggle(
|
||||
MI_VectorGuidedDrawing, tr("Vector Guided Drawing"), "",
|
||||
Preferences::instance()->isGuidedDrawingEnabled(), MenuViewCommandType);
|
||||
|
||||
if (QGLPixelBuffer::hasOpenGLPbuffers())
|
||||
createToggle(MI_RasterizePli, tr("&Visualize Vector As Raster"), "",
|
||||
RasterizePliToggleAction ? 1 : 0, MenuViewCommandType);
|
||||
|
@ -2041,6 +2046,9 @@ void MainWindow::defineActions() {
|
|||
createMenuHelpAction(MI_OpenCommunityForum, tr("&Community Forum..."), "");
|
||||
createMenuHelpAction(MI_OpenReportABug, tr("&Report a Bug..."), "");
|
||||
|
||||
createMenuWindowsAction(MI_OpenGuidedDrawingControls,
|
||||
tr("Guided Drawing Controls"), "");
|
||||
|
||||
createRightClickMenuAction(MI_BlendColors, tr("&Blend colors"), "");
|
||||
|
||||
createToggle(MI_OnionSkin, tr("Onion Skin Toggle"), "/", false,
|
||||
|
@ -2201,20 +2209,24 @@ void MainWindow::defineActions() {
|
|||
CommandManager::instance()->setToggleTexts(V_ShowHideFullScreen,
|
||||
tr("Full Screen Mode"),
|
||||
tr("Exit Full Screen Mode"));
|
||||
createRightClickMenuAction(MI_SelectNextGuideStroke,
|
||||
tr("Select Next Frame Guide Stroke"), "");
|
||||
createRightClickMenuAction(MI_SelectPrevGuideStroke,
|
||||
tr("Select Previous Frame Guide Stroke"), "");
|
||||
createRightClickMenuAction(MI_SelectBothGuideStrokes,
|
||||
tr("Select Prev && Next Frame Guide Strokes"), "");
|
||||
createRightClickMenuAction(MI_SelectGuideStrokeReset,
|
||||
tr("Reset Guide Stroke Selections"), "");
|
||||
createRightClickMenuAction(MI_TweenGuideStrokes,
|
||||
tr("Tween Selected Guide Strokes"), "");
|
||||
createRightClickMenuAction(MI_TweenGuideStrokeToSelected,
|
||||
tr("Tween Guide Strokes to Selected"), "");
|
||||
createRightClickMenuAction(MI_SelectGuidesAndTweenMode,
|
||||
tr("Select Guide Strokes && Tween Mode"), "");
|
||||
createMiscAction(MI_SelectNextGuideStroke,
|
||||
tr("Select Next Frame Guide Stroke"), "");
|
||||
createMiscAction(MI_SelectPrevGuideStroke,
|
||||
tr("Select Previous Frame Guide Stroke"), "");
|
||||
createMiscAction(MI_SelectBothGuideStrokes,
|
||||
tr("Select Prev && Next Frame Guide Strokes"), "");
|
||||
createMiscAction(MI_SelectGuideStrokeReset,
|
||||
tr("Reset Guide Stroke Selections"), "");
|
||||
createMiscAction(MI_TweenGuideStrokes,
|
||||
tr("Tween Selected Guide Strokes"), "");
|
||||
createMiscAction(MI_TweenGuideStrokeToSelected,
|
||||
tr("Tween Guide Strokes to Selected"), "");
|
||||
createMiscAction(MI_SelectGuidesAndTweenMode,
|
||||
tr("Select Guide Strokes && Tween Mode"), "");
|
||||
createMiscAction(MI_FlipNextGuideStroke,
|
||||
tr("Flip Next Guide Stroke Direction"), "");
|
||||
createMiscAction(MI_FlipPrevGuideStroke,
|
||||
tr("Flip Previous Guide Stroke Direction"), "");
|
||||
|
||||
// Following actions are for adding "Visualization" menu items to the command
|
||||
// bar. They are separated from the original actions in order to avoid
|
||||
|
|
|
@ -1380,6 +1380,8 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
|||
addMenuItem(viewMenu, MI_NoShift);
|
||||
addMenuItem(viewMenu, MI_ResetShift);
|
||||
viewMenu->addSeparator();
|
||||
addMenuItem(viewMenu, MI_VectorGuidedDrawing);
|
||||
viewMenu->addSeparator();
|
||||
addMenuItem(viewMenu, MI_RasterizePli);
|
||||
#ifdef LINETEST
|
||||
viewMenu->addSeparator();
|
||||
|
@ -1427,6 +1429,7 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
|||
addMenuItem(windowsMenu, MI_OpenStopMotionPanel);
|
||||
#endif
|
||||
addMenuItem(windowsMenu, MI_StartupPopup);
|
||||
addMenuItem(windowsMenu, MI_OpenGuidedDrawingControls);
|
||||
#ifdef LINETEST
|
||||
windowsMenu->addSeparator();
|
||||
addMenuItem(windowsMenu, MI_OpenExport);
|
||||
|
|
|
@ -369,6 +369,9 @@
|
|||
|
||||
#define MI_ClearCacheFolder "MI_ClearCacheFolder"
|
||||
|
||||
#define MI_VectorGuidedDrawing "MI_VectorGuidedDrawing"
|
||||
#define MI_OpenGuidedDrawingControls "MI_OpenGuidedDrawingControls"
|
||||
|
||||
#define MI_SelectNextGuideStroke "MI_SelectNextGuideStroke"
|
||||
#define MI_SelectPrevGuideStroke "MI_SelectPrevGuideStroke"
|
||||
#define MI_SelectGuideStrokeReset "MI_SelectGuideStrokeReset"
|
||||
|
@ -377,5 +380,8 @@
|
|||
#define MI_SelectBothGuideStrokes "MI_SelectBothGuideStrokes"
|
||||
#define MI_SelectGuidesAndTweenMode "MI_SelectGuidesAndTweenMode"
|
||||
|
||||
#define MI_FlipNextGuideStroke "MI_FlipNextGuideStroke"
|
||||
#define MI_FlipPrevGuideStroke "MI_FlipPrevGuideStroke"
|
||||
|
||||
#define MI_ExportXDTS "MI_ExportXDTS"
|
||||
#endif
|
||||
|
|
|
@ -530,6 +530,44 @@ public:
|
|||
}
|
||||
} positionResetCommand;
|
||||
|
||||
class TVectorGuidedDrawingToggleCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TVectorGuidedDrawingToggleCommand()
|
||||
: MenuItemHandler(MI_VectorGuidedDrawing) {}
|
||||
void execute() override {
|
||||
CommandManager *cm = CommandManager::instance();
|
||||
QAction *action = cm->getAction(MI_VectorGuidedDrawing);
|
||||
Preferences::instance()->setValue(guidedDrawingType,
|
||||
action->isChecked() ? 1 : 0);
|
||||
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||
TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
|
||||
"GuidedDrawingFrame");
|
||||
}
|
||||
|
||||
bool isChecked(CommandId id) const {
|
||||
QAction *action = CommandManager::instance()->getAction(id);
|
||||
return action != 0 && action->isChecked();
|
||||
}
|
||||
} vectorGuidedDrawingToggleCommand;
|
||||
|
||||
class TSelectGuideStrokeResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TSelectGuideStrokeResetCommand()
|
||||
: MenuItemHandler(MI_SelectGuideStrokeReset) {}
|
||||
void execute() override {
|
||||
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
|
||||
if (!vi) return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
if (!tool) return;
|
||||
|
||||
tool->getViewer()->setGuidedStrokePickerMode(0);
|
||||
tool->getViewer()->setGuidedBackStroke(-1);
|
||||
tool->getViewer()->setGuidedFrontStroke(-1);
|
||||
tool->getViewer()->invalidateAll();
|
||||
}
|
||||
} SelectGuideStrokeResetCommand;
|
||||
|
||||
class TSelectGuideStrokeNextCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TSelectGuideStrokeNextCommand() : MenuItemHandler(MI_SelectNextGuideStroke) {}
|
||||
|
@ -538,8 +576,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -557,8 +595,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -577,8 +615,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -588,24 +626,6 @@ public:
|
|||
}
|
||||
} selectBothGuideStrokesCommand;
|
||||
|
||||
class TSelectGuideStrokeResetCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TSelectGuideStrokeResetCommand()
|
||||
: MenuItemHandler(MI_SelectGuideStrokeReset) {}
|
||||
void execute() override {
|
||||
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
|
||||
if (!vi) return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
if (!tool) return;
|
||||
|
||||
tool->getViewer()->setGuidedStrokePickerMode(0);
|
||||
tool->getViewer()->setGuidedBackStroke(-1);
|
||||
tool->getViewer()->setGuidedFrontStroke(-1);
|
||||
tool->getViewer()->invalidateAll();
|
||||
}
|
||||
} selectGuideStrokeResetCommand;
|
||||
|
||||
class TTweenGuideStrokesCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TTweenGuideStrokesCommand() : MenuItemHandler(MI_TweenGuideStrokes) {}
|
||||
|
@ -614,8 +634,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -634,8 +654,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -654,8 +674,8 @@ public:
|
|||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() ||
|
||||
(pref->getGuidedDrawing() != 1 && pref->getGuidedDrawing() != 2))
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
|
@ -665,6 +685,44 @@ public:
|
|||
}
|
||||
} selectGuidesAndTweenCommand;
|
||||
|
||||
class TFlipNextStrokeDirectionCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TFlipNextStrokeDirectionCommand() : MenuItemHandler(MI_FlipNextGuideStroke) {}
|
||||
void execute() override {
|
||||
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
|
||||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
if (!tool) return;
|
||||
|
||||
tool->flipGuideStrokeDirection(1);
|
||||
}
|
||||
} flipNextStrokeDirectionCommand;
|
||||
|
||||
class TFlipPrevStrokeDirectionCommand final : public MenuItemHandler {
|
||||
public:
|
||||
TFlipPrevStrokeDirectionCommand() : MenuItemHandler(MI_FlipPrevGuideStroke) {}
|
||||
void execute() override {
|
||||
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
|
||||
if (!vi) return;
|
||||
|
||||
Preferences *pref = Preferences::instance();
|
||||
if (!pref->isOnionSkinEnabled() || (pref->getGuidedDrawingType() != 1 &&
|
||||
pref->getGuidedDrawingType() != 2))
|
||||
return;
|
||||
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
if (!tool) return;
|
||||
|
||||
tool->flipGuideStrokeDirection(-1);
|
||||
}
|
||||
} flipPrevStrokeDirectionCommand;
|
||||
|
||||
//=============================================================================
|
||||
// SceneViewer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1797,7 +1855,7 @@ void SceneViewer::drawScene() {
|
|||
TXshSimpleLevel::m_fillFullColorRaster = false;
|
||||
|
||||
// Guided Drawing Check
|
||||
int useGuidedDrawing = Preferences::instance()->getGuidedDrawing();
|
||||
int useGuidedDrawing = Preferences::instance()->getGuidedDrawingType();
|
||||
TTool *tool = app->getCurrentTool()->getTool();
|
||||
int guidedFrontStroke = tool ? tool->getViewer()->getGuidedFrontStroke() : -1;
|
||||
int guidedBackStroke = tool ? tool->getViewer()->getGuidedBackStroke() : -1;
|
||||
|
|
|
@ -134,90 +134,91 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
|
|||
if (Preferences::instance()->isOnionSkinEnabled() &&
|
||||
!parent->isPreviewEnabled())
|
||||
OnioniSkinMaskGUI::addOnionSkinCommand(this);
|
||||
QMenu *guidedDrawingMenu = addMenu(tr("Vector Guided Drawing"));
|
||||
int guidedDrawingStatus = Preferences::instance()->getGuidedDrawing();
|
||||
action = guidedDrawingMenu->addAction(tr("Off"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedDrawingStatus == 0);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedDrawingOff()));
|
||||
action = guidedDrawingMenu->addAction(tr("Closest Drawing"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedDrawingStatus == 1);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedDrawingClosest()));
|
||||
action = guidedDrawingMenu->addAction(tr("Farthest Drawing"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedDrawingStatus == 2);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedDrawingFarthest()));
|
||||
action = guidedDrawingMenu->addAction(tr("All Drawings"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedDrawingStatus == 3);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedDrawingAll()));
|
||||
guidedDrawingMenu->addSeparator();
|
||||
bool enableOption = guidedDrawingStatus == 1 || guidedDrawingStatus == 2;
|
||||
action = guidedDrawingMenu->addAction(tr("Auto Inbetween"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(Preferences::instance()->getGuidedAutoInbetween());
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedAutoInbetween()));
|
||||
guidedDrawingMenu->addSeparator();
|
||||
int guidedInterpolation = Preferences::instance()->getGuidedInterpolation();
|
||||
action = guidedDrawingMenu->addAction(tr("Linear Interpolation"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedInterpolation == 1);
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedInterpolationLinear()));
|
||||
action = guidedDrawingMenu->addAction(tr("Ease In Interpolation"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedInterpolation == 2);
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedInterpolationEaseIn()));
|
||||
action = guidedDrawingMenu->addAction(tr("Ease Out Interpolation"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedInterpolation == 3);
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedInterpolationEaseOut()));
|
||||
action = guidedDrawingMenu->addAction(tr("Ease In/Out Interpolation"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(guidedInterpolation == 4);
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedInterpolationEaseInOut()));
|
||||
guidedDrawingMenu->addSeparator();
|
||||
action = CommandManager::instance()->getAction(MI_SelectPrevGuideStroke);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action = CommandManager::instance()->getAction(MI_SelectNextGuideStroke);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action = CommandManager::instance()->getAction(MI_SelectBothGuideStrokes);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action = CommandManager::instance()->getAction(MI_SelectGuideStrokeReset);
|
||||
action->setEnabled(true);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
guidedDrawingMenu->addSeparator();
|
||||
action = CommandManager::instance()->getAction(MI_TweenGuideStrokes);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action = CommandManager::instance()->getAction(MI_TweenGuideStrokeToSelected);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action = CommandManager::instance()->getAction(MI_SelectGuidesAndTweenMode);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
|
||||
// Zero Thick
|
||||
if (!parent->isPreviewEnabled())
|
||||
ZeroThickToggleGui::addZeroThickCommand(this);
|
||||
if (tool->getTargetType() & TTool::VectorImage) {
|
||||
auto addOptionAction = [](const QString &label, const int data,
|
||||
const int currentData, QMenu *menu,
|
||||
QActionGroup *group) {
|
||||
QAction *action = menu->addAction(label);
|
||||
action->setData(data);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(data == currentData);
|
||||
group->addAction(action);
|
||||
};
|
||||
QMenu *guidedDrawingMenu = addMenu(tr("Vector Guided Drawing"));
|
||||
int guidedDrawingStatus = Preferences::instance()->getGuidedDrawingType();
|
||||
|
||||
QActionGroup *guidedDrawingGroup = new QActionGroup(this);
|
||||
addOptionAction(tr("Off"), 0, guidedDrawingStatus, guidedDrawingMenu,
|
||||
guidedDrawingGroup);
|
||||
addOptionAction(tr("Closest Drawing"), 1, guidedDrawingStatus,
|
||||
guidedDrawingMenu, guidedDrawingGroup);
|
||||
addOptionAction(tr("Farthest Drawing"), 2, guidedDrawingStatus,
|
||||
guidedDrawingMenu, guidedDrawingGroup);
|
||||
addOptionAction(tr("All Drawings"), 3, guidedDrawingStatus,
|
||||
guidedDrawingMenu, guidedDrawingGroup);
|
||||
ret =
|
||||
ret && parent->connect(guidedDrawingGroup, SIGNAL(triggered(QAction *)),
|
||||
this, SLOT(setGuidedDrawingType(QAction *)));
|
||||
|
||||
guidedDrawingMenu->addSeparator();
|
||||
bool enableOption = guidedDrawingStatus == 1 || guidedDrawingStatus == 2;
|
||||
action = guidedDrawingMenu->addAction(tr("Auto Inbetween"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(Preferences::instance()->getGuidedAutoInbetween());
|
||||
action->setEnabled(enableOption);
|
||||
ret = ret && parent->connect(action, SIGNAL(triggered()), this,
|
||||
SLOT(setGuidedAutoInbetween()));
|
||||
guidedDrawingMenu->addSeparator();
|
||||
int guidedInterpolation = Preferences::instance()->getGuidedInterpolation();
|
||||
QActionGroup *interpolationGroup = new QActionGroup(this);
|
||||
addOptionAction(tr("Linear Interpolation"), 1, guidedInterpolation,
|
||||
guidedDrawingMenu, interpolationGroup);
|
||||
addOptionAction(tr("Ease In Interpolation"), 2, guidedInterpolation,
|
||||
guidedDrawingMenu, interpolationGroup);
|
||||
addOptionAction(tr("Ease Out Interpolation"), 3, guidedInterpolation,
|
||||
guidedDrawingMenu, interpolationGroup);
|
||||
addOptionAction(tr("Ease In/Out Interpolation"), 4, guidedInterpolation,
|
||||
guidedDrawingMenu, interpolationGroup);
|
||||
ret = ret &&
|
||||
parent->connect(interpolationGroup, SIGNAL(triggered(QAction *)),
|
||||
this, SLOT(setGuidedInterpolationState(QAction *)));
|
||||
interpolationGroup->setEnabled(enableOption);
|
||||
/*
|
||||
guidedDrawingMenu->addSeparator();
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_SelectPrevGuideStroke);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_SelectNextGuideStroke);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_SelectBothGuideStrokes);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_SelectGuideStrokeReset);
|
||||
action->setEnabled(true);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
guidedDrawingMenu->addSeparator();
|
||||
action = CommandManager::instance()->getAction(MI_TweenGuideStrokes);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_TweenGuideStrokeToSelected);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
action =
|
||||
CommandManager::instance()->getAction(MI_SelectGuidesAndTweenMode);
|
||||
action->setEnabled(enableOption);
|
||||
guidedDrawingMenu->addAction(action);
|
||||
*/
|
||||
// Zero Thick
|
||||
if (!parent->isPreviewEnabled())
|
||||
ZeroThickToggleGui::addZeroThickCommand(this);
|
||||
}
|
||||
// Brush size outline
|
||||
CursorOutlineToggleGui::addCursorOutlineCommand(this);
|
||||
|
||||
|
@ -424,49 +425,33 @@ void SceneViewerContextMenu::onSetCurrent() {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedDrawingOff() {
|
||||
Preferences::instance()->setValue(guidedDrawingType, 0);
|
||||
}
|
||||
void SceneViewerContextMenu::setGuidedDrawingType(QAction *action) {
|
||||
Preferences::instance()->setValue(guidedDrawingType, action->data().toInt());
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedDrawingClosest() {
|
||||
Preferences::instance()->setValue(guidedDrawingType, 1);
|
||||
}
|
||||
QAction *guidedDrawingAction =
|
||||
CommandManager::instance()->getAction(MI_VectorGuidedDrawing);
|
||||
if (guidedDrawingAction)
|
||||
guidedDrawingAction->setChecked(
|
||||
Preferences::instance()->isGuidedDrawingEnabled());
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedDrawingFarthest() {
|
||||
Preferences::instance()->setValue(guidedDrawingType, 2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedDrawingAll() {
|
||||
Preferences::instance()->setValue(guidedDrawingType, 3);
|
||||
TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
|
||||
"GuidedDrawingFrame");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedAutoInbetween() {
|
||||
Preferences::instance()->setValue(
|
||||
guidedAutoInbetween, !Preferences::instance()->getGuidedAutoInbetween());
|
||||
TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
|
||||
"GuidedDrawingAutoInbetween");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedInterpolationLinear() {
|
||||
Preferences::instance()->setValue(guidedInterpolationType, 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedInterpolationEaseIn() {
|
||||
Preferences::instance()->setValue(guidedInterpolationType, 2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedInterpolationEaseOut() {
|
||||
Preferences::instance()->setValue(guidedInterpolationType, 3);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SceneViewerContextMenu::setGuidedInterpolationEaseInOut() {
|
||||
Preferences::instance()->setValue(guidedInterpolationType, 4);
|
||||
void SceneViewerContextMenu::setGuidedInterpolationState(QAction *action) {
|
||||
Preferences::instance()->setValue(guidedInterpolationType,
|
||||
action->data().toInt());
|
||||
TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
|
||||
"GuidedDrawingInterpolation");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -31,15 +31,9 @@ public slots:
|
|||
|
||||
void enterVectorImageGroup();
|
||||
void exitVectorImageGroup();
|
||||
void setGuidedDrawingOff();
|
||||
void setGuidedDrawingClosest();
|
||||
void setGuidedDrawingFarthest();
|
||||
void setGuidedDrawingAll();
|
||||
void setGuidedDrawingType(QAction *);
|
||||
void setGuidedAutoInbetween();
|
||||
void setGuidedInterpolationLinear();
|
||||
void setGuidedInterpolationEaseIn();
|
||||
void setGuidedInterpolationEaseOut();
|
||||
void setGuidedInterpolationEaseInOut();
|
||||
void setGuidedInterpolationState(QAction *);
|
||||
|
||||
void onShowHide();
|
||||
void onSetCurrent();
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "historypane.h"
|
||||
#include "cleanupsettingspane.h"
|
||||
|
||||
#include "vectorguideddrawingpane.h"
|
||||
|
||||
#ifdef WITH_STOPMOTION
|
||||
#include "stopmotioncontroller.h"
|
||||
#endif
|
||||
|
@ -1467,3 +1469,38 @@ public:
|
|||
//=============================================================================
|
||||
OpenFloatingPanel openFxSettingsCommand(MI_FxParamEditor, "FxSettings",
|
||||
QObject::tr("Fx Settings"));
|
||||
|
||||
//=========================================================
|
||||
// VectorGuidedDrawingPanel
|
||||
//---------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
VectorGuidedDrawingPanel::VectorGuidedDrawingPanel(QWidget *parent)
|
||||
: TPanel(parent) {
|
||||
VectorGuidedDrawingPane *pane = new VectorGuidedDrawingPane(this);
|
||||
setWidget(pane);
|
||||
setIsMaximizable(false);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// VectorGuidedDrawingFactory
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VectorGuidedDrawingFactory final : public TPanelFactory {
|
||||
public:
|
||||
VectorGuidedDrawingFactory() : TPanelFactory("VectorGuidedDrawingPanel") {}
|
||||
TPanel *createPanel(QWidget *parent) override {
|
||||
TPanel *panel = new VectorGuidedDrawingPanel(parent);
|
||||
panel->setObjectName(getPanelType());
|
||||
panel->setWindowTitle(QObject::tr("Vector Guided Drawing Controls"));
|
||||
panel->setMinimumSize(387, 265);
|
||||
|
||||
return panel;
|
||||
}
|
||||
void initialize(TPanel *panel) override {}
|
||||
} VectorGuidedDrawingFactory;
|
||||
|
||||
//=============================================================================
|
||||
OpenFloatingPanel openVectorGuidedDrawingPanelCommand(
|
||||
MI_OpenGuidedDrawingControls, "VectorGuidedDrawingPanel",
|
||||
QObject::tr("Vector Guided Drawing"));
|
||||
|
|
|
@ -27,6 +27,7 @@ class FlipBook;
|
|||
class ToolOptions;
|
||||
class ComboViewerPanel;
|
||||
class FxSettings;
|
||||
class VectorGuidedDrawingPane;
|
||||
|
||||
//=========================================================
|
||||
// PaletteViewerPanel
|
||||
|
@ -286,4 +287,15 @@ public:
|
|||
void restoreFloatingPanelState() override;
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// VectorGuidedDrawingPanel
|
||||
//---------------------------------------------------------
|
||||
|
||||
class VectorGuidedDrawingPanel final : public TPanel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VectorGuidedDrawingPanel(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
246
toonz/sources/toonz/vectorguideddrawingpane.cpp
Normal file
246
toonz/sources/toonz/vectorguideddrawingpane.cpp
Normal file
|
@ -0,0 +1,246 @@
|
|||
#include "vectorguideddrawingpane.h"
|
||||
#include "menubarcommandids.h"
|
||||
#include "tapp.h"
|
||||
#include "sceneviewer.h"
|
||||
|
||||
#include "toonz/preferences.h"
|
||||
#include "toonz/tscenehandle.h"
|
||||
|
||||
#include "toonzqt/menubarcommand.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
using namespace DVGui;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
#if QT_VERSION >= 0x050500
|
||||
VectorGuidedDrawingPane::VectorGuidedDrawingPane(QWidget *parent,
|
||||
Qt::WindowFlags flags)
|
||||
#else
|
||||
VectorGuidedDrawingPane::VectorGuidedDrawingPane(QWidget *parent,
|
||||
Qt::WindowFlags flags)
|
||||
#endif
|
||||
: QFrame(parent) {
|
||||
|
||||
setObjectName("cornerWidget");
|
||||
setObjectName("VectorGuidedDrawingToolbar");
|
||||
|
||||
m_guidedTypeCB = new QComboBox();
|
||||
QStringList inputs;
|
||||
inputs << tr("Off") << tr("Closest") << tr("Farthest") << tr("All");
|
||||
m_guidedTypeCB->addItems(inputs);
|
||||
int guidedIndex = Preferences::instance()->getGuidedDrawingType();
|
||||
|
||||
m_guidedTypeCB->setCurrentIndex(guidedIndex);
|
||||
|
||||
m_autoInbetween = new QCheckBox(tr("Auto Inbetween"), this);
|
||||
m_autoInbetween->setChecked(
|
||||
Preferences::instance()->getGuidedAutoInbetween());
|
||||
connect(m_autoInbetween, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(onAutoInbetweenChanged()));
|
||||
|
||||
m_interpolationTypeCB = new QComboBox();
|
||||
inputs.clear();
|
||||
inputs << tr("Linear") << tr("Ease In") << tr("Ease Out") << tr("EaseIn/Out");
|
||||
m_interpolationTypeCB->addItems(inputs);
|
||||
int interpolationIndex =
|
||||
Preferences::instance()->getGuidedInterpolation() - 1;
|
||||
if (interpolationIndex < 0) {
|
||||
// Was set off, force to Linear
|
||||
Preferences::instance()->setValue(guidedInterpolationType, 1);
|
||||
interpolationIndex = 0;
|
||||
}
|
||||
m_interpolationTypeCB->setCurrentIndex(interpolationIndex);
|
||||
|
||||
QAction *action;
|
||||
m_selectPrevGuideBtn = new QPushButton(tr("Previous"), this);
|
||||
action = CommandManager::instance()->getAction(MI_SelectPrevGuideStroke);
|
||||
m_selectPrevGuideBtn->addAction(action);
|
||||
connect(m_selectPrevGuideBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_selectNextGuideBtn = new QPushButton(tr("Next"), this);
|
||||
action = CommandManager::instance()->getAction(MI_SelectNextGuideStroke);
|
||||
m_selectNextGuideBtn->addAction(action);
|
||||
connect(m_selectNextGuideBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_selectBothGuideBtn = new QPushButton(tr("Both"), this);
|
||||
action = CommandManager::instance()->getAction(MI_SelectBothGuideStrokes);
|
||||
m_selectBothGuideBtn->addAction(action);
|
||||
connect(m_selectBothGuideBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_resetGuidesBtn = new QPushButton(tr("Reset"), this);
|
||||
action = CommandManager::instance()->getAction(MI_SelectGuideStrokeReset);
|
||||
m_resetGuidesBtn->addAction(action);
|
||||
connect(m_resetGuidesBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_tweenSelectedGuidesBtn =
|
||||
new QPushButton(tr("Tween Selected Guide Strokes"), this);
|
||||
action = CommandManager::instance()->getAction(MI_TweenGuideStrokes);
|
||||
m_tweenSelectedGuidesBtn->addAction(action);
|
||||
connect(m_tweenSelectedGuidesBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_tweenToSelectedStrokeBtn =
|
||||
new QPushButton(tr("Tween Guide Strokes to Selected"), this);
|
||||
action = CommandManager::instance()->getAction(MI_TweenGuideStrokeToSelected);
|
||||
m_tweenToSelectedStrokeBtn->addAction(action);
|
||||
connect(m_tweenToSelectedStrokeBtn, SIGNAL(clicked()), action,
|
||||
SLOT(trigger()));
|
||||
|
||||
m_SelectAndTweenBtn =
|
||||
new QPushButton(tr("Select Guide Strokes && Tween Mode"), this);
|
||||
action = CommandManager::instance()->getAction(MI_SelectGuidesAndTweenMode);
|
||||
m_SelectAndTweenBtn->addAction(action);
|
||||
connect(m_SelectAndTweenBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_FlipNextDirectionBtn = new QPushButton(tr("Next"), this);
|
||||
action = CommandManager::instance()->getAction(MI_FlipNextGuideStroke);
|
||||
m_FlipNextDirectionBtn->addAction(action);
|
||||
connect(m_FlipNextDirectionBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
m_FlipPrevDirectionBtn = new QPushButton(tr("Previous"), this);
|
||||
action = CommandManager::instance()->getAction(MI_FlipPrevGuideStroke);
|
||||
m_FlipPrevDirectionBtn->addAction(action);
|
||||
connect(m_FlipPrevDirectionBtn, SIGNAL(clicked()), action, SLOT(trigger()));
|
||||
|
||||
QGridLayout *mainlayout = new QGridLayout();
|
||||
mainlayout->setMargin(5);
|
||||
mainlayout->setSpacing(2);
|
||||
{
|
||||
QLabel *guideFrameLabel = new QLabel(this);
|
||||
guideFrameLabel->setText(tr("Guide Frames:"));
|
||||
mainlayout->addWidget(guideFrameLabel, 0, 0, Qt::AlignRight);
|
||||
mainlayout->addWidget(m_guidedTypeCB, 0, 1);
|
||||
|
||||
QLabel *selectGuideStrokeLabel = new QLabel(this);
|
||||
selectGuideStrokeLabel->setText(tr("Select Guide Stroke:"));
|
||||
mainlayout->addWidget(selectGuideStrokeLabel, 1, 0, Qt::AlignRight);
|
||||
QHBoxLayout *selectBtnLayout = new QHBoxLayout();
|
||||
selectBtnLayout->setMargin(0);
|
||||
selectBtnLayout->setSpacing(2);
|
||||
{
|
||||
selectBtnLayout->addWidget(m_selectPrevGuideBtn, 0);
|
||||
selectBtnLayout->addWidget(m_selectNextGuideBtn, 0);
|
||||
selectBtnLayout->addWidget(m_selectBothGuideBtn, 0);
|
||||
selectBtnLayout->addWidget(m_resetGuidesBtn, 0);
|
||||
}
|
||||
mainlayout->addLayout(selectBtnLayout, 1, 1);
|
||||
|
||||
QLabel *flipGuideStrokeLabel = new QLabel(this);
|
||||
flipGuideStrokeLabel->setText(tr("Flip Guide Stroke:"));
|
||||
mainlayout->addWidget(flipGuideStrokeLabel, 2, 0, Qt::AlignRight);
|
||||
QHBoxLayout *flipBtnLayout = new QHBoxLayout();
|
||||
flipBtnLayout->setMargin(0);
|
||||
flipBtnLayout->setSpacing(2);
|
||||
{
|
||||
flipBtnLayout->addWidget(m_FlipPrevDirectionBtn, 0);
|
||||
flipBtnLayout->addWidget(m_FlipNextDirectionBtn, 0);
|
||||
}
|
||||
mainlayout->addLayout(flipBtnLayout, 2, 1);
|
||||
|
||||
mainlayout->addWidget(new DVGui::Separator("", this, true), 3, 0, 1, 2);
|
||||
|
||||
mainlayout->addWidget(m_autoInbetween, 4, 1);
|
||||
|
||||
QLabel *interpolationLabel = new QLabel(this);
|
||||
interpolationLabel->setText(tr("Interpolation:"));
|
||||
mainlayout->addWidget(interpolationLabel, 5, 0, Qt::AlignRight);
|
||||
mainlayout->addWidget(m_interpolationTypeCB, 5, 1);
|
||||
|
||||
mainlayout->addWidget(new DVGui::Separator("", this, true), 6, 0, 1, 2);
|
||||
|
||||
mainlayout->addWidget(m_tweenSelectedGuidesBtn, 7, 0, 1, 2);
|
||||
mainlayout->addWidget(m_tweenToSelectedStrokeBtn, 8, 0, 1, 2);
|
||||
mainlayout->addWidget(m_SelectAndTweenBtn, 9, 0, 1, 2);
|
||||
}
|
||||
|
||||
setLayout(mainlayout);
|
||||
|
||||
connect(m_guidedTypeCB, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onGuidedTypeChanged()));
|
||||
connect(m_interpolationTypeCB, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onInterpolationTypeChanged()));
|
||||
connect(TApp::instance()->getCurrentScene(),
|
||||
SIGNAL(preferenceChanged(const QString &)), this,
|
||||
SLOT(onPreferenceChanged(const QString &)));
|
||||
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
void VectorGuidedDrawingPane::updateStatus() {
|
||||
int guidedType = m_guidedTypeCB->currentIndex();
|
||||
if (guidedType == 0 || guidedType == 3) { // Off or All
|
||||
m_selectPrevGuideBtn->setDisabled(true);
|
||||
m_selectNextGuideBtn->setDisabled(true);
|
||||
m_selectBothGuideBtn->setDisabled(true);
|
||||
m_autoInbetween->setDisabled(true);
|
||||
m_interpolationTypeCB->setDisabled(true);
|
||||
m_tweenSelectedGuidesBtn->setDisabled(true);
|
||||
m_tweenToSelectedStrokeBtn->setDisabled(true);
|
||||
m_SelectAndTweenBtn->setDisabled(true);
|
||||
m_FlipNextDirectionBtn->setDisabled(true);
|
||||
m_FlipPrevDirectionBtn->setDisabled(true);
|
||||
} else { // Closest/Farthest
|
||||
m_selectPrevGuideBtn->setDisabled(false);
|
||||
m_selectNextGuideBtn->setDisabled(false);
|
||||
m_selectBothGuideBtn->setDisabled(false);
|
||||
m_autoInbetween->setDisabled(false);
|
||||
m_interpolationTypeCB->setDisabled(false);
|
||||
m_tweenSelectedGuidesBtn->setDisabled(false);
|
||||
m_tweenToSelectedStrokeBtn->setDisabled(false);
|
||||
m_SelectAndTweenBtn->setDisabled(false);
|
||||
m_FlipNextDirectionBtn->setDisabled(false);
|
||||
m_FlipPrevDirectionBtn->setDisabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void VectorGuidedDrawingPane::onGuidedTypeChanged() {
|
||||
int guidedIndex = m_guidedTypeCB->currentIndex();
|
||||
// 0 == Off 1 = closest, 2 = farthest, 3 = all
|
||||
Preferences::instance()->setValue(guidedDrawingType, guidedIndex);
|
||||
|
||||
QAction *guidedDrawingAction =
|
||||
CommandManager::instance()->getAction(MI_VectorGuidedDrawing);
|
||||
if (guidedDrawingAction)
|
||||
guidedDrawingAction->setChecked(
|
||||
Preferences::instance()->isGuidedDrawingEnabled());
|
||||
|
||||
TApp::instance()->getActiveViewer()->update();
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
void VectorGuidedDrawingPane::onAutoInbetweenChanged() {
|
||||
Preferences::instance()->setValue(guidedAutoInbetween,
|
||||
m_autoInbetween->isChecked());
|
||||
}
|
||||
|
||||
void VectorGuidedDrawingPane::onInterpolationTypeChanged() {
|
||||
int interpolationIndex = m_interpolationTypeCB->currentIndex() + 1;
|
||||
// 1 = Linear, 2 = Ease In, 3 = Ease Out, 4 = Ease In/Out
|
||||
Preferences::instance()->setValue(guidedInterpolationType,
|
||||
interpolationIndex);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void VectorGuidedDrawingPane::onPreferenceChanged(const QString &propertyName) {
|
||||
if (propertyName.isEmpty()) return;
|
||||
|
||||
if (propertyName == "GuidedDrawingFrame")
|
||||
m_guidedTypeCB->setCurrentIndex(
|
||||
Preferences::instance()->getGuidedDrawingType());
|
||||
else if (propertyName == "GuidedDrawingAutoInbetween")
|
||||
m_autoInbetween->setChecked(
|
||||
Preferences::instance()->getGuidedAutoInbetween());
|
||||
else if (propertyName == "GuidedDrawingInterpolation")
|
||||
m_interpolationTypeCB->setCurrentIndex(
|
||||
Preferences::instance()->getGuidedInterpolation() - 1);
|
||||
else
|
||||
return;
|
||||
|
||||
updateStatus();
|
||||
}
|
44
toonz/sources/toonz/vectorguideddrawingpane.h
Normal file
44
toonz/sources/toonz/vectorguideddrawingpane.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef VECTORGUIDEDDRAWINGPANE_H
|
||||
#define VECTORGUIDEDDRAWINGPANE_H
|
||||
|
||||
#include "toonzqt/dvdialog.h"
|
||||
|
||||
#include <QToolBar>
|
||||
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QPushButton;
|
||||
|
||||
//=============================================================================
|
||||
// VectorGuidedDrawingPan
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VectorGuidedDrawingPane final : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
QComboBox *m_guidedTypeCB, *m_interpolationTypeCB;
|
||||
QCheckBox *m_autoInbetween;
|
||||
QPushButton *m_selectPrevGuideBtn, *m_selectNextGuideBtn,
|
||||
*m_selectBothGuideBtn, *m_resetGuidesBtn, *m_tweenSelectedGuidesBtn,
|
||||
*m_tweenToSelectedStrokeBtn, *m_SelectAndTweenBtn,
|
||||
*m_FlipNextDirectionBtn, *m_FlipPrevDirectionBtn;
|
||||
|
||||
public:
|
||||
#if QT_VERSION >= 0x050500
|
||||
VectorGuidedDrawingPane(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
#else
|
||||
VectorGuidedDrawingPane(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
#endif
|
||||
~VectorGuidedDrawingPane(){};
|
||||
|
||||
void updateStatus();
|
||||
protected slots:
|
||||
void onGuidedTypeChanged();
|
||||
void onAutoInbetweenChanged();
|
||||
void onInterpolationTypeChanged();
|
||||
void onPreferenceChanged(const QString &);
|
||||
};
|
||||
|
||||
#endif // VECTORGUIDEDDRAWINGPANE_H
|
Loading…
Reference in a new issue