Merge pull request #1099 from manongjohn/ot_patches_20221202

OpenToonz Fix Patches thru 12/2/2022
This commit is contained in:
manongjohn 2022-12-08 06:23:49 -05:00 committed by GitHub
commit e90463919f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1533 additions and 64 deletions

View file

@ -1,7 +1,7 @@
#ifdef _WIN32 #ifdef _WIN32
//#define UNICODE // per le funzioni di conversione da/a UNC // #define UNICODE // per le funzioni di conversione da/a UNC
#include <windows.h> #include <windows.h>
#include <lm.h> #include <lm.h>
@ -279,8 +279,7 @@ void TFilePath::setPath(std::wstring path) {
} }
} else if (isSlash(path[pos])) { } else if (isSlash(path[pos])) {
int firstSlashPos = pos; int firstSlashPos = pos;
do do pos++;
pos++;
while (pos < length && isSlash(path[pos])); while (pos < length && isSlash(path[pos]));
if (firstSlashPos == 0 && pos == 4) // Caso "\\\\MachineName" if (firstSlashPos == 0 && pos == 4) // Caso "\\\\MachineName"
m_path.append(2, wslash); m_path.append(2, wslash);
@ -1113,8 +1112,9 @@ TFilePath::TFilePathInfo TFilePath::analyzePath() const {
// hogehoge.0001a.jpg // hogehoge.0001a.jpg
// empty frame case : hogehoge..jpg // empty frame case : hogehoge..jpg
QRegExp rx("^" + levelNameRegExp + sepCharRegExp + "(?:" + fIdRegExp + ")?" + // empty level name case : ..jpg .0001a.jpg
"\\." + extensionRegExp + "$"); QRegExp rx("^(?:" + levelNameRegExp + ")?" + sepCharRegExp +
"(?:" + fIdRegExp + ")?" + "\\." + extensionRegExp + "$");
if (rx.indexIn(fileName) != -1) { if (rx.indexIn(fileName) != -1) {
assert(rx.captureCount() == 5); assert(rx.captureCount() == 5);
info.levelName = rx.cap(1); info.levelName = rx.cap(1);

View file

@ -63,6 +63,7 @@ if(NOT BUILD_TARGET_BSD)
tif/tiio_tif.cpp tif/tiio_tif.cpp
tzp/tiio_plt.cpp tzp/tiio_plt.cpp
tzp/tiio_tzp.cpp tzp/tiio_tzp.cpp
tzp/toonzrle.cpp
tzp/avl.c tzp/avl.c
) )
endif() endif()

File diff suppressed because it is too large Load diff

View file

@ -65,7 +65,7 @@ class TParamVarT final : public TParamVar {
public: public:
TParamVarT(std::string name, T *var = nullptr, TParamP pluginVar = 0, TParamVarT(std::string name, T *var = nullptr, TParamP pluginVar = 0,
bool hidden = false, bool obsolete = false) bool hidden = false, bool obsolete = false)
: TParamVar(name, hidden), m_var(var), m_pluginVar(pluginVar) {} : TParamVar(name, hidden, obsolete), m_var(var), m_pluginVar(pluginVar) {}
TParamVarT() = delete; TParamVarT() = delete;
void setParam(TParam *param) { void setParam(TParam *param) {
if (m_var) if (m_var)
@ -80,7 +80,8 @@ public:
return m_pluginVar.getPointer(); return m_pluginVar.getPointer();
} }
TParamVar *clone() const { TParamVar *clone() const {
return new TParamVarT<T>(getName(), m_var, m_pluginVar, isHidden()); return new TParamVarT<T>(getName(), m_var, m_pluginVar, isHidden(),
isObsolete());
} }
}; };

View file

@ -362,8 +362,8 @@ int igs::rotate_blur::reference_margin(
const double blur_radius, /* ぼかしの始まる半径 */ const double blur_radius, /* ぼかしの始まる半径 */
const double spin_radius, /* ゼロ以上でspin指定となり、 const double spin_radius, /* ゼロ以上でspin指定となり、
*/ */
const int type // 0: Accelerator, 1: Uniform Angle, 2: Uniform Length const int type, // 0: Accelerator, 1: Uniform Angle, 2: Uniform Length
) { const double ellipse_aspect_ratio) {
/* 強度のないとき、なにもしない */ /* 強度のないとき、なにもしない */
if (degree <= 0.0) { if (degree <= 0.0) {
return 0; return 0;
@ -402,5 +402,13 @@ int igs::rotate_blur::reference_margin(
margin1 = margin2; margin1 = margin2;
} }
// Consider ellipse deformation.
// Instead of precise computing, return the maximum possible value.
if (ellipse_aspect_ratio != 1.0) {
double axis_x = 2.0 * ellipse_aspect_ratio / (ellipse_aspect_ratio + 1.0);
double axis_y = axis_x / ellipse_aspect_ratio;
margin1 *= std::max(axis_x, axis_y);
}
return static_cast<int>(ceil(margin1)); return static_cast<int>(ceil(margin1));
} }

View file

@ -44,8 +44,8 @@ IGS_ROTATE_BLUR_EXPORT int reference_margin(
const double blur_radius, /* ぼかしの始まる半径 */ const double blur_radius, /* ぼかしの始まる半径 */
const double spin_radius, /* ゼロ以上でspin指定となり、 const double spin_radius, /* ゼロ以上でspin指定となり、
*/ */
const int type // 0: Accelerator, 1: Uniform Angle, 2: Uniform Length const int type, // 0: Accelerator, 1: Uniform Angle, 2: Uniform Length
); const double ellipse_aspect_ratio = 1.0);
} // namespace rotate_blur } // namespace rotate_blur
} // namespace igs } // namespace igs

