Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

#assistants: allow to create assistants level

Ivan Mahonin1e389aa0255f
diff --git a/toonz/sources/common/tcolor/tpixel.cpp b/toonz/sources/common/tcolor/tpixel.cpp
index ffd82acd9..053f86bd7 100644
--- a/toonz/sources/common/tcolor/tpixel.cpp
+++ b/toonz/sources/common/tcolor/tpixel.cpp
@@ -14,6 +14,8 @@ const TPixelRGBM32 TPixelRGBM32::Blue(0, 0, maxChannelValue);
const TPixelRGBM32 TPixelRGBM32::Yellow(maxChannelValue, maxChannelValue, 0);
const TPixelRGBM32 TPixelRGBM32::Cyan(0, maxChannelValue, maxChannelValue);
const TPixelRGBM32 TPixelRGBM32::Magenta(maxChannelValue, 0, maxChannelValue);
+const TPixelRGBM32 TPixelRGBM32::Gray(maxChannelValue/2, maxChannelValue/2,
+ maxChannelValue/2);
const TPixelRGBM32 TPixelRGBM32::White(maxChannelValue, maxChannelValue,
maxChannelValue);
const TPixelRGBM32 TPixelRGBM32::Black(0, 0, 0);
@@ -26,6 +28,8 @@ const TPixelRGBM64 TPixelRGBM64::Blue(0, 0, maxChannelValue);
const TPixelRGBM64 TPixelRGBM64::Yellow(maxChannelValue, maxChannelValue, 0);
const TPixelRGBM64 TPixelRGBM64::Cyan(0, maxChannelValue, maxChannelValue);
const TPixelRGBM64 TPixelRGBM64::Magenta(maxChannelValue, 0, maxChannelValue);
+const TPixelRGBM64 TPixelRGBM64::Gray(maxChannelValue/2, maxChannelValue/2,
+ maxChannelValue/2);
const TPixelRGBM64 TPixelRGBM64::White(maxChannelValue, maxChannelValue,
maxChannelValue);
const TPixelRGBM64 TPixelRGBM64::Black(0, 0, 0);
@@ -37,6 +41,7 @@ const TPixelD TPixelD::Blue(0, 0, 1);
const TPixelD TPixelD::Yellow(1, 1, 0);
const TPixelD TPixelD::Cyan(0, 1, 1);
const TPixelD TPixelD::Magenta(1, 0, 1);
+const TPixelD TPixelD::Gray(0.5, 0.5, 0.5);
const TPixelD TPixelD::White(1, 1, 1);
const TPixelD TPixelD::Black(0, 0, 0);
const TPixelD TPixelD::Transparent(0, 0, 0, 0);
diff --git a/toonz/sources/include/toonz/txshleveltypes.h b/toonz/sources/include/toonz/txshleveltypes.h
index e976c73d9..638782a3f 100644
--- a/toonz/sources/include/toonz/txshleveltypes.h
+++ b/toonz/sources/include/toonz/txshleveltypes.h
@@ -13,6 +13,7 @@ enum TXshLevelType {
TZP_TYPE = 0x10,
OVL_TYPE = 0x20,
CHILD_TYPE = 0x40,
+ META_TYPE = 0x80,
FULLCOLOR_TYPE = TZI_TYPE | OVL_TYPE,
RASTER_TYPE = FULLCOLOR_TYPE | TZP_TYPE,
@@ -22,6 +23,7 @@ enum TXshLevelType {
TZP_XSHLEVEL = TZP_TYPE | LEVELCOLUMN_XSHLEVEL, // ToonzRaster
OVL_XSHLEVEL = OVL_TYPE | LEVELCOLUMN_XSHLEVEL, // Raster
CHILD_XSHLEVEL = CHILD_TYPE | LEVELCOLUMN_XSHLEVEL,
+ META_XSHLEVEL = META_TYPE | LEVELCOLUMN_XSHLEVEL,
ZERARYFX_XSHLEVEL = 1 << 7,
PLT_XSHLEVEL = 2 << 7,
diff --git a/toonz/sources/include/tpixel.h b/toonz/sources/include/tpixel.h
index 2b0136690..e08f7f3d8 100644
--- a/toonz/sources/include/tpixel.h
+++ b/toonz/sources/include/tpixel.h
@@ -140,6 +140,7 @@ dithering
static const TPixelRGBM32 Yellow;
static const TPixelRGBM32 Cyan;
static const TPixelRGBM32 Magenta;
+ static const TPixelRGBM32 Gray;
static const TPixelRGBM32 White;
static const TPixelRGBM32 Black;
static const TPixelRGBM32 Transparent;
@@ -239,6 +240,7 @@ static inline TPixelRGBM64 from(const TPixelD &pix);
static const TPixelRGBM64 Yellow;
static const TPixelRGBM64 Cyan;
static const TPixelRGBM64 Magenta;
+ static const TPixelRGBM64 Gray;
static const TPixelRGBM64 White;
static const TPixelRGBM64 Black;
static const TPixelRGBM64 Transparent;
@@ -312,6 +314,7 @@ static inline TPixelD from(const TPixelD &pix) {return pix;};
static const TPixelD Yellow;
static const TPixelD Cyan;
static const TPixelD Magenta;
+ static const TPixelD Gray;
static const TPixelD White;
static const TPixelD Black;
static const TPixelD Transparent;
diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cpp
index c1c886646..717d75f67 100644
--- a/toonz/sources/toonz/levelcreatepopup.cpp
+++ b/toonz/sources/toonz/levelcreatepopup.cpp
@@ -45,6 +45,7 @@
#include "tvectorimage.h"
#include "trasterimage.h"
#include "ttoonzimage.h"
+#include "tmetaimage.h"
#include "timagecache.h"
#include "tundo.h"
#include "filebrowsermodel.h"
@@ -196,6 +197,7 @@ LevelCreatePopup::LevelCreatePopup()
m_levelTypeOm->addItem(tr("Toonz Raster Level"), (int)TZP_XSHLEVEL);
m_levelTypeOm->addItem(tr("Raster Level"), (int)OVL_XSHLEVEL);
m_levelTypeOm->addItem(tr("Scan Level"), (int)TZI_XSHLEVEL);
+ m_levelTypeOm->addItem(tr("Assistants Level"), (int)META_XSHLEVEL);
if (Preferences::instance()->getUnits() == "pixel") {
m_widthFld->setMeasure("camera.lx");
@@ -631,6 +633,8 @@ bool LevelCreatePopup::apply() {
TFrameId fid(i);
if (lType == PLI_XSHLEVEL)
sl->setFrame(fid, new TVectorImage());
+ else if (lType == META_XSHLEVEL)
+ sl->setFrame(fid, new TMetaImage());
else if (lType == TZP_XSHLEVEL) {
TRasterCM32P raster(xres, yres);
raster->fill(TPixelCM32());
diff --git a/toonz/sources/toonzqt/icongenerator.cpp b/toonz/sources/toonzqt/icongenerator.cpp
index fc9a03979..c3f826491 100644
--- a/toonz/sources/toonzqt/icongenerator.cpp
+++ b/toonz/sources/toonzqt/icongenerator.cpp
@@ -498,6 +498,25 @@ IconRenderer::~IconRenderer() {}
//=============================================================================
+//======================================
+// NoImageIconRenderer class
+//--------------------------------------
+
+class NoImageIconRenderer final : public IconRenderer {
+public:
+ NoImageIconRenderer(const std::string &id, const TDimension &iconSize):
+ IconRenderer(id, iconSize) { }
+ void run() override {
+ try {
+ TRaster32P ras(getIconSize());
+ ras->fill(TPixel32::Gray);
+ setIcon(ras);
+ } catch(...){}
+ }
+};
+
+//=============================================================================
+
//======================================
// VectorImageIconRenderer class
//--------------------------------------
@@ -1442,7 +1461,7 @@ QPixmap IconGenerator::getIcon(TXshLevel *xl, const TFrameId &fid,
addTask(id, new MeshImageIconRenderer(id, iconSize, sl, fid, m_settings));
break;
default:
- assert(false);
+ addTask(id, new NoImageIconRenderer(id, iconSize));
break;
}