Exemplo n.º 1
0
TFx *TExternalProgramFx::clone(bool recursive) const {
  TExternalProgramFx *fx =
      dynamic_cast<TExternalProgramFx *>(TExternFx::create(m_externFxName));
  assert(fx);
  // new TExternalProgramFx();
  // fx->setExecutable(m_executablePath, m_args);

  // copia della time region
  fx->setActiveTimeRegion(getActiveTimeRegion());
  // fx->m_imp->m_activeTimeRegion = m_imp->m_activeTimeRegion;

  fx->getParams()->copy(getParams());

  assert(getInputPortCount() == fx->getInputPortCount());

  // std::map<std::string, Port>::const_iterator j;
  // for(j=m_ports.begin(); j!=m_ports.end(); ++j)
  //  fx->addPort(j->first, j->second.m_ext, j->second.m_port != 0);

  // copia ricorsiva sulle porte
  if (recursive) {
    for (int i = 0; i < getInputPortCount(); ++i) {
      TFxPort *port = getInputPort(i);
      if (port->getFx())
        fx->connect(getInputPortName(i), port->getFx()->clone(true));
    }
  }

  // std::map<std::string, TParamP>::const_iterator j;
  // for(j=m_params.begin(); j!=m_params.end(); ++j)
  //  fx->addParam(j->first, j->second->clone());

  return fx;
}
Exemplo n.º 2
0
std::string Iwa_TiledParticlesFx::getAlias(double frame, const TRenderSettings &info) const
{
	std::string alias = getFxType();
	alias += "[";

	// alias degli effetti connessi alle porte di input separati da virgole
	// una porta non connessa da luogo a un alias vuoto (stringa vuota)
	for (int i = 0; i < getInputPortCount(); ++i) {
		TFxPort *port = getInputPort(i);
		if (port->isConnected()) {
			TRasterFxP ifx = port->getFx();
			assert(ifx);
			alias += ifx->getAlias(frame, info);
		}
		alias += ",";
	}

	std::string paramalias("");
	for (int i = 0; i < getParams()->getParamCount(); ++i) {
		TParam *param = getParams()->getParam(i);
		paramalias += param->getName() + "=" + param->getValueAlias(frame, 3);
	}

	return alias + toString(frame) + "," + toString(getIdentifier()) + paramalias + "]";
}
Exemplo n.º 3
0
void TMacroFx::compatibilityTranslatePort(int major, int minor, std::string &portName)
{
	// Reroute translation to the actual fx associated to the port
	const std::string &fxId = portName.substr(portName.find_last_of('_') + 1,
											  std::string::npos);

	if (TFx *fx = getFxById(toWideString(fxId))) {
		size_t opnEnd = portName.find_first_of('_');

		std::string originalPortName = portName.substr(0, opnEnd);
		fx->compatibilityTranslatePort(major, minor, originalPortName);

		portName.replace(0, opnEnd, originalPortName);
	}

	// Seems that at a certain point, the port name got extended...
	if (VersionNumber(major, minor) == VersionNumber(1, 16)) {
		for (int i = 0; i < getInputPortCount(); ++i) {
			const std::string &name = getInputPortName(i);
			if (name.find(portName) != string::npos) {
				portName = name;
				break;
			}
		}
	}
}
Exemplo n.º 4
0
string TMacroFx::getAlias(double frame, const TRenderSettings &info) const
{
	string alias = getFxType();
	alias += "[";

	// alias degli effetti connessi alle porte di input separati da virgole
	// una porta non connessa da luogo a un alias vuoto (stringa vuota)
	int i;
	for (i = 0; i < getInputPortCount(); i++) {
		TFxPort *port = getInputPort(i);
		if (port->isConnected()) {
			TRasterFxP ifx = port->getFx();
			assert(ifx);
			alias += ifx->getAlias(frame, info);
		}
		alias += ",";
	}

	// alias dei valori dei parametri dell'effetto al frame dato
	for (int j = 0; j < (int)m_fxs.size(); j++) {
		alias += (j == 0) ? "(" : ",(";
		for (i = 0; i < m_fxs[j]->getParams()->getParamCount(); i++) {
			if (i > 0)
				alias += ",";
			TParam *param = m_fxs[j]->getParams()->getParam(i);
			alias += param->getName() + "=" + param->getValueAlias(frame, 2);
		}
		alias += ")";
	}

	alias += "]";
	return alias;
}
Exemplo n.º 5
0
std::string TGeometryFx::getAlias(double frame,
                                  const TRenderSettings &info) const {
  TGeometryFx *tthis = const_cast<TGeometryFx *>(this);
  TAffine affine     = tthis->getPlacement(frame);

  std::string alias = getFxType();
  alias += "[";

  // alias degli effetti connessi alle porte di input separati da virgole
  // una porta non connessa da luogo a un alias vuoto (stringa vuota)

  for (int i = 0; i < getInputPortCount(); ++i) {
    TFxPort *port = getInputPort(i);
    if (port->isConnected()) {
      TRasterFxP ifx = port->getFx();
      assert(ifx);
      alias += ifx->getAlias(frame, info);
    }
    alias += ",";
  }

  return alias +
         (areAlmostEqual(affine.a11, 0) ? "0" : ::to_string(affine.a11, 5)) +
         "," +
         (areAlmostEqual(affine.a12, 0) ? "0" : ::to_string(affine.a12, 5)) +
         "," +
         (areAlmostEqual(affine.a13, 0) ? "0" : ::to_string(affine.a13, 5)) +
         "," +
         (areAlmostEqual(affine.a21, 0) ? "0" : ::to_string(affine.a21, 5)) +
         "," +
         (areAlmostEqual(affine.a22, 0) ? "0" : ::to_string(affine.a22, 5)) +
         "," +
         (areAlmostEqual(affine.a23, 0) ? "0" : ::to_string(affine.a23, 5)) +
         "]";
}
Exemplo n.º 6
0
void TRasterFx::compute(TFlash &flash, int frame) {
  for (int i = getInputPortCount() - 1; i >= 0; i--) {
    TFxPort *port = getInputPort(i);

    if (port->isConnected() && !port->isaControlPort()) {
      flash.pushMatrix();
      ((TRasterFxP)(port->getFx()))->compute(flash, frame);
      flash.popMatrix();
    }
  }
}
Exemplo n.º 7
0
void Iwa_TiledParticlesFx::doDryCompute(TRectD &rect, double frame, const TRenderSettings &info)
{
	Iwa_ParticlesManager *pc = Iwa_ParticlesManager::instance();
	unsigned long fxId = getIdentifier();
	int inputPortCount = getInputPortCount();

	int i,
		j,
		curr_frame = frame,					   /*- 現在のフレーム -*/
		startframe = startpos_val->getValue(); /*- Particesの開始フレーム -*/

	TRenderSettings infoOnInput(info);
	infoOnInput.m_affine = TAffine(); // Using the standard reference - indep. from cameras.
	infoOnInput.m_bpp = 64;			  // Control ports rendered at 32 bit - since not visible.

	for (i = startframe - 1; i <= curr_frame; ++i) {
		double frame = tmax(0, i);

		for (j = 0; j < inputPortCount; ++j) {
			TFxPort *port = getInputPort(j);
			std::string tmpName = getInputPortName(j);
			if (port->isConnected()) {
				TRasterFxP fx = port->getFx();

				// Now, consider that source ports work different than control ones
				QString portName = QString::fromStdString(tmpName);
				if (portName.startsWith("C")) {
					// Control ports are calculated from start to current frame, since
					// particle mechanics at current frame is influenced by previous ones
					// (and therefore by all previous control images).

					TRectD bbox;
					fx->getBBox(frame, bbox, infoOnInput);
					if (bbox == TConsts::infiniteRectD)
						bbox = info.m_affine.inv() * rect;
					fx->dryCompute(bbox, frame, infoOnInput);
				} else if (portName.startsWith("T")) {
					// Particles handle source ports caching procedures on its own.
				}
			}
		}
	}
}