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


C++ TXsheet::getPlacement方法代码示例

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


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

示例1: getCurrentColumnParentMatrix

TAffine TTool::getCurrentColumnParentMatrix() const {
  if (!m_application) return TAffine();

  TFrameHandle *fh = m_application->getCurrentFrame();
  if (fh->isEditingLevel()) return TAffine();
  int frame       = fh->getFrame();
  int columnIndex = m_application->getCurrentColumn()->getColumnIndex();
  TXsheet *xsh    = m_application->getCurrentXsheet()->getXsheet();
  TStageObjectId parentId =
      xsh->getStageObjectParent(TStageObjectId::ColumnId(columnIndex));
  return xsh->getPlacement(parentId, frame);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:12,代码来源:tool.cpp

示例2: getCurrentObjectParentMatrix

TAffine TTool::getCurrentObjectParentMatrix() const {
  if (!m_application) return TAffine();

  TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet();
  int frame    = m_application->getCurrentFrame()->getFrame();
  TStageObjectId currentObjectId =
      m_application->getCurrentObject()->getObjectId();
  if (currentObjectId == TStageObjectId::NoneId) return TAffine();
  TStageObjectId parentId = xsh->getStageObjectParent(currentObjectId);
  if (parentId == TStageObjectId::NoneId)
    return TAffine();
  else
    return xsh->getPlacement(parentId, frame);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:14,代码来源:tool.cpp

示例3:

TAffine TTool::getCurrentObjectParentMatrix2() const {
  TTool::Application *app = m_application;
  TFrameHandle *fh        = app->getCurrentFrame();
  if (fh->isEditingLevel()) return TAffine();
  int frame               = fh->getFrame();
  TXsheet *xsh            = app->getCurrentXsheet()->getXsheet();
  TStageObjectId id       = app->getCurrentObject()->getObjectId();
  double objZ             = xsh->getZ(id, frame);
  TStageObjectId parentId = xsh->getStageObjectParent(id);
  if (parentId == TStageObjectId::NoneId) return TAffine();
  id                   = parentId;
  TAffine objPlacement = xsh->getPlacement(id, frame);

  TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
  TStageObject *camera    = xsh->getStageObject(cameraId);
  TAffine cameraPlacement = camera->getPlacement(frame);
  double cameraZ          = camera->getZ(frame);

  TAffine placement;
  TStageObject::perspective(placement, cameraPlacement, cameraZ, objPlacement,
                            objZ, 0);
  return placement;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:23,代码来源:tool.cpp

示例4: getColumnMatrix

TAffine TTool::getColumnMatrix(int columnIndex) const {
  if (!m_application) return TAffine();

  TFrameHandle *fh = m_application->getCurrentFrame();
  if (fh->isEditingLevel()) return TAffine();
  int frame               = fh->getFrame();
  TXsheet *xsh            = m_application->getCurrentXsheet()->getXsheet();
  TStageObjectId columnId = TStageObjectId::ColumnId(columnIndex);
  TAffine columnPlacement = xsh->getPlacement(columnId, frame);
  double columnZ          = xsh->getZ(columnId, frame);

  TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
  TStageObject *camera    = xsh->getStageObject(cameraId);
  TAffine cameraPlacement = camera->getPlacement(frame);
  double cameraZ          = camera->getZ(frame);

  TStageObject *object = xsh->getStageObject(columnId);
  TAffine placement;
  TStageObject::perspective(placement, cameraPlacement, cameraZ,
                            columnPlacement, columnZ,
                            object->getGlobalNoScaleZ());

  return placement;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:24,代码来源:tool.cpp

示例5: togglePinnedStatus

void SkeletonTool::togglePinnedStatus(int columnIndex, int frame, bool shiftPressed)
{
	Skeleton skeleton;
	buildSkeleton(skeleton, columnIndex);
	if (!skeleton.getRootBone() || !skeleton.getRootBone()->getStageObject())
		return;
	Skeleton::Bone *bone = skeleton.getBoneByColumnIndex(columnIndex);
	assert(bone);
	if (!bone)
		return;

	TogglePinnedStatusUndo *undo = new TogglePinnedStatusUndo(this, frame);
	for (int i = 0; i < skeleton.getBoneCount(); i++) {
		TStageObject *obj = skeleton.getBone(i)->getStageObject();
		if (obj) {
			undo->addBoneId(obj->getId());
			obj->setKeyframeWithoutUndo(frame);
		}
	}

	getApplication()->getCurrentXsheet()->notifyXsheetChanged();
	getApplication()->getCurrentObject()->notifyObjectIdChanged(false);

	undo->setOldTemp(m_temporaryPinnedColumns);
	bool isTemporaryPinned = m_temporaryPinnedColumns.count(columnIndex) > 0;
	if (shiftPressed || isTemporaryPinned) {
		if (isTemporaryPinned)
			m_temporaryPinnedColumns.erase(columnIndex);
		else
			m_temporaryPinnedColumns.insert(columnIndex);
	} else {
		TXsheet *xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet();
		TAffine placement = xsh->getPlacement(bone->getStageObject()->getId(), frame);

		TStageObjectId rootId = skeleton.getRootBone()->getStageObject()->getId();
		TAffine rootPlacement = xsh->getPlacement(rootId, frame);

		int pinnedStatus = bone->getPinnedStatus();
		if (pinnedStatus != Skeleton::Bone::PINNED) {
			int oldPinned = -1;
			for (int i = 0; i < skeleton.getBoneCount(); i++) {
				TStageObject *obj = skeleton.getBone(i)->getStageObject();
				if (obj->getPinnedRangeSet()->isPinned(frame)) {
					oldPinned = i;
					break;
				}
			}

			int lastFrame = 1000000;
			if (oldPinned >= 0) {
				assert(skeleton.getBone(oldPinned) != bone);
				TStageObject *obj = skeleton.getBone(oldPinned)->getStageObject();
				const TPinnedRangeSet::Range *range = obj->getPinnedRangeSet()->getRange(frame);
				assert(range && range->first <= frame && frame <= range->second);
				lastFrame = range->second;
				TPinnedRangeSet *rangeSet = obj->getPinnedRangeSet();
				rangeSet->removeRange(frame, range->second);
				obj->invalidate();
				undo->setOldRange(oldPinned, frame, range->second, rangeSet->getPlacement());
			} else {
				for (int i = 0; i < skeleton.getBoneCount(); i++) {
					TStageObject *obj = skeleton.getBone(i)->getStageObject();
					const TPinnedRangeSet::Range *range = obj->getPinnedRangeSet()->getNextRange(frame);
					if (range) {
						assert(range->first > frame);
						if (range->first - 1 < lastFrame)
							lastFrame = range->first - 1;
					}
				}
			}

			TStageObject *obj = bone->getStageObject();
			TPinnedRangeSet *rangeSet = obj->getPinnedRangeSet();
			rangeSet->setRange(frame, lastFrame);
			if (frame == 0) {
				// this code should be moved elsewhere, possibly in the stageobject implementation
				// the idea is to remove the normal
				TStageObject *rootObj = skeleton.getRootBone()->getStageObject();
				rootObj->setStatus(TStageObject::XY);
				placement = rootObj->getPlacement(0).inv() * placement;
				rootObj->setStatus(TStageObject::IK);
				rangeSet->setPlacement(placement);
				rootObj->invalidate();
			}
			undo->setNewRange(bone->getColumnIndex(), frame, lastFrame, rangeSet->getPlacement());
		}
	}
	undo->setNewTemp(m_temporaryPinnedColumns);
	TUndoManager::manager()->add(undo);
}
开发者ID:titer1,项目名称:opentoonz,代码行数:90,代码来源:skeletontool.cpp


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