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"
Toshihiro Shimizu 890ddd
#include "cleanuppalette.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"
Toshihiro Shimizu 890ddd
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));
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;
Shinya Kitaoka 120a6e
    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));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSceneProperties::onInitialize() {
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
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);
Shinya Kitaoka 120a6e
  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;
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);
Shinya Kitaoka 120a6e
    os.child("stereoscopic") << (rs.m_stereoscopic ? 1 : 0)
Shinya Kitaoka 120a6e
                             << 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
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();
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;
Shinya Kitaoka 120a6e
  *m_outputProp = *m_previewProp = TOutputProperties();
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")
Shinya Kitaoka 120a6e
            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;
Shinya Kitaoka 120a6e
              if (j == 32 || j == 64) renderSettings.m_bpp = j;
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);
Shinya Kitaoka 120a6e
                  is.closeChild();
Shinya Kitaoka 120a6e
                } else
Shinya Kitaoka 120a6e
                  throw TException("unexpected tag: " + tagName);
Shinya Kitaoka 120a6e
              }  // 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;
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      throw TException("unexpected property tag: " + tagName);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    is.closeChild();
Shinya Kitaoka 120a6e
  }
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
}