Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/sceneproperties.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzLib includes
Toshihiro Shimizu 890ddd
#include "toonz/cleanupparameters.h"
Toshihiro Shimizu 890ddd
#include "toonz/tcenterlinevectorizer.h"
Toshihiro Shimizu 890ddd
#include "toonz/captureparameters.h"
Toshihiro Shimizu 890ddd
#include "toonz/tcamera.h"
Toshihiro Shimizu 890ddd
#include "toonz/tstageobjecttree.h"
Toshihiro Shimizu 890ddd
#include "toonz/txshleveltypes.h"
shun-iwasawa cf6df1
#include "toonz/preferences.h"
Toshihiro Shimizu 890ddd
#include "cleanuppalette.h"
shun-iwasawa cd4694
#include "toonz/boardsettings.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzBase includes
Toshihiro Shimizu 890ddd
#include "toutputproperties.h"
Toshihiro Shimizu 890ddd
#include "trasterfx.h"
Toshihiro Shimizu 890ddd
#include "tscanner.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tstream.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tproperty.h"
shun-iwasawa e87e08
#include "tiio.h"
Toshihiro Shimizu 890ddd
shun-iwasawa f84c65
namespace {
shun-iwasawa 508768
const QList<tsceneproperties::cellmark> getDefaultCellMarks() {</tsceneproperties::cellmark>
shun-iwasawa 508768
  return QList<tsceneproperties::cellmark>{</tsceneproperties::cellmark>
shun-iwasawa 508768
      {QObject::tr("Red"), TPixel32(167, 55, 55)},
shun-iwasawa 508768
      {QObject::tr("Orange"), TPixel32(195, 115, 40)},
shun-iwasawa 508768
      {QObject::tr("Yellow"), TPixel32(214, 183, 22)},
shun-iwasawa 508768
      {QObject::tr("Light Green"), TPixel32(165, 179, 57)},
shun-iwasawa 508768
      {QObject::tr("Green"), TPixel32(82, 157, 79)},
shun-iwasawa 508768
      {QObject::tr("Light Blue"), TPixel32(71, 142, 165)},
shun-iwasawa 508768
      {QObject::tr("Blue"), TPixel32(64, 103, 172)},
shun-iwasawa 508768
      {QObject::tr("Dark Blue"), TPixel32(60, 49, 187)},
shun-iwasawa 508768
      {QObject::tr("Purple"), TPixel32(108, 66, 170)},
shun-iwasawa 508768
      {QObject::tr("Pink"), TPixel32(161, 75, 140)},
shun-iwasawa 508768
      {QObject::tr("Dark Pink"), TPixel32(111, 29, 108)},
shun-iwasawa 508768
      {QObject::tr("White"), TPixel32(255, 255, 255)}};
shun-iwasawa f84c65
}
shun-iwasawa a266be
shun-iwasawa a266be
const QList<tsceneproperties::colorfilter> getDefaultColorFilters() {</tsceneproperties::colorfilter>
shun-iwasawa a266be
  return QList<tsceneproperties::colorfilter>{</tsceneproperties::colorfilter>
shun-iwasawa a266be
      {QObject::tr("None"), TPixel::Black},  // not editable
shun-iwasawa a266be
      {QObject::tr("Red"), TPixel::Red},
shun-iwasawa a266be
      {QObject::tr("Green"), TPixel::Green},
shun-iwasawa a266be
      {QObject::tr("Blue"), TPixel::Blue},
shun-iwasawa a266be
      {QObject::tr("DarkYellow"), TPixel(128, 128, 0)},
shun-iwasawa a266be
      {QObject::tr("DarkCyan"), TPixel32(0, 128, 128)},
shun-iwasawa a266be
      {QObject::tr("DarkMagenta"), TPixel32(128, 0, 128)},
shun-iwasawa a266be
      {"", TPixel::Black},
shun-iwasawa a266be
      {"", TPixel::Black},
shun-iwasawa a266be
      {"", TPixel::Black},
shun-iwasawa a266be
      {"", TPixel::Black}};
shun-iwasawa a266be
}
shun-iwasawa 508768
}  // namespace
shun-iwasawa f84c65
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TSceneProperties::TSceneProperties()
Shinya Kitaoka 120a6e
    : m_cleanupParameters(new CleanupParameters())
Shinya Kitaoka 120a6e
    , m_scanParameters(new TScannerParameters())
Shinya Kitaoka 120a6e
    , m_vectorizerParameters(new VectorizerParameters())
Shinya Kitaoka 120a6e
    , m_captureParameters(new CaptureParameters())
Shinya Kitaoka 120a6e
    , m_outputProp(new TOutputProperties())
Shinya Kitaoka 120a6e
    , m_previewProp(new TOutputProperties())
Shinya Kitaoka 120a6e
    , m_bgColor(255, 255, 255, 0)
Shinya Kitaoka 120a6e
    , m_markerDistance(6)
Shinya Kitaoka 120a6e
    , m_markerOffset(0)
Shinya Kitaoka 120a6e
    , m_fullcolorSubsampling(1)
Shinya Kitaoka 120a6e
    , m_tlvSubsampling(1)
shun_iwasawa fe1261
    , m_fieldGuideSize(16)
shun_iwasawa 2c0f50
    , m_fieldGuideAspectRatio(1.77778)
shun-iwasawa 3f818e
    , m_columnColorFilterOnRender(false)
shun-iwasawa 3f818e
    , m_camCapSaveInPath() {
Shinya Kitaoka 120a6e
  // Default color
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(255, 235, 140));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(255, 160, 120));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(255, 180, 190));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(135, 205, 250));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(145, 240, 145));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(130, 255, 210));
Shinya Kitaoka 120a6e
  m_notesColor.push_back(TPixel32(150, 245, 255));
shun-iwasawa f84c65
shun-iwasawa f84c65
  // Default Cell Marks
shun-iwasawa 508768
  m_cellMarks = getDefaultCellMarks();
shun-iwasawa a266be
  // Default Color Filters