View file

@ -86,8 +86,8 @@ public:
static_cast<int>(ceil(bBox.getLy())), static_cast<int>(ceil(bBox.getLy())),
static_cast<int>(ceil(bBox.getLx())), center, static_cast<int>(ceil(bBox.getLx())), center,
this->m_blur->getValue(frame), this->m_radius->getValue(frame) * scale, this->m_blur->getValue(frame), this->m_radius->getValue(frame) * scale,
((0 < this->m_type->getValue()) ? 0.0 : (bBox.getLy() / 2.0)), bBox.getLy() / 2.0, this->m_type->getValue(),
this->m_type->getValue()); this->m_ellipse_aspect_ratio->getValue(frame));
} }
void get_render_enlarge(const double frame, const TAffine affine, void get_render_enlarge(const double frame, const TAffine affine,
TRectD &bBox) { TRectD &bBox) {

View file

@ -1280,21 +1280,25 @@ void BokehUtils::setOutputRaster(double4* src, const RASTER dstRas,
outPix->r = outPix->r =
(typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue) (typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue)
? (double)PIXEL::maxChannelValue ? (double)PIXEL::maxChannelValue
: (val < 0.) ? 0.
: val); : val);
val = (*src_p).y * (double)PIXEL::maxChannelValue + 0.5; val = (*src_p).y * (double)PIXEL::maxChannelValue + 0.5;
outPix->g = outPix->g =
(typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue) (typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue)
? (double)PIXEL::maxChannelValue ? (double)PIXEL::maxChannelValue
: (val < 0.) ? 0.
: val); : val);
val = (*src_p).z * (double)PIXEL::maxChannelValue + 0.5; val = (*src_p).z * (double)PIXEL::maxChannelValue + 0.5;
outPix->b = outPix->b =
(typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue) (typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue)
? (double)PIXEL::maxChannelValue ? (double)PIXEL::maxChannelValue
: (val < 0.) ? 0.
: val); : val);
val = (*src_p).w * (double)PIXEL::maxChannelValue + 0.5; val = (*src_p).w * (double)PIXEL::maxChannelValue + 0.5;
outPix->m = outPix->m =
(typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue) (typename PIXEL::Channel)((val > (double)PIXEL::maxChannelValue)
? (double)PIXEL::maxChannelValue ? (double)PIXEL::maxChannelValue
: (val < 0.) ? 0.
: val); : val);
} }
src_p += margin.x; src_p += margin.x;

