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; }
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; } } } }
bool AirSpring::init(void) { mPositionPort = getInputPort(0)->toRealPortHandle(); if (!mPositionPort.isConnected()) { Log(Model, Error) << "Initialization of AirSpring model \"" << getName() << "\" failed: Input port \"" << getInputPortName(0) << "\" is not connected!" << endl; return false; } mVelocityPort = getInputPort(1)->toRealPortHandle(); if (!mVelocityPort.isConnected()) { Log(Model, Error) << "Initialization of AirSpring model \"" << getName() << "\" failed: Input port \"" << getInputPortName(1) << "\" is not connected!" << endl; return false; } return Model::init(); }
bool DeadBand::init(void) { mInputPort = getInputPort(0)->toRealPortHandle(); if (!mInputPort.isConnected()) { Log(Model, Error) << "Initialization of DeadBand model \"" << getName() << "\" failed: Input port \"" << getInputPortName(0) << "\" is not connected!" << endl; return false; } return Model::init(); }
bool Launchbar::init(void) { mState = Unmounted; mAngleCommand = mUpAngle; mTryMountPort = getInputPort(0)->toRealPortHandle(); if (!mTryMountPort.isConnected()) { Log(Model, Error) << "Initialization of Launchbar model \"" << getName() << "\" failed: Input port \"" << getInputPortName(0) << "\" is not connected!" << std::endl; return false; } mLaunchCommandPort = getInputPort(1)->toRealPortHandle(); if (!mLaunchCommandPort.isConnected()) { Log(Model, Error) << "Initialization of Launchbar model \"" << getName() << "\" failed: Input port \"" << getInputPortName(1) << "\" is not connected!" << std::endl; return false; } return ExternalForce::init(); }
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. } } } } }
bool Bias::init(void) { // Invalidate outputs mOutput.resize(0, 0); mInputPort = getInputPort(0)->toMatrixPortHandle(); if (!mInputPort.isConnected()) { Log(Model, Error) << "Initialization of Bias model \"" << getName() << "\" failed: Input port \"" << getInputPortName(0) << "\" is not connected!" << endl; return false; } // Size compatibility check if (size(mInputPort.getMatrixValue()) != size(mBias)) { Log(Model, Error) << "Input port of \"" << getName() << "\", does not " << "match the size of the bias property" << endl; return false; } mOutput.resize(mInputPort.getMatrixValue()); return Model::init(); }
bool Iwa_TiledParticlesFx::allowUserCacheOnPort(int portNum) { // Only control port are currently allowed to cache upon explicit user's request std::string tmpName = getInputPortName(portNum); return tmpName.find("Control") != std::string::npos; }