当前位置: 首页>>代码示例>>C++>>正文


C++ TStageObject::getSpline方法代码示例

本文整理汇总了C++中TStageObject::getSpline方法的典型用法代码示例。如果您正苦于以下问题:C++ TStageObject::getSpline方法的具体用法?C++ TStageObject::getSpline怎么用?C++ TStageObject::getSpline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TStageObject的用法示例。


在下文中一共展示了TStageObject::getSpline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: restoreColumn

TStageObjectId TColumnDataElement::restoreColumn(TXsheet *xsh, int index, int fxFlags, bool copyPosition) const
{
	bool doClone = (fxFlags & eDoClone);
	bool resetFxDagPositions = (fxFlags & eResetFxDagPositions);

	TXshColumn *column = m_column.getPointer();

	// The xsheet 'changes' if a new column is inserted. If it was already there, no.
	bool xsheetChange = false;
	if (column && column->getXsheet() && column->getXsheet() != xsh)
		xsheetChange = true;

	// Insert a column at the specified index. If a column was stored, insert that one.
	TPointD dagPos = TConst::nowhere;
	if (column) {
		if (column->getFx())
			dagPos = column->getFx()->getAttributes()->getDagNodePos();
		if (doClone)
			column = column->clone();
		xsh->insertColumn(index, column);
	} else
		xsh->insertColumn(index); // Create a new one otherwise

	if (!resetFxDagPositions && dagPos != TConst::nowhere) {
		// Don't accept the default position (fx object)
		TXshColumn *restoredColumn = xsh->getColumn(index);
		restoredColumn->getFx()->getAttributes()->setDagNodePos(dagPos);
	}

	// Retrieve the newly inserted column stage object
	TStageObject *obj = xsh->getStageObject(TStageObjectId::ColumnId(index));
	assert(obj);
	obj->assignParams(m_params, doClone); // Assign the stored params

	if (copyPosition)
		obj->setDagNodePos(m_dagPos);

	// Clone the associated curve if any
	if (xsheetChange && obj->getSpline()) {
		TStageObjectSpline *srcSpl = obj->getSpline();
		TStageObjectSpline *dstSpl = xsh->getStageObjectTree()->createSpline();
		dstSpl->addRef();
		dstSpl->setStroke(new TStroke(*srcSpl->getStroke()));
		obj->setSpline(dstSpl);
	}

	int gridType = xsh->getStageObjectTree()->getDagGridDimension();
	obj->setIsOpened(gridType == 0); // gridType is 0 if the node is opened, 1 if closed
									 // see StageSchematicScene::GridDimension
									 // TODO: Should be made PUBLIC!!

	xsh->updateFrameCount();
	return obj->getId();
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:54,代码来源:stageobjectsdata.cpp

示例2: onObjectSwitched

void TApp::onObjectSwitched() {
  if (m_currentObject->isSpline()) {
    TXsheet *xsh = m_currentXsheet->getXsheet();
    TStageObject *currentObject =
        xsh->getStageObject(m_currentObject->getObjectId());
    TStageObjectSpline *ps = currentObject->getSpline();
    m_currentObject->setSplineObject(ps);
  } else
    m_currentObject->setSplineObject(0);
  onImageChanged();
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:11,代码来源:tapp.cpp

示例3: notifyImageChanged

/*! Notify change of current image: update icon and notify level change.
    If current object is a spline commit spline chenged.
    If current mode is EditingLevel touch current frame.
*/
void TTool::notifyImageChanged() {
  onImageChanged();

  if (!m_application) return;

  m_application->getCurrentScene()->setDirtyFlag(true);
  if (m_application->getCurrentFrame()->isEditingLevel()) {
    TXshLevel *xl = m_application->getCurrentLevel()->getLevel();
    if (!xl) return;
    TXshSimpleLevel *sl = xl->getSimpleLevel();
    if (!sl) return;
    TFrameId fid = m_application->getCurrentFrame()->getFid();
    sl->touchFrame(fid);
    // sl->setDirtyFlag(true);
    IconGenerator::instance()->invalidate(sl, fid);
    IconGenerator::instance()->invalidateSceneIcon();
  } else {
    TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet();
    if (!xsh) return;

    TObjectHandle *currentObject = m_application->getCurrentObject();

    if (currentObject->isSpline()) {
      m_application->getCurrentObject()->commitSplineChanges();
      TStageObject *pegbar = xsh->getStageObject(currentObject->getObjectId());
      IconGenerator::instance()->invalidate(pegbar->getSpline());
    } else {
      int row = m_application->getCurrentFrame()->getFrame();
      int col = m_application->getCurrentColumn()->getColumnIndex();
      if (col < 0) return;
      TXshCell cell       = xsh->getCell(row, col);
      TXshSimpleLevel *sl = cell.getSimpleLevel();
      if (sl) {
        IconGenerator::instance()->invalidate(sl, cell.m_frameId);
        sl->touchFrame(cell.m_frameId);
        IconGenerator::instance()->invalidateSceneIcon();
      }
    }
  }
  m_application->getCurrentLevel()->notifyLevelChange();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:45,代码来源:tool.cpp

示例4: if


//.........这里部分代码省略.........
					else
						linkedFx->getAttributes()->setDagNodePos(oldLinkedFx->getAttributes()->getDagNodePos());

					xsh->getFxDag()->assignUniqueId(linkedFx);
				} else
					linkedFx = oldLinkedFx;

				fxTable[oldLinkedFx] = linkedFx;

				xsh->getFxDag()->getInternalFxs()->addFx(linkedFx);
				if (m_terminalFxs.count(oldLinkedFx) > 0)
					xsh->getFxDag()->getTerminalFxs()->addFx(linkedFx);

				if (!doClone) {
					int fxTypeCount = xsh->getFxDag()->getFxTypeCount(linkedFx);
					int maxFxTypeId = std::max(fxTypeCount, linkedFx->getAttributes()->getId());
					xsh->getFxDag()->updateFxTypeTable(linkedFx, maxFxTypeId);
					xsh->getFxDag()->updateFxIdTable(linkedFx);
				}
			}
		}
	}

	// Update the link, like in functions above
	if (!fxTable.empty() && doClone)
		updateFxLinks(fxTable);

	// Paste any associated spline (not stored im m_splines)
	std::map<TStageObjectSpline *, TStageObjectSpline *> splines;
	for (i = 0; i < (int)restoredIds.size(); ++i) {
		TStageObjectId id = restoredIds[i];
		TStageObject *obj = xsh->getStageObject(id);

		TStageObjectSpline *spline = obj->getSpline();
		if (!spline)
			continue;

		TStageObjectTree *objTree = xsh->getStageObjectTree();
		if (objTree->containsSpline(spline)) // No need to add it if it's already there
			continue;

		std::map<TStageObjectSpline *, TStageObjectSpline *>::iterator it = splines.find(spline);
		if (it != splines.end()) {
			// Seems that multiple objects can have the same spline...
			// BTW, shouldn't this case stop at the continue before ?
			obj->setSpline(it->second);
			continue;
		}

		// The spline was not found. Clone and add it to the xsheet
		TStageObjectSpline *newSpline = spline->clone(); // Not checking doClone ?
		objTree->assignUniqueSplineId(newSpline);
		objTree->insertSpline(newSpline);
		obj->setSpline(newSpline);

		splines[spline] = newSpline;
	}

	//paste stored path
	QList<TSplineDataElement *>::const_iterator splinIt;
	for (splinIt = m_splines.begin(); splinIt != m_splines.end(); ++splinIt) {
		TStageObjectTree *objTree = xsh->getStageObjectTree();
		TSplineDataElement *splineEl = *splinIt;
		TStageObjectSpline *spline = splineEl->restoreSpline(fxFlags);
		if (doClone)
			objTree->assignUniqueSplineId(spline);
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:67,代码来源:stageobjectsdata.cpp


注:本文中的TStageObject::getSpline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。