Merge remote-tracking branch 'origin/master' into numpad_for_palette_shortcut
This commit is contained in:
commit
7292b3f0dc
20 changed files with 161 additions and 64 deletions
|
@ -92,7 +92,7 @@ elseif(UNIX)
|
|||
else()
|
||||
set(PLATFORM 32)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
add_definitions(-DLINUX)
|
||||
else()
|
||||
message(WARNING "Support for generic Unix (Not Apple or Linux) isn't yet working!")
|
||||
|
|
|
@ -146,7 +146,8 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
TToonzImageP makeTlv(bool transparentSyntheticInks);
|
||||
TToonzImageP makeTlv(bool transparentSyntheticInks,
|
||||
bool removeUnusedStyles = false);
|
||||
|
||||
TVectorImageP vectorize(const TToonzImageP &ti);
|
||||
TVectorImageP vectorize(const TRaster32P &ras);
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
bool isConstantFolder(int index) const;
|
||||
|
||||
TFilePath getFolder(int index) const;
|
||||
TFilePath getFolder(std::string name) const;
|
||||
TFilePath getFolder(std::string name, bool absolute = false) const;
|
||||
|
||||
TFilePath getScenesPath() const;
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ class DVAPI FileField : public QWidget {
|
|||
QStringList m_filters;
|
||||
QFileDialog::FileMode m_fileMode;
|
||||
QString m_windowTitle;
|
||||
QString m_descriptionText; // if the initial text is not path, set the string
|
||||
// here and prevent browsing
|
||||
|
||||
protected: // used in the child class for CleanupSettings
|
||||
QPushButton *m_fileBrowseButton;
|
||||
|
@ -73,7 +75,7 @@ public:
|
|||
static BrowserPopupController *m_browserPopupController;
|
||||
|
||||
FileField(QWidget *parent = 0, QString path = QString(),
|
||||
bool readOnly = false);
|
||||
bool readOnly = false, bool doNotBrowseInitialPath = false);
|
||||
~FileField() {}
|
||||
|
||||
/*! Set what the user may select in the file dialog:
|
||||
|
|
|
@ -111,8 +111,10 @@ void DVAPI convertNaa2Tlv(
|
|||
FrameTaskNotifier
|
||||
*frameNotifier, //!< Observer class for frame success notifications.
|
||||
TPalette *palette =
|
||||
0); //!< Special conversion function from an antialiased level to tlv.
|
||||
//! \sa Function ImageUtils::convert().
|
||||
0, //!< Special conversion function from an antialiased level to tlv.
|
||||
//! \sa Function ImageUtils::convert().
|
||||
bool removeUnusedStyles =
|
||||
false); //! Remove unused styles from input palette.
|
||||
|
||||
double DVAPI getQuantizedZoomFactor(double zf, bool forward);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ set(MOC_HEADERS
|
|||
../include/tools/screenpicker.h
|
||||
rgbpickertool.h
|
||||
rulertool.h
|
||||
stylepickertool.h
|
||||
stylepickertool.h
|
||||
)
|
||||
|
||||
set(HEADERS ${MOC_HEADERS}
|
||||
|
|
|
@ -436,10 +436,10 @@ if(APPLE)
|
|||
get_target_property(loc OpenToonz_${VERSION} MACOSX_BUNDLE_NAME)
|
||||
message(" ==> App Bundle: " ${loc})
|
||||
message(" ==> Mach-o: " ${bin})
|
||||
foreach (lib ${EXTRA_LIBS})
|
||||
foreach(lib ${EXTRA_LIBS})
|
||||
message(" copy:" ${lib} "==>" ${CMAKE_CURRENT_BINARY_DIR}/OpenToonz_${VERSION}.app/Contents/MacOS/)
|
||||
add_custom_command(TARGET OpenToonz_${VERSION} POST_BUILD COMMAND cp ${lib} ${CMAKE_CURRENT_BINARY_DIR}/OpenToonz_${VERSION}.app/Contents/MacOS/)
|
||||
endforeach ()
|
||||
endforeach()
|
||||
|
||||
add_custom_command(TARGET OpenToonz_${VERSION}
|
||||
POST_BUILD COMMAND
|
||||
|
|
|
@ -55,6 +55,8 @@ TEnv::IntVar ConvertPopupRemoveDot("ConvertPopupRemoveDot", 1);
|
|||
TEnv::IntVar ConvertPopupSaveToNopaint("ConvertPopupSaveToNopaint", 1);
|
||||
TEnv::IntVar ConvertPopupAppendDefaultPalette(
|
||||
"ConvertPopupAppendDefaultPalette", 0);
|
||||
TEnv::IntVar ConvertPopupRemoveUnusedStyles("ConvertPopupRemoveUnusedStyles",
|
||||
0);
|
||||
|
||||
//=============================================================================
|
||||
// convertPopup
|
||||
|
@ -200,7 +202,8 @@ void ConvertPopup::Converter::convertLevel(
|
|||
// no AA source (retas)
|
||||
TPaletteP palette = popup->readUserProvidedPalette();
|
||||
ImageUtils::convertNaa2Tlv(sourceFileFullPath, dstFileFullPath, from, to,
|
||||
m_parent->m_notifier, palette.getPointer());
|
||||
m_parent->m_notifier, palette.getPointer(),
|
||||
m_parent->m_removeUnusedStyles->isChecked());
|
||||
} else {
|
||||
convertLevelWithConvert2Tlv(sourceFileFullPath);
|
||||
}
|
||||
|
@ -441,6 +444,7 @@ ConvertPopup::ConvertPopup(bool specifyInput)
|
|||
m_removeDotBeforeFrameNumber->setChecked(ConvertPopupRemoveDot != 0);
|
||||
m_saveBackupToNopaint->setChecked(ConvertPopupSaveToNopaint != 0);
|
||||
m_appendDefaultPalette->setChecked(ConvertPopupAppendDefaultPalette != 0);
|
||||
m_removeUnusedStyles->setChecked(ConvertPopupRemoveUnusedStyles != 0);
|
||||
|
||||
//--- signal-slot connections
|
||||
qRegisterMetaType<TFilePath>("TFilePath");
|
||||
|
@ -470,6 +474,9 @@ ConvertPopup::ConvertPopup(bool specifyInput)
|
|||
ret = ret && connect(m_convertFileFld, SIGNAL(pathChanged()), this,
|
||||
SLOT(onFileInChanged()));
|
||||
|
||||
// update unable/enable of checkboxes
|
||||
onTlvModeSelected(m_tlvMode->currentText());
|
||||
|
||||
assert(ret);
|
||||
}
|
||||
|
||||
|
@ -522,7 +529,7 @@ QFrame *ConvertPopup::createTlvSettings() {
|
|||
m_tlvMode = new QComboBox();
|
||||
m_unpaintedFolderLabel = new QLabel(tr("Unpainted File Folder:"));
|
||||
m_unpaintedFolder =
|
||||
new DVGui::FileField(0, QString(tr("Same as Painted")), true);
|
||||
new DVGui::FileField(0, QString(tr("Same as Painted")), true, true);
|
||||
m_suffixLabel = new QLabel(tr(" Unpainted File Suffix:"));
|
||||
m_unpaintedSuffix = new DVGui::LineEdit("_np");
|
||||
m_applyAutoclose = new QCheckBox(tr("Apply Autoclose"));
|
||||
|
@ -531,8 +538,12 @@ QFrame *ConvertPopup::createTlvSettings() {
|
|||
m_appendDefaultPalette = new QCheckBox(tr("Append Default Palette"));
|
||||
m_antialias = new QComboBox();
|
||||
m_antialiasIntensity = new DVGui::IntLineEdit(0, 50, 0, 100);
|
||||
m_palettePath = new DVGui::FileField(0, QString(CreateNewPalette), true);
|
||||
m_tolerance = new DVGui::IntLineEdit(0, 0, 0, 255);
|
||||
m_palettePath =
|
||||
new DVGui::FileField(0, QString(CreateNewPalette), true, true);
|
||||
m_tolerance = new DVGui::IntLineEdit(0, 0, 0, 255);
|
||||
|
||||
m_removeUnusedStyles =
|
||||
new QCheckBox(tr("Remove Unused Styles from Input Palette"));
|
||||
|
||||
m_unpaintedFolder->setFileMode(QFileDialog::DirectoryOnly);
|
||||
m_unpaintedSuffix->setMaximumWidth(40);
|
||||
|
@ -585,8 +596,9 @@ QFrame *ConvertPopup::createTlvSettings() {
|
|||
Qt::AlignRight | Qt::AlignVCenter);
|
||||
gridLay->addWidget(m_tolerance, 4, 3);
|
||||
|
||||
gridLay->addWidget(m_appendDefaultPalette, 5, 1, 1, 3);
|
||||
gridLay->addWidget(m_saveBackupToNopaint, 6, 1, 1, 3);
|
||||
gridLay->addWidget(m_removeUnusedStyles, 5, 1, 1, 3);
|
||||
gridLay->addWidget(m_appendDefaultPalette, 6, 1, 1, 3);
|
||||
gridLay->addWidget(m_saveBackupToNopaint, 7, 1, 1, 3);
|
||||
}
|
||||
gridLay->setColumnStretch(0, 0);
|
||||
gridLay->setColumnStretch(1, 1);
|
||||
|
@ -597,6 +609,9 @@ QFrame *ConvertPopup::createTlvSettings() {
|
|||
bool ret = true;
|
||||
ret = ret && connect(m_antialias, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onAntialiasSelected(int)));
|
||||
ret = ret && connect(m_palettePath, SIGNAL(pathChanged()), this,
|
||||
SLOT(onPalettePathChanged()));
|
||||
|
||||
assert(ret);
|
||||
|
||||
frame->setVisible(false);
|
||||
|
@ -652,8 +667,13 @@ void ConvertPopup::onTlvModeSelected(const QString &tlvMode) {
|
|||
m_suffixLabel->setEnabled(usesTwoImages);
|
||||
m_unpaintedSuffix->setEnabled(usesTwoImages);
|
||||
m_antialias->setEnabled(TlvMode_PaintedFromNonAA != tlvMode);
|
||||
m_palettePath->setEnabled(TlvMode_PaintedFromNonAA != tlvMode);
|
||||
// m_palettePath->setEnabled(TlvMode_PaintedFromNonAA != tlvMode);
|
||||
m_tolerance->setEnabled(TlvMode_PaintedFromNonAA != tlvMode);
|
||||
m_appendDefaultPalette->setEnabled(TlvMode_PaintedFromNonAA != tlvMode);
|
||||
|
||||
m_removeUnusedStyles->setEnabled(TlvMode_PaintedFromNonAA == tlvMode &&
|
||||
m_palettePath->getPath() !=
|
||||
CreateNewPalette);
|
||||
|
||||
m_saveBackupToNopaint->setEnabled(TlvMode_Unpainted == tlvMode);
|
||||
}
|
||||
|
@ -1057,6 +1077,7 @@ void ConvertPopup::apply() {
|
|||
ConvertPopupSaveToNopaint = m_saveBackupToNopaint->isChecked() ? 1 : 0;
|
||||
ConvertPopupAppendDefaultPalette =
|
||||
m_appendDefaultPalette->isChecked() ? 1 : 0;
|
||||
ConvertPopupRemoveUnusedStyles = m_removeUnusedStyles->isChecked() ? 1 : 0;
|
||||
|
||||
// parameters are ok: close the dialog first
|
||||
close();
|
||||
|
@ -1174,6 +1195,14 @@ void ConvertPopup::onFormatChanged(const QString &ext) {
|
|||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
void ConvertPopup::onPalettePathChanged() {
|
||||
m_removeUnusedStyles->setEnabled(
|
||||
m_tlvMode->currentText() == TlvMode_PaintedFromNonAA &&
|
||||
m_palettePath->getPath() != CreateNewPalette);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
bool ConvertPopup::isSaveTlvBackupToNopaintActive() {
|
||||
return m_fileFormat->currentText() ==
|
||||
TlvExtension /*-- tlvが選択されている --*/
|
||||
|
|
|
@ -87,6 +87,7 @@ public slots:
|
|||
void onLevelConverted(const TFilePath &fullPath);
|
||||
|
||||
void onFormatChanged(const QString &);
|
||||
void onPalettePathChanged();
|
||||
|
||||
protected:
|
||||
Convert2Tlv *makeTlvConverter(const TFilePath &sourceFilePath);
|
||||
|
@ -104,7 +105,7 @@ private:
|
|||
DVGui::ColorField *m_bgColorField;
|
||||
QFrame *m_tlvFrame;
|
||||
QCheckBox *m_applyAutoclose, *m_removeDotBeforeFrameNumber,
|
||||
*m_saveBackupToNopaint, *m_appendDefaultPalette;
|
||||
*m_saveBackupToNopaint, *m_appendDefaultPalette, *m_removeUnusedStyles;
|
||||
DVGui::CheckBox *m_skip;
|
||||
QComboBox *m_antialias, *m_tlvMode, *m_fileFormat;
|
||||
QLabel *m_bgColorLabel, *m_suffixLabel, *m_unpaintedFolderLabel,
|
||||
|
|
|
@ -485,17 +485,15 @@ bool LoadScenePopup::execute() {
|
|||
void LoadScenePopup::initFolder() { setInitialFolderByCurrentRoom(); }
|
||||
|
||||
void LoadScenePopup::setInitialFolderByCurrentRoom() {
|
||||
QString roomName = TApp::instance()->getCurrentRoomName();
|
||||
QString roomName = TApp::instance()->getCurrentRoomName();
|
||||
TProjectP project = TProjectManager::instance()->getCurrentProject();
|
||||
TFilePath scenePath;
|
||||
if (roomName == "Cleanup" || roomName == "InknPaint")
|
||||
scenePath = TProjectManager::instance()->getCurrentProject()->getFolder(
|
||||
TProject::Drawings);
|
||||
scenePath = project->getFolder(TProject::Drawings, true);
|
||||
else if (roomName == "PltEdit")
|
||||
scenePath = TProjectManager::instance()->getCurrentProject()->getFolder(
|
||||
TProject::Palettes);
|
||||
scenePath = project->getFolder(TProject::Palettes, true);
|
||||
else
|
||||
scenePath = TProjectManager::instance()->getCurrentProject()->getFolder(
|
||||
TProject::Scenes);
|
||||
scenePath = project->getFolder(TProject::Scenes, true);
|
||||
setFolder(scenePath);
|
||||
}
|
||||
|
||||
|
|
|
@ -322,25 +322,49 @@ void SceneViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
|
||||
TPanelTitleBarButtonSet *viewModeButtonSet;
|
||||
m_referenceModeBs = viewModeButtonSet = new TPanelTitleBarButtonSet();
|
||||
int x = -188;
|
||||
int x = -232;
|
||||
int iconWidth = 17;
|
||||
TPanelTitleBarButton *button;
|
||||
button = new TPanelTitleBarButton(titleBar, ":Resources/freeze.png",
|
||||
":Resources/freeze_over.png",
|
||||
":Resources/freeze_on.png");
|
||||
button->setToolTip(tr("Freeze"));
|
||||
titleBar->add(QPoint(x, 2), button);
|
||||
ret = ret && connect(button, SIGNAL(toggled(bool)), m_sceneViewer,
|
||||
SLOT(freeze(bool)));
|
||||
ret = ret && connect(m_sceneViewer, SIGNAL(freezeStateChanged(bool)), button,
|
||||
SLOT(setPressed(bool)));
|
||||
|
||||
// buttons for show / hide toggle for the field guide and the safe area
|
||||
TPanelTitleBarButtonForSafeArea *safeAreaButton =
|
||||
new TPanelTitleBarButtonForSafeArea(titleBar, ":Resources/safearea.png",
|
||||
":Resources/safearea_over.png",
|
||||
":Resources/safearea_on.png");
|
||||
safeAreaButton->setToolTip(tr("Safe Area (Right Click to Select)"));
|
||||
titleBar->add(QPoint(x, 1), safeAreaButton);
|
||||
ret = ret && connect(safeAreaButton, SIGNAL(toggled(bool)),
|
||||
CommandManager::instance()->getAction(MI_SafeArea),
|
||||
SLOT(trigger()));
|
||||
ret = ret && connect(CommandManager::instance()->getAction(MI_SafeArea),
|
||||
SIGNAL(triggered(bool)), safeAreaButton,
|
||||
SLOT(setPressed(bool)));
|
||||
// initialize state
|
||||
safeAreaButton->setPressed(
|
||||
CommandManager::instance()->getAction(MI_SafeArea)->isChecked());
|
||||
|
||||
button = new TPanelTitleBarButton(titleBar, ":Resources/fieldguide.png",
|
||||
":Resources/fieldguide_over.png",
|
||||
":Resources/fieldguide_on.png");
|
||||
button->setToolTip(tr("Field Guide"));
|
||||
x += 5 + iconWidth;
|
||||
titleBar->add(QPoint(x, 1), button);
|
||||
ret = ret && connect(button, SIGNAL(toggled(bool)),
|
||||
CommandManager::instance()->getAction(MI_FieldGuide),
|
||||
SLOT(trigger()));
|
||||
ret = ret && connect(CommandManager::instance()->getAction(MI_FieldGuide),
|
||||
SIGNAL(triggered(bool)), button, SLOT(setPressed(bool)));
|
||||
// initialize state
|
||||
button->setPressed(
|
||||
CommandManager::instance()->getAction(MI_FieldGuide)->isChecked());
|
||||
|
||||
// view mode toggles
|
||||
button = new TPanelTitleBarButton(titleBar, ":Resources/standard.png",
|
||||
":Resources/standard_over.png",
|
||||
":Resources/standard_on.png");
|
||||
button->setToolTip(tr("Camera Stand View"));
|
||||
x += 18 + iconWidth;
|
||||
titleBar->add(QPoint(x, 2), button);
|
||||
x += 10 + iconWidth;
|
||||
titleBar->add(QPoint(x, 1), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::NORMAL_REFERENCE);
|
||||
button->setPressed(true);
|
||||
|
||||
|
@ -348,25 +372,37 @@ void SceneViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
":Resources/3D_over.png",
|
||||
":Resources/3D_on.png");
|
||||
button->setToolTip(tr("3D View"));
|
||||
x += 5 + iconWidth;
|
||||
titleBar->add(QPoint(x, 2), button);
|
||||
x += 19; // width of standard.png = 18pixels
|
||||
titleBar->add(QPoint(x, 1), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA3D_REFERENCE);
|
||||
|
||||
button = new TPanelTitleBarButton(titleBar, ":Resources/view_camera.png",
|
||||
":Resources/view_camera_over.png",
|
||||
":Resources/view_camera_on.png");
|
||||
button->setToolTip(tr("Camera View"));
|
||||
x += 5 + iconWidth;
|
||||
titleBar->add(QPoint(x, 2), button);
|
||||
x += 18; // width of 3D.png = 18pixels
|
||||
titleBar->add(QPoint(x, 1), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE);
|
||||
ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), m_sceneViewer,
|
||||
SLOT(setReferenceMode(int)));
|
||||
|
||||
// freeze button
|
||||
button = new TPanelTitleBarButton(titleBar, ":Resources/freeze.png",
|
||||
":Resources/freeze_over.png",
|
||||
":Resources/freeze_on.png");
|
||||
x += 10 + 19; // width of viewcamera.png = 18pixels
|
||||
|
||||
button->setToolTip(tr("Freeze")); // RC1
|
||||
titleBar->add(QPoint(x, 1), button);
|
||||
ret = ret && connect(button, SIGNAL(toggled(bool)), m_sceneViewer,
|
||||
SLOT(freeze(bool)));
|
||||
|
||||
// preview toggles
|
||||
m_previewButton = new TPanelTitleBarButton(
|
||||
titleBar, ":Resources/viewpreview.png", ":Resources/viewpreview_over.png",
|
||||
":Resources/viewpreview_on.png");
|
||||
x += 18 + iconWidth;
|
||||
titleBar->add(QPoint(x, 2), m_previewButton);
|
||||
x += 5 + iconWidth;
|
||||
titleBar->add(QPoint(x, 1), m_previewButton);
|
||||
m_previewButton->setToolTip(tr("Preview"));
|
||||
ret = ret && connect(m_previewButton, SIGNAL(toggled(bool)),
|
||||
SLOT(enableFullPreview(bool)));
|
||||
|
@ -375,8 +411,9 @@ void SceneViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
new TPanelTitleBarButton(titleBar, ":Resources/subcamera_preview.png",
|
||||
":Resources/subcamera_preview_over.png",
|
||||
":Resources/subcamera_preview_on.png");
|
||||
x += 5 + iconWidth;
|
||||
titleBar->add(QPoint(x, 2), m_subcameraPreviewButton);
|
||||
x += 28; // width of viewpreview.png =28pixels
|
||||
|
||||
titleBar->add(QPoint(x, 1), m_subcameraPreviewButton);
|
||||
m_subcameraPreviewButton->setToolTip(tr("Sub-camera Preview"));
|
||||
ret = ret && connect(m_subcameraPreviewButton, SIGNAL(toggled(bool)),
|
||||
SLOT(enableSubCameraPreview(bool)));
|
||||
|
|
|
@ -1005,7 +1005,8 @@ int Naa2TlvConverter::measureThickness(int x0, int y0) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TToonzImageP Naa2TlvConverter::makeTlv(bool transparentSyntheticInks) {
|
||||
TToonzImageP Naa2TlvConverter::makeTlv(bool transparentSyntheticInks,
|
||||
bool removeUnusedStyles) {
|
||||
if (!m_valid || m_colors.empty() || m_regions.empty() || !m_regionRas)
|
||||
return TToonzImageP();
|
||||
int lx = m_regionRas->getLx();
|
||||
|
@ -1025,8 +1026,9 @@ TToonzImageP Naa2TlvConverter::makeTlv(bool transparentSyntheticInks) {
|
|||
if (cs->getMainColor() != color) cs = 0;
|
||||
}
|
||||
if (cs == 0) {
|
||||
styleId = palette->getPage(0)->addStyle(color);
|
||||
cs = palette->getStyle(styleId);
|
||||
styleId = palette->addStyle(color);
|
||||
palette->getPage(0)->addStyle(styleId);
|
||||
cs = palette->getStyle(styleId);
|
||||
}
|
||||
styleIds.append(styleId);
|
||||
}
|
||||
|
@ -1035,6 +1037,21 @@ TToonzImageP Naa2TlvConverter::makeTlv(bool transparentSyntheticInks) {
|
|||
// int synteticInkStyleId = palette->getPage(0)->addStyle(TPixel32(0,0,0,0));
|
||||
// styleIds.append(synteticInkStyleId);
|
||||
|
||||
// Remove unused styles from input palette
|
||||
if (removeUnusedStyles) {
|
||||
for (int p = palette->getPageCount() - 1; p >= 0; p--) {
|
||||
TPalette::Page *page = palette->getPage(p);
|
||||
for (int s = page->getStyleCount() - 1; s >= 0; s--) {
|
||||
int styleId = page->getStyleId(s);
|
||||
if (styleId == -1) continue;
|
||||
// check if the style is used or not
|
||||
if (!styleIds.contains(styleId)) page->removeStyle(s);
|
||||
}
|
||||
// erase empty page
|
||||
if (page->getStyleCount() == 0) palette->erasePage(p);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < ly; y++) {
|
||||
unsigned short *workScanLine = m_regionRas->pixels(y);
|
||||
TPixelCM32 *outScanLine = ras->pixels(y);
|
||||
|
|
|
@ -209,7 +209,6 @@ void MovieRenderer::Imp::prepareForStart() {
|
|||
|
||||
if (TSystem::doesExistFileOrLevel(fp)) {
|
||||
bool remove = false;
|
||||
|
||||
// In case the raster specifics are different from those of a currently
|
||||
// existing movie, erase it
|
||||
try {
|
||||
|
@ -217,7 +216,8 @@ void MovieRenderer::Imp::prepareForStart() {
|
|||
lr->loadInfo();
|
||||
|
||||
const TImageInfo *info = lr->getImageInfo();
|
||||
if (!info || info->m_lx != imageSize.lx || info->m_ly != imageSize.ly)
|
||||
if (!info || info->m_lx != imageSize.lx ||
|
||||
info->m_ly != imageSize.ly || fp.isFfmpegType())
|
||||
TSystem::removeFileOrLevel(fp); // nothrow
|
||||
} catch (...) {
|
||||
// Same if the level could not be read/opened
|
||||
|
|
|
@ -97,7 +97,7 @@ TOutputProperties &TOutputProperties::operator=(const TOutputProperties &src) {
|
|||
|
||||
std::map<std::string, TPropertyGroup *>::const_iterator sft,
|
||||
sfEnd = src.m_formatProperties.end();
|
||||
for (sft = src.m_formatProperties.end(); sft != sfEnd; ++sft)
|
||||
for (sft = src.m_formatProperties.begin(); sft != sfEnd; ++sft)
|
||||
m_formatProperties[sft->first] = sft->second->clone();
|
||||
|
||||
return *this;
|
||||
|
|
|
@ -80,8 +80,6 @@ void TSceneProperties::assign(const TSceneProperties *sprop) {
|
|||
for (int i = 0; i < (int)m_cameras.size(); i++)
|
||||
m_cameras[i] = new TCamera(*m_cameras[i]);
|
||||
}
|
||||
*m_outputProp = *sprop->m_outputProp;
|
||||
*m_previewProp = *sprop->m_previewProp;
|
||||
m_bgColor = sprop->m_bgColor;
|
||||
m_markerDistance = sprop->m_markerDistance;
|
||||
m_markerOffset = sprop->m_markerOffset;
|
||||
|
|
|
@ -298,13 +298,15 @@ void TProject::setFolder(string name) { setFolder(name, TFilePath(name)); }
|
|||
//-------------------------------------------------------------------
|
||||
/*! Returns the path of the folder named with \b name.\n
|
||||
Returns TFilePath() if there isn't a folder named with \b name.
|
||||
\note The returned path could be a relative path.
|
||||
\note The returned path could be a relative path if \b absolute is
|
||||
false.
|
||||
*/
|
||||
TFilePath TProject::getFolder(string name) const {
|
||||
TFilePath TProject::getFolder(string name, bool absolute) const {
|
||||
std::map<std::string, TFilePath>::const_iterator it;
|
||||
it = m_folders.find(name);
|
||||
if (it != m_folders.end())
|
||||
return it->second;
|
||||
return (absolute) ? makeAbsolute(getProjectFolder(), it->second)
|
||||
: it->second;
|
||||
else
|
||||
return TFilePath();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ FileField::BrowserPopupController *FileField::m_browserPopupController = 0;
|
|||
// FileField
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FileField::FileField(QWidget *parent, QString path, bool readOnly)
|
||||
FileField::FileField(QWidget *parent, QString path, bool readOnly,
|
||||
bool doNotBrowseInitialPath)
|
||||
: QWidget(parent)
|
||||
, m_filters(QStringList())
|
||||
, m_fileMode(QFileDialog::DirectoryOnly)
|
||||
|
@ -33,6 +34,9 @@ FileField::FileField(QWidget *parent, QString path, bool readOnly)
|
|||
m_fileBrowseButton->setMinimumSize(20, WidgetHeight);
|
||||
m_fileBrowseButton->setObjectName("PushButton_NoPadding");
|
||||
|
||||
// if the initial text is not path, set the string here and prevent browsing
|
||||
if (doNotBrowseInitialPath) m_descriptionText = path;
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout();
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(1);
|
||||
|
@ -90,7 +94,7 @@ void FileField::browseDirectory() {
|
|||
if (!m_browserPopupController) return;
|
||||
m_browserPopupController->openPopup(
|
||||
m_filters, (m_fileMode == QFileDialog::DirectoryOnly),
|
||||
m_lastSelectedPath);
|
||||
(m_lastSelectedPath == m_descriptionText) ? "" : m_lastSelectedPath);
|
||||
if (m_browserPopupController->isExecute())
|
||||
directory = m_browserPopupController->getPath();
|
||||
|
||||
|
|
|
@ -1184,11 +1184,14 @@ void FunctionTreeModel::onChange(const TParamChange &tpc) {
|
|||
|
||||
struct Func final : public TFunctorInvoker::BaseFunctor {
|
||||
FunctionTreeModel *m_obj;
|
||||
const TParamChange *m_tpc;
|
||||
// Use a copy of 'TParamChange' since callers declare
|
||||
// and free this value on the stack,
|
||||
// so we can't ensure its valid later on when the notifier executes.
|
||||
const TParamChange m_tpc;
|
||||
|
||||
Func(FunctionTreeModel *obj, const TParamChange *tpc)
|
||||
: m_obj(obj), m_tpc(tpc) {}
|
||||
void operator()() override { m_obj->onParamChange(m_tpc->m_dragging); }
|
||||
: m_obj(obj), m_tpc(*tpc) {}
|
||||
void operator()() override { m_obj->onParamChange(m_tpc.m_dragging); }
|
||||
};
|
||||
|
||||
QMetaObject::invokeMethod(TFunctorInvoker::instance(), "invoke",
|
||||
|
|
|
@ -632,7 +632,8 @@ void convert(const TFilePath &source, const TFilePath &dest,
|
|||
|
||||
void convertNaa2Tlv(const TFilePath &source, const TFilePath &dest,
|
||||
const TFrameId &from, const TFrameId &to,
|
||||
FrameTaskNotifier *frameNotifier, TPalette *palette) {
|
||||
FrameTaskNotifier *frameNotifier, TPalette *palette,
|
||||
bool removeUnusedStyles) {
|
||||
std::string dstExt = dest.getType(), srcExt = source.getType();
|
||||
|
||||
// Load source level structure
|
||||
|
@ -671,8 +672,8 @@ void convertNaa2Tlv(const TFilePath &source, const TFilePath &dest,
|
|||
|
||||
converter.process(raster);
|
||||
|
||||
if (TToonzImageP dstImg =
|
||||
converter.makeTlv(false)) // Opaque synthetic inks
|
||||
if (TToonzImageP dstImg = converter.makeTlv(
|
||||
false, removeUnusedStyles)) // Opaque synthetic inks
|
||||
{
|
||||
if (converter.getPalette() == 0)
|
||||
converter.setPalette(dstImg->getPalette());
|
||||
|
|
|
@ -1050,6 +1050,8 @@ void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) {
|
|||
|
||||
resetDropItem();
|
||||
|
||||
if (newPath.isEmpty()) return;
|
||||
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
const PaletteData *paletteData = dynamic_cast<const PaletteData *>(mimeData);
|
||||
if (paletteData) {
|
||||
|
|
Loading…
Reference in a new issue