shun-iwasawa a266be
  m_colorFilters = getDefaultColorFilters();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSceneProperties::~TSceneProperties() {
Shinya Kitaoka 120a6e
  delete m_cleanupParameters;
Shinya Kitaoka 120a6e
  delete m_scanParameters;
Shinya Kitaoka 120a6e
  delete m_vectorizerParameters;
Shinya Kitaoka 120a6e
  delete m_captureParameters;
Shinya Kitaoka 120a6e
  clearPointerContainer(m_cameras);
Shinya Kitaoka 120a6e
  delete m_outputProp;
Shinya Kitaoka 120a6e
  delete m_previewProp;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::assign(const TSceneProperties *sprop) {
Shinya Kitaoka 120a6e
  assert(sprop);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_hGuides      = sprop->m_hGuides;
Shinya Kitaoka 120a6e
  m_vGuides      = sprop->m_vGuides;
Shinya Kitaoka 120a6e
  *m_outputProp  = *sprop->m_outputProp;
Shinya Kitaoka 120a6e
  *m_previewProp = *sprop->m_previewProp;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_cleanupParameters->assign(sprop->m_cleanupParameters);
Shinya Kitaoka 120a6e
  m_scanParameters->assign(sprop->m_scanParameters);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  assert(sprop->m_vectorizerParameters);
Shinya Kitaoka 120a6e
  *m_vectorizerParameters = *sprop->m_vectorizerParameters;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (sprop != this) {
Shinya Kitaoka 120a6e
    m_cameras = sprop->m_cameras;
shun-iwasawa f84c65
    for (int i = 0; i < (int)m_cameras.size(); i++)
Shinya Kitaoka 120a6e
      m_cameras[i] = new TCamera(*m_cameras[i]);
Shinya Kitaoka 120a6e
  }
shun_iwasawa 2c0f50
  m_bgColor                   = sprop->m_bgColor;
shun_iwasawa 2c0f50
  m_markerDistance            = sprop->m_markerDistance;
shun_iwasawa 2c0f50
  m_markerOffset              = sprop->m_markerOffset;
shun_iwasawa 2c0f50
  m_fullcolorSubsampling      = sprop->m_fullcolorSubsampling;
shun_iwasawa 2c0f50
  m_tlvSubsampling            = sprop->m_tlvSubsampling;
shun_iwasawa 2c0f50
  m_fieldGuideSize            = sprop->m_fieldGuideSize;
shun_iwasawa 2c0f50
  m_fieldGuideAspectRatio     = sprop->m_fieldGuideAspectRatio;
shun_iwasawa 2c0f50
  m_columnColorFilterOnRender = sprop->m_columnColorFilterOnRender;
Shinya Kitaoka 120a6e
  int i;
Shinya Kitaoka 120a6e
  for (i = 0; i < m_notesColor.size(); i++)
Shinya Kitaoka 120a6e
    m_notesColor.replace(i, sprop->getNoteColor(i));
shun-iwasawa a266be
  for (i = 0; i < m_cellMarks.size(); i++)
shun-iwasawa a266be
    m_cellMarks.replace(i, sprop->getCellMark(i));
shun-iwasawa a266be
  for (i = 0; i < m_colorFilters.size(); i++)
shun-iwasawa a266be
    m_colorFilters.replace(i, sprop->getColorFilter(i));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::onInitialize() {
shun-iwasawa cf6df1
  // set initial output folder to $scenefolder when the scene folder mode is set
shun-iwasawa cf6df1
  // in user preferences
shun-iwasawa cf6df1
  if (Preferences::instance()->getPathAliasPriority() ==
shun-iwasawa cf6df1
          Preferences::SceneFolderAlias &&
shun-iwasawa cf6df1
      !TFilePath("$scenefolder").isAncestorOf(m_outputProp->getPath())) {
shun-iwasawa cf6df1
    std::string ext = m_outputProp->getPath().getDottedType();
shun-iwasawa cf6df1
    m_outputProp->setPath(TFilePath("$scenefolder/") + ext);
shun-iwasawa cf6df1
  }
shun-iwasawa cf6df1
Shinya Kitaoka 120a6e
  //  m_scanParameters->adaptToCurrentScanner();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setBgColor(const TPixel32 &color) { m_bgColor = color; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
shun-iwasawa fe3506
void TSceneProperties::getMarkers(int &distance, int &offset,
shun-iwasawa fe3506
                                  int &secDistance) const {
shun-iwasawa fe3506
  distance = m_markerDistance;
shun-iwasawa fe3506
  offset   = m_markerOffset;
shun-iwasawa fe3506
  // TODO: handle drop frame when the fps has decimal part
shun-iwasawa fe3506
  secDistance =
shun-iwasawa fe3506
      (Preferences::instance()->getBoolValue(highlightLineEverySecond))
shun-iwasawa fe3506
          ? (int)std::round(getOutputProperties()->getFrameRate())
shun-iwasawa fe3506
          : -1;
shun-iwasawa fe3506
}
shun-iwasawa fe3506
shun-iwasawa fe3506
//-----------------------------------------------------------------------------
shun-iwasawa fe3506
Shinya Kitaoka 120a6e
void TSceneProperties::setMarkers(int distance, int offset) {
Shinya Kitaoka 120a6e
  m_markerDistance = distance;
Shinya Kitaoka 120a6e
  m_markerOffset   = offset;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setFullcolorSubsampling(int s) {
Shinya Kitaoka 120a6e
  assert(1 <= s && s <= 100);
Shinya Kitaoka 120a6e
  m_fullcolorSubsampling = tcrop(s, 1, 100);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setTlvSubsampling(int s) {
Shinya Kitaoka 120a6e
  assert(1 <= s && s <= 100);
Shinya Kitaoka 120a6e
  m_tlvSubsampling = tcrop(s, 1, 100);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setFieldGuideSize(int size) {
Shinya Kitaoka 120a6e
  assert(1 <= size && size <= 100);
Shinya Kitaoka 120a6e
  m_fieldGuideSize = tcrop(size, 1, 100);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setFieldGuideAspectRatio(double ar) {
Shinya Kitaoka 120a6e
  assert(ar >= 0);
shun-iwasawa f84c65
  if (ar <= 0) ar = 1;
Shinya Kitaoka 120a6e
  m_fieldGuideAspectRatio = ar;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::saveData(TOStream &os) const {
Shinya Kitaoka 120a6e
  if (!m_hGuides.empty()) {
Shinya Kitaoka 120a6e
    os.openChild("hGuides");
Shinya Kitaoka 120a6e
    for (int i = 0; i < (int)m_hGuides.size(); i++) os << m_hGuides[i];
Shinya Kitaoka 120a6e
    os.closeChild();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (!m_vGuides.empty()) {
Shinya Kitaoka 120a6e
    os.openChild("vGuides");
Shinya Kitaoka 120a6e
    for (int i = 0; i < (int)m_vGuides.size(); i++) os << m_vGuides[i];
Shinya Kitaoka 120a6e
    os.closeChild();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int i;
Shinya Kitaoka 120a6e
  if (!m_cameras.empty()) {
Shinya Kitaoka 120a6e
    os.openChild("cameras");
Shinya Kitaoka 120a6e
    for (i = 0; i < (int)m_cameras.size(); i++) {
Shinya Kitaoka 120a6e
      os.openChild("camera");
Shinya Kitaoka 120a6e
      m_cameras[i]->saveData(os);
Shinya Kitaoka 120a6e
      os.closeChild();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    os.closeChild();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  os.openChild("outputs");
Shinya Kitaoka 120a6e
  std::vector<toutputproperties *=""> outputs;</toutputproperties>
Shinya Kitaoka 120a6e
  outputs.push_back(getOutputProperties());
Shinya Kitaoka 120a6e
  outputs.push_back(getPreviewProperties());
Shinya Kitaoka 120a6e
  for (i = 0; i < (int)outputs.size(); i++) {
Shinya Kitaoka 120a6e
    TOutputProperties &out    = *outputs[i];
Shinya Kitaoka 120a6e
    const TRenderSettings &rs = out.getRenderSettings();
Shinya Kitaoka 120a6e
    std::map<std::string, std::string=""> attr;</std::string,>
Shinya Kitaoka 120a6e
    attr["name"] = i == 0 ? "main" : "preview";
Shinya Kitaoka 120a6e
    os.openChild("output", attr);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TFilePath outPath = out.getPath();
Shinya Kitaoka 120a6e
    int from, to, step;
Shinya Kitaoka 120a6e
    out.getRange(from, to, step);
Shinya Kitaoka 120a6e
    os.child("range") << from << to;
Shinya Kitaoka 120a6e
    os.child("step") << step;
Shinya Kitaoka 120a6e
    os.child("shrink") << rs.m_shrinkX;
Shinya Kitaoka 120a6e
    os.child("applyShrinkToViewer") << (rs.m_applyShrinkToViewer ? 1 : 0);
Shinya Kitaoka 120a6e
    os.child("fps") << out.getFrameRate();
Shinya Kitaoka 120a6e
    os.child("path") << outPath;
Shinya Kitaoka 120a6e
    os.child("bpp") << rs.m_bpp;
shun-iwasawa 481b59
    if (rs.m_linearColorSpace) {
shun-iwasawa 481b59
      os.child("linearColorSpace") << (rs.m_linearColorSpace ? 1 : 0);
shun-iwasawa 481b59
      os.child("nonlinearBpp") << out.getNonlinearBpp();
shun-iwasawa 481b59
    }
shun-iwasawa 481b59
    if (rs.m_colorSpaceGamma >= 1. &&
shun-iwasawa 481b59
        !areAlmostEqual(rs.m_colorSpaceGamma, 2.2))
shun-iwasawa 481b59
      os.child("colorSpaceGamma") << rs.m_colorSpaceGamma;
shun-iwasawa 481b59
    if (i == 1)  // preview
shun-iwasawa 481b59
      os.child("syncColorSettings") << (out.isColorSettingsSynced() ? 1 : 0);
shun-iwasawa 481b59
Shinya Kitaoka 120a6e
    os.child("multimedia") << out.getMultimediaRendering();
Shinya Kitaoka 120a6e
    os.child("threadsIndex") << out.getThreadIndex();
Shinya Kitaoka 120a6e
    os.child("maxTileSizeIndex") << out.getMaxTileSizeIndex();
Shinya Kitaoka 120a6e
    os.child("subcameraPrev") << (out.isSubcameraPreview() ? 1 : 0);
shun-iwasawa f84c65
    os.child("stereoscopic")
shun-iwasawa f84c65
        << (rs.m_stereoscopic ? 1 : 0) << rs.m_stereoscopicShift;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    switch (rs.m_quality) {
Shinya Kitaoka 120a6e
    case TRenderSettings::StandardResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)0;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::ImprovedResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)1;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::HighResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)2;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Triangle_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)100;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Mitchell_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)101;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Cubic5_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)102;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Cubic75_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)103;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Cubic1_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)104;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Hann2_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)105;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Hann3_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)106;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Hamming2_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)107;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Hamming3_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)108;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Lanczos2_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)109;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Lanczos3_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)110;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Gauss_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)111;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::ClosestPixel_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)112;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::Bilinear_FilterResampleQuality:
