本文整理汇总了C++中TStageObject::invalidate方法的典型用法代码示例。如果您正苦于以下问题:C++ TStageObject::invalidate方法的具体用法?C++ TStageObject::invalidate怎么用?C++ TStageObject::invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStageObject
的用法示例。
在下文中一共展示了TStageObject::invalidate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}