|
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()
|
|
Toshihiro Shimizu |
890ddd |
: m_cleanupParameters(new CleanupParameters()), m_scanParameters(new TScannerParameters()), m_vectorizerParameters(new VectorizerParameters()), m_captureParameters(new CaptureParameters()), m_outputProp(new TOutputProperties()), m_previewProp(new TOutputProperties()), m_bgColor(255, 255, 255, 0), m_markerDistance(6), m_markerOffset(0), m_fullcolorSubsampling(1), m_tlvSubsampling(1), m_fieldGuideSize(12), m_fieldGuideAspectRatio(1.38)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Default color
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(255, 235, 140));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(255, 160, 120));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(255, 180, 190));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(135, 205, 250));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(145, 240, 145));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(130, 255, 210));
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.push_back(TPixel32(150, 245, 255));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TSceneProperties::~TSceneProperties()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_cleanupParameters;
|
|
Toshihiro Shimizu |
890ddd |
delete m_scanParameters;
|
|
Toshihiro Shimizu |
890ddd |
delete m_vectorizerParameters;
|
|
Toshihiro Shimizu |
890ddd |
delete m_captureParameters;
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_cameras);
|
|
Toshihiro Shimizu |
890ddd |
delete m_outputProp;
|
|
Toshihiro Shimizu |
890ddd |
delete m_previewProp;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::assign(const TSceneProperties *sprop)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(sprop);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_hGuides = sprop->m_hGuides;
|
|
Toshihiro Shimizu |
890ddd |
m_vGuides = sprop->m_vGuides;
|
|
Toshihiro Shimizu |
890ddd |
*m_outputProp = *sprop->m_outputProp;
|
|
Toshihiro Shimizu |
890ddd |
*m_previewProp = *sprop->m_previewProp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_cleanupParameters->assign(sprop->m_cleanupParameters);
|
|
Toshihiro Shimizu |
890ddd |
m_scanParameters->assign(sprop->m_scanParameters);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(sprop->m_vectorizerParameters);
|
|
Toshihiro Shimizu |
890ddd |
*m_vectorizerParameters = *sprop->m_vectorizerParameters;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (sprop != this) {
|
|
Toshihiro Shimizu |
890ddd |
m_cameras = sprop->m_cameras;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < (int)m_cameras.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
m_cameras[i] = new TCamera(*m_cameras[i]);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*m_outputProp = *sprop->m_outputProp;
|
|
Toshihiro Shimizu |
890ddd |
*m_previewProp = *sprop->m_previewProp;
|
|
Toshihiro Shimizu |
890ddd |
m_bgColor = sprop->m_bgColor;
|
|
Toshihiro Shimizu |
890ddd |
m_markerDistance = sprop->m_markerDistance;
|
|
Toshihiro Shimizu |
890ddd |
m_markerOffset = sprop->m_markerOffset;
|
|
Toshihiro Shimizu |
890ddd |
m_fullcolorSubsampling = sprop->m_fullcolorSubsampling;
|
|
Toshihiro Shimizu |
890ddd |
m_tlvSubsampling = sprop->m_tlvSubsampling;
|
|
Toshihiro Shimizu |
890ddd |
m_fieldGuideSize = sprop->m_fieldGuideSize;
|
|
Toshihiro Shimizu |
890ddd |
m_fieldGuideAspectRatio = sprop->m_fieldGuideAspectRatio;
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < m_notesColor.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.replace(i, sprop->getNoteColor(i));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::onInitialize()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
// m_scanParameters->adaptToCurrentScanner();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setBgColor(const TPixel32 &color)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_bgColor = color;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setMarkers(int distance, int offset)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_markerDistance = distance;
|
|
Toshihiro Shimizu |
890ddd |
m_markerOffset = offset;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setFullcolorSubsampling(int s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(1 <= s && s <= 100);
|
|
Toshihiro Shimizu |
890ddd |
m_fullcolorSubsampling = tcrop(s, 1, 100);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setTlvSubsampling(int s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(1 <= s && s <= 100);
|
|
Toshihiro Shimizu |
890ddd |
m_tlvSubsampling = tcrop(s, 1, 100);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setFieldGuideSize(int size)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(1 <= size && size <= 100);
|
|
Toshihiro Shimizu |
890ddd |
m_fieldGuideSize = tcrop(size, 1, 100);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setFieldGuideAspectRatio(double ar)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(ar >= 0);
|
|
Toshihiro Shimizu |
890ddd |
if (ar <= 0)
|
|
Toshihiro Shimizu |
890ddd |
ar = 1;
|
|
Toshihiro Shimizu |
890ddd |
m_fieldGuideAspectRatio = ar;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::saveData(TOStream &os) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_hGuides.empty()) {
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("hGuides");
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < (int)m_hGuides.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
os << m_hGuides[i];
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (!m_vGuides.empty()) {
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("vGuides");
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < (int)m_vGuides.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
os << m_vGuides[i];
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
if (!m_cameras.empty()) {
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("cameras");
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)m_cameras.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("camera");
|
|
Toshihiro Shimizu |
890ddd |
m_cameras[i]->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("outputs");
|
|
Toshihiro Shimizu |
890ddd |
std::vector<toutputproperties *=""> outputs;</toutputproperties>
|
|
Toshihiro Shimizu |
890ddd |
outputs.push_back(getOutputProperties());
|
|
Toshihiro Shimizu |
890ddd |
outputs.push_back(getPreviewProperties());
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)outputs.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties &out = *outputs[i];
|
|
Toshihiro Shimizu |
890ddd |
const TRenderSettings &rs = out.getRenderSettings();
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, std::string=""> attr;</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
attr["name"] = i == 0 ? "main" : "preview";
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("output", attr);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath outPath = out.getPath();
|
|
Toshihiro Shimizu |
890ddd |
int from, to, step;
|
|
Toshihiro Shimizu |
890ddd |
out.getRange(from, to, step);
|
|
Toshihiro Shimizu |
890ddd |
os.child("range") << from << to;
|
|
Toshihiro Shimizu |
890ddd |
os.child("step") << step;
|
|
Toshihiro Shimizu |
890ddd |
os.child("shrink") << rs.m_shrinkX;
|
|
Toshihiro Shimizu |
890ddd |
os.child("applyShrinkToViewer") << (rs.m_applyShrinkToViewer ? 1 : 0);
|
|
Toshihiro Shimizu |
890ddd |
os.child("fps") << out.getFrameRate();
|
|
Toshihiro Shimizu |
890ddd |
os.child("path") << outPath;
|
|
Toshihiro Shimizu |
890ddd |
os.child("bpp") << rs.m_bpp;
|
|
Toshihiro Shimizu |
890ddd |
os.child("multimedia") << out.getMultimediaRendering();
|
|
Toshihiro Shimizu |
890ddd |
os.child("threadsIndex") << out.getThreadIndex();
|
|
Toshihiro Shimizu |
890ddd |
os.child("maxTileSizeIndex") << out.getMaxTileSizeIndex();
|
|
Toshihiro Shimizu |
890ddd |
os.child("subcameraPrev") << (out.isSubcameraPreview() ? 1 : 0);
|
|
Toshihiro Shimizu |
890ddd |
os.child("stereoscopic") << (rs.m_stereoscopic ? 1 : 0) << rs.m_stereoscopicShift;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
switch (rs.m_quality) {
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::StandardResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)0;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::ImprovedResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)1;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::HighResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)2;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Triangle_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)100;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Mitchell_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)101;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Cubic5_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)102;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Cubic75_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)103;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Cubic1_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)104;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Hann2_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)105;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Hann3_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)106;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Hamming2_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)107;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Hamming3_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)108;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Lanczos2_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)109;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Lanczos3_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)110;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Gauss_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)111;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::ClosestPixel_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)112;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::Bilinear_FilterResampleQuality:
|
|
Toshihiro Shimizu |
890ddd |
os.child("resquality") << (int)113;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Shinya Kitaoka |
d4642c |
default:
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
switch (rs.m_fieldPrevalence) {
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::NoField:
|
|
Toshihiro Shimizu |
890ddd |
os.child("fieldprevalence") << (int)0;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::EvenField:
|
|
Toshihiro Shimizu |
890ddd |
os.child("fieldprevalence") << (int)1;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TRenderSettings::OddField:
|
|
Toshihiro Shimizu |
890ddd |
os.child("fieldprevalence") << (int)2;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Shinya Kitaoka |
d4642c |
default:
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
os.child("gamma") << rs.m_gamma;
|
|
Toshihiro Shimizu |
890ddd |
os.child("timestretch") << rs.m_timeStretchFrom << rs.m_timeStretchTo;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (out.getOffset() != 0)
|
|
Toshihiro Shimizu |
890ddd |
os.child("offset") << out.getOffset();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("formatsProperties");
|
|
Shinya Kitaoka |
3bfa54 |
std::vector<std::string> fileExtensions;</std::string>
|
|
Toshihiro Shimizu |
890ddd |
out.getFileFormatPropertiesExtensions(fileExtensions);
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < (int)fileExtensions.size(); i++) {
|
|
Shinya Kitaoka |
3bfa54 |
std::string ext = fileExtensions[i];
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *pg = out.getFileFormatProperties(ext);
|
|
Toshihiro Shimizu |
890ddd |
assert(pg);
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, std::string=""> attr;</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
attr["ext"] = ext;
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("formatProperties", attr);
|
|
Toshihiro Shimizu |
890ddd |
pg->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild(); //
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("cleanupParameters");
|
|
Toshihiro Shimizu |
890ddd |
m_cleanupParameters->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("scanParameters");
|
|
Toshihiro Shimizu |
890ddd |
m_scanParameters->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("vectorizerParameters");
|
|
Toshihiro Shimizu |
890ddd |
m_vectorizerParameters->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
os.child("bgColor") << m_bgColor;
|
|
Toshihiro Shimizu |
890ddd |
os.child("markers") << m_markerDistance << m_markerOffset;
|
|
Toshihiro Shimizu |
890ddd |
os.child("subsampling") << m_fullcolorSubsampling << m_tlvSubsampling;
|
|
Toshihiro Shimizu |
890ddd |
os.child("fieldguide") << m_fieldGuideSize << m_fieldGuideAspectRatio;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("noteColors");
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < m_notesColor.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
os << m_notesColor.at(i);
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Set all scene properties elements, to information contained in \b TIStream \b is.
|
|
Toshihiro Shimizu |
890ddd |
\sa saveData()
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::loadData(TIStream &is, bool isLoadingProject)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TSceneProperties defaultProperties;
|
|
Toshihiro Shimizu |
890ddd |
assign(&defaultProperties);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int globFrom = -1, globTo = 0, globStep = 1;
|
|
Toshihiro Shimizu |
890ddd |
double globFrameRate = -1;
|
|
Shinya Kitaoka |
3bfa54 |
std::string tagName;
|
|
Toshihiro Shimizu |
890ddd |
*m_outputProp = *m_previewProp = TOutputProperties();
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "projectPath") {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath projectPath;
|
|
Toshihiro Shimizu |
890ddd |
is >> projectPath;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "range") {
|
|
Toshihiro Shimizu |
890ddd |
is >> globFrom >> globTo;
|
|
Toshihiro Shimizu |
890ddd |
} //backCompatibility: prima range e fps non erano in Output
|
|
Toshihiro Shimizu |
890ddd |
else if (tagName == "step") {
|
|
Toshihiro Shimizu |
890ddd |
is >> globStep;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "fps") {
|
|
Toshihiro Shimizu |
890ddd |
is >> globFrameRate;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "bgColor") {
|
|
Toshihiro Shimizu |
890ddd |
is >> m_bgColor;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "viewerBgColor" || tagName == "previewBgColor" || tagName == "chessboardColor1" || tagName == "chessboardColor2") //back compatibility
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPixel32 dummy;
|
|
Toshihiro Shimizu |
890ddd |
is >> dummy;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "markers") {
|
|
Toshihiro Shimizu |
890ddd |
is >> m_markerDistance >> m_markerOffset;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "subsampling") {
|
|
Toshihiro Shimizu |
890ddd |
is >> m_fullcolorSubsampling >> m_tlvSubsampling;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "fieldguide") {
|
|
Toshihiro Shimizu |
890ddd |
is >> m_fieldGuideSize >> m_fieldGuideAspectRatio;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "safearea") {
|
|
Toshihiro Shimizu |
890ddd |
double dummy1, dummy2;
|
|
Toshihiro Shimizu |
890ddd |
is >> dummy1 >> dummy2;
|
|
Toshihiro Shimizu |
890ddd |
} //back compatibility
|
|
Toshihiro Shimizu |
890ddd |
else if (tagName == "columnIconLoadingPolicy") {
|
|
Toshihiro Shimizu |
890ddd |
int dummy;
|
|
Toshihiro Shimizu |
890ddd |
is >> dummy;
|
|
Toshihiro Shimizu |
890ddd |
} //back compatibility
|
|
Toshihiro Shimizu |
890ddd |
else if (tagName == "playrange") //back compatibility
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
std::string dummy;
|
|
Toshihiro Shimizu |
890ddd |
is >> globFrom >> globTo >> dummy;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "camera") //back compatibility with tab 2.2
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_cameras);
|
|
Toshihiro Shimizu |
890ddd |
m_cameras.clear();
|
|
Toshihiro Shimizu |
890ddd |
TCamera *camera = new TCamera();
|
|
Toshihiro Shimizu |
890ddd |
m_cameras.push_back(camera);
|
|
Toshihiro Shimizu |
890ddd |
TDimension res(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
is >> res.lx >> res.ly;
|
|
Toshihiro Shimizu |
890ddd |
camera->setRes(res);
|
|
Toshihiro Shimizu |
890ddd |
double cameraDpi = 36.0;
|
|
Toshihiro Shimizu |
890ddd |
camera->setSize(TDimensionD(res.lx / cameraDpi, res.ly / cameraDpi));
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "playRange") {
|
|
Toshihiro Shimizu |
890ddd |
int playR0, playR1;
|
|
Toshihiro Shimizu |
890ddd |
is >> playR0 >> playR1;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "hGuides" || tagName == "vGuides") {
|
|
Toshihiro Shimizu |
890ddd |
Guides &guides = tagName == "hGuides" ? m_hGuides : m_vGuides;
|
|
Toshihiro Shimizu |
890ddd |
while (!is.matchEndTag()) {
|
|
Toshihiro Shimizu |
890ddd |
double g;
|
|
Toshihiro Shimizu |
890ddd |
is >> g;
|
|
Toshihiro Shimizu |
890ddd |
guides.push_back(g);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "cameras") {
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_cameras);
|
|
Toshihiro Shimizu |
890ddd |
m_cameras.clear();
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "camera") {
|
|
Toshihiro Shimizu |
890ddd |
TCamera *camera = new TCamera();
|
|
Toshihiro Shimizu |
890ddd |
m_cameras.push_back(camera);
|
|
Toshihiro Shimizu |
890ddd |
camera->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
} // if "camera"
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unexpected property tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "outputs" || tagName == "outputStreams") {
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "output" || tagName == "outputStream") {
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties dummyOut;
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties *outPtr = &dummyOut;
|
|
Shinya Kitaoka |
3bfa54 |
std::string name = is.getTagAttribute("name");
|
|
Toshihiro Shimizu |
890ddd |
if (name == "preview")
|
|
Toshihiro Shimizu |
890ddd |
outPtr = m_previewProp;
|
|
Toshihiro Shimizu |
890ddd |
else if (name == "main")
|
|
Toshihiro Shimizu |
890ddd |
outPtr = m_outputProp;
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties &out = *outPtr;
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings renderSettings;
|
|
Toshihiro Shimizu |
890ddd |
if (globFrom != -1)
|
|
Toshihiro Shimizu |
890ddd |
out.setRange(globFrom, globTo, globStep);
|
|
Toshihiro Shimizu |
890ddd |
else if (globStep != 1) {
|
|
Toshihiro Shimizu |
890ddd |
int from, to, dummy;
|
|
Toshihiro Shimizu |
890ddd |
out.getRange(from, to, dummy);
|
|
Toshihiro Shimizu |
890ddd |
out.setRange(from, to, globStep);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (globFrameRate != -1)
|
|
Toshihiro Shimizu |
890ddd |
out.setFrameRate(globFrameRate);
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "camera") {
|
|
Toshihiro Shimizu |
890ddd |
int dummy;
|
|
Toshihiro Shimizu |
890ddd |
is >> dummy;
|
|
Toshihiro Shimizu |
890ddd |
} // per compatibilita'
|
|
Toshihiro Shimizu |
890ddd |
else if (tagName == "cameraData") { // per compatibilita'
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "size") {
|
|
Toshihiro Shimizu |
890ddd |
TDimensionD size(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
is >> size.lx >> size.ly;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "res") {
|
|
Toshihiro Shimizu |
890ddd |
TDimension res(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
is >> res.lx >> res.ly;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "path") {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath fp;
|
|
Toshihiro Shimizu |
890ddd |
is >> fp;
|
|
Shinya Kitaoka |
3bfa54 |
std::string ext = fp.getUndottedType();
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *pg = out.getFileFormatProperties(ext);
|
|
Toshihiro Shimizu |
890ddd |
if (ext == "avi" && pg->getPropertyCount() != 1)
|
|
Toshihiro Shimizu |
890ddd |
fp = fp.withType("tif");
|
|
Toshihiro Shimizu |
890ddd |
out.setPath(fp);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "offset") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setOffset(j);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "range") {
|
|
Toshihiro Shimizu |
890ddd |
int from, to, step, dummy;
|
|
Toshihiro Shimizu |
890ddd |
is >> from >> to;
|
|
Toshihiro Shimizu |
890ddd |
out.getRange(dummy, dummy, step);
|
|
Toshihiro Shimizu |
890ddd |
out.setRange(from, to, step);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "step") {
|
|
Toshihiro Shimizu |
890ddd |
int dummy, from, to, step;
|
|
Toshihiro Shimizu |
890ddd |
is >> step;
|
|
Toshihiro Shimizu |
890ddd |
out.getRange(from, to, dummy);
|
|
Toshihiro Shimizu |
890ddd |
out.setRange(from, to, step);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "shrink") {
|
|
Toshihiro Shimizu |
890ddd |
int shrink;
|
|
Toshihiro Shimizu |
890ddd |
is >> shrink;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_shrinkX = renderSettings.m_shrinkY = shrink;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "applyShrinkToViewer") {
|
|
Toshihiro Shimizu |
890ddd |
int applyShrinkToViewer;
|
|
Toshihiro Shimizu |
890ddd |
is >> applyShrinkToViewer;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_applyShrinkToViewer = (applyShrinkToViewer != 0);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "fps") {
|
|
Toshihiro Shimizu |
890ddd |
double j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setFrameRate(j);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "bpp") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
if (j == 32 || j == 64)
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_bpp = j;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "multimedia") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setMultimediaRendering(j);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "threadsIndex") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setThreadIndex(j);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "maxTileSizeIndex") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setMaxTileSizeIndex(j);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "subcameraPrev") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
out.setSubcameraPreview(j != 0);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "resquality") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
switch (j) {
|
|
Toshihiro Shimizu |
890ddd |
case 0:
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality = TRenderSettings::StandardResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 1:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::ImprovedResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 2:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::HighResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 100:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Triangle_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 101:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Mitchell_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 102:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Cubic5_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 103:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Cubic75_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 104:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Cubic1_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 105:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Hann2_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 106:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Hann3_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 107:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Hamming2_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 108:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Hamming3_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 109:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Lanczos2_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 110:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Lanczos3_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 111:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Gauss_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 112:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::ClosestPixel_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 113:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_quality = TRenderSettings::Bilinear_FilterResampleQuality;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
default:
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality = TRenderSettings::StandardResampleQuality;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "fieldprevalence") {
|
|
Toshihiro Shimizu |
890ddd |
int j;
|
|
Toshihiro Shimizu |
890ddd |
is >> j;
|
|
Toshihiro Shimizu |
890ddd |
switch (j) {
|
|
Toshihiro Shimizu |
890ddd |
case 0:
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_fieldPrevalence = TRenderSettings::NoField;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 1:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_fieldPrevalence = TRenderSettings::EvenField;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
case 2:
|
|
Shinya Kitaoka |
d4642c |
renderSettings.m_fieldPrevalence = TRenderSettings::OddField;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Shinya Kitaoka |
d4642c |
default:
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_fieldPrevalence = TRenderSettings::NoField;
|
|
Shinya Kitaoka |
d4642c |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "gamma") {
|
|
Toshihiro Shimizu |
890ddd |
double g;
|
|
Toshihiro Shimizu |
890ddd |
is >> g;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_gamma = g;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "timestretch") {
|
|
Toshihiro Shimizu |
890ddd |
double from, to;
|
|
Toshihiro Shimizu |
890ddd |
is >> from >> to;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_timeStretchFrom = from;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_timeStretchTo = to;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "stereoscopic") {
|
|
Toshihiro Shimizu |
890ddd |
int doit;
|
|
Toshihiro Shimizu |
890ddd |
double val;
|
|
Toshihiro Shimizu |
890ddd |
is >> doit >> val;
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_stereoscopic = (doit == 1);
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_stereoscopicShift = val;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TODO: aggiungere la lettura della quality
|
|
Toshihiro Shimizu |
890ddd |
else if (tagName == "res") { // obsoleto
|
|
Toshihiro Shimizu |
890ddd |
TDimension d(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
is >> d.lx >> d.ly;
|
|
Toshihiro Shimizu |
890ddd |
if (!is.eos()) {
|
|
Shinya Kitaoka |
3bfa54 |
std::string s;
|
|
Toshihiro Shimizu |
890ddd |
is >> s;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "formatsProperties") {
|
|
Toshihiro Shimizu |
890ddd |
while (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "formatProperties") {
|
|
Shinya Kitaoka |
3bfa54 |
std::string ext = is.getTagAttribute("ext");
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *pg =
|
|
Toshihiro Shimizu |
890ddd |
out.getFileFormatProperties(ext);
|
|
Toshihiro Shimizu |
890ddd |
if (ext == "avi") {
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup appProperties;
|
|
Toshihiro Shimizu |
890ddd |
appProperties.loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
if (pg->getPropertyCount() != 1 || appProperties.getPropertyCount() != 1) {
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty *enumProp = dynamic_cast<tenumproperty *="">(pg->getProperty(0));</tenumproperty>
|
|
Toshihiro Shimizu |
890ddd |
TEnumProperty *enumAppProp = dynamic_cast<tenumproperty *="">(appProperties.getProperty(0));</tenumproperty>
|
|
Toshihiro Shimizu |
890ddd |
assert(enumAppProp && enumProp);
|
|
Toshihiro Shimizu |
890ddd |
if (enumAppProp && enumProp) {
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
enumProp->setValue(enumAppProp->getValue());
|
|
Toshihiro Shimizu |
890ddd |
} catch (TProperty::RangeError &) {
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
throw TException();
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
pg->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unexpected tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
} // end while
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unexpected property tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (renderSettings.m_timeStretchFrom == renderSettings.m_timeStretchTo &&
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_timeStretchTo == 1)
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_timeStretchFrom = renderSettings.m_timeStretchTo = out.getFrameRate();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
out.setRenderSettings(renderSettings);
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unexpected property tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
} // while (outputs/outputStreams)
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "cleanupPalette") {
|
|
Toshihiro Shimizu |
890ddd |
m_cleanupParameters->m_cleanupPalette->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "cleanupParameters") {
|
|
Toshihiro Shimizu |
890ddd |
m_cleanupParameters->loadData(is, !isLoadingProject);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "scanParameters") {
|
|
Toshihiro Shimizu |
890ddd |
//m_scanParameters->adaptToCurrentScanner(); Rallenta tutto!!!
|
|
Toshihiro Shimizu |
890ddd |
m_scanParameters->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "vectorizerParameters") {
|
|
Toshihiro Shimizu |
890ddd |
m_vectorizerParameters->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "captureParameters") {
|
|
Toshihiro Shimizu |
890ddd |
m_captureParameters->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "defaultLevelParameters") {
|
|
Toshihiro Shimizu |
890ddd |
// this
|
|
Toshihiro Shimizu |
890ddd |
int type;
|
|
Toshihiro Shimizu |
890ddd |
double width, height, dpi;
|
|
Toshihiro Shimizu |
890ddd |
is >> type >> width >> height >> dpi;
|
|
Toshihiro Shimizu |
890ddd |
} else if (tagName == "noteColors") {
|
|
Toshihiro Shimizu |
890ddd |
int i = 0;
|
|
Toshihiro Shimizu |
890ddd |
while (!is.eos()) {
|
|
Toshihiro Shimizu |
890ddd |
TPixel32 color;
|
|
Toshihiro Shimizu |
890ddd |
is >> color;
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor.replace(i, color);
|
|
Toshihiro Shimizu |
890ddd |
i++;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
assert(i == 7);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
throw TException("unexpected property tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::cloneCamerasFrom(TStageObjectTree *stageObjects)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_cameras);
|
|
Toshihiro Shimizu |
890ddd |
int cameraCount = stageObjects->getCameraCount();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int tmpCameraId = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < cameraCount;) {
|
|
Toshihiro Shimizu |
890ddd |
/*-- カメラが見つからなかった場合、tmpCameraIdのみ進める --*/
|
|
Toshihiro Shimizu |
890ddd |
if (!stageObjects->getStageObject(TStageObjectId::CameraId(tmpCameraId), false)) {
|
|
Toshihiro Shimizu |
890ddd |
tmpCameraId++;
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *cameraObject = stageObjects->getStageObject(TStageObjectId::CameraId(tmpCameraId));
|
|
Toshihiro Shimizu |
890ddd |
TCamera *camera = new TCamera(*cameraObject->getCamera());
|
|
Toshihiro Shimizu |
890ddd |
m_cameras.push_back(camera);
|
|
Toshihiro Shimizu |
890ddd |
/*-- カメラが見つかったので、i も tmpCameraId も進める --*/
|
|
Toshihiro Shimizu |
890ddd |
i++;
|
|
Toshihiro Shimizu |
890ddd |
tmpCameraId++;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::cloneCamerasTo(TStageObjectTree *stageObjects) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TDimension maxCameraRes(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < (int)m_cameras.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *cameraPegbar = stageObjects->getStageObject(TStageObjectId::CameraId(i));
|
|
Toshihiro Shimizu |
890ddd |
TCamera *camera = m_cameras[i];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension cameraRes = camera->getRes();
|
|
Toshihiro Shimizu |
890ddd |
bool modified = false;
|
|
Toshihiro Shimizu |
890ddd |
if (maxCameraRes.lx > 0 && cameraRes.lx > maxCameraRes.lx) {
|
|
Toshihiro Shimizu |
890ddd |
cameraRes.lx = maxCameraRes.lx;
|
|
Toshihiro Shimizu |
890ddd |
modified = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (maxCameraRes.ly > 0 && cameraRes.ly > maxCameraRes.ly) {
|
|
Toshihiro Shimizu |
890ddd |
cameraRes.ly = maxCameraRes.ly;
|
|
Toshihiro Shimizu |
890ddd |
modified = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (modified)
|
|
Toshihiro Shimizu |
890ddd |
camera->setRes(cameraRes);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
*cameraPegbar->getCamera() = *m_cameras[i];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QList<tpixel32> TSceneProperties::getNoteColors() const</tpixel32>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_notesColor;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPixel32 TSceneProperties::getNoteColor(int colorIndex) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_notesColor[colorIndex];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TSceneProperties::setNoteColor(TPixel32 color, int colorIndex)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_notesColor[colorIndex] = color;
|
|
Toshihiro Shimizu |
890ddd |
}
|