Shinya Kitaoka 120a6e
      os.child("resquality") << (int)113;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    default:
Shinya Kitaoka 120a6e
      assert(false);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    switch (rs.m_fieldPrevalence) {
Shinya Kitaoka 120a6e
    case TRenderSettings::NoField:
Shinya Kitaoka 120a6e
      os.child("fieldprevalence") << (int)0;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::EvenField:
Shinya Kitaoka 120a6e
      os.child("fieldprevalence") << (int)1;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    case TRenderSettings::OddField:
Shinya Kitaoka 120a6e
      os.child("fieldprevalence") << (int)2;
Shinya Kitaoka 120a6e
      break;
Shinya Kitaoka 120a6e
    default:
Shinya Kitaoka 120a6e
      assert(false);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    os.child("gamma") << rs.m_gamma;
Shinya Kitaoka 120a6e
    os.child("timestretch") << rs.m_timeStretchFrom << rs.m_timeStretchTo;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    if (out.getOffset() != 0) os.child("offset") << out.getOffset();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    os.openChild("formatsProperties");
Shinya Kitaoka 120a6e
    std::vector<std::string> fileExtensions;</std::string>
Shinya Kitaoka 120a6e
    out.getFileFormatPropertiesExtensions(fileExtensions);
Shinya Kitaoka 120a6e
    for (int i = 0; i < (int)fileExtensions.size(); i++) {
Shinya Kitaoka 120a6e
      std::string ext    = fileExtensions[i];
Shinya Kitaoka 120a6e
      TPropertyGroup *pg = out.getFileFormatProperties(ext);
Shinya Kitaoka 120a6e
      assert(pg);
Shinya Kitaoka 120a6e
      std::map<std::string, std::string=""> attr;</std::string,>
Shinya Kitaoka 120a6e
      attr["ext"] = ext;
Shinya Kitaoka 120a6e
      os.openChild("formatProperties", attr);
Shinya Kitaoka 120a6e
      pg->saveData(os);
Shinya Kitaoka 120a6e
      os.closeChild();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    os.closeChild();
Shinya Kitaoka 120a6e
shun-iwasawa cd4694
    if (out.getBoardSettings() && out.getBoardSettings()->getDuration()) {
shun-iwasawa cd4694
      os.openChild("clapperboardSettings");
shun-iwasawa cd4694
      out.getBoardSettings()->saveData(os);
shun-iwasawa cd4694
      os.closeChild();
shun-iwasawa cd4694
    }
shun-iwasawa cd4694
shun-iwasawa fc0d80
    if (out.formatTemplateFId().getZeroPadding() !=
shun-iwasawa fc0d80
            TFrameId().getZeroPadding() ||
shun-iwasawa fc0d80
        out.formatTemplateFId().getStartSeqInd() !=
shun-iwasawa fc0d80
            TFrameId().getStartSeqInd()) {
shun-iwasawa fc0d80
      os.openChild("frameFormat");
shun-iwasawa fc0d80
      os.child("padding") << (int)out.formatTemplateFId().getZeroPadding();
shun-iwasawa fc0d80
      os.child("sepchar") << QString(out.formatTemplateFId().getStartSeqInd());
shun-iwasawa fc0d80
      os.closeChild();
shun-iwasawa fc0d80
    }
shun-iwasawa fc0d80
Shinya Kitaoka 120a6e
    os.closeChild();  // 
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  os.closeChild();
Shinya Kitaoka 120a6e
  os.openChild("cleanupParameters");
Shinya Kitaoka 120a6e
  m_cleanupParameters->saveData(os);
Shinya Kitaoka 120a6e
  os.closeChild();
Shinya Kitaoka 120a6e
  os.openChild("scanParameters");
Shinya Kitaoka 120a6e
  m_scanParameters->saveData(os);
Shinya Kitaoka 120a6e
  os.closeChild();
Shinya Kitaoka 120a6e
  os.openChild("vectorizerParameters");
Shinya Kitaoka 120a6e
  m_vectorizerParameters->saveData(os);
Shinya Kitaoka 120a6e
  os.closeChild();
Shinya Kitaoka 120a6e
  os.child("bgColor") << m_bgColor;
Shinya Kitaoka 120a6e
  os.child("markers") << m_markerDistance << m_markerOffset;
Shinya Kitaoka 120a6e
  os.child("subsampling") << m_fullcolorSubsampling << m_tlvSubsampling;
Shinya Kitaoka 120a6e
  os.child("fieldguide") << m_fieldGuideSize << m_fieldGuideAspectRatio;
shun_iwasawa 2c0f50
  if (m_columnColorFilterOnRender) os.child("columnColorFilterOnRender") << 1;
shun-iwasawa 3f818e
  if (!m_camCapSaveInPath.isEmpty())
shun-iwasawa 3f818e
    os.child("cameraCaputureSaveInPath") << m_camCapSaveInPath;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  os.openChild("noteColors");
Shinya Kitaoka 120a6e
  for (i = 0; i < m_notesColor.size(); i++) os << m_notesColor.at(i);
Shinya Kitaoka 120a6e
  os.closeChild();
shun-iwasawa f84c65
shun-iwasawa f84c65
  if (!hasDefaultCellMarks()) {
shun-iwasawa f84c65
    os.openChild("cellMarks");
shun-iwasawa f84c65
    for (auto mark : m_cellMarks) os << mark.name.toStdString() << mark.color;
shun-iwasawa f84c65
    os.closeChild();
shun-iwasawa f84c65
  }
shun-iwasawa a266be
  if (!hasDefaultColorFilters()) {
shun-iwasawa a266be
    os.openChild("colorFilters");
shun-iwasawa a266be
    for (auto filter : m_colorFilters)
shun-iwasawa a266be
      os << filter.name.toStdString() << filter.color;
shun-iwasawa a266be
    os.closeChild();
shun-iwasawa a266be
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Shinya Kitaoka 120a6e
/*! Set all scene properties elements, to information contained in \b TIStream
Shinya Kitaoka 120a6e
   \b is.
Shinya Kitaoka 120a6e
                \sa saveData()
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
void TSceneProperties::loadData(TIStream &is, bool isLoadingProject) {
Shinya Kitaoka 120a6e
  TSceneProperties defaultProperties;
Shinya Kitaoka 120a6e
  assign(&defaultProperties);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int globFrom = -1, globTo = 0, globStep = 1;
Shinya Kitaoka 120a6e
  double globFrameRate = -1;
Shinya Kitaoka 120a6e
  std::string tagName;
shun-iwasawa 481b59
  *m_outputProp  = TOutputProperties();
shun-iwasawa 481b59
  *m_previewProp = TOutputProperties();
shun-iwasawa 481b59
Shinya Kitaoka 120a6e
  while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
    if (tagName == "projectPath") {
Shinya Kitaoka 120a6e
      TFilePath projectPath;
Shinya Kitaoka 120a6e
      is >> projectPath;
Shinya Kitaoka 120a6e
    } else if (tagName == "range") {
Shinya Kitaoka 120a6e
      is >> globFrom >> globTo;
Shinya Kitaoka 120a6e
    }  // backCompatibility: prima range e fps non erano in Output
Shinya Kitaoka 120a6e
    else if (tagName == "step") {
Shinya Kitaoka 120a6e
      is >> globStep;
Shinya Kitaoka 120a6e
    } else if (tagName == "fps") {
Shinya Kitaoka 120a6e
      is >> globFrameRate;
Shinya Kitaoka 120a6e
    } else if (tagName == "bgColor") {
Shinya Kitaoka 120a6e
      is >> m_bgColor;
Shinya Kitaoka 120a6e
    } else if (tagName == "viewerBgColor" || tagName == "previewBgColor" ||
Shinya Kitaoka 120a6e
               tagName == "chessboardColor1" ||
Shinya Kitaoka 120a6e
               tagName == "chessboardColor2")  // back compatibility
Shinya Kitaoka 120a6e
    {
Shinya Kitaoka 120a6e
      TPixel32 dummy;
Shinya Kitaoka 120a6e
      is >> dummy;
Shinya Kitaoka 120a6e
    } else if (tagName == "markers") {
Shinya Kitaoka 120a6e
      is >> m_markerDistance >> m_markerOffset;
Shinya Kitaoka 120a6e
    } else if (tagName == "subsampling") {
Shinya Kitaoka 120a6e
      is >> m_fullcolorSubsampling >> m_tlvSubsampling;
Shinya Kitaoka 120a6e
    } else if (tagName == "fieldguide") {
Shinya Kitaoka 120a6e
      is >> m_fieldGuideSize >> m_fieldGuideAspectRatio;
shun_iwasawa 2c0f50
    } else if (tagName == "columnColorFilterOnRender") {
shun_iwasawa 2c0f50
      int val;
shun_iwasawa 2c0f50
      is >> val;
shun_iwasawa 2c0f50
      enableColumnColorFilterOnRender(val == 1);
Shinya Kitaoka 120a6e
    } else if (tagName == "safearea") {
Shinya Kitaoka 120a6e
      double dummy1, dummy2;
Shinya Kitaoka 120a6e
      is >> dummy1 >> dummy2;
Shinya Kitaoka 120a6e
    }  // back compatibility
Shinya Kitaoka 120a6e
    else if (tagName == "columnIconLoadingPolicy") {
Shinya Kitaoka 120a6e
      int dummy;
Shinya Kitaoka 120a6e
      is >> dummy;
Shinya Kitaoka 120a6e
    }                                 // back compatibility
Shinya Kitaoka 120a6e
    else if (tagName == "playrange")  // back compatibility
Shinya Kitaoka 120a6e
    {
Shinya Kitaoka 120a6e
      std::string dummy;
Shinya Kitaoka 120a6e
      is >> globFrom >> globTo >> dummy;
Shinya Kitaoka 120a6e
    } else if (tagName == "camera")  // back compatibility with tab 2.2
Shinya Kitaoka 120a6e
    {
Shinya Kitaoka 120a6e
      clearPointerContainer(m_cameras);
Shinya Kitaoka 120a6e
      m_cameras.clear();
Shinya Kitaoka 120a6e
      TCamera *camera = new TCamera();
Shinya Kitaoka 120a6e
      m_cameras.push_back(camera);
Shinya Kitaoka 120a6e
      TDimension res(0, 0);
Shinya Kitaoka 120a6e
      is >> res.lx >> res.ly;
Shinya Kitaoka 120a6e
      camera->setRes(res);
Shinya Kitaoka 120a6e
      double cameraDpi = 36.0;
Shinya Kitaoka 120a6e
      camera->setSize(TDimensionD(res.lx / cameraDpi, res.ly / cameraDpi));
Shinya Kitaoka 120a6e
    } else if (tagName == "playRange") {
Shinya Kitaoka 120a6e
      int playR0, playR1;
Shinya Kitaoka 120a6e
      is >> playR0 >> playR1;
Shinya Kitaoka 120a6e
    } else if (tagName == "hGuides" || tagName == "vGuides") {
Shinya Kitaoka 120a6e
      Guides &guides = tagName == "hGuides" ? m_hGuides : m_vGuides;
Shinya Kitaoka 120a6e
      while (!is.matchEndTag()) {
Shinya Kitaoka 120a6e
        double g;
Shinya Kitaoka 120a6e
        is >> g;
Shinya Kitaoka 120a6e
        guides.push_back(g);
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
      continue;
Shinya Kitaoka 120a6e
    } else if (tagName == "cameras") {
Shinya Kitaoka 120a6e
      clearPointerContainer(m_cameras);
Shinya Kitaoka 120a6e
      m_cameras.clear();
Shinya Kitaoka 120a6e
      while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
        if (tagName == "camera") {
Shinya Kitaoka 120a6e
          TCamera *camera = new TCamera();
Shinya Kitaoka 120a6e
          m_cameras.push_back(camera);
Shinya Kitaoka 120a6e
          camera->loadData(is);
Shinya Kitaoka 120a6e
        }  // if "camera"
Shinya Kitaoka 120a6e
        else
Shinya Kitaoka 120a6e
          throw TException("unexpected property tag: " + tagName);
Shinya Kitaoka 120a6e
        is.closeChild();
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
    } else if (tagName == "outputs" || tagName == "outputStreams") {
Shinya Kitaoka 120a6e
      while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
        if (tagName == "output" || tagName == "outputStream") {
Shinya Kitaoka 120a6e
          TOutputProperties dummyOut;
Shinya Kitaoka 120a6e
          TOutputProperties *outPtr = &dummyOut;
Shinya Kitaoka 120a6e
          std::string name          = is.getTagAttribute("name");
Shinya Kitaoka 120a6e
          if (name == "preview")
Shinya Kitaoka 120a6e
            outPtr = m_previewProp;
Shinya Kitaoka 120a6e
          else if (name == "main")
shun-iwasawa f84c65
            outPtr = m_outputProp;
Shinya Kitaoka 120a6e
          TOutputProperties &out = *outPtr;
Shinya Kitaoka 120a6e
          TRenderSettings renderSettings;
Shinya Kitaoka 120a6e
          if (globFrom != -1)
Shinya Kitaoka 120a6e
            out.setRange(globFrom, globTo, globStep);
Shinya Kitaoka 120a6e
          else if (globStep != 1) {
Shinya Kitaoka 120a6e
            int from, to, dummy;
Shinya Kitaoka 120a6e
            out.getRange(from, to, dummy);
Shinya Kitaoka 120a6e
            out.setRange(from, to, globStep);
Shinya Kitaoka 120a6e
          }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
          if (globFrameRate != -1) out.setFrameRate(globFrameRate);
Shinya Kitaoka 120a6e
          while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
            if (tagName == "camera") {
Shinya Kitaoka 120a6e
              int dummy;
Shinya Kitaoka 120a6e
              is >> dummy;
Shinya Kitaoka 120a6e
            }                                    // per compatibilita'
Shinya Kitaoka 120a6e
            else if (tagName == "cameraData") {  // per compatibilita'
Shinya Kitaoka 120a6e
              while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
                if (tagName == "size") {
Shinya Kitaoka 120a6e
                  TDimensionD size(0, 0);
Shinya Kitaoka 120a6e
                  is >> size.lx >> size.ly;
Shinya Kitaoka 120a6e
                } else if (tagName == "res") {
Shinya Kitaoka 120a6e
                  TDimension res(0, 0);
Shinya Kitaoka 120a6e
                  is >> res.lx >> res.ly;
Shinya Kitaoka 120a6e
                }
Shinya Kitaoka 120a6e
                is.closeChild();
Shinya Kitaoka 120a6e
              }
Shinya Kitaoka 120a6e
            } else if (tagName == "path") {
Shinya Kitaoka 120a6e
              TFilePath fp;
Shinya Kitaoka 120a6e
              is >> fp;
Shinya Kitaoka 120a6e
              std::string ext    = fp.getUndottedType();
Shinya Kitaoka 120a6e
              TPropertyGroup *pg = out.getFileFormatProperties(ext);
Shinya Kitaoka 120a6e
              if (ext == "avi" && pg->getPropertyCount() != 1)
Shinya Kitaoka 120a6e
                fp = fp.withType("tif");
Shinya Kitaoka 120a6e
              out.setPath(fp);
Shinya Kitaoka 120a6e
            } else if (tagName == "offset") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setOffset(j);
Shinya Kitaoka 120a6e
            } else if (tagName == "range") {
Shinya Kitaoka 120a6e
              int from, to, step, dummy;
Shinya Kitaoka 120a6e
              is >> from >> to;
Shinya Kitaoka 120a6e
              out.getRange(dummy, dummy, step);
Shinya Kitaoka 120a6e
              out.setRange(from, to, step);
Shinya Kitaoka 120a6e
            } else if (tagName == "step") {
Shinya Kitaoka 120a6e
              int dummy, from, to, step;
Shinya Kitaoka 120a6e
              is >> step;
Shinya Kitaoka 120a6e
              out.getRange(from, to, dummy);
Shinya Kitaoka 120a6e
              out.setRange(from, to, step);
Shinya Kitaoka 120a6e
            } else if (tagName == "shrink") {
Shinya Kitaoka 120a6e
              int shrink;
Shinya Kitaoka 120a6e
              is >> shrink;
Shinya Kitaoka 120a6e
              renderSettings.m_shrinkX = renderSettings.m_shrinkY = shrink;
Shinya Kitaoka 120a6e
            } else if (tagName == "applyShrinkToViewer") {
Shinya Kitaoka 120a6e
              int applyShrinkToViewer;
Shinya Kitaoka 120a6e
              is >> applyShrinkToViewer;
Shinya Kitaoka 120a6e
              renderSettings.m_applyShrinkToViewer = (applyShrinkToViewer != 0);
Shinya Kitaoka 120a6e
            } else if (tagName == "fps") {
Shinya Kitaoka 120a6e
              double j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setFrameRate(j);
Shinya Kitaoka 120a6e
            } else if (tagName == "bpp") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
shun-iwasawa 481b59
              if (j == 32 || j == 64 || j == 128) renderSettings.m_bpp = j;
shun-iwasawa 481b59
            } else if (tagName == "linearColorSpace") {
shun-iwasawa 481b59
              int linearColorSpace;
shun-iwasawa 481b59
              is >> linearColorSpace;
shun-iwasawa 481b59
              renderSettings.m_linearColorSpace = (linearColorSpace != 0);
shun-iwasawa 481b59
            } else if (tagName == "nonlinearBpp") {
shun-iwasawa 481b59
              int j;
shun-iwasawa 481b59
              is >> j;
shun-iwasawa 481b59
              if (j == 32 || j == 64 || j == 128) out.setNonlinearBpp(j);
shun-iwasawa 481b59
            } else if (tagName == "colorSpaceGamma") {
shun-iwasawa 481b59
              double colorSpaceGamma;
shun-iwasawa 481b59
              is >> colorSpaceGamma;
shun-iwasawa 481b59
              renderSettings.m_colorSpaceGamma = colorSpaceGamma;
shun-iwasawa 481b59
            } else if (tagName == "syncColorSettings") {
shun-iwasawa 481b59
              assert(name == "preview");
shun-iwasawa 481b59
              int syncColorSettings;
shun-iwasawa 481b59
              is >> syncColorSettings;
shun-iwasawa 481b59
              out.syncColorSettings(syncColorSettings != 0);
Shinya Kitaoka 120a6e
            } else if (tagName == "multimedia") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setMultimediaRendering(j);
Shinya Kitaoka 120a6e
            } else if (tagName == "threadsIndex") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setThreadIndex(j);
Shinya Kitaoka 120a6e
            } else if (tagName == "maxTileSizeIndex") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setMaxTileSizeIndex(j);
Shinya Kitaoka 120a6e
            } else if (tagName == "subcameraPrev") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              out.setSubcameraPreview(j != 0);
Shinya Kitaoka 120a6e
            } else if (tagName == "resquality") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              switch (j) {
Shinya Kitaoka 120a6e
              case 0:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::StandardResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 1:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::ImprovedResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 2:
Shinya Kitaoka 120a6e
                renderSettings.m_quality = TRenderSettings::HighResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 100:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Triangle_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 101:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Mitchell_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 102:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Cubic5_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 103:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Cubic75_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 104:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Cubic1_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 105:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Hann2_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 106:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Hann3_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 107:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Hamming2_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 108:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Hamming3_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 109:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Lanczos2_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 110:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Lanczos3_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 111:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Gauss_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 112:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::ClosestPixel_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 113:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::Bilinear_FilterResampleQuality;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              default:
Shinya Kitaoka 120a6e
                renderSettings.m_quality =
Shinya Kitaoka 120a6e
                    TRenderSettings::StandardResampleQuality;
Shinya Kitaoka 120a6e
              }
Shinya Kitaoka 120a6e
            } else if (tagName == "fieldprevalence") {
Shinya Kitaoka 120a6e
              int j;
Shinya Kitaoka 120a6e
              is >> j;
Shinya Kitaoka 120a6e
              switch (j) {
Shinya Kitaoka 120a6e
              case 0:
Shinya Kitaoka 120a6e
                renderSettings.m_fieldPrevalence = TRenderSettings::NoField;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 1:
Shinya Kitaoka 120a6e
                renderSettings.m_fieldPrevalence = TRenderSettings::EvenField;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              case 2:
Shinya Kitaoka 120a6e
                renderSettings.m_fieldPrevalence = TRenderSettings::OddField;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              default:
Shinya Kitaoka 120a6e
                renderSettings.m_fieldPrevalence = TRenderSettings::NoField;
Shinya Kitaoka 120a6e
                break;
Shinya Kitaoka 120a6e
              }
Shinya Kitaoka 120a6e
            } else if (tagName == "gamma") {
Shinya Kitaoka 120a6e
              double g;
Shinya Kitaoka 120a6e
              is >> g;
Shinya Kitaoka 120a6e
              renderSettings.m_gamma = g;
Shinya Kitaoka 120a6e
            } else if (tagName == "timestretch") {
Shinya Kitaoka 120a6e
              double from, to;
Shinya Kitaoka 120a6e
              is >> from >> to;
Shinya Kitaoka 120a6e
              renderSettings.m_timeStretchFrom = from;
Shinya Kitaoka 120a6e
              renderSettings.m_timeStretchTo   = to;
Shinya Kitaoka 120a6e
            } else if (tagName == "stereoscopic") {
Shinya Kitaoka 120a6e
              int doit;
Shinya Kitaoka 120a6e
              double val;
Shinya Kitaoka 120a6e
              is >> doit >> val;
Shinya Kitaoka 120a6e
              renderSettings.m_stereoscopic      = (doit == 1);
Shinya Kitaoka 120a6e
              renderSettings.m_stereoscopicShift = val;
Shinya Kitaoka 120a6e
            }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
            // TODO: aggiungere la lettura della quality
Shinya Kitaoka 120a6e
            else if (tagName == "res") {  // obsoleto
Shinya Kitaoka 120a6e
              TDimension d(0, 0);
Shinya Kitaoka 120a6e
              is >> d.lx >> d.ly;
Shinya Kitaoka 120a6e
              if (!is.eos()) {
Shinya Kitaoka 120a6e
                std::string s;
Shinya Kitaoka 120a6e
                is >> s;
Shinya Kitaoka 120a6e
              }
Shinya Kitaoka 120a6e
            } else if (tagName == "formatsProperties") {
Shinya Kitaoka 120a6e
              while (is.matchTag(tagName)) {
Shinya Kitaoka 120a6e
                if (tagName == "formatProperties") {
Shinya Kitaoka 120a6e
                  std::string ext    = is.getTagAttribute("ext");
Shinya Kitaoka 120a6e
                  TPropertyGroup *pg = out.getFileFormatProperties(ext);
Shinya Kitaoka 120a6e
                  if (ext == "avi") {
Shinya Kitaoka 120a6e
                    TPropertyGroup appProperties;
Shinya Kitaoka 120a6e
                    appProperties.loadData(is);
Shinya Kitaoka 120a6e
                    if (pg->getPropertyCount() != 1 ||
Shinya Kitaoka 120a6e
                        appProperties.getPropertyCount() != 1) {
Shinya Kitaoka 120a6e
                      is.closeChild();
Shinya Kitaoka 120a6e
                      continue;
Shinya Kitaoka 120a6e
                    }
Shinya Kitaoka 120a6e
                    TEnumProperty *enumProp =
Shinya Kitaoka 120a6e
                        dynamic_cast<tenumproperty *="">(pg->getProperty(0));</tenumproperty>
Shinya Kitaoka 120a6e
                    TEnumProperty *enumAppProp = dynamic_cast<tenumproperty *="">(</tenumproperty>
Shinya Kitaoka 120a6e
                        appProperties.getProperty(0));
Shinya Kitaoka 120a6e
                    assert(enumAppProp && enumProp);
Shinya Kitaoka 120a6e
                    if (enumAppProp && enumProp) {
Shinya Kitaoka 120a6e
                      try {
Shinya Kitaoka 120a6e
                        enumProp->setValue(enumAppProp->getValue());
Shinya Kitaoka 120a6e
                      } catch (TProperty::RangeError &) {
Shinya Kitaoka 120a6e
                      }
Shinya Kitaoka 120a6e
                    } else
Shinya Kitaoka 120a6e
                      throw TException();
Shinya Kitaoka 120a6e
                  } else
Shinya Kitaoka 120a6e
                    pg->loadData(is);
shun-iwasawa e87e08
shun-iwasawa e87e08
                  ////////ここだ!
shun-iwasawa e87e08
                  {
shun-iwasawa e87e08
                    TPropertyGroup *refPg = Tiio::makeWriterProperties(ext);
shun-iwasawa e87e08
                    pg->assignUINames(refPg);
shun-iwasawa e87e08
                    delete refPg;
shun-iwasawa e87e08
                  }
shun-iwasawa e87e08
Shinya Kitaoka 120a6e
                  is.closeChild();
Shinya Kitaoka 120a6e
                } else
Shinya Kitaoka 120a6e
                  throw TException("unexpected tag: " + tagName);
Shinya Kitaoka 120a6e
              }  // end while
shun-iwasawa cd4694
            } else if (tagName == "clapperboardSettings") {
shun-iwasawa cd4694
              assert(out.getBoardSettings());
shun-iwasawa cd4694
              out.getBoardSettings()->loadData(is);
shun-iwasawa fc0d80
            } else if (tagName == "frameFormat") {
shun-iwasawa fc0d80
              while (is.matchTag(tagName)) {
shun-iwasawa fc0d80
                if (tagName == "padding") {
shun-iwasawa fc0d80
                  int padding;
shun-iwasawa fc0d80
                  is >> padding;
shun-iwasawa fc0d80
                  out.formatTemplateFId().setZeroPadding(padding);
shun-iwasawa fc0d80
                } else if (tagName == "sepchar") {
shun-iwasawa fc0d80
                  QString sepChar;
shun-iwasawa fc0d80
                  is >> sepChar;
shun-iwasawa fc0d80
                  out.formatTemplateFId().setStartSeqInd(sepChar[0].toLatin1());
shun-iwasawa fc0d80
                } else
shun-iwasawa fc0d80
                  throw TException("unexpected tag: " + tagName);
shun-iwasawa fc0d80
                is.closeChild();
shun-iwasawa fc0d80
              }  // end while
Shinya Kitaoka 120a6e
            } else {
Shinya Kitaoka 120a6e
              throw TException("unexpected property tag: " + tagName);
Shinya Kitaoka 120a6e
            }
Shinya Kitaoka 120a6e
            is.closeChild();
Shinya Kitaoka 120a6e
          }
Shinya Kitaoka 120a6e
          if (renderSettings.m_timeStretchFrom ==
Shinya Kitaoka 120a6e
                  renderSettings.m_timeStretchTo &&
Shinya Kitaoka 120a6e
              renderSettings.m_timeStretchTo == 1)
Shinya Kitaoka 120a6e
            renderSettings.m_timeStretchFrom = renderSettings.m_timeStretchTo =
Shinya Kitaoka 120a6e
                out.getFrameRate();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
          out.setRenderSettings(renderSettings);
Shinya Kitaoka 120a6e
        } else
Shinya Kitaoka 120a6e
          throw TException("unexpected property tag: " + tagName);
Shinya Kitaoka 120a6e
        is.closeChild();
Shinya Kitaoka 120a6e
      }  // while (outputs/outputStreams)
Shinya Kitaoka 120a6e
    } else if (tagName == "cleanupPalette") {
Shinya Kitaoka 120a6e
      m_cleanupParameters->m_cleanupPalette->loadData(is);
Shinya Kitaoka 120a6e
    } else if (tagName == "cleanupParameters") {
Shinya Kitaoka 120a6e
      m_cleanupParameters->loadData(is, !isLoadingProject);
Shinya Kitaoka 120a6e
    } else if (tagName == "scanParameters") {
Shinya Kitaoka 120a6e
      // m_scanParameters->adaptToCurrentScanner(); Rallenta tutto!!!
Shinya Kitaoka 120a6e
      m_scanParameters->loadData(is);
Shinya Kitaoka 120a6e
    } else if (tagName == "vectorizerParameters") {
Shinya Kitaoka 120a6e
      m_vectorizerParameters->loadData(is);
Shinya Kitaoka 120a6e
    } else if (tagName == "captureParameters") {
Shinya Kitaoka 120a6e
      m_captureParameters->loadData(is);
Shinya Kitaoka 120a6e
    } else if (tagName == "defaultLevelParameters") {
Shinya Kitaoka 120a6e
      // this
Shinya Kitaoka 120a6e
      int type;
Shinya Kitaoka 120a6e
      double width, height, dpi;
Shinya Kitaoka 120a6e
      is >> type >> width >> height >> dpi;
Shinya Kitaoka 120a6e
    } else if (tagName == "noteColors") {
Shinya Kitaoka 120a6e
      int i = 0;
Shinya Kitaoka 120a6e
      while (!is.eos()) {
Shinya Kitaoka 120a6e
        TPixel32 color;
Shinya Kitaoka 120a6e
        is >> color;
Shinya Kitaoka 120a6e
        m_notesColor.replace(i, color);
Shinya Kitaoka 120a6e
        i++;
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
      assert(i == 7);
shun-iwasawa 3f818e
    } else if (tagName == "cameraCaputureSaveInPath") {
shun-iwasawa 3f818e
      is >> m_camCapSaveInPath;
shun-iwasawa f84c65
    } else if (tagName == "cellMarks") {
shun-iwasawa f84c65
      int i = 0;
shun-iwasawa f84c65
      while (!is.eos()) {
shun-iwasawa f84c65
        TPixel32 color;
shun-iwasawa f84c65
        std::string name;
shun-iwasawa f84c65
        is >> name >> color;
shun-iwasawa f84c65
        m_cellMarks.replace(i, {QString::fromStdString(name), color});
shun-iwasawa f84c65
        i++;
shun-iwasawa f84c65
      }
shun-iwasawa a266be
    } else if (tagName == "colorFilters") {
shun-iwasawa a266be
      int i = 0;
shun-iwasawa a266be
      while (!is.eos()) {
shun-iwasawa a266be
        TPixel32 color;
shun-iwasawa a266be
        std::string name;
shun-iwasawa a266be
        is >> name >> color;
shun-iwasawa a266be
        m_colorFilters.replace(i, {QString::fromStdString(name), color});
shun-iwasawa a266be
        i++;
shun-iwasawa a266be
      }
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      throw TException("unexpected property tag: " + tagName);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    is.closeChild();
Shinya Kitaoka 120a6e
  }
shun-iwasawa 481b59
shun-iwasawa 481b59
  // in order to support scenes made in previous development version
shun-iwasawa 481b59
  if (m_previewProp->getRenderSettings().m_colorSpaceGamma < 0.) {
shun-iwasawa 481b59
    TRenderSettings rs(m_previewProp->getRenderSettings());
shun-iwasawa 481b59
    rs.m_colorSpaceGamma = m_outputProp->getRenderSettings().m_colorSpaceGamma;
shun-iwasawa 481b59
    m_previewProp->setRenderSettings(rs);
shun-iwasawa 481b59
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::cloneCamerasFrom(TStageObjectTree *stageObjects) {
Shinya Kitaoka 120a6e
  clearPointerContainer(m_cameras);
Shinya Kitaoka 120a6e
  int cameraCount = stageObjects->getCameraCount();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int tmpCameraId = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (int i = 0; i < cameraCount;) {
Shinya Kitaoka 120a6e
    /*-- カメラが見つからなかった場合、tmpCameraIdのみ進める --*/
Shinya Kitaoka 120a6e
    if (!stageObjects->getStageObject(TStageObjectId::CameraId(tmpCameraId),
Shinya Kitaoka 120a6e
                                      false)) {
Shinya Kitaoka 120a6e
      tmpCameraId++;
Shinya Kitaoka 120a6e
      continue;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    TStageObject *cameraObject =
Shinya Kitaoka 120a6e
        stageObjects->getStageObject(TStageObjectId::CameraId(tmpCameraId));
Shinya Kitaoka 120a6e
    TCamera *camera = new TCamera(*cameraObject->getCamera());
Shinya Kitaoka 120a6e
    m_cameras.push_back(camera);
Shinya Kitaoka 120a6e
    /*-- カメラが見つかったので、i も tmpCameraId も進める --*/
Shinya Kitaoka 120a6e
    i++;
Shinya Kitaoka 120a6e
    tmpCameraId++;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::cloneCamerasTo(TStageObjectTree *stageObjects) const {
Shinya Kitaoka 120a6e
  TDimension maxCameraRes(0, 0);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (int i = 0; i < (int)m_cameras.size(); i++) {
Shinya Kitaoka 120a6e
    TStageObject *cameraPegbar =
Shinya Kitaoka 120a6e
        stageObjects->getStageObject(TStageObjectId::CameraId(i));
Shinya Kitaoka 120a6e
    TCamera *camera = m_cameras[i];
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TDimension cameraRes = camera->getRes();
Shinya Kitaoka 120a6e
    bool modified        = false;
Shinya Kitaoka 120a6e
    if (maxCameraRes.lx > 0 && cameraRes.lx > maxCameraRes.lx) {
Shinya Kitaoka 120a6e
      cameraRes.lx = maxCameraRes.lx;
Shinya Kitaoka 120a6e
      modified     = true;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (maxCameraRes.ly > 0 && cameraRes.ly > maxCameraRes.ly) {
Shinya Kitaoka 120a6e
      cameraRes.ly = maxCameraRes.ly;
Shinya Kitaoka 120a6e
      modified     = true;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (modified) camera->setRes(cameraRes);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    *cameraPegbar->getCamera() = *m_cameras[i];
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
QList<tpixel32> TSceneProperties::getNoteColors() const { return m_notesColor; }</tpixel32>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TPixel32 TSceneProperties::getNoteColor(int colorIndex) const {
Shinya Kitaoka 120a6e
  return m_notesColor[colorIndex];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::setNoteColor(TPixel32 color, int colorIndex) {
Shinya Kitaoka 120a6e
  m_notesColor[colorIndex] = color;
Toshihiro Shimizu 890ddd
}
shun-iwasawa f84c65
shun-iwasawa f84c65
//-----------------------------------------------------------------------------
shun-iwasawa f84c65
shun-iwasawa f84c65
QList<tsceneproperties::cellmark> TSceneProperties::getCellMarks() const {</tsceneproperties::cellmark>
shun-iwasawa f84c65
  return m_cellMarks;
shun-iwasawa f84c65
}
shun-iwasawa f84c65
shun-iwasawa f84c65
//-----------------------------------------------------------------------------
shun-iwasawa f84c65
shun-iwasawa f84c65
TSceneProperties::CellMark TSceneProperties::getCellMark(int index) const {
shun-iwasawa f84c65
  return m_cellMarks[index];
shun-iwasawa f84c65
}
shun-iwasawa f84c65
shun-iwasawa f84c65
//-----------------------------------------------------------------------------
shun-iwasawa f84c65
shun-iwasawa f84c65
void TSceneProperties::setCellMark(const TSceneProperties::CellMark &mark,
shun-iwasawa f84c65
                                   int index) {
shun-iwasawa f84c65
  m_cellMarks[index] = mark;
shun-iwasawa f84c65
}
shun-iwasawa f84c65
shun-iwasawa f84c65
//-----------------------------------------------------------------------------
shun-iwasawa f84c65
// check if the cell mark settings are modified
shun-iwasawa f84c65
bool TSceneProperties::hasDefaultCellMarks() const {
shun-iwasawa f84c65
  if (m_cellMarks.size() != 12) return false;
shun-iwasawa 508768
  return m_cellMarks == getDefaultCellMarks();
shun-iwasawa fc0d80
}
shun-iwasawa fc0d80
shun-iwasawa fc0d80
//-----------------------------------------------------------------------------
shun-iwasawa a266be
shun-iwasawa a266be
QList<tsceneproperties::colorfilter> TSceneProperties::getColorFilters() const {</tsceneproperties::colorfilter>
shun-iwasawa a266be
  return m_colorFilters;
shun-iwasawa a266be
}
shun-iwasawa a266be
shun-iwasawa a266be
//-----------------------------------------------------------------------------
shun-iwasawa a266be
shun-iwasawa a266be
TSceneProperties::ColorFilter TSceneProperties::getColorFilter(
shun-iwasawa a266be
    int index) const {
shun-iwasawa a266be
  return m_colorFilters[index];
shun-iwasawa a266be
}
shun-iwasawa a266be
shun-iwasawa a266be
//-----------------------------------------------------------------------------
shun-iwasawa a266be
shun-iwasawa a266be
TPixel32 TSceneProperties::getColorFilterColor(int index) const {
shun-iwasawa a266be
  return m_colorFilters[index].color;
shun-iwasawa a266be
}
shun-iwasawa a266be
shun-iwasawa a266be
//-----------------------------------------------------------------------------
shun-iwasawa a266be
shun-iwasawa a266be
void TSceneProperties::setColorFilter(
shun-iwasawa a266be
    const TSceneProperties::ColorFilter &filter, int index) {
shun-iwasawa a266be
  assert(index != 0);  // the first item (None) is not editable
shun-iwasawa a266be
  if (index == 0) return;
shun-iwasawa a266be
  m_colorFilters[index] = filter;
shun-iwasawa a266be
}
shun-iwasawa a266be
shun-iwasawa a266be
//-----------------------------------------------------------------------------
shun-iwasawa a266be
// check if the cell mark settings are modified
shun-iwasawa a266be
bool TSceneProperties::hasDefaultColorFilters() const {
shun-iwasawa a266be
  if (m_colorFilters.size() != 11) return false;
shun-iwasawa a266be
  return m_colorFilters == getDefaultColorFilters();
shun-iwasawa a266be
}
shun-iwasawa a266be
shun-iwasawa a266be
//-----------------------------------------------------------------------------
shun-iwasawa fc0d80
// templateFId in preview settings is used for "input" file format
shun-iwasawa fc0d80
// such as new raster level, captured images by camera capture feature, etc.
shun-iwasawa fc0d80
TFrameId &TSceneProperties::formatTemplateFIdForInput() {
shun-iwasawa fc0d80
  return m_previewProp->formatTemplateFId();
shun-iwasawa 481b59
}