af90cdedbe
* add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix travis-install (#3389) * Fix assert debug crash in flipconsole.cpp Fix crash when using the viewer controls in the console (debug) * Redraw Audio Waveform Fills the waveform rather than outlines it. * Update .gitignore * fix undo data when drawing arc and mutliarc * fix overwriting raster drawing palette (#3387) * mode sensitive fx settings * Create New Style Command Button (#3394) * Create New Style Command Button This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz. Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com> * Update paletteviewergui.cpp Made changes to the PR per request by Shun. * Fixed a space within the code that wasn't suppose to be there. Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> * tahoma license (#3396) * new style button optional * fix loading pegbars (removing updateKeyframes) * periodic random expression * add fx in linear color space this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd. in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories. * fractal noise iwa fx * skip unnecessary icon invalidation * fix frame range fill with tablet * stop function editor to open by dbl clicking key * Expanding the radius of the rotation handle. This just changes when the cursor transforms into the rotation tool. (cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39) * fix vector img patern stroke style * Update Stylesheets - Support the new icon sizes - XSheet and Timeline significantly redesigned - Lots of margin fixes and refactoring - Remove deprecated icons, as some icons are moved into binary - New Light theme * New Icons - Redesigns almost every icon as symbolic - Adds icons for most commands * Add Option for Icon Themes - Adds option for icon themes - Removes useless label from Preferences category list * Update Icon Functions - Adds themePath() boolean - Adds function for recoloring black pixels in pixmaps to any color - Rebuilds createQIcon to use fromTheme() and recolorPixmap() - Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon - Removes a grey horizontal line drawn above the console play bar in the viewer * Set Default Icon Theme and Paths - Sets search paths for icons for use with QIcon::fromTheme() - Sets default start icon theme on first install - Sets flag for displaying icons in menus, so we can selectively hide them * Set Icons for Commands - Sets icons for the commands - Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16 - Selectively allows icons to display for Tools in menus * Change Icon Sizes, General Fixes and Stylesheet Additions - Change icon sizes to new size - Remove margin around FX Editor window - Remove white line under color sliders in Style Editor - Make keyframe icons uniform and color stylable in the stylesheets - Removes deprecated stylesheet strings - Redesign GUI for palette list view - Make tree list header sort row stylable - Remove black lines from scrollbars in New Project window - Remove margin around combobox in Level Strip - Alter how some lines are drawn in the Timeline to fix some alpha issues - Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility - Make text always viewable in the FPS field in console bar - Increase size of radio buttons in Cleanup Settings - Increase size of switches in motion path nodes - Remove unessesary "Layer" label in Timeline and other rects - Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more - Moves some external stylesheet icons into binary * Make TPanelTitleBar Icon States Stylable - Makes icon states for TPanelTitleBar buttons stylable in stylesheets * Travis Fixes * Swap Startup Popup Logos They were in the wrong folders * Revert "Swap Startup Popup Logos" This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d. * Fix Startup Popup Logo It wasn't switching * Feedback Changes - Change render visualization to clapboard - Fix text contrast on levels in XSheet * Make Cell Selection More Clear * Darken Light Theme and Tint Empty Cell Selection * Fix missing icons * Fix memo button * Bring back colors * Hide Motion Tab * Fix Play Range Area (Light) Make play range area more visible * Vector Column Color Co-authored-by: pojienie <pojienie@gmail.com> Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp> Co-authored-by: Rodney <rodney.baker@gmail.com> Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Co-authored-by: Kite <konero@users.noreply.github.com> Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
242 lines
7.1 KiB
C++
242 lines
7.1 KiB
C++
|
|
|
|
#include "toonzqt/functiontoolbar.h"
|
|
|
|
// TnzQt includes
|
|
#include "toonzqt/doublefield.h"
|
|
#include "toonzqt/functionkeyframenavigator.h"
|
|
#include "toonzqt/functionselection.h"
|
|
#include "toonzqt/framenavigator.h"
|
|
#include "toonzqt/gutil.h"
|
|
#include "toonzqt/menubarcommand.h"
|
|
|
|
// TnzLib includes
|
|
#include "toonz/tframehandle.h"
|
|
#include "toonz/doubleparamcmd.h"
|
|
|
|
// Qt includes
|
|
#include <QLabel>
|
|
#include <QApplication>
|
|
|
|
//=========================================================================
|
|
|
|
/*
|
|
* two states: curve_defined / curve_not_defined
|
|
|
|
* three widgets: value_fld, frame_nav, keyframe_nav
|
|
(if curve_not_defined only keyframe_nav is visible)
|
|
|
|
* user actions
|
|
|
|
- value_fld changed / keyframe_nav changed (key icon) => modify current
|
|
curve
|
|
- frame_nav changed / keyframe_nav changed (arrows) => modify the 'extern'
|
|
frame
|
|
|
|
* 'extern' events:
|
|
|
|
- 'extern' frame changed => update fields
|
|
- curve selected => update fields (and possibly change status)
|
|
*/
|
|
|
|
//=========================================================================
|
|
|
|
FunctionToolbar::FunctionToolbar(QWidget *parent)
|
|
: DVGui::ToolBar(parent), m_frameHandle(0), m_curve(0), m_selection(0) {
|
|
setFixedHeight(28);
|
|
setIconSize(QSize(20, 20));
|
|
|
|
m_valueToolbar = new DVGui::ToolBar();
|
|
m_keyframeToolbar = new DVGui::ToolBar();
|
|
|
|
// value field
|
|
m_valueToolbar->addWidget(new QLabel(tr("Value")));
|
|
m_valueFld = new DVGui::MeasuredDoubleLineEdit();
|
|
m_valueFld->setDecimals(2);
|
|
// frame navigator
|
|
m_frameNavigator = new FrameNavigator(this);
|
|
// keyframe navigator
|
|
m_keyframeNavigator = new FunctionKeyframeNavigator(this);
|
|
QWidget *space = new QWidget(this);
|
|
DVGui::ToolBar *spaceToolBar = new DVGui::ToolBar();
|
|
spaceToolBar->addWidget(space);
|
|
|
|
m_valueFld->setStyleSheet("height:14px;margin-right:5px;margin-top:2px;");
|
|
space->setMinimumHeight(22);
|
|
space->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
QIcon toggleIcon = createQIcon("swap");
|
|
QAction *toggleAction = new QAction(tr("&Open Function Curve Editor"), this);
|
|
assert(toggleAction);
|
|
toggleAction->setIcon(toggleIcon);
|
|
|
|
//-----layout
|
|
m_valueFldAction = addWidget(m_valueToolbar);
|
|
m_keyframeNavigatorAction = addWidget(m_keyframeToolbar);
|
|
|
|
m_valueToolbar->addWidget(m_valueFld);
|
|
m_valueToolbar->addSeparator();
|
|
|
|
m_keyframeToolbar->addWidget(m_keyframeNavigator);
|
|
m_keyframeToolbar->addSeparator();
|
|
|
|
addWidget(m_frameNavigator);
|
|
addSeparator();
|
|
addWidget(spaceToolBar);
|
|
addSeparator();
|
|
addAction(toggleAction);
|
|
|
|
bool ret = connect(m_valueFld, SIGNAL(valueChanged()), this,
|
|
SLOT(onValueFieldChanged()));
|
|
ret = ret && connect(m_frameNavigator, SIGNAL(frameSwitched()), this,
|
|
SLOT(onNavFrameSwitched()));
|
|
ret = ret && connect(toggleAction, SIGNAL(triggered()), this,
|
|
SIGNAL(numericalColumnToggled()));
|
|
|
|
m_valueFldAction->setVisible(false);
|
|
m_keyframeNavigatorAction->setVisible(false);
|
|
assert(ret);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
FunctionToolbar::~FunctionToolbar() {
|
|
if (m_curve) {
|
|
m_curve->removeObserver(this);
|
|
m_curve->release();
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
bool FunctionToolbar::anyWidgetHasFocus() {
|
|
return hasFocus() || m_valueToolbar->hasFocus() ||
|
|
m_keyframeToolbar->hasFocus() || m_valueFld->hasFocus() ||
|
|
m_frameNavigator->anyWidgetHasFocus() ||
|
|
m_keyframeNavigator->hasFocus();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::setCurve(TDoubleParam *curve) {
|
|
if (curve == m_curve) return;
|
|
bool curveDefined = curve != 0;
|
|
m_valueFldAction->setVisible(curveDefined);
|
|
m_keyframeNavigatorAction->setVisible(curveDefined);
|
|
m_keyframeNavigator->setCurve(curve);
|
|
if (curve) {
|
|
curve->addObserver(this);
|
|
curve->addRef();
|
|
}
|
|
if (m_curve) {
|
|
m_curve->removeObserver(this);
|
|
m_curve->release();
|
|
}
|
|
m_curve = curve;
|
|
if (m_curve) {
|
|
m_valueFld->setMeasure(m_curve->getMeasureName());
|
|
setFrame(m_frameNavigator->getFrame());
|
|
} else {
|
|
m_valueFld->setMeasure("");
|
|
m_valueFld->setValue(0);
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::setFrame(double frame) {
|
|
m_frameNavigator->setFrame(tround(frame), false);
|
|
if (m_curve)
|
|
m_valueFld->setValue(m_curve->getValue(frame));
|
|
else
|
|
m_valueFld->setValue(0);
|
|
}
|
|
|
|
void FunctionToolbar::onNextKeyframe(QWidget *panel) {
|
|
m_keyframeNavigator->onNextKeyframe(panel);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onPrevKeyframe(QWidget *panel) {
|
|
m_keyframeNavigator->onPrevKeyframe(panel);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onValueFieldChanged() {
|
|
if (!m_curve) return;
|
|
int frame = m_frameNavigator->getFrame();
|
|
double value = m_valueFld->getValue();
|
|
double fValue = m_curve->getValue(frame);
|
|
if (value == fValue) return;
|
|
KeyframeSetter::setValue(m_curve, frame, value);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onFrameSwitched() { setFrame(m_frameHandle->getFrame()); }
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onNavFrameSwitched() {
|
|
if (m_frameHandle) m_frameHandle->setFrame(m_frameNavigator->getFrame());
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onSelectionChanged() {
|
|
if (m_selection) {
|
|
if (m_selection->getSelectedKeyframeCount() == 1) {
|
|
QPair<TDoubleParam *, int> k = m_selection->getSelectedKeyframe(0);
|
|
if (k.first == m_curve) {
|
|
int frame = m_curve->keyframeIndexToFrame(k.second);
|
|
setFrame(frame);
|
|
return;
|
|
}
|
|
} else if (m_selection->getSelectedKeyframeCount() > 1) {
|
|
setFrame(m_frameHandle->getFrame());
|
|
m_valueFld->setText("");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (m_frameHandle && m_curve)
|
|
setFrame(m_frameHandle->getFrame());
|
|
else
|
|
m_valueFld->setText("");
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::setFrameHandle(TFrameHandle *frameHandle) {
|
|
if (m_frameHandle) m_frameHandle->disconnect(this);
|
|
|
|
m_frameHandle = frameHandle;
|
|
|
|
if (m_frameHandle)
|
|
connect(m_frameHandle, SIGNAL(frameSwitched()), this,
|
|
SLOT(onFrameSwitched()));
|
|
|
|
m_keyframeNavigator->setFrameHandle(frameHandle);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::setSelection(FunctionSelection *selection) {
|
|
if (m_selection != selection) {
|
|
if (m_selection)
|
|
disconnect(m_selection, SIGNAL(selectionChanged()), this,
|
|
SLOT(onSelectionChanged()));
|
|
m_selection = selection;
|
|
if (m_selection)
|
|
connect(m_selection, SIGNAL(selectionChanged()), this,
|
|
SLOT(onSelectionChanged()));
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
void FunctionToolbar::onChange(const TParamChange &) {
|
|
m_keyframeNavigator->update();
|
|
}
|