View file

@ -164,8 +164,7 @@ void Iwa_BokehFx::doCompute(TTile& tile, double frame,
for (auto index : sourceIndices) { for (auto index : sourceIndices) {
LayerValue layerValue; LayerValue layerValue;
layerValue.sourceTile = sourceTiles[index]; layerValue.sourceTile = sourceTiles[index];
layerValue.premultiply = layerValue.premultiply = m_layerParams[index].m_premultiply->getValue();
m_layerParams[index].m_premultiply->getValue() ? 1 : 0;
layerValue.layerHardness = masterHardness; layerValue.layerHardness = masterHardness;
layerValue.depth_ref = 0; layerValue.depth_ref = 0;
layerValue.irisSize = irisSizes.value(index); layerValue.irisSize = irisSizes.value(index);

View file

@ -212,7 +212,7 @@ void Iwa_BokehRefFx::doCompute(TTile& tile, double frame,
} }
ctrls[1] = depth_buff; ctrls[1] = depth_buff;
layerValue.premultiply = 2; // auto layerValue.premultiply = false;
layerValue.layerHardness = m_hardness->getValue(frame); layerValue.layerHardness = m_hardness->getValue(frame);
layerValue.depth_ref = 1; layerValue.depth_ref = 1;
layerValue.distance = 0.5; layerValue.distance = 0.5;

View file

@ -60,7 +60,7 @@ static float* dt(float* f, int n, float a = 1.0f) {
delete[] z; delete[] z;
return d; return d;
} }
} } // namespace
//------------------------------------ //------------------------------------
@ -204,9 +204,10 @@ void Iwa_SoapBubbleFx::doCompute(TTile& tile, double frame,
/* obtain shape image */ /* obtain shape image */
TTile shape_tile; TTile shape_tile;
{ {
TRaster32P tmp(1, 1); TRenderSettings settings_aux(settings);
m_shape->allocateAndCompute(shape_tile, bBox.getP00(), dim, tmp, frame, settings_aux.m_bpp = 32;
settings); m_shape->allocateAndCompute(shape_tile, bBox.getP00(), dim, nullptr,
frame, settings_aux);
} }
if (checkCancelAndReleaseRaster(allocatedRasList, tile, settings)) return; if (checkCancelAndReleaseRaster(allocatedRasList, tile, settings)) return;

View file

@ -22,6 +22,7 @@
#include "toonz/txshcolumn.h" #include "toonz/txshcolumn.h"
#include "toonz/tlog.h" #include "toonz/tlog.h"
#include "toonz/imagestyles.h" #include "toonz/imagestyles.h"
#include "toonz/filepathproperties.h"
// TnzBase includes // TnzBase includes
#include "tcli.h" #include "tcli.h"
@ -596,6 +597,12 @@ int main(int argc, char *argv[]) {
cout << "project:" << project->getName() << endl; cout << "project:" << project->getName() << endl;
// update TFilePath condition on loading the current project
FilePathProperties *fpProp = project->getFilePathProperties();
TFilePath::setFilePathProperties(fpProp->useStandard(),
fpProp->acceptNonAlphabetSuffix(),
fpProp->letterCountForSuffix());
TFilePath fp = srcName; TFilePath fp = srcName;
/*- CLNファイルを直接指定した場合 -*/ /*- CLNファイルを直接指定した場合 -*/

View file

@ -33,6 +33,7 @@
#include "toonz/levelset.h" #include "toonz/levelset.h"
#include "toonz/txshsimplelevel.h" #include "toonz/txshsimplelevel.h"
#include "toonz/levelproperties.h" #include "toonz/levelproperties.h"
#include "toonz/filepathproperties.h"
// TnzSound includes // TnzSound includes
#include "tnzsound.h" #include "tnzsound.h"
@ -50,7 +51,7 @@
#include "tunit.h" #include "tunit.h"
#include "tenv.h" #include "tenv.h"
#include "tpassivecachemanager.h" #include "tpassivecachemanager.h"
//#include "tcacheresourcepool.h" // #include "tcacheresourcepool.h"
// TnzCore includes // TnzCore includes
#include "tsystem.h" #include "tsystem.h"
@ -798,7 +799,7 @@ int main(int argc, char *argv[]) {
loadShaderInterfaces(ToonzFolder::getLibraryFolder() + loadShaderInterfaces(ToonzFolder::getLibraryFolder() +
TFilePath("shaders")); TFilePath("shaders"));
//#endif // #endif
//--------------------------------------------------------- //---------------------------------------------------------
@ -828,6 +829,12 @@ int main(int argc, char *argv[]) {
m_userLog->info(msg); m_userLog->info(msg);
// pm->setCurrentProject(project, false); // false => temporaneamente // pm->setCurrentProject(project, false); // false => temporaneamente
// update TFilePath condition on loading the current project
FilePathProperties *fpProp = project->getFilePathProperties();
TFilePath::setFilePathProperties(fpProp->useStandard(),
fpProp->acceptNonAlphabetSuffix(),
fpProp->letterCountForSuffix());
Sw1.start(); Sw1.start();
if (!TSystem::doesExistFileOrLevel(srcFilePath)) return -2; if (!TSystem::doesExistFileOrLevel(srcFilePath)) return -2;
@ -927,12 +934,9 @@ int main(int argc, char *argv[]) {
const int threadCounts[3] = {1, procCount / 2, procCount}; const int threadCounts[3] = {1, procCount / 2, procCount};
if (nthreads.isSelected()) { if (nthreads.isSelected()) {
QString threadCountStr = QString::fromStdString(nthreads.getValue()); QString threadCountStr = QString::fromStdString(nthreads.getValue());
threadCount = (threadCountStr == "single") threadCount = (threadCountStr == "single") ? threadCounts[0]
? threadCounts[0] : (threadCountStr == "half") ? threadCounts[1]
: (threadCountStr == "half") : (threadCountStr == "all") ? threadCounts[2]
? threadCounts[1]
: (threadCountStr == "all")
? threadCounts[2]
: threadCountStr.toInt(); : threadCountStr.toInt();
if (threadCount <= 0) { if (threadCount <= 0) {
@ -953,14 +957,10 @@ int main(int argc, char *argv[]) {
TOutputProperties::MediumVal, TOutputProperties::SmallVal}; TOutputProperties::MediumVal, TOutputProperties::SmallVal};
if (tileSize.isSelected()) { if (tileSize.isSelected()) {
QString tileSizeStr = QString::fromStdString(tileSize.getValue()); QString tileSizeStr = QString::fromStdString(tileSize.getValue());
maxTileSize = (tileSizeStr == "none") maxTileSize = (tileSizeStr == "none") ? maxTileSizes[0]
? maxTileSizes[0] : (tileSizeStr == "large") ? maxTileSizes[1]
: (tileSizeStr == "large") : (tileSizeStr == "medium") ? maxTileSizes[2]
? maxTileSizes[1] : (tileSizeStr == "small") ? maxTileSizes[3]
: (tileSizeStr == "medium")
? maxTileSizes[2]
: (tileSizeStr == "small")
? maxTileSizes[3]
: tileSizeStr.toInt(); : tileSizeStr.toInt();
if (maxTileSize <= 0) { if (maxTileSize <= 0) {

View file

@ -1475,6 +1475,7 @@ void LevelSettingsPopup::onSubsamplingChanged() {
return; return;
} }
bool somethingChanged = false;
TUndoManager::manager()->beginBlock(); TUndoManager::manager()->beginBlock();
QSetIterator<TXshLevelP> levelItr(m_selectedLevels); QSetIterator<TXshLevelP> levelItr(m_selectedLevels);
while (levelItr.hasNext()) { while (levelItr.hasNext()) {
@ -1491,8 +1492,10 @@ void LevelSettingsPopup::onSubsamplingChanged() {
TUndoManager::manager()->add(new LevelSettingsUndo( TUndoManager::manager()->add(new LevelSettingsUndo(
levelP.getPointer(), LevelSettingsUndo::Subsampling, oldSubsampling, levelP.getPointer(), LevelSettingsUndo::Subsampling, oldSubsampling,
subsampling)); subsampling));
somethingChanged = true;
} }
TUndoManager::manager()->endBlock(); TUndoManager::manager()->endBlock();
if (!somethingChanged) return;
TApp::instance()->getCurrentScene()->setDirtyFlag(true); TApp::instance()->getCurrentScene()->setDirtyFlag(true);
TApp::instance() TApp::instance()

View file

@ -1456,6 +1456,7 @@ void PreviewFxManager::onLevelChanged() {
// Build the level name as an alias keyword. All cache images associated // Build the level name as an alias keyword. All cache images associated
// with an alias containing the level name will be updated. // with an alias containing the level name will be updated.
TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel(); TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel();
if (!xl) return;
std::string aliasKeyword; std::string aliasKeyword;
TFilePath fp = xl->getPath(); TFilePath fp = xl->getPath();
aliasKeyword = ::to_string(fp.withType("")); aliasKeyword = ::to_string(fp.withType(""));

View file

@ -1113,7 +1113,8 @@ void RowArea::mouseMoveEvent(QMouseEvent *event) {
return; return;
} }
m_row = m_viewer->xyToPosition(pos).frame(); m_row = std::max(0, m_viewer->xyToPosition(pos).frame());
int x = pos.x(); int x = pos.x();
if ((event->buttons() & Qt::LeftButton) != 0 && if ((event->buttons() & Qt::LeftButton) != 0 &&

View file

@ -164,6 +164,8 @@ TPropertyGroup *TOutputProperties::getFileFormatProperties(std::string ext) {
TPropertyGroup *ret = Tiio::makeWriterProperties(ext); TPropertyGroup *ret = Tiio::makeWriterProperties(ext);
m_formatProperties[ext] = ret; m_formatProperties[ext] = ret;
return ret; return ret;
} else if (ext == "mov" || ext == "3gp") {
return it->second;
} else { } else {
// Try to merge settings instead of overriding them // Try to merge settings instead of overriding them
TPropertyGroup *ret = Tiio::makeWriterProperties(ext); TPropertyGroup *ret = Tiio::makeWriterProperties(ext);

View file

@ -1,4 +1,4 @@
#include <QTimer>
#include "toonz/tscenehandle.h" #include "toonz/tscenehandle.h"
@ -24,7 +24,22 @@ ToonzScene *TSceneHandle::getScene() const { return m_scene; }
void TSceneHandle::setScene(ToonzScene *scene) { void TSceneHandle::setScene(ToonzScene *scene) {
if (m_scene == scene) return; if (m_scene == scene) return;
emit sceneSwitching(); emit sceneSwitching();
delete m_scene; ToonzScene *oldscene = m_scene;
m_scene = scene; m_scene = scene;
if (m_scene) emit sceneSwitched(); if (m_scene) emit sceneSwitched();
// Prevent memory corruption caused by delayed signals writing into the
// discarded old scene while that memory was freed.
// That made OT had a chance of crashing when project or scene changed rapidly.
// Note: This is not the best solution but "it just works"
if (oldscene) {
QTimer *delayedTimer = new QTimer(this);
delayedTimer->setSingleShot(true);
connect(delayedTimer, &QTimer::timeout, [=]() {
delete oldscene;
delayedTimer->deleteLater();
});
delayedTimer->start(3000); // 1 sec was enough, but... dunno about toasters
}
} }

View file

@ -570,7 +570,7 @@ void TStyleSelection::selectNone() {
//------------------------------------------------------------------- //-------------------------------------------------------------------
bool TStyleSelection::isEmpty() const { bool TStyleSelection::isEmpty() const {
return m_pageIndex < 0 && m_styleIndicesInPage.empty(); return m_pageIndex < 0 || m_styleIndicesInPage.empty();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------