diff --git a/toonz/sources/include/trasterfx.h b/toonz/sources/include/trasterfx.h index 45795c8..8542bb0 100644 --- a/toonz/sources/include/trasterfx.h +++ b/toonz/sources/include/trasterfx.h @@ -146,6 +146,11 @@ public: bool m_applyShrinkToViewer; //!< Whether shrink must be considered. \note //! Should be moved to TOutputProperties. + // when this flag is true, TLevelColumnFx::doGetBBox returns full image sized + // box instead of the bounding box. It takes effect only for Toonz Raster / + // Raster levels. Currently used only in Tile Fx Iwa. (see iwa_tilefx.cpp) + bool m_getFullSizeBBox; + /*-- カメラサイズ --*/ TRectD m_cameraBox; /*-- 途中でPreview計算がキャンセルされたときのフラグ --*/ diff --git a/toonz/sources/stdfx/iwa_tilefx.cpp b/toonz/sources/stdfx/iwa_tilefx.cpp index 0ecd646..0fcdfb9 100644 --- a/toonz/sources/stdfx/iwa_tilefx.cpp +++ b/toonz/sources/stdfx/iwa_tilefx.cpp @@ -16,7 +16,7 @@ class Iwa_TileFx final : public TStandardRasterFx { enum tileQuantity { eNoTile = 1, eOneTile = 2, eMultipleTiles = 3 }; - enum inputSize { eBoundingBox = 1, eCameraBox = 2 }; + enum inputSize { eBoundingBox = 1, eCameraBox = 2, eImageSize = 3 }; TIntEnumParamP m_inputSizeMode; TRasterFxPort m_input; @@ -70,6 +70,7 @@ Iwa_TileFx::Iwa_TileFx() bindParam(this, "inputSize", m_inputSizeMode); m_inputSizeMode->addItem(eCameraBox, "Camera Box"); + m_inputSizeMode->addItem(eImageSize, "Image Size"); bindParam(this, "leftQuantity", m_leftQuantity); m_leftQuantity->addItem(eOneTile, "1 Tile"); @@ -182,7 +183,8 @@ void Iwa_TileFx::doCompute(TTile &tile, double frame, TRectD inputBox; int inputSizeMode = - m_inputSizeMode->getValue(); // eBoundingBox = 1, eCameraBox = 2 + m_inputSizeMode + ->getValue(); // eBoundingBox = 1, eCameraBox = 2, eImageSize = 3 if (inputSizeMode == eBoundingBox) m_input->getBBox(frame, inputBox, ri); else if (inputSizeMode == eCameraBox) { @@ -191,6 +193,12 @@ void Iwa_TileFx::doCompute(TTile &tile, double frame, inputBox = TRectD( TPointD(ri.m_cameraBox.x0 + offset.x, ri.m_cameraBox.y0 + offset.y), TDimensionD(ri.m_cameraBox.getLx(), ri.m_cameraBox.getLy())); + } else if (inputSizeMode == eImageSize) { + TRenderSettings riAux(ri); + // set a tentative flag to obtain full image size. (see + // TLevelColumnFx::doGetBBox) + riAux.m_getFullSizeBBox = true; + m_input->getBBox(frame, inputBox, riAux); } double scale = sqrt(fabs(ri.m_affine.det())); @@ -266,7 +274,7 @@ bool Iwa_TileFx::checkIfThisTileShouldBeComptedOrNot(int horizIndex, //------------------------------------------------------------------------------ //! Make the tile of the image contained in \b inputTile in \b tile /* -*/ + */ void Iwa_TileFx::makeTile(const TTile &inputTile, const TTile &tile) { tile.getRaster()->clear(); diff --git a/toonz/sources/tnzbase/trasterfx.cpp b/toonz/sources/tnzbase/trasterfx.cpp index 12bd377..29f7ee5 100644 --- a/toonz/sources/tnzbase/trasterfx.cpp +++ b/toonz/sources/tnzbase/trasterfx.cpp @@ -183,7 +183,7 @@ inline std::string traduce(const TAffine &aff) { (areAlmostEqual(aff.a23, 0.0) ? "0" : ::to_string(aff.a23, 5)); } -} // Local namespace +} // namespace //------------------------------------------------------------------------------ @@ -1073,7 +1073,8 @@ TRenderSettings::TRenderSettings() , m_isSwatch(false) , m_applyShrinkToViewer(false) , m_userCachable(true) - , m_isCanceled(NULL) {} + , m_isCanceled(NULL) + , m_getFullSizeBBox(false) {} //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp index 800281b..8d58dad 100644 --- a/toonz/sources/toonzlib/tcolumnfx.cpp +++ b/toonz/sources/toonzlib/tcolumnfx.cpp @@ -1408,16 +1408,19 @@ bool TLevelColumnFx::doGetBBox(double frame, TRectD &bBox, TImageInfo imageInfo; getImageInfo(imageInfo, sl, cell.m_frameId); - TRect imageSavebox(imageInfo.m_x0, imageInfo.m_y0, imageInfo.m_x1, - imageInfo.m_y1); double cx = 0.5 * imageInfo.m_lx; double cy = 0.5 * imageInfo.m_ly; - double x0 = (imageSavebox.x0 - cx); - double y0 = (imageSavebox.y0 - cy); - double x1 = x0 + imageSavebox.getLx(); - double y1 = y0 + imageSavebox.getLy(); - bBox = TRectD(x0, y0, x1, y1); - + if (info.m_getFullSizeBBox) { + bBox = TRectD(-cx, -cy, cx, cy); + } else { + TRect imageSavebox(imageInfo.m_x0, imageInfo.m_y0, imageInfo.m_x1, + imageInfo.m_y1); + double x0 = (imageSavebox.x0 - cx); + double y0 = (imageSavebox.y0 - cy); + double x1 = x0 + imageSavebox.getLx(); + double y1 = y0 + imageSavebox.getLy(); + bBox = TRectD(x0, y0, x1, y1); + } dpi = imageInfo.m_dpix / Stage::inch; } else { TImageP img = m_levelColumn->getCell(row).getImage(false);