diff --git a/toonz/sources/include/toonz/imagepainter.h b/toonz/sources/include/toonz/imagepainter.h index cc864a0a..61379d47 100644 --- a/toonz/sources/include/toonz/imagepainter.h +++ b/toonz/sources/include/toonz/imagepainter.h @@ -67,6 +67,8 @@ public: bool m_drawBlankFrame; bool m_useChecks; //!< whether to consider paint check and ink check bool m_forSceneIcon = false; // whether it is redered for the scene icons + bool m_forReference = + false; // whether it is rendered for reference operations public: VisualSettings(); diff --git a/toonz/sources/include/toonz/toonzscene.h b/toonz/sources/include/toonz/toonzscene.h index 10c3897a..5a5b6abe 100644 --- a/toonz/sources/include/toonz/toonzscene.h +++ b/toonz/sources/include/toonz/toonzscene.h @@ -150,7 +150,8 @@ the specified 32-bit raster. */ void renderFrame(const TRaster32P &ras, int row, const TXsheet *xsh = 0, - bool checkFlags = true) const; + bool checkFlags = true, bool forSceneIcon = true, + bool forReference = false) const; /*! Performs a camera-stand render of the specified xsheet in the specified diff --git a/toonz/sources/tnzext/ttexturesstorage.cpp b/toonz/sources/tnzext/ttexturesstorage.cpp index b436bce4..8f7632c8 100644 --- a/toonz/sources/tnzext/ttexturesstorage.cpp +++ b/toonz/sources/tnzext/ttexturesstorage.cpp @@ -222,7 +222,10 @@ DrawableTextureDataP TTexturesStorage::getTextureData( // If there is no known associated display lists space, the texture cannot be // stored. - if (dlSpaceId < 0) return DrawableTextureDataP(); + // if (dlSpaceId < 0) return DrawableTextureDataP(); + + // If from an offline display, let's see if found under display 0 + if (dlSpaceId < 0) dlSpaceId = 0; QMutexLocker locker(&l_mutex); diff --git a/toonz/sources/toonzlib/fill.cpp b/toonz/sources/toonzlib/fill.cpp index 0ce884e9..aeb26da3 100644 --- a/toonz/sources/toonzlib/fill.cpp +++ b/toonz/sources/toonzlib/fill.cpp @@ -457,13 +457,18 @@ bool fill(const TRasterCM32P &r, const FillParameters ¶ms, ToonzScene *scene = xsheet->getScene(); TCamera *camera = scene->getCurrentCamera(); TRaster32P tmpRaster(camera->getRes()); - scene->renderFrame(tmpRaster, frameIndex); + + // Render for reference + scene->renderFrame(tmpRaster, frameIndex, xsheet, false, false, true); + + refRaster->lock(); + TPoint offset((params.m_imageSize.lx - tmpRaster->getLx()) / 2, (params.m_imageSize.ly - tmpRaster->getLy()) / 2); offset -= params.m_imageOffset; + refRaster->fill(color); refRaster->copy(tmpRaster, offset); - refRaster->lock(); refpix = refRaster->pixels(p.y) + p.x; clickedPosColor = *refpix; @@ -881,13 +886,15 @@ void fullColorFill(const TRaster32P &ras, const FillParameters ¶ms, ToonzScene *scene = xsheet->getScene(); TCamera *camera = scene->getCurrentCamera(); TRaster32P tmpRaster(camera->getRes()); - scene->renderFrame(tmpRaster, frameIndex); + scene->renderFrame(tmpRaster, frameIndex, xsheet, false, false, true); + + refRas->lock(); + TPoint offset((refRas->getLx() - tmpRaster->getLx()) / 2, (refRas->getLy() - tmpRaster->getLy()) / 2); refRas->fill(color); refRas->copy(tmpRaster, offset); - refRas->lock(); clickedPosColor = *(refRas->pixels(y) + x); } diff --git a/toonz/sources/toonzlib/stagevisitor.cpp b/toonz/sources/toonzlib/stagevisitor.cpp index 60ab51a5..db120ed1 100644 --- a/toonz/sources/toonzlib/stagevisitor.cpp +++ b/toonz/sources/toonzlib/stagevisitor.cpp @@ -795,7 +795,7 @@ void RasterPainter::onImage(const Stage::Player &player) { TStageObject *obj = ::plasticDeformedObj(player, m_vs.m_plasticVisualSettings); if (obj && QThread::currentThread() == qGuiApp->thread() && - !m_vs.m_forSceneIcon) { + (!m_vs.m_forSceneIcon || m_vs.m_forReference)) { flushRasterImages(); ::onPlasticDeformedImage(obj, player, m_vs, m_viewAff); } else { @@ -809,6 +809,8 @@ void RasterPainter::onImage(const Stage::Player &player) { else if (TToonzImageP ti = img) onToonzImage(ti.getPointer(), player); else if (TMeshImageP mi = img) { + // Never draw mesh when building reference image + if (m_vs.m_forReference) return; flushRasterImages(); ::onMeshImage(mi.getPointer(), player, m_vs, m_viewAff); } diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp index 6de09827..880e4125 100644 --- a/toonz/sources/toonzlib/toonzscene.cpp +++ b/toonz/sources/toonzlib/toonzscene.cpp @@ -709,7 +709,8 @@ int ToonzScene::getFrameCount() const { //----------------------------------------------------------------------------- void ToonzScene::renderFrame(const TRaster32P &ras, int row, const TXsheet *xsh, - bool checkFlags) const { + bool checkFlags, bool forSceneIcon, + bool forReference) const { if (xsh == 0) xsh = getXsheet(); TCamera *camera = xsh->getStageObjectTree()->getCurrentCamera(); @@ -738,7 +739,9 @@ void ToonzScene::renderFrame(const TRaster32P &ras, int row, const TXsheet *xsh, ImagePainter::VisualSettings vs; vs.m_plasticVisualSettings.m_drawMeshesWireframe = false; - vs.m_forSceneIcon = true; + vs.m_forSceneIcon = forSceneIcon; + vs.m_forReference = forReference; + vs.m_sceneProperties = xsh->getScene()->getProperties(); Stage::RasterPainter painter(ras->getSize(), viewAff, clipRect, vs, checkFlags);