2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
#include "toonzqt/studiopaletteviewer.h"
|
|
|
|
|
|
|
|
// TnzQt includes
|
|
|
|
#include "toonzqt/menubarcommand.h"
|
|
|
|
#include "toonzqt/paletteviewer.h"
|
|
|
|
#include "toonzqt/trepetitionguard.h"
|
|
|
|
#include "toonzqt/gutil.h"
|
|
|
|
#include "toonzqt/icongenerator.h"
|
|
|
|
#include "toonzqt/intfield.h"
|
|
|
|
#include "palettesscanpopup.h"
|
|
|
|
#include "palettedata.h"
|
|
|
|
|
|
|
|
// TnzLib includes
|
|
|
|
#include "toonz/studiopalettecmd.h"
|
|
|
|
#include "toonz/tpalettehandle.h"
|
|
|
|
#include "toonz/txshsimplelevel.h"
|
|
|
|
#include "toonz/toonzscene.h"
|
|
|
|
#include "toonz/sceneproperties.h"
|
|
|
|
#include "toonz/txsheethandle.h"
|
|
|
|
#include "toonz/txshlevelhandle.h"
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tconvert.h"
|
|
|
|
#include "tundo.h"
|
|
|
|
#include "tsystem.h"
|
|
|
|
|
|
|
|
#include "../toonz/menubarcommandids.h"
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QContextMenuEvent>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QInputDialog>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QDrag>
|
2020-01-15 20:30:19 +13:00
|
|
|
#include <QApplication>
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace PaletteViewerGUI;
|
|
|
|
using namespace DVGui;
|
|
|
|
|
|
|
|
//=============================================================================
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace {
|
2016-03-19 06:57:51 +13:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! Return true if path is in folder \b rootPath of \b StudioPalette.
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
bool isInStudioPaletteFolder(TFilePath path, TFilePath rootPath) {
|
|
|
|
if (path.getType() != "tpl") return false;
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
std::vector<TFilePath> childrenPath;
|
|
|
|
studioPalette->getChildren(childrenPath, rootPath);
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < (int)childrenPath.size(); i++) {
|
|
|
|
if (path == childrenPath[i])
|
|
|
|
return true;
|
|
|
|
else if (isInStudioPaletteFolder(path, childrenPath[i]))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! Return true if path is in a \b StudioPalette folder.
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
bool isInStudioPalette(TFilePath path) {
|
|
|
|
if (path.getType() != "tpl") return false;
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
if (isInStudioPaletteFolder(path, studioPalette->getLevelPalettesRoot()))
|
|
|
|
return true;
|
|
|
|
if (isInStudioPaletteFolder(path, studioPalette->getProjectPalettesRoot()))
|
|
|
|
return true;
|
2020-07-26 16:51:26 +12:00
|
|
|
if (isInStudioPaletteFolder(path, studioPalette->getPersonalPalettesRoot()))
|
|
|
|
return true;
|
2016-06-15 18:43:10 +12:00
|
|
|
return false;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2016-06-15 18:43:10 +12:00
|
|
|
} // namespace
|
2016-03-19 06:57:51 +13:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// StudioPaletteTreeViewer
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPaletteTreeViewer::StudioPaletteTreeViewer(
|
|
|
|
QWidget *parent, TPaletteHandle *studioPaletteHandle,
|
|
|
|
TPaletteHandle *levelPaletteHandle, TXsheetHandle *xsheetHandle,
|
|
|
|
TXshLevelHandle *currentLevelHandle)
|
|
|
|
: QTreeWidget(parent)
|
|
|
|
, m_dropItem(0)
|
|
|
|
, m_studioPaletteHandle(studioPaletteHandle)
|
|
|
|
, m_levelPaletteHandle(levelPaletteHandle)
|
|
|
|
, m_currentLevelHandle(currentLevelHandle)
|
|
|
|
, m_xsheetHandle(xsheetHandle)
|
|
|
|
, m_folderIcon(QIcon())
|
|
|
|
, m_levelPaletteIcon(QIcon())
|
2020-01-15 20:30:19 +13:00
|
|
|
, m_studioPaletteIcon(QIcon())
|
|
|
|
, m_startPos() {
|
2016-06-15 18:43:10 +12:00
|
|
|
setIndentation(14);
|
|
|
|
setAlternatingRowColors(true);
|
|
|
|
|
|
|
|
header()->close();
|
|
|
|
setUniformRowHeights(true);
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
setIconSize(QSize(21, 18));
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
QList<QTreeWidgetItem *> paletteItems;
|
|
|
|
|
2017-08-18 19:24:14 +12:00
|
|
|
QString levelPaletteIcon = QString(":Resources/palette.svg");
|
2016-06-15 18:43:10 +12:00
|
|
|
m_levelPaletteIcon.addPixmap(levelPaletteIcon, QIcon::Normal, QIcon::On);
|
2017-08-18 19:24:14 +12:00
|
|
|
QString studioPaletteIcon = QString(":Resources/studiopalette.svg");
|
2016-06-15 18:43:10 +12:00
|
|
|
m_studioPaletteIcon.addPixmap(studioPaletteIcon, QIcon::Normal, QIcon::On);
|
|
|
|
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
|
|
|
|
TFilePath levelPalettePath = studioPalette->getLevelPalettesRoot();
|
|
|
|
paletteItems.append(createRootItem(levelPalettePath));
|
|
|
|
|
|
|
|
TFilePath projectPalettePath = studioPalette->getProjectPalettesRoot();
|
|
|
|
if (TSystem::doesExistFileOrLevel(projectPalettePath))
|
|
|
|
paletteItems.append(createRootItem(projectPalettePath));
|
|
|
|
|
2020-07-26 16:51:26 +12:00
|
|
|
TFilePath personalPalettePath = studioPalette->getPersonalPalettesRoot();
|
|
|
|
if (TSystem::doesExistFileOrLevel(personalPalettePath))
|
|
|
|
paletteItems.append(createRootItem(personalPalettePath));
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
insertTopLevelItems(0, paletteItems);
|
|
|
|
|
|
|
|
bool ret = connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int)),
|
|
|
|
SLOT(onItemChanged(QTreeWidgetItem *, int)));
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
ret = ret && connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
|
2016-06-15 18:43:10 +12:00
|
|
|
SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
|
|
|
ret =
|
|
|
|
ret &&
|
|
|
|
connect(this,
|
|
|
|
SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
|
|
|
SLOT(onCurrentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
|
|
|
ret = ret && connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
|
|
|
|
SLOT(onTreeItemExpanded(QTreeWidgetItem *)));
|
|
|
|
|
|
|
|
// refresh tree with shortcut key
|
|
|
|
QAction *refreshAct = CommandManager::instance()->getAction(MI_RefreshTree);
|
|
|
|
ret = ret && connect(refreshAct, SIGNAL(triggered()), this,
|
|
|
|
SLOT(onRefreshTreeShortcutTriggered()));
|
|
|
|
addAction(refreshAct);
|
|
|
|
|
|
|
|
m_palettesScanPopup = new PalettesScanPopup();
|
|
|
|
|
|
|
|
setAcceptDrops(true);
|
|
|
|
|
|
|
|
// Per la selezione multipla
|
|
|
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
|
|
|
|
|
|
StudioPalette::instance()->addListener(this);
|
|
|
|
TProjectManager::instance()->addListener(this);
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
|
|
|
|
assert(ret);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPaletteTreeViewer::~StudioPaletteTreeViewer() {
|
|
|
|
StudioPalette::instance()->removeListener(this);
|
|
|
|
TProjectManager::instance()->removeListener(this);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::setCurrentLevelHandle(
|
|
|
|
TXshLevelHandle *currentLevelHandle) {
|
|
|
|
m_currentLevelHandle = currentLevelHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::setLevelPaletteHandle(
|
|
|
|
TPaletteHandle *paletteHandle) {
|
|
|
|
m_levelPaletteHandle = paletteHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::setStdPaletteHandle(
|
|
|
|
TPaletteHandle *studioPaletteHandle) {
|
|
|
|
m_studioPaletteHandle = studioPaletteHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QTreeWidgetItem *StudioPaletteTreeViewer::createRootItem(TFilePath path) {
|
|
|
|
QString rootName = QString::fromStdWString(path.getWideName());
|
2020-07-26 16:51:26 +12:00
|
|
|
if (rootName != "Global Palettes")
|
|
|
|
if (path == StudioPalette::instance()->getPersonalPalettesRoot())
|
|
|
|
rootName = "Personal Palettes";
|
|
|
|
else
|
|
|
|
rootName = "Project Palettes";
|
2016-06-15 18:43:10 +12:00
|
|
|
QTreeWidgetItem *rootItem =
|
|
|
|
new QTreeWidgetItem((QTreeWidget *)0, QStringList(rootName));
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
rootItem->setIcon(0, createQIcon("folder", true));
|
2016-06-15 18:43:10 +12:00
|
|
|
rootItem->setData(1, Qt::UserRole, toQString(path));
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
refreshItem(rootItem);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
return rootItem;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool StudioPaletteTreeViewer::isRootItem(QTreeWidgetItem *item) {
|
|
|
|
assert(item);
|
|
|
|
TFilePath path = getItemPath(item);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
if (path == studioPalette->getLevelPalettesRoot() ||
|
2020-07-26 16:51:26 +12:00
|
|
|
path == studioPalette->getProjectPalettesRoot() ||
|
|
|
|
path == studioPalette->getPersonalPalettesRoot())
|
2016-06-15 18:43:10 +12:00
|
|
|
return true;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
return false;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QTreeWidgetItem *StudioPaletteTreeViewer::createItem(const TFilePath path) {
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
QString itemName = toQString(TFilePath(path.getWideName()));
|
|
|
|
QTreeWidgetItem *item =
|
|
|
|
new QTreeWidgetItem((QTreeWidget *)0, QStringList(itemName));
|
2018-04-23 17:13:40 +12:00
|
|
|
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |
|
|
|
|
Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (studioPalette->isPalette(path)) {
|
|
|
|
if (studioPalette->hasGlobalName(path))
|
|
|
|
item->setIcon(0, m_studioPaletteIcon);
|
|
|
|
else
|
|
|
|
item->setIcon(0, m_levelPaletteIcon);
|
2018-04-23 17:13:40 +12:00
|
|
|
item->setFlags(item->flags() | Qt::ItemNeverHasChildren);
|
|
|
|
} else if (studioPalette->isFolder(path)) {
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
item->setIcon(0, createQIcon("folder", true));
|
2018-04-23 17:13:40 +12:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsDropEnabled);
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
item->setData(1, Qt::UserRole, toQString(path));
|
|
|
|
|
|
|
|
return item;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath StudioPaletteTreeViewer::getItemPath(QTreeWidgetItem *item) {
|
|
|
|
TFilePath path =
|
|
|
|
(item) ? TFilePath(item->data(1, Qt::UserRole).toString().toStdWString())
|
|
|
|
: TFilePath();
|
|
|
|
return path;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath StudioPaletteTreeViewer::getCurrentFolderPath() {
|
|
|
|
return getItemPath(currentItem());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QTreeWidgetItem *StudioPaletteTreeViewer::getItem(const TFilePath path) {
|
|
|
|
QList<QTreeWidgetItem *> oldItems =
|
|
|
|
findItems(QString(""), Qt::MatchContains, 0);
|
|
|
|
if (oldItems.isEmpty()) return 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < (int)oldItems.size(); i++) {
|
|
|
|
TFilePath oldItemPath(
|
|
|
|
oldItems[i]->data(1, Qt::UserRole).toString().toStdWString());
|
|
|
|
if (oldItemPath == path)
|
|
|
|
return oldItems[i];
|
|
|
|
else {
|
|
|
|
QTreeWidgetItem *item = getFolderItem(oldItems[i], path);
|
|
|
|
if (item) return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QTreeWidgetItem *StudioPaletteTreeViewer::getFolderItem(QTreeWidgetItem *parent,
|
|
|
|
const TFilePath path) {
|
|
|
|
int childrenCount = parent->childCount();
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < childrenCount; i++) {
|
|
|
|
QTreeWidgetItem *item = parent->child(i);
|
|
|
|
if (getItemPath(item) == path)
|
|
|
|
return item;
|
|
|
|
else {
|
|
|
|
item = getFolderItem(item, path);
|
|
|
|
if (item) return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::resetDropItem() {
|
|
|
|
if (!m_dropItem) return;
|
|
|
|
m_dropItem = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::refresh() {
|
|
|
|
m_openedItems.clear();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath levelPalettePath = studioPalette->getLevelPalettesRoot();
|
|
|
|
refreshItem(getItem(levelPalettePath));
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath projectPalettePath = studioPalette->getProjectPalettesRoot();
|
|
|
|
if (!TSystem::doesExistFileOrLevel(projectPalettePath)) return;
|
|
|
|
refreshItem(getItem(projectPalettePath));
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2020-07-26 16:51:26 +12:00
|
|
|
TFilePath personalPalettePath = studioPalette->getPersonalPalettesRoot();
|
|
|
|
if (!TSystem::doesExistFileOrLevel(personalPalettePath)) return;
|
|
|
|
refreshItem(getItem(personalPalettePath));
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// refresh all expanded items
|
|
|
|
QList<QTreeWidgetItem *> items =
|
|
|
|
findItems(QString(""), Qt::MatchContains | Qt::MatchRecursive, 0);
|
|
|
|
if (items.isEmpty()) return;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
for (int i = 0; i < (int)items.size(); i++)
|
|
|
|
if (items[i]->isExpanded()) refreshItem(items[i]);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2016-06-15 18:43:10 +12:00
|
|
|
/*!When expand a tree, prepare the child items of it
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::onTreeItemExpanded(QTreeWidgetItem *item) {
|
|
|
|
if (!item) return;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// if this item was not yet opened, then get the children of this item
|
|
|
|
if (!m_openedItems.contains(item)) refreshItem(item);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// expand the item
|
|
|
|
item->setExpanded(!item->isExpanded());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! Refresh tree only when this widget has focus
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::onRefreshTreeShortcutTriggered() {
|
|
|
|
if (hasFocus()) refresh();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! Update the content of item
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::refreshItem(QTreeWidgetItem *item) {
|
2018-04-23 17:13:40 +12:00
|
|
|
struct Locals {
|
|
|
|
bool isUpper(const TFilePath &fp1, const TFilePath &fp2) {
|
|
|
|
bool fp1IsFolder = StudioPalette::instance()->isFolder(fp1);
|
|
|
|
bool fp2IsFolder = StudioPalette::instance()->isFolder(fp2);
|
|
|
|
if (fp1IsFolder == fp2IsFolder)
|
|
|
|
return fp1 < fp2;
|
|
|
|
else
|
|
|
|
return fp1IsFolder;
|
|
|
|
}
|
|
|
|
} locals;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath folderPath = getItemPath(item);
|
|
|
|
assert(folderPath != TFilePath());
|
|
|
|
// correct only tpl files and folders
|
|
|
|
std::vector<TFilePath> childrenPath;
|
|
|
|
StudioPalette::instance()->getChildren(childrenPath, folderPath);
|
|
|
|
int currentChildCount = item->childCount();
|
|
|
|
std::vector<QTreeWidgetItem *> currentChildren;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < currentChildCount; i++)
|
|
|
|
currentChildren.push_back(item->child(i));
|
|
|
|
|
|
|
|
int childrenPathCount = childrenPath.size();
|
|
|
|
int itemIndex = 0;
|
|
|
|
int pathIndex = 0;
|
|
|
|
while (itemIndex < currentChildCount || pathIndex < childrenPathCount) {
|
|
|
|
TFilePath path =
|
|
|
|
(pathIndex < childrenPathCount) ? childrenPath[pathIndex] : TFilePath();
|
|
|
|
|
|
|
|
QTreeWidgetItem *currentItem =
|
|
|
|
(itemIndex < currentChildCount) ? currentChildren[itemIndex] : 0;
|
|
|
|
TFilePath currentItemPath = getItemPath(currentItem);
|
|
|
|
|
|
|
|
if (path == currentItemPath) {
|
|
|
|
itemIndex++;
|
|
|
|
pathIndex++;
|
2018-04-23 17:13:40 +12:00
|
|
|
} else if ((!path.isEmpty() && locals.isUpper(path, currentItemPath)) ||
|
2016-06-15 18:43:10 +12:00
|
|
|
currentItemPath.isEmpty()) {
|
|
|
|
currentItem = createItem(path);
|
2018-04-23 17:13:40 +12:00
|
|
|
item->insertChild(pathIndex, currentItem);
|
2016-06-15 18:43:10 +12:00
|
|
|
pathIndex++;
|
|
|
|
} else {
|
2018-04-23 17:13:40 +12:00
|
|
|
assert(locals.isUpper(currentItemPath, path) || path.isEmpty());
|
2016-06-15 18:43:10 +12:00
|
|
|
assert(currentItem);
|
|
|
|
item->removeChild(currentItem);
|
|
|
|
itemIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_openedItems.insert(item);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::resetProjectPaletteFolder() {
|
|
|
|
int projectPaletteIndex = 1;
|
|
|
|
TFilePath projectPalettePath =
|
|
|
|
StudioPalette::instance()->getProjectPalettesRoot();
|
|
|
|
// Prendo l'item del project palette.
|
|
|
|
QTreeWidgetItem *projectPaletteItem = topLevelItem(projectPaletteIndex);
|
|
|
|
if (projectPaletteItem) {
|
|
|
|
// Se il path dell'item e' uguale a quello del project palette corrente
|
|
|
|
// ritorno.
|
|
|
|
if (getItemPath(projectPaletteItem) == projectPalettePath) return;
|
|
|
|
// Altrimenti lo rimuovo.
|
|
|
|
removeItemWidget(projectPaletteItem, 0);
|
|
|
|
delete projectPaletteItem;
|
|
|
|
// clear the item list in order to search the folder from scratch
|
|
|
|
m_openedItems.clear();
|
|
|
|
// Toonz Palette is not changed, so resurrect the ToonzPaletteRoot
|
|
|
|
m_openedItems.insert(topLevelItem(0));
|
|
|
|
}
|
|
|
|
if (!TSystem::doesExistFileOrLevel(projectPalettePath)) return;
|
|
|
|
// Creo il nuovo item con il nuovo project folder e lo inserisco nell'albero.
|
|
|
|
// Items in the ProjectPaletteRoot are refreshed here. Stored in openedItems
|
|
|
|
// as well.
|
|
|
|
QTreeWidgetItem *newProjectPaletteItem = createRootItem(projectPalettePath);
|
|
|
|
insertTopLevelItem(projectPaletteIndex, newProjectPaletteItem);
|
|
|
|
|
|
|
|
setCurrentItem(0);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::onItemClicked(QTreeWidgetItem *item, int column) {
|
|
|
|
if (currentItem() && m_studioPaletteHandle && m_currentPalette.getPointer()) {
|
|
|
|
// if(m_studioPaletteHandle->getPalette() != m_currentPalette.getPointer())
|
|
|
|
{
|
|
|
|
m_studioPaletteHandle->setPalette(m_currentPalette.getPointer());
|
|
|
|
m_studioPaletteHandle->notifyPaletteSwitched();
|
|
|
|
StudioPaletteCmd::updateAllLinkedStyles(m_levelPaletteHandle,
|
|
|
|
m_xsheetHandle);
|
|
|
|
}
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) {
|
|
|
|
if (item != currentItem() || isRootItem(item)) return;
|
|
|
|
wstring name = item->text(column).toStdWString();
|
|
|
|
TFilePath oldPath = getCurrentFolderPath();
|
|
|
|
if (oldPath.isEmpty() || name.empty() || oldPath.getWideName() == name)
|
|
|
|
return;
|
|
|
|
TFilePath newPath(oldPath.getParentDir() +
|
|
|
|
TFilePath(name + ::to_wstring(oldPath.getDottedType())));
|
|
|
|
try {
|
|
|
|
StudioPaletteCmd::movePalette(newPath, oldPath);
|
|
|
|
} catch (TException &e) {
|
|
|
|
error(QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
item->setText(column, QString::fromStdWString(oldPath.getWideName()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't rename file");
|
|
|
|
item->setText(column, QString::fromStdWString(oldPath.getWideName()));
|
|
|
|
}
|
|
|
|
refreshItem(getItem(oldPath.getParentDir()));
|
|
|
|
setCurrentItem(getItem(newPath));
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! Called when the current palette is switched
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::onCurrentItemChanged(QTreeWidgetItem *current,
|
|
|
|
QTreeWidgetItem *previous) {
|
|
|
|
TFilePath oldPath = getItemPath(previous);
|
|
|
|
TFilePath newPath = getCurrentFolderPath();
|
|
|
|
if (!m_studioPaletteHandle) return;
|
|
|
|
|
|
|
|
if (m_currentPalette.getPointer() && m_currentPalette->getDirtyFlag()) {
|
|
|
|
TFilePath oldPath = StudioPalette::instance()->getPalettePath(
|
|
|
|
m_currentPalette->getGlobalName());
|
|
|
|
if (oldPath == newPath) return;
|
|
|
|
wstring gname = m_currentPalette->getGlobalName();
|
2019-08-19 21:52:45 +12:00
|
|
|
QString question =
|
|
|
|
tr("The current palette %1\nin the studio palette has been modified. "
|
|
|
|
"Do you want to "
|
|
|
|
"save your changes?")
|
|
|
|
.arg(QString::fromStdWString(oldPath.getWideString()));
|
|
|
|
int ret =
|
|
|
|
DVGui::MsgBox(question, tr("Save"), tr("Discard"), tr("Cancel"), 0);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (ret == 3) {
|
|
|
|
setCurrentItem(getItem(oldPath));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ret == 1) {
|
2020-07-06 17:32:52 +12:00
|
|
|
try {
|
|
|
|
// If the palette is level palette (i.e. NOT stdio palette), just
|
|
|
|
// overwrite it
|
|
|
|
if (gname.empty())
|
|
|
|
StudioPalette::instance()->save(oldPath,
|
|
|
|
m_currentPalette.getPointer());
|
|
|
|
else
|
|
|
|
StudioPalette::instance()->setPalette(
|
|
|
|
oldPath, m_currentPalette.getPointer(), false);
|
|
|
|
} catch (TSystemException se) {
|
|
|
|
DVGui::warning(QString::fromStdWString(se.getMessage()));
|
|
|
|
setCurrentItem(previous);
|
|
|
|
return;
|
|
|
|
} catch (...) {
|
|
|
|
DVGui::warning(
|
|
|
|
QString::fromStdWString(oldPath.getWideString() + L"\n") +
|
|
|
|
tr("Failed to save palette."));
|
|
|
|
setCurrentItem(previous);
|
|
|
|
return;
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
m_currentPalette->setDirtyFlag(false);
|
|
|
|
}
|
|
|
|
// load palette here
|
|
|
|
m_currentPalette = StudioPalette::instance()->getPalette(newPath, false);
|
|
|
|
m_studioPaletteHandle->setPalette(m_currentPalette.getPointer());
|
|
|
|
m_studioPaletteHandle->notifyPaletteSwitched();
|
2016-09-15 23:31:45 +12:00
|
|
|
StudioPaletteCmd::updateAllLinkedStyles(m_levelPaletteHandle, m_xsheetHandle);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::addNewPalette() {
|
|
|
|
if (!currentItem()) {
|
|
|
|
error("Error: No folder selected.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TFilePath newPath;
|
|
|
|
try {
|
|
|
|
newPath = StudioPaletteCmd::createPalette(getCurrentFolderPath(), "", 0);
|
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't create palette: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't create palette");
|
|
|
|
}
|
|
|
|
refreshItem(currentItem());
|
|
|
|
setCurrentItem(getItem(newPath));
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::addNewFolder() {
|
|
|
|
if (!currentItem()) {
|
|
|
|
error("Error: No folder selected.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TFilePath newPath;
|
|
|
|
try {
|
|
|
|
newPath = StudioPaletteCmd::addFolder(getCurrentFolderPath());
|
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't create palette folder: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't create palette folder");
|
|
|
|
}
|
|
|
|
refreshItem(currentItem());
|
|
|
|
setCurrentItem(getItem(newPath));
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2016-06-15 18:43:10 +12:00
|
|
|
/*! Convert level palette to studio palette.
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::convertToStudioPalette() {
|
|
|
|
TFilePath path = getItemPath(currentItem());
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
if (studioPalette->isPalette(path)) {
|
|
|
|
TPalette *palette = studioPalette->getPalette(path);
|
|
|
|
|
|
|
|
if (!palette) {
|
|
|
|
error("Can't touch palette");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_currentPalette->getPaletteName() != palette->getPaletteName()) {
|
|
|
|
error("Can't touch palette");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-19 21:52:45 +12:00
|
|
|
QString question =
|
|
|
|
tr("Convert %1 to Studio Palette and Overwrite. \nAre you sure ?")
|
|
|
|
.arg(QString::fromStdWString(path.getWideString()));
|
|
|
|
int ret = DVGui::MsgBox(question, tr("Convert"), tr("Cancel"));
|
2016-06-15 18:43:10 +12:00
|
|
|
if (ret == 0 || ret == 2) return;
|
|
|
|
|
|
|
|
// apply global name
|
|
|
|
time_t ltime;
|
|
|
|
time(<ime);
|
|
|
|
wstring gname = std::to_wstring(ltime) + L"_" + std::to_wstring(rand());
|
|
|
|
m_currentPalette->setGlobalName(gname);
|
|
|
|
studioPalette->setStylesGlobalNames(m_currentPalette.getPointer());
|
|
|
|
studioPalette->save(path, m_currentPalette.getPointer());
|
|
|
|
|
|
|
|
m_currentPalette->setDirtyFlag(false);
|
|
|
|
currentItem()->setIcon(0, m_studioPaletteIcon);
|
|
|
|
|
|
|
|
} else
|
|
|
|
error("Can't find palette");
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::deleteItem(QTreeWidgetItem *item) {
|
|
|
|
QTreeWidgetItem *parent = item->parent();
|
|
|
|
if (!parent) return;
|
|
|
|
|
|
|
|
if (item->childCount() > 0) {
|
|
|
|
QString question;
|
|
|
|
question = tr("This folder is not empty. Delete anyway?");
|
2019-08-19 21:52:45 +12:00
|
|
|
int ret = DVGui::MsgBox(question, tr("Delete"), tr("Cancel"));
|
2016-06-15 18:43:10 +12:00
|
|
|
if (ret == 0 || ret == 2) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TFilePath path = getItemPath(item);
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
if (studioPalette->isFolder(path)) {
|
|
|
|
try {
|
|
|
|
StudioPaletteCmd::deleteFolder(path);
|
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't delete folder: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't delete folder");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
assert(studioPalette->isPalette(path));
|
|
|
|
try {
|
|
|
|
StudioPaletteCmd::deletePalette(path);
|
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't delete palette: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't delete palette");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
refreshItem(parent);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::deleteItems() {
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int count = items.size();
|
|
|
|
|
|
|
|
if (count == 0) {
|
|
|
|
error("Nothing to delete");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int i;
|
|
|
|
TUndoManager::manager()->beginBlock();
|
|
|
|
for (i = 0; i < count; i++) deleteItem(items[i]);
|
|
|
|
TUndoManager::manager()->endBlock();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::searchForPalette() {
|
|
|
|
m_palettesScanPopup->setCurrentFolder(getCurrentFolderPath());
|
|
|
|
int ret = m_palettesScanPopup->exec();
|
|
|
|
if (ret == QDialog::Accepted) refresh();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class InvalidateIconsUndo final : public TUndo {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPaletteP m_targetPalette, m_oldPalette, m_newPalette;
|
|
|
|
TXshLevelHandle *m_levelHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
InvalidateIconsUndo(TXshLevelHandle *levelHandle)
|
|
|
|
: m_levelHandle(levelHandle) {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void undo() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
TXshLevel *level = m_levelHandle->getLevel();
|
|
|
|
if (level) {
|
|
|
|
std::vector<TFrameId> fids;
|
|
|
|
level->getFids(fids);
|
|
|
|
invalidateIcons(level, fids);
|
|
|
|
}
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void redo() const override { undo(); }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getSize() const override { return sizeof(*this); }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2019-08-19 21:52:45 +12:00
|
|
|
AdjustPaletteDialog::AdjustPaletteDialog()
|
|
|
|
: Dialog(0, true, true, "Adjust Current Level to This Palette") {
|
|
|
|
setWindowTitle(tr("Adjust Current Level to This Palette"));
|
|
|
|
|
|
|
|
beginVLayout();
|
|
|
|
m_tolerance = new IntField(this);
|
|
|
|
m_tolerance->setRange(0, 255);
|
|
|
|
m_tolerance->setValue(0);
|
|
|
|
addWidget(tr("Tolerance"), m_tolerance);
|
|
|
|
endVLayout();
|
|
|
|
|
|
|
|
QPushButton *okBtn = new QPushButton(tr("Apply"), this);
|
|
|
|
okBtn->setDefault(true);
|
|
|
|
QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
|
|
|
|
bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(accept()));
|
|
|
|
ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
|
|
|
assert(ret);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-08-19 21:52:45 +12:00
|
|
|
addButtonBarWidget(okBtn, cancelBtn);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-08-19 21:52:45 +12:00
|
|
|
int AdjustPaletteDialog::getTolerance() { return m_tolerance->getValue(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::loadInCurrentPaletteAndAdaptLevel() {
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
assert(items.size() == 1);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPalette *palette = m_levelPaletteHandle->getPalette();
|
|
|
|
if (!palette) return;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2020-01-12 08:22:05 +13:00
|
|
|
// prevent crash when the command is applied to the palette level
|
|
|
|
if (!m_currentLevelHandle->getSimpleLevel()) return;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPalette *newPalette =
|
|
|
|
StudioPalette::instance()->getPalette(getItemPath(items[0]), true);
|
|
|
|
if (!newPalette) return;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
AdjustPaletteDialog apd;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
if (apd.exec() != QDialog::Accepted) return;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/* awful patch: since in StudioPaletteCmd(defined in toonzlib) I cannot use
|
|
|
|
the invalidateIcons(defined in toonzqt)
|
|
|
|
i do invalidate icons from here using a "fake TUndo", named InvalidateIconsUndo.
|
|
|
|
And, since I need to refresh icons at the end of the processing, i have to put
|
|
|
|
that fake undo twice, one before and one after.
|
|
|
|
this way , when the user do either an undo or a redo operation, I am ensured
|
|
|
|
that the last operation is the icon refresh...
|
|
|
|
*/
|
|
|
|
TUndoManager::manager()->beginBlock();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TUndoManager::manager()->add(new InvalidateIconsUndo(m_currentLevelHandle));
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPaletteCmd::loadIntoCurrentPalette(m_levelPaletteHandle, newPalette,
|
|
|
|
m_currentLevelHandle,
|
|
|
|
apd.getTolerance());
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TUndoManager::manager()->add(new InvalidateIconsUndo(m_currentLevelHandle));
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TUndoManager::manager()->endBlock();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
InvalidateIconsUndo(m_currentLevelHandle).undo();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::loadInCurrentPalette() {
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int count = items.size();
|
|
|
|
if (count == 0) return;
|
|
|
|
|
|
|
|
TPalette *palette = m_levelPaletteHandle->getPalette();
|
|
|
|
if (!palette) return;
|
|
|
|
|
|
|
|
if (palette->isLocked()) {
|
|
|
|
DVGui::warning("Palette is Locked!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TPalette *newPalette =
|
|
|
|
StudioPalette::instance()->getPalette(getItemPath(items[0]), false);
|
|
|
|
if (!newPalette) return;
|
|
|
|
if (m_xsheetHandle) {
|
|
|
|
int ret = DVGui::eraseStylesInDemand(palette, m_xsheetHandle, newPalette);
|
|
|
|
if (ret == 0) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
StudioPaletteCmd::loadIntoCurrentPalette(m_levelPaletteHandle, newPalette);
|
|
|
|
m_currentLevelHandle->notifyLevelChange();
|
|
|
|
|
|
|
|
TXshLevel *level = m_currentLevelHandle->getLevel();
|
|
|
|
if (level) {
|
|
|
|
std::vector<TFrameId> fids;
|
|
|
|
level->getFids(fids);
|
|
|
|
invalidateIcons(level, fids);
|
|
|
|
}
|
|
|
|
|
|
|
|
int i;
|
|
|
|
for (i = 1; i < count; i++) {
|
|
|
|
TFilePath path = getItemPath(items[i]);
|
|
|
|
StudioPaletteCmd::mergeIntoCurrentPalette(m_levelPaletteHandle, path);
|
|
|
|
}
|
|
|
|
// in order to update the title bar of palette viewer
|
|
|
|
m_levelPaletteHandle->getPalette()->setDirtyFlag(true);
|
|
|
|
m_levelPaletteHandle->notifyPaletteChanged();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::replaceCurrentPalette() {
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int count = items.size();
|
|
|
|
if (count == 0) return;
|
|
|
|
|
|
|
|
// exec confirmation dialog
|
|
|
|
TPalette *current = m_levelPaletteHandle->getPalette();
|
|
|
|
if (!current) return;
|
|
|
|
|
|
|
|
QString label;
|
|
|
|
if (count != 1) // replacing to multiple palettes
|
2019-08-19 21:52:45 +12:00
|
|
|
label = tr("Replacing all selected palettes with the palette \"%1\". \nAre "
|
|
|
|
"you sure ?")
|
|
|
|
.arg(QString::fromStdWString(current->getPaletteName()));
|
2016-06-15 18:43:10 +12:00
|
|
|
else {
|
|
|
|
TPalette *dstPalette =
|
|
|
|
StudioPalette::instance()->getPalette(getItemPath(items[0]));
|
|
|
|
if (!dstPalette) return;
|
2019-08-19 21:52:45 +12:00
|
|
|
label = tr("Replacing the palette \"%1\" with the palette \"%2\". \nAre "
|
|
|
|
"you sure ?")
|
|
|
|
.arg(QString::fromStdWString(dstPalette->getPaletteName()))
|
|
|
|
.arg(QString::fromStdWString(current->getPaletteName()));
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
|
2019-08-19 21:52:45 +12:00
|
|
|
int ret = DVGui::MsgBox(label, tr("Replace"), tr("Cancel"), 1);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (ret == 0 || ret == 2) return;
|
|
|
|
|
|
|
|
TUndoManager::manager()->beginBlock();
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
StudioPaletteCmd::replaceWithCurrentPalette(
|
|
|
|
m_levelPaletteHandle, m_studioPaletteHandle, getItemPath(items[i]));
|
|
|
|
TUndoManager::manager()->endBlock();
|
|
|
|
|
|
|
|
if (m_currentPalette) m_currentPalette->setDirtyFlag(false);
|
|
|
|
// in order to update display
|
|
|
|
onCurrentItemChanged(currentItem(), currentItem());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::mergeToCurrentPalette() {
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int count = items.size();
|
|
|
|
if (count == 0) return;
|
|
|
|
|
|
|
|
TUndoManager::manager()->beginBlock();
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
StudioPaletteCmd::mergeIntoCurrentPalette(m_levelPaletteHandle,
|
|
|
|
getItemPath(items[i]));
|
|
|
|
TUndoManager::manager()->endBlock();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::paintEvent(QPaintEvent *event) {
|
|
|
|
QTreeWidget::paintEvent(event);
|
|
|
|
QPainter p(viewport());
|
|
|
|
if (m_dropItem) {
|
|
|
|
p.setPen(QColor(50, 105, 200));
|
|
|
|
p.drawRect(visualItemRect(m_dropItem));
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::contextMenuEvent(QContextMenuEvent *event) {
|
|
|
|
TFilePath path = getCurrentFolderPath();
|
|
|
|
|
|
|
|
StudioPalette *studioPalette = StudioPalette::instance();
|
|
|
|
|
|
|
|
// Menu' per la selezione singola
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int count = items.size();
|
|
|
|
if (count == 1) {
|
|
|
|
// Verify if click position is in a row containing an item.
|
|
|
|
QRect rect = visualItemRect(currentItem());
|
|
|
|
if (!QRect(0, rect.y(), width(), rect.height()).contains(event->pos()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
bool isFolder = (studioPalette->isFolder(path));
|
|
|
|
|
|
|
|
QMenu menu(this);
|
|
|
|
if (isFolder) {
|
|
|
|
createMenuAction(menu, "", tr("New Palette"), "addNewPalette()");
|
|
|
|
createMenuAction(menu, "", tr("New Folder"), "addNewFolder()");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (studioPalette->isFolder(path) &&
|
|
|
|
studioPalette->getLevelPalettesRoot() != path &&
|
2020-07-26 16:51:26 +12:00
|
|
|
studioPalette->getProjectPalettesRoot() != path &&
|
|
|
|
studioPalette->getPersonalPalettesRoot() != path) {
|
2016-06-15 18:43:10 +12:00
|
|
|
menu.addSeparator();
|
|
|
|
createMenuAction(menu, "", tr("Delete Folder"), "deleteItems()");
|
|
|
|
} else if (studioPalette->isPalette(path)) {
|
|
|
|
if (m_studioPaletteHandle->getPalette()) {
|
|
|
|
createMenuAction(menu, "MI_LoadIntoCurrentPalette",
|
|
|
|
tr("Load into Current Palette"),
|
|
|
|
"loadInCurrentPalette()");
|
|
|
|
createMenuAction(menu, "MI_AdjustCurrentLevelToPalette",
|
|
|
|
tr("Adjust Current Level to This Palette"),
|
|
|
|
"loadInCurrentPaletteAndAdaptLevel()");
|
|
|
|
createMenuAction(menu, "MI_MergeToCurrentPalette",
|
|
|
|
tr("Merge to Current Palette"),
|
|
|
|
"mergeToCurrentPalette()");
|
|
|
|
if (!m_studioPaletteHandle->getPalette()->isLocked()) {
|
|
|
|
createMenuAction(menu, "MI_ReplaceWithCurrentPalette",
|
|
|
|
tr("Replace with Current Palette"),
|
|
|
|
"replaceCurrentPalette()");
|
|
|
|
menu.addSeparator();
|
|
|
|
createMenuAction(menu, "MI_DeletePalette", tr("Delete Palette"),
|
|
|
|
"deleteItems()");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!studioPalette->hasGlobalName(path)) {
|
|
|
|
menu.addSeparator();
|
|
|
|
createMenuAction(menu, "",
|
|
|
|
tr("Convert to Studio Palette and Overwrite"),
|
|
|
|
"convertToStudioPalette()");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isFolder) {
|
|
|
|
menu.addSeparator();
|
|
|
|
createMenuAction(menu, "", tr("Search for Palettes"),
|
|
|
|
"searchForPalette()");
|
|
|
|
}
|
|
|
|
menu.exec(event->globalPos());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Menu' per la selezione multipla
|
|
|
|
// Verify if click position is in a row containing an item.
|
|
|
|
bool areAllPalette = true;
|
|
|
|
bool isClickInSelection = false;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
QTreeWidgetItem *item = items[i];
|
|
|
|
QRect rect = visualItemRect(item);
|
|
|
|
if (QRect(0, rect.y(), width(), rect.height()).contains(event->pos()))
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
isClickInSelection = true;
|
|
|
|
TFilePath path = getItemPath(item);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (studioPalette->isFolder(path)) areAllPalette = false;
|
|
|
|
}
|
|
|
|
if (!isClickInSelection) return;
|
|
|
|
|
|
|
|
QMenu menu(this);
|
|
|
|
if (areAllPalette) {
|
|
|
|
createMenuAction(menu, "", tr("Load into Current Palette"),
|
|
|
|
"loadInCurrentPalette()");
|
|
|
|
createMenuAction(menu, "", tr("Merge to Current Palette"),
|
|
|
|
"mergeToCurrentPalette()");
|
|
|
|
createMenuAction(menu, "", tr("Replace with Current Palette"),
|
|
|
|
"replaceCurrentPalette()");
|
|
|
|
menu.addSeparator();
|
|
|
|
}
|
|
|
|
createMenuAction(menu, "", tr("Delete"), "deleteItems()");
|
|
|
|
|
|
|
|
menu.exec(event->globalPos());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::createMenuAction(QMenu &menu, const char *id,
|
|
|
|
QString name, const char *slot) {
|
|
|
|
QAction *act = menu.addAction(name);
|
|
|
|
string slotName(slot);
|
|
|
|
slotName = string("1") + slotName;
|
|
|
|
connect(act, SIGNAL(triggered()), slotName.c_str());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2020-01-15 20:30:19 +13:00
|
|
|
void StudioPaletteTreeViewer::mousePressEvent(QMouseEvent *event) {
|
|
|
|
QTreeWidget::mousePressEvent(event);
|
|
|
|
// If left button is not pressed return
|
|
|
|
if (event->button() == Qt::LeftButton) m_startPos = event->pos();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::mouseMoveEvent(QMouseEvent *event) {
|
|
|
|
// If left button is not pressed return; is not drag event.
|
|
|
|
if (!(event->buttons() & Qt::LeftButton)) return;
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
if (!m_startPos.isNull() &&
|
|
|
|
(m_startPos - event->pos()).manhattanLength() >=
|
|
|
|
QApplication::startDragDistance())
|
2020-01-15 20:30:19 +13:00
|
|
|
startDragDrop();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void StudioPaletteTreeViewer::mouseReleaseEvent(QMouseEvent *event) {
|
|
|
|
QTreeWidget::mouseReleaseEvent(event);
|
|
|
|
if (event->button() == Qt::LeftButton) m_startPos = QPoint();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::startDragDrop() {
|
|
|
|
TRepetitionGuard guard;
|
|
|
|
if (!guard.hasLock()) return;
|
|
|
|
|
|
|
|
QDrag *drag = new QDrag(this);
|
|
|
|
QMimeData *mimeData = new QMimeData;
|
|
|
|
QList<QUrl> urls;
|
|
|
|
|
|
|
|
QList<QTreeWidgetItem *> items = selectedItems();
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < items.size(); i++) {
|
|
|
|
// Sposto solo le palette.
|
|
|
|
TFilePath path = getItemPath(items[i]);
|
|
|
|
if (!path.isEmpty() &&
|
|
|
|
(path.getType() == "tpl" || path.getType() == "pli" ||
|
|
|
|
path.getType() == "tlv" || path.getType() == "tnz"))
|
|
|
|
urls.append(pathToUrl(path));
|
|
|
|
}
|
|
|
|
if (urls.isEmpty()) return;
|
|
|
|
mimeData->setUrls(urls);
|
|
|
|
drag->setMimeData(mimeData);
|
|
|
|
Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
|
|
|
|
viewport()->update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::dragEnterEvent(QDragEnterEvent *event) {
|
|
|
|
const QMimeData *mimeData = event->mimeData();
|
|
|
|
const PaletteData *paletteData = dynamic_cast<const PaletteData *>(mimeData);
|
|
|
|
|
|
|
|
if (acceptResourceDrop(mimeData->urls())) {
|
|
|
|
QList<QUrl> urls = mimeData->urls();
|
|
|
|
int count = urls.size();
|
|
|
|
if (count == 0) return;
|
|
|
|
|
|
|
|
// Controllo che almeno un url del drag sia una palette da spostare.
|
|
|
|
bool isPalette = false;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
QUrl url = urls[i];
|
|
|
|
TFilePath path(url.toLocalFile().toStdWString());
|
2019-11-19 18:27:09 +13:00
|
|
|
if (!path.isEmpty() && isInStudioPalette(path) &&
|
2016-06-15 18:43:10 +12:00
|
|
|
(path.getType() == "tpl" || path.getType() == "pli" ||
|
|
|
|
path.getType() == "tlv" || path.getType() == "tnz")) {
|
|
|
|
isPalette = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isPalette) return;
|
|
|
|
|
|
|
|
event->acceptProposedAction();
|
|
|
|
} else if (paletteData && paletteData->hasOnlyPalette())
|
|
|
|
event->acceptProposedAction();
|
|
|
|
viewport()->update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::dragMoveEvent(QDragMoveEvent *event) {
|
|
|
|
QTreeWidgetItem *item = itemAt(event->pos());
|
|
|
|
TFilePath newPath = getItemPath(item);
|
|
|
|
|
|
|
|
if (item) {
|
2018-04-23 17:13:40 +12:00
|
|
|
// drop will not be executed on the same item
|
|
|
|
const QMimeData *mimeData = event->mimeData();
|
|
|
|
if (mimeData->hasUrls() && mimeData->urls().size() == 1) {
|
|
|
|
TFilePath path =
|
|
|
|
TFilePath(mimeData->urls()[0].toLocalFile().toStdWString());
|
|
|
|
if (path == getItemPath(item)) {
|
|
|
|
m_dropItem = 0;
|
|
|
|
event->ignore();
|
|
|
|
viewport()->update();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// when dragging over other items, drop destination will be the parent
|
|
|
|
// folder of it
|
|
|
|
if (item->flags() & Qt::ItemNeverHasChildren) {
|
|
|
|
item = item->parent();
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
m_dropItem = item;
|
|
|
|
event->acceptProposedAction();
|
|
|
|
} else {
|
|
|
|
m_dropItem = 0;
|
|
|
|
event->ignore();
|
|
|
|
}
|
|
|
|
viewport()->update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) {
|
|
|
|
TFilePath newPath = getItemPath(m_dropItem);
|
|
|
|
|
|
|
|
resetDropItem();
|
|
|
|
|
2016-10-26 20:27:19 +13:00
|
|
|
if (newPath.isEmpty()) return;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
const QMimeData *mimeData = event->mimeData();
|
|
|
|
const PaletteData *paletteData = dynamic_cast<const PaletteData *>(mimeData);
|
|
|
|
if (paletteData) {
|
|
|
|
if (paletteData->hasOnlyPalette()) {
|
|
|
|
TPalette *palette = paletteData->getPalette();
|
|
|
|
if (!palette) return;
|
|
|
|
|
|
|
|
try {
|
|
|
|
StudioPaletteCmd::createPalette(
|
|
|
|
newPath, ::to_string(palette->getPaletteName()), palette);
|
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't create palette: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't create palette");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mimeData->hasUrls() || mimeData->urls().size() == 0) return;
|
|
|
|
|
|
|
|
QList<QUrl> urls = mimeData->urls();
|
|
|
|
|
2018-04-23 17:13:40 +12:00
|
|
|
// make the list of palette paths which will be actually moved
|
|
|
|
QList<TFilePath> palettePaths;
|
|
|
|
for (int i = 0; i < urls.size(); i++) {
|
|
|
|
TFilePath path = TFilePath(urls[i].toLocalFile().toStdWString());
|
|
|
|
if (path != newPath && path.getParentDir() != newPath)
|
|
|
|
palettePaths.append(path);
|
|
|
|
}
|
|
|
|
if (palettePaths.isEmpty()) return;
|
|
|
|
|
|
|
|
// open the confirmation dialog in order to prevent unintended move
|
|
|
|
QString pltName;
|
|
|
|
if (palettePaths.size() == 1)
|
|
|
|
pltName = tr("the palette \"%1\"")
|
|
|
|
.arg(QString::fromStdWString(palettePaths[0].getWideName()));
|
|
|
|
else
|
UI update and Icons from Konero (#126)
* 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>
2020-09-01 06:51:22 +12:00
|
|
|
pltName = tr("the selected palettes");
|
2018-04-23 17:13:40 +12:00
|
|
|
QString dstName = QString::fromStdWString(newPath.getWideName());
|
|
|
|
|
|
|
|
QString question =
|
|
|
|
tr("Move %1 to \"%2\". Are you sure ?").arg(pltName).arg(dstName);
|
|
|
|
int ret = DVGui::MsgBox(question, tr("Move"), tr("Cancel"));
|
|
|
|
if (ret == 0 || ret == 2) return;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2019-11-19 18:27:09 +13:00
|
|
|
bool paletteMoved = false;
|
2018-04-23 17:13:40 +12:00
|
|
|
TUndoManager::manager()->beginBlock();
|
|
|
|
for (int i = 0; i < palettePaths.size(); i++) {
|
|
|
|
TFilePath path = palettePaths[i];
|
2016-06-15 18:43:10 +12:00
|
|
|
if (isInStudioPalette(path)) {
|
|
|
|
TFilePath newPalettePath =
|
|
|
|
newPath +
|
|
|
|
TFilePath(path.getWideName() + ::to_wstring(path.getDottedType()));
|
|
|
|
try {
|
|
|
|
StudioPaletteCmd::movePalette(newPalettePath, path);
|
2019-11-19 18:27:09 +13:00
|
|
|
paletteMoved = true;
|
2016-06-15 18:43:10 +12:00
|
|
|
} catch (TException &e) {
|
|
|
|
error("Can't rename palette: " +
|
|
|
|
QString(::to_string(e.getMessage()).c_str()));
|
|
|
|
} catch (...) {
|
|
|
|
error("Can't rename palette");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TUndoManager::manager()->endBlock();
|
2019-11-19 18:27:09 +13:00
|
|
|
if (paletteMoved) {
|
|
|
|
event->setDropAction(Qt::MoveAction);
|
|
|
|
event->accept();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void StudioPaletteTreeViewer::dragLeaveEvent(QDragLeaveEvent *event) {
|
|
|
|
resetDropItem();
|
|
|
|
update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// StudioPaletteViewer
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
StudioPaletteViewer::StudioPaletteViewer(QWidget *parent,
|
2016-06-15 18:43:10 +12:00
|
|
|
TPaletteHandle *studioPaletteHandle,
|
|
|
|
TPaletteHandle *levelPaletteHandle,
|
|
|
|
TFrameHandle *frameHandle,
|
|
|
|
TXsheetHandle *xsheetHandle,
|
|
|
|
TXshLevelHandle *currentLevelHandle)
|
|
|
|
: QSplitter(parent) {
|
|
|
|
// style sheet
|
|
|
|
setObjectName("StudioPaletteViewer");
|
|
|
|
setFrameStyle(QFrame::StyledPanel);
|
|
|
|
|
|
|
|
setAcceptDrops(true);
|
|
|
|
setOrientation(Qt::Vertical);
|
|
|
|
|
|
|
|
// First Splitter Widget
|
|
|
|
QWidget *treeWidget = new QWidget(this);
|
|
|
|
QVBoxLayout *treeVLayout = new QVBoxLayout(treeWidget);
|
|
|
|
treeVLayout->setMargin(0);
|
|
|
|
treeVLayout->setSpacing(0);
|
|
|
|
|
|
|
|
m_studioPaletteTreeViewer = new StudioPaletteTreeViewer(
|
|
|
|
treeWidget, studioPaletteHandle, levelPaletteHandle, xsheetHandle,
|
|
|
|
currentLevelHandle);
|
|
|
|
|
|
|
|
treeVLayout->addWidget(m_studioPaletteTreeViewer);
|
|
|
|
treeWidget->setLayout(treeVLayout);
|
|
|
|
|
|
|
|
// Second Splitter Widget
|
2018-11-16 22:28:38 +13:00
|
|
|
m_studioPaletteViewer =
|
2016-06-15 18:43:10 +12:00
|
|
|
new PaletteViewer(this, PaletteViewerGUI::STUDIO_PALETTE);
|
2018-11-16 22:28:38 +13:00
|
|
|
m_studioPaletteViewer->setObjectName("PaletteViewerInStudioPalette");
|
|
|
|
m_studioPaletteViewer->setXsheetHandle(xsheetHandle);
|
|
|
|
m_studioPaletteViewer->setPaletteHandle(studioPaletteHandle);
|
|
|
|
m_studioPaletteViewer->setFrameHandle(frameHandle);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
addWidget(treeWidget);
|
2018-11-16 22:28:38 +13:00
|
|
|
addWidget(m_studioPaletteViewer);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2018-11-16 22:28:38 +13:00
|
|
|
setFocusProxy(m_studioPaletteViewer);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
StudioPaletteViewer::~StudioPaletteViewer() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! In order to save current palette from the tool button in the PageViewer.
|
2019-08-19 21:52:45 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
TFilePath StudioPaletteViewer::getCurrentItemPath() {
|
|
|
|
return m_studioPaletteTreeViewer->getCurrentItemPath();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
2018-11-16 22:28:38 +13:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
int StudioPaletteViewer::getViewMode() const {
|
|
|
|
return m_studioPaletteViewer->getViewMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void StudioPaletteViewer::setViewMode(int mode) {
|
|
|
|
m_studioPaletteViewer->setViewMode(
|
|
|
|
(PaletteViewerGUI::PageViewer::ViewMode)mode);
|
|
|
|
}
|