本文整理汇总了C++中TFx类的典型用法代码示例。如果您正苦于以下问题:C++ TFx类的具体用法?C++ TFx怎么用?C++ TFx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undo
void undo() const {
FxDag *fxDag =
TApp::instance()->getCurrentXsheet()->getXsheet()->getFxDag();
int i, j;
for (i = 0; i < (int)m_fxs.size(); i++) {
TApp::instance()->getCurrentFx()->setFx(m_fxs[i].m_fx.getPointer());
TFxCommand::addFx(m_fxs[i].m_fx.getPointer());
}
for (i = 0; i < (int)m_fxs.size(); i++) {
const Node &node = m_fxs[i];
TFx *fx = node.m_fx.getPointer();
if (node.m_xsheetConnected) fxDag->addToXsheet(fx);
for (j = 0; j < (int)node.m_inputLinks.size(); j++)
fx->getInputPort(j)->setFx(node.m_inputLinks[j].getPointer());
for (j = 0; j < (int)node.m_outputLinks.size(); j++) {
TFx *outFx = node.m_outputLinks[j].second.getPointer();
outFx->getInputPort(node.m_outputLinks[j].first)->setFx(fx);
}
}
for (i = 0; i < (int)m_inputConnectedToXsheet.size(); i++) {
TFx *inputFx = m_inputConnectedToXsheet[i].getPointer();
fxDag->getTerminalFxs()->removeFx(inputFx);
}
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
示例2: assert
void TColumnDataElement::storeColumn(TXsheet *xsh, int index, int fxFlags)
{
if (index < 0)
return;
bool doClone = (fxFlags & eDoClone);
bool resetFxDagPositions = (fxFlags & eResetFxDagPositions);
// Fetch the specified column (if none, return)
TStageObject *obj = xsh->getStageObject(TStageObjectId::ColumnId(index));
assert(obj);
TXshColumn *column = xsh->getColumn(index);
if (!column)
return;
TFx *fx = column->getFx();
TPointD dagPos;
if (fx)
dagPos = fx->getAttributes()->getDagNodePos();
if (doClone)
column = column->clone(); // Zerary fxs clone the associated fx (drawn levels do not)
if (fx && !resetFxDagPositions)
column->getFx()->getAttributes()->setDagNodePos(dagPos);
m_column = column;
storeObject(obj->getId(), xsh);
}
示例3:
//!Build the scene fx for each node below the xsheet one.
//!Remember that left xsheet ports must not be expanded.
void MultimediaRenderer::Imp::scanSceneForLayers()
{
//Retrieve the terminal fxs (ie, fxs which are implicitly
//connected to the xsheet one)
TXsheet *xsh = m_scene->getXsheet();
TFxSet *fxs = xsh->getFxDag()->getTerminalFxs();
//Examine all of them and - eventually - expand left xsheet
//ports (ie fx nodes who allow implicit overlaying)
for (int i = 0; i < fxs->getFxCount(); ++i) {
TFx *fx = fxs->getFx(i);
TFxPort *leftXSheetPort;
retry:
if (!fx)
continue;
leftXSheetPort = fx->getXsheetPort();
if (!leftXSheetPort) {
m_fxsToRender.addFx(fx);
continue;
}
//If the leftXSheetPort is not connected, retry on port 0
if (leftXSheetPort->isConnected())
m_fxsToRender.addFx(fx);
else {
fx = fx->getInputPort(0)->getFx();
goto retry;
}
}
}
示例4: getFx
void FxKeyframeNavigator::toggle() {
TFx *fx = getFx();
if (!fx) return;
int i, paramCount = fx->getParams()->getParamCount();
// determino in quale caso ci troviamo:
// il frame corrente non e' keyframe di nessun parametro (isKeyframe=false),
// di qualche parametro o di tutti i parametri (isFullKeyframe=true)
bool isFullKeyframe = true;
bool isKeyframe = false;
int frame = getCurrentFrame();
for (i = 0; i < paramCount; i++) {
TParamP param = fx->getParams()->getParam(i);
if (!param->isAnimatable()) continue;
if (param->isKeyframe(frame))
isKeyframe = true;
else
isFullKeyframe = false;
}
if (!isKeyframe) isFullKeyframe = false;
// modifico lo stato: nokeyframe->full, full->no, partial->full
bool on = !isKeyframe || isKeyframe && !isFullKeyframe;
for (i = 0; i < fx->getParams()->getParamCount();
i++) { // TODO. spostare questo codice in TParam
TParamP param = fx->getParams()->getParam(i);
if (TDoubleParamP dp = param) {
if (on)
dp->setValue(frame, dp->getValue(frame));
else
dp->deleteKeyframe(frame);
} else if (TRangeParamP rp = param) {
if (on)
rp->setValue(frame, rp->getValue(frame));
else
rp->deleteKeyframe(frame);
} else if (TPointParamP pp = param) {
if (on)
pp->setValue(frame, pp->getValue(frame));
else
pp->deleteKeyframe(frame);
} else if (TPixelParamP pip = param) {
if (on)
pip->setValue(frame, pip->getValue(frame));
else
pip->deleteKeyframe(frame);
} else if (TSpectrumParamP sp = param) {
if (on)
sp->setValue(frame, sp->getValue(frame), false);
else
sp->deleteKeyframe(frame);
} else if (TToneCurveParamP tcp = param) {
if (on)
tcp->setValue(frame, tcp->getValue(frame), false);
else
tcp->deleteKeyframe(frame);
}
}
m_fxHandle->notifyFxChanged();
}
示例5: getFxs
void FxsData::getFxs(QList<TFxP> &fxs, QMap<TFx *, int> &zeraryFxColumnSize,
QList<TXshColumnP> &columns) const {
QMap<TFx *, TFx *> clonedFxs;
for (int i = 0; i < m_fxs.size(); i++) {
TFx *clonedFx = m_fxs[i]->clone(false);
TPointD pos = m_fxs[i]->getAttributes()->getDagNodePos();
clonedFx->getAttributes()->setDagNodePos(pos);
clonedFx->getAttributes()->removeFromAllGroup();
fxs.append(clonedFx);
if (m_fxs[i]->isZerary())
zeraryFxColumnSize[clonedFx] =
m_zeraryFxColumnSize[m_fxs[i].getPointer()];
clonedFxs[m_fxs[i].getPointer()] = clonedFx;
TFx *linkedFx = m_fxs[i]->getLinkedFx();
if (linkedFx && clonedFxs.contains(linkedFx))
clonedFx->linkParams(clonedFxs[linkedFx]);
}
QList<TXshColumnP>::const_iterator it;
for (it = m_columns.begin(); it != m_columns.end(); it++) {
TXshColumn *col = it->getPointer();
TXshColumn *newCol = col->clone();
newCol->getFx()->getAttributes()->setDagNodePos(
col->getFx()->getAttributes()->getDagNodePos());
columns.append(newCol);
clonedFxs[col->getFx()] = newCol->getFx();
}
linkFxs(clonedFxs);
}
示例6: isColumnEmpty
bool TXsheet::setCell(int row, int col, const TXshCell &cell) {
if (row < 0 || col < 0) return false;
bool wasColumnEmpty = isColumnEmpty(col);
TXshCellColumn *cellColumn;
if (!cell.isEmpty()) {
TXshLevel *level = cell.m_level.getPointer();
assert(level);
int levelType = level->getType();
TXshColumn::ColumnType type = TXshColumn::eLevelType;
if (levelType == SND_XSHLEVEL)
type = TXshColumn::eSoundType;
else if (levelType == SND_TXT_XSHLEVEL)
type = TXshColumn::eSoundTextType;
else if (levelType == PLT_XSHLEVEL)
type = TXshColumn::ePaletteType;
else if (levelType == ZERARYFX_XSHLEVEL)
type = TXshColumn::eZeraryFxType;
else if (levelType == MESH_XSHLEVEL)
type = TXshColumn::eMeshType;
cellColumn = touchColumn(col, type)->getCellColumn();
} else {
TXshColumn *column = getColumn(col);
cellColumn = column ? column->getCellColumn() : 0;
}
if (!cellColumn || cellColumn->isLocked()) return false;
cellColumn->setXsheet(this);
if (!cellColumn->setCell(row, cell)) {
if (wasColumnEmpty) {
removeColumn(col);
insertColumn(col);
}
return false;
}
TFx *fx = cellColumn->getFx();
if (wasColumnEmpty && fx && fx->getOutputConnectionCount() == 0 &&
cellColumn->getPaletteColumn() == 0)
getFxDag()->addToXsheet(fx);
if (cell.isEmpty())
updateFrameCount();
else if (row >= m_imp->m_frameCount)
m_imp->m_frameCount = row + 1;
TNotifier::instance()->notify(TXsheetChange());
return true;
}
示例7: locker
void SwatchCacheManager::setFx(const TFxP &fx)
{
QMutexLocker locker(&m_mutex);
//Update the fxs id data
if (fx == TFxP()) {
//Clear if no fx is set
m_setFxId = 0;
m_childrenFxIds.clear();
} else {
m_setFxId = fx->getIdentifier();
m_childrenFxIds.clear();
assert(m_setFxId != 0);
TRasterFx *rfx = dynamic_cast<TRasterFx *>(fx.getPointer());
assert(rfx);
for (int i = 0; i < fx->getInputPortCount(); ++i) {
//Fxs not allowing cache on the input port are skipped
if (!rfx->allowUserCacheOnPort(i))
continue;
TFxPort *iport = fx->getInputPort(i);
if (iport && iport->isConnected()) {
TFx *child = iport->getFx();
//In the zerary case, extract the actual fx
TZeraryColumnFx *zcfx = dynamic_cast<TZeraryColumnFx *>(child);
if (zcfx)
child = zcfx->getZeraryFx();
assert(child && child->getIdentifier() != 0);
m_childrenFxIds.insert(child->getIdentifier());
}
}
}
//NOTE: Check if this should be avoided in some case...
//Release the locks and clear the resources
if (m_currEditedFxResult)
m_currEditedFxResult->releaseLock();
m_currEditedFxResult = TCacheResourceP();
std::set<TCacheResourceP>::iterator it;
for (it = m_swatchCacheContainer.begin(); it != m_swatchCacheContainer.end(); ++it)
(*it)->releaseLock();
m_swatchCacheContainer.clear();
#ifdef USE_SQLITE_HDPOOL
TCacheResourcePool::instance()->releaseReferences("S");
#else
for (it = m_genericCacheContainer.begin(); it != m_genericCacheContainer.end(); ++it)
(*it)->releaseLock();
m_genericCacheContainer.clear();
#endif
}
示例8: clones
TFx *TMacroFx::clone(bool recursive) const
{
int n = m_fxs.size();
vector<TFxP> clones(n);
std::map<TFx *, int> table;
std::map<TFx *, int>::iterator it;
int i, rootIndex = -1;
// nodi
for (i = 0; i < n; ++i) {
TFx *fx = m_fxs[i].getPointer();
assert(fx);
clones[i] = fx->clone(false);
assert(table.count(fx) == 0);
table[fx] = i;
if (fx == m_root.getPointer())
rootIndex = i;
TFx *linkedFx = fx->getLinkedFx();
if (linkedFx && table.find(linkedFx) != table.end())
clones[i]->linkParams(clones[table[linkedFx]].getPointer());
}
assert(rootIndex >= 0);
// connessioni
for (i = 0; i < n; i++) {
TFx *fx = m_fxs[i].getPointer();
for (int j = 0; j < fx->getInputPortCount(); j++) {
TFxPort *port = fx->getInputPort(j);
TFx *inputFx = port->getFx();
if (!inputFx)
continue;
it = table.find(inputFx);
if (it == table.end()) {
// il j-esimo input di fx e' esterno alla macro
if (recursive)
clones[i]->connect(fx->getInputPortName(j), inputFx->clone(true));
} else {
// il j-esimo input di fx e' interno alla macro
clones[i]->connect(fx->getInputPortName(j), clones[it->second].getPointer());
}
}
}
//TFx *rootClone =
// const_cast<TMacroFx*>(this)->
// clone(m_root.getPointer(), recursive, visited, clones);
TMacroFx *clone = TMacroFx::create(clones);
clone->setName(getName());
clone->setFxId(getFxId());
//Copy the index of the passive cache manager.
clone->getAttributes()->passiveCacheDataIdx() = getAttributes()->passiveCacheDataIdx();
assert(clone->getRoot() == clones[rootIndex].getPointer());
return clone;
}
示例9:
TFx *TMacroFx::getFxById(const wstring &id) const
{
int i;
for (i = 0; i < (int)m_fxs.size(); i++) {
TFx *fx = m_fxs[i].getPointer();
if (fx->getFxId() == id)
return fx;
}
return 0;
}
示例10: clearAll
void TXsheet::loadData(TIStream &is) {
clearAll();
TStageObjectId cameraId = TStageObjectId::CameraId(0);
TStageObject *firstCamera = getStageObject(cameraId);
m_imp->m_pegTree->removeStageObject(cameraId);
int col = 0;
string tagName;
while (is.openChild(tagName)) {
if (tagName == "columns") {
while (!is.eos()) {
TPersist *p = 0;
is >> p;
TXshColumn *column = dynamic_cast<TXshColumn *>(p);
if (!column) throw TException("expected xsheet column");
m_imp->m_columnSet.insertColumn(col++, column);
column->setXsheet(this);
if (TXshZeraryFxColumn *zc =
dynamic_cast<TXshZeraryFxColumn *>(column)) {
TFx *fx = zc->getZeraryColumnFx()->getZeraryFx();
int fxTypeCount = m_imp->m_fxDag->getFxTypeCount(fx);
int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
m_imp->m_fxDag->updateFxTypeTable(fx, maxFxTypeId);
m_imp->m_fxDag->updateFxIdTable(fx);
for (int j = 0; j < fx->getParams()->getParamCount(); j++) {
TParam *param = fx->getParams()->getParam(j);
if (TDoubleParam *dp = dynamic_cast<TDoubleParam *>(param))
getStageObjectTree()->setGrammar(dp);
else if (dynamic_cast<TPointParam *>(param) ||
dynamic_cast<TRangeParam *>(param) ||
dynamic_cast<TPixelParam *>(param)) {
TParamSet *paramSet = dynamic_cast<TParamSet *>(param);
assert(paramSet);
int f;
for (f = 0; f < paramSet->getParamCount(); f++) {
TDoubleParam *dp = dynamic_cast<TDoubleParam *>(
paramSet->getParam(f).getPointer());
if (!dp) continue;
getStageObjectTree()->setGrammar(dp);
}
}
}
}
}
} else if (tagName == "pegbars") {
TPersist *p = m_imp->m_pegTree;
is >> *p;
} else if (tagName == "fxnodes") {
示例11: clearGadgets
void FxGadgetController::onFxSwitched() {
clearGadgets();
bool enabled = false;
TFx *fx = m_fxHandle ? m_fxHandle->getFx() : 0;
if (fx) {
int referenceColumnIndex = fx->getReferenceColumnIndex();
if (referenceColumnIndex == -1) {
TObjectHandle *oh = m_tool->getApplication()->getCurrentObject();
if (!oh->getObjectId().isCamera()) {
oh->setObjectId(TStageObjectId::CameraId(0));
}
enabled = true;
} else if (referenceColumnIndex == m_tool->getColumnIndex())
enabled = true;
}
if (fx && enabled) {
m_editingNonZeraryFx = true;
TZeraryColumnFx *zfx = 0;
if ((zfx = dynamic_cast<TZeraryColumnFx *>(fx)) ||
dynamic_cast<TLevelColumnFx *>(fx))
// WARNING! quick patch for huge bug: I added the || with TLevelColumnFx;
// before, the levels were considered as nonZeraryFx and the edit tool
// gadget was not displayed! Vinz
{
if (zfx) fx = zfx->getZeraryFx();
m_editingNonZeraryFx = false;
}
// Parse the UI Concepts returned by the fx
TParamUIConcept *uiConcepts = 0;
int i, count;
fx->getParamUIs(uiConcepts, count);
for (i = 0; i < count; ++i) {
FxGadget *gadget = allocateGadget(uiConcepts[i]);
if (gadget) addGadget(gadget);
}
delete[] uiConcepts;
} else
m_editingNonZeraryFx = false;
m_tool->invalidate();
}
示例12: m_zeraryColumnFx
TXshZeraryFxColumn::TXshZeraryFxColumn(const TXshZeraryFxColumn &src)
: m_zeraryColumnFx(new TZeraryColumnFx()), m_zeraryFxLevel(new TXshZeraryFxLevel())
{
m_zeraryColumnFx->addRef();
m_zeraryColumnFx->setColumn(this);
m_zeraryFxLevel->addRef();
m_zeraryFxLevel->setColumn(this);
m_first = src.m_first;
int i;
for (i = 0; i < (int)src.m_cells.size(); i++)
m_cells.push_back(TXshCell(m_zeraryFxLevel, src.m_cells[i].getFrameId()));
assert((int)src.m_cells.size() == (int)m_cells.size());
TFx *fx = src.getZeraryColumnFx()->getZeraryFx();
if (fx) {
wstring fxName = fx->getName();
fx = fx->clone(false);
fx->setName(fxName);
m_zeraryColumnFx->setZeraryFx(fx);
}
}
示例13:
StageObjectsData::~StageObjectsData()
{
int i, elementsCount = m_elements.size();
for (i = 0; i < elementsCount; ++i)
delete m_elements[i];
for (i = 0; i < m_splines.size(); ++i)
delete m_splines[i];
std::set<TFx *>::iterator it;
for (it = m_fxs.begin(); it != m_fxs.end(); ++it) {
TFx *fx = *it;
if (fx)
fx->release();
}
for (it = m_terminalFxs.begin(); it != m_terminalFxs.end(); ++it) {
TFx *fx = *it;
if (fx)
fx->release();
}
}
示例14: createFx
void AddFxContextMenu::onAddFx(QAction *action)
{
if (action->isCheckable() && action->isChecked())
action->setChecked(false);
TFx *fx = createFx(action, m_app->getCurrentXsheet());
if (fx) {
QList<TFxP> fxs = m_selection->getFxs();
// try to add node at cursor position
if (m_currentCursorScenePos.x() != 0 || m_currentCursorScenePos.y() != 0) {
fx->getAttributes()->setDagNodePos(TPointD(m_currentCursorScenePos.x(), m_currentCursorScenePos.y()));
m_currentCursorScenePos.setX(0);
m_currentCursorScenePos.setY(0);
}
TFxCommand::addFx(fx, fxs, m_app,
m_app->getCurrentColumn()->getColumnIndex(), m_app->getCurrentFrame()->getFrameIndex());
m_app->getCurrentXsheet()->notifyXsheetChanged();
//memorize the latest operation
m_app->getCurrentFx()->setPreviousActionString(QString("A ") + action->data().toString());
}
}
示例15: DeleteFxsUndo
DeleteFxsUndo(const QList<TFx *> &fxs) {
TApp *app = TApp::instance();
FxDag *fxDag = app->getCurrentXsheet()->getXsheet()->getFxDag();
for (int i = 0; i < (int)fxs.size(); i++) {
TFx *fx = fxs[i];
TZeraryColumnFx *zfx = dynamic_cast<TZeraryColumnFx *>(fx);
if (zfx) fx = zfx->getZeraryFx();
Node node;
node.m_fx = fx;
node.m_xsheetConnected = fxDag->getTerminalFxs()->containsFx(fx);
int j;
for (j = 0; j < fx->getInputPortCount(); j++) {
TFxP inputFx(fx->getInputPort(j)->getFx());
int i;
if (inputFx &&
!fxDag->getTerminalFxs()->containsFx(inputFx.getPointer())) {
for (i = 0; i < (int)m_inputConnectedToXsheet.size(); i++)
if (m_inputConnectedToXsheet[i].getPointer() ==
inputFx.getPointer())
break;
if (i == (int)m_inputConnectedToXsheet.size())
m_inputConnectedToXsheet.push_back(inputFx);
}
node.m_inputLinks.push_back(inputFx);
}
for (j = 0; j < fx->getOutputConnectionCount(); j++) {
TFxPort *port = fx->getOutputConnection(j);
TFx *outFx = port->getOwnerFx();
if (outFx) {
int k;
for (k = 0; k < outFx->getInputPortCount(); k++)
if (outFx->getInputPort(k)->getFx() == fx) break;
if (k < outFx->getInputPortCount())
node.m_outputLinks.push_back(std::make_pair(k, TFxP(outFx)));
}
}
m_fxs.push_back(node);
}
}