Exemple #1
0
void TRangeParam::saveData(TOStream &os)
{
	os.openChild("min");
	m_data->m_min->saveData(os);
	os.closeChild();
	os.openChild("max");
	m_data->m_max->saveData(os);
	os.closeChild();
}
void TToneCurveParam::saveData(TOStream &os) {
  os.openChild("tonecurve");
  m_rgbaParamSet->saveData(os);
  m_rgbParamSet->saveData(os);
  m_rParamSet->saveData(os);
  m_gParamSet->saveData(os);
  m_bParamSet->saveData(os);
  m_aParamSet->saveData(os);
  os.openChild("isLineaer");
  m_isLinear->saveData(os);
  os.closeChild();
  os.closeChild();
}
void ShaderInterface::saveData(TOStream &os) {
  struct locals {
    inline static TFilePath getRelativePath(const TFilePath &file,
                                            const TFilePath &relTo) {
      QDir relToDir(
          QString::fromStdWString(relTo.getParentDir().getWideString()));
      QString relFileStr(relToDir.relativeFilePath(
          QString::fromStdWString(file.getWideString())));
      return TFilePath(relFileStr.toStdWString());
    }
  };

  assert(isValid());

  if (isValid()) {
    os.openChild(l_names[MAIN_PROGRAM]);
    os << m_mainShader;
    os.closeChild();

    os.openChild(l_names[INPUT_PORTS]);
    {
      int i, iCount = int(m_ports.size());
      for (i = 0; i != iCount; ++i) {
        os.openChild(l_names[INPUT_PORT]);
        os << m_ports[i];
        os.closeChild();
      }

      if (m_portsShader.isValid()) {
        os.openChild(l_names[PORTS_PROGRAM]);
        os << m_portsShader;
        os.closeChild();
      }
    }
    os.closeChild();

    if (m_bboxShader.isValid()) {
      os.openChild(l_names[BBOX_PROGRAM]);
      os << m_bboxShader;
      os.closeChild();
    }

    if (m_hwt != ANY) {
      os.openChild(l_names[HANDLED_WORLD_TRANSFORMS]);
      os << l_names[m_hwt];
      os.closeChild();
    }

    os.openChild(l_names[PARAMETERS]);
    {
      int p, pCount = int(m_parameters.size());
      for (p = 0; p != pCount; ++p) {
        os.openChild(l_names[PARAMETER]);
        os << m_parameters[p];
        os.closeChild();
      }
    }
    os.closeChild();
  }
}
void TLevelSet::saveFolder(TOStream &os, TFilePath folder) {
  std::map<std::string, std::string> attr;
  attr["name"]                                   = folder.getName();
  if (folder == getDefaultFolder()) attr["type"] = "default";
  os.openChild("folder", attr);
  std::vector<TFilePath> folders;
  listFolders(folders, folder);
  if (!folders.empty()) {
    for (int i = 0; i < (int)folders.size(); i++) saveFolder(os, folders[i]);
  }
  std::vector<TXshLevel *> levels;
  listLevels(levels, folder);
  if (!levels.empty()) {
    os.openChild("levels");
    for (int i = 0; i < (int)levels.size(); i++)
      if (m_saveSet.empty() || m_saveSet.count(levels[i]) > 0) os << levels[i];
    os.closeChild();
  }
  os.closeChild();
}
Exemple #5
0
void TXshMeshColumn::saveData(TOStream &os) {
  os.child("status") << getStatusWord();
  if (getOpacity() < 255) os.child("camerastand_opacity") << (int)getOpacity();

  int r0, r1;
  if (getRange(r0, r1)) {
    os.openChild("cells");
    {
      for (int r = r0; r <= r1; ++r) {
        TXshCell cell = getCell(r);
        if (cell.isEmpty()) continue;

        TFrameId fid = cell.m_frameId;
        int n = 1, inc = 0, dr = fid.getNumber();

        // If fid has no letter save more than one cell and its increment -
        // otherwise save just one cell
        if (r < r1 && fid.getLetter() == 0) {
          TXshCell cell2 = getCell(r + 1);
          TFrameId fid2  = cell2.m_frameId;

          if (cell2.m_level.getPointer() == cell.m_level.getPointer() &&
              fid2.getLetter() == 0) {
            inc = cell2.m_frameId.getNumber() - dr;
            for (++n;; ++n) {
              if (r + n > r1) break;

              cell2         = getCell(r + n);
              TFrameId fid2 = cell2.m_frameId;

              if (cell2.m_level.getPointer() != cell.m_level.getPointer() ||
                  fid2.getLetter() != 0)
                break;

              if (fid2.getNumber() != dr + n * inc) break;
            }
          }
        }

        os.child("cell") << r << n << cell.m_level.getPointer() << fid.expand()
                         << inc;
        r += n - 1;
      }
    }
    os.closeChild();
  }
}
Exemple #6
0
void TTextureMesh::saveData(TOStream &os) {
  struct locals {
    static inline bool hasNon1Rigidity(const TTextureMesh &mesh) {
      int v, vCount = int(mesh.verticesCount());
      for (v = 0; v != vCount; ++v)
        if (mesh.vertex(v).P().rigidity != 1.0) return true;
      return false;
    }
  };

  // NOTE: Primitives saved by INDEX iteration is NOT COINCIDENTAL - since
  // the lists' internal linking could have been altered to mismatch the
  // natural indexing referred to by primitives' data.

  if (m_vertices.size() != m_vertices.nodesCount() ||
      m_edges.size() != m_edges.nodesCount() ||
      m_faces.size() != m_faces.nodesCount()) {
    // Ensure the mesh is already squeezed - save a squeezed
    // copy if necessary
    TTextureMesh mesh(*this);

    mesh.squeeze();
    mesh.saveData(os);

    return;
  }

  assert(m_vertices.size() == m_vertices.nodesCount());
  assert(m_edges.size() == m_edges.nodesCount());
  assert(m_faces.size() == m_faces.nodesCount());

  // Store Vertices
  os.openChild("V");
  {
    int vCount = int(m_vertices.size());
    os << vCount;

    for (int v = 0; v != vCount; ++v) {
      TTextureMesh::vertex_type &vx = m_vertices[v];
      os << vx.P().x << vx.P().y;
    }
  }
  os.closeChild();

  // Store Edges
  os.openChild("E");
  {
    int eCount = int(m_edges.size());
    os << eCount;

    for (int e = 0; e != eCount; ++e) {
      TTextureMesh::edge_type &ed = m_edges[e];
      os << ed.vertex(0) << ed.vertex(1);
    }
  }
  os.closeChild();

  // Store Faces
  os.openChild("F");
  {
    int fCount = int(m_faces.size());
    os << fCount;

    for (int f = 0; f != fCount; ++f) {
      TTextureMesh::face_type &fc = m_faces[f];

      int e, eCount = fc.edgesCount();
      for (e = 0; e < eCount; ++e) os << fc.edge(e);
    }
  }
  os.closeChild();

  // Store rigidities
  if (locals::hasNon1Rigidity(*this)) {
    os.openChild("rigidities");
    {
      int vCount = int(m_vertices.size());
      os << vCount;

      for (int v = 0; v != vCount; ++v) os << m_vertices[v].P().rigidity;
    }
    os.closeChild();
  }
}
void CleanupParameters::saveData(TOStream &os) const
{
	CleanupParameters::LastSavedParameters.assign(this);

	os.openChild("cleanupCamera");
	m_camera.saveData(os);
	os.closeChild();

	os.openChild("cleanupPalette");
	m_cleanupPalette->saveData(os);
	os.closeChild();

	std::map<std::string, std::string> attr;
	if (m_autocenterType != AUTOCENTER_NONE) {
		attr.clear();
		attr["type"] = toString((int)m_autocenterType);
		attr["pegHoles"] = toString((int)m_pegSide);
		//attr["fieldGuide"] = toString((int)m_pegSide);
		os.openCloseChild("autoCenter", attr);
	}

	if (m_flipx || m_flipy || m_rotate != 0 //|| m_scale!=1
		|| m_offx != 0 || m_offy != 0) {
		attr.clear();
		std::string flip = std::string(m_flipx ? "x" : "") + std::string(m_flipy ? "y" : "");
		if (flip != "")
			attr["flip"] = flip;
		if (m_rotate != 0)
			attr["rotate"] = toString(m_rotate);
		//if(m_scale!=1) attr["scale"] = toString(m_scale);
		if (m_offx != 0.0)
			attr["xoff"] = toString(m_offx);
		if (m_offy != 0.0)
			attr["yoff"] = toString(m_offy);
		os.openCloseChild("transform", attr);
	}

	if (m_lineProcessingMode != lpNone) {
		attr.clear();
		attr["sharpness"] = toString(m_sharpness);
		attr["autoAdjust"] = toString((int)m_autoAdjustMode);
		attr["mode"] = (m_lineProcessingMode == lpGrey ? "grey" : "color");
		os.openCloseChild("lineProcessing", attr);
	}
	if (m_noAntialias) {
		attr.clear();
		os.openCloseChild("noAntialias", attr);
	}
	if (m_postAntialias) {
		attr.clear();
		os.openCloseChild("MLAA", attr);
	}
	attr.clear();
	attr["value"] = toString(m_despeckling);
	os.openCloseChild("despeckling", attr);
	attr.clear();
	attr["value"] = toString(m_aaValue);
	os.openCloseChild("aaValue", attr);
	attr.clear();
	attr["value"] = toString(m_closestField);
	os.openCloseChild("closestField", attr);
	attr.clear();
	attr["name"] = m_fdgInfo.m_name;
	os.openCloseChild("fdg", attr);
	attr.clear();
	if (m_path != TFilePath())
		os.child("path") << m_path;

	// attr["path"] = toString(m_path.getWideString());
	// os.openCloseChild("path", attr);

	//m_closestField = param->m_closestField;
	//m_autoAdjustMode = param->m_autoAdjustMode;
	//m_sharpness = param->m_sharpness;
	//m_transparencyCheckEnabled = param->m_transparencyCheckEnabled;
}
void TSceneProperties::saveData(TOStream &os) const
{
	if (!m_hGuides.empty()) {
		os.openChild("hGuides");
		for (int i = 0; i < (int)m_hGuides.size(); i++)
			os << m_hGuides[i];
		os.closeChild();
	}
	if (!m_vGuides.empty()) {
		os.openChild("vGuides");
		for (int i = 0; i < (int)m_vGuides.size(); i++)
			os << m_vGuides[i];
		os.closeChild();
	}

	int i;
	if (!m_cameras.empty()) {
		os.openChild("cameras");
		for (i = 0; i < (int)m_cameras.size(); i++) {
			os.openChild("camera");
			m_cameras[i]->saveData(os);
			os.closeChild();
		}
		os.closeChild();
	}

	os.openChild("outputs");
	std::vector<TOutputProperties *> outputs;
	outputs.push_back(getOutputProperties());
	outputs.push_back(getPreviewProperties());
	for (i = 0; i < (int)outputs.size(); i++) {
		TOutputProperties &out = *outputs[i];
		const TRenderSettings &rs = out.getRenderSettings();
		std::map<std::string, std::string> attr;
		attr["name"] = i == 0 ? "main" : "preview";
		os.openChild("output", attr);

		TFilePath outPath = out.getPath();
		int from, to, step;
		out.getRange(from, to, step);
		os.child("range") << from << to;
		os.child("step") << step;
		os.child("shrink") << rs.m_shrinkX;
		os.child("applyShrinkToViewer") << (rs.m_applyShrinkToViewer ? 1 : 0);
		os.child("fps") << out.getFrameRate();
		os.child("path") << outPath;
		os.child("bpp") << rs.m_bpp;
		os.child("multimedia") << out.getMultimediaRendering();
		os.child("threadsIndex") << out.getThreadIndex();
		os.child("maxTileSizeIndex") << out.getMaxTileSizeIndex();
		os.child("subcameraPrev") << (out.isSubcameraPreview() ? 1 : 0);
		os.child("stereoscopic") << (rs.m_stereoscopic ? 1 : 0) << rs.m_stereoscopicShift;

		switch (rs.m_quality) {
		case TRenderSettings::StandardResampleQuality:
			os.child("resquality") << (int)0;
			break;
		case TRenderSettings::ImprovedResampleQuality:
			os.child("resquality") << (int)1;
			break;
		case TRenderSettings::HighResampleQuality:
			os.child("resquality") << (int)2;

		case TRenderSettings::Triangle_FilterResampleQuality:
			os.child("resquality") << (int)100;
			break;
		case TRenderSettings::Mitchell_FilterResampleQuality:
			os.child("resquality") << (int)101;
			break;
		case TRenderSettings::Cubic5_FilterResampleQuality:
			os.child("resquality") << (int)102;
			break;
		case TRenderSettings::Cubic75_FilterResampleQuality:
			os.child("resquality") << (int)103;
			break;
		case TRenderSettings::Cubic1_FilterResampleQuality:
			os.child("resquality") << (int)104;
			break;
		case TRenderSettings::Hann2_FilterResampleQuality:
			os.child("resquality") << (int)105;
			break;
		case TRenderSettings::Hann3_FilterResampleQuality:
			os.child("resquality") << (int)106;
			break;
		case TRenderSettings::Hamming2_FilterResampleQuality:
			os.child("resquality") << (int)107;
			break;
		case TRenderSettings::Hamming3_FilterResampleQuality:
			os.child("resquality") << (int)108;
			break;
		case TRenderSettings::Lanczos2_FilterResampleQuality:
			os.child("resquality") << (int)109;
			break;
		case TRenderSettings::Lanczos3_FilterResampleQuality:
			os.child("resquality") << (int)110;
			break;
		case TRenderSettings::Gauss_FilterResampleQuality:
			os.child("resquality") << (int)111;
			break;
		case TRenderSettings::ClosestPixel_FilterResampleQuality:
			os.child("resquality") << (int)112;
			break;
		case TRenderSettings::Bilinear_FilterResampleQuality:
			os.child("resquality") << (int)113;
			break;
			break;
		DEFAULT:
			assert(false);
		}
		switch (rs.m_fieldPrevalence) {
		case TRenderSettings::NoField:
			os.child("fieldprevalence") << (int)0;
			break;
		case TRenderSettings::EvenField:
			os.child("fieldprevalence") << (int)1;
			break;
		case TRenderSettings::OddField:
			os.child("fieldprevalence") << (int)2;
			break;
		DEFAULT:
			assert(false);
		}
		os.child("gamma") << rs.m_gamma;
		os.child("timestretch") << rs.m_timeStretchFrom << rs.m_timeStretchTo;

		if (out.getOffset() != 0)
			os.child("offset") << out.getOffset();

		os.openChild("formatsProperties");
		std::vector<std::string> fileExtensions;
		out.getFileFormatPropertiesExtensions(fileExtensions);
		for (int i = 0; i < (int)fileExtensions.size(); i++) {
			std::string ext = fileExtensions[i];
			TPropertyGroup *pg = out.getFileFormatProperties(ext);
			assert(pg);
			std::map<std::string, std::string> attr;
			attr["ext"] = ext;
			os.openChild("formatProperties", attr);
			pg->saveData(os);
			os.closeChild();
		}
		os.closeChild();

		os.closeChild(); // </output>
	}
	os.closeChild();
	os.openChild("cleanupParameters");
	m_cleanupParameters->saveData(os);
	os.closeChild();
	os.openChild("scanParameters");
	m_scanParameters->saveData(os);
	os.closeChild();
	os.openChild("vectorizerParameters");
	m_vectorizerParameters->saveData(os);
	os.closeChild();
	os.child("bgColor") << m_bgColor;
	os.child("markers") << m_markerDistance << m_markerOffset;
	os.child("subsampling") << m_fullcolorSubsampling << m_tlvSubsampling;
	os.child("fieldguide") << m_fieldGuideSize << m_fieldGuideAspectRatio;

	os.openChild("noteColors");
	for (i = 0; i < m_notesColor.size(); i++)
		os << m_notesColor.at(i);
	os.closeChild();
}