本文整理汇总了C++中TStageObject::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ TStageObject::getId方法的具体用法?C++ TStageObject::getId怎么用?C++ TStageObject::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStageObject
的用法示例。
在下文中一共展示了TStageObject::getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: storeColumn
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);
}
示例2: 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();
}
示例3: toggle
void ViewerKeyframeNavigator::toggle()
{
TStageObject *pegbar = getStageObject();
if (!pegbar)
return;
int frame = getCurrentFrame();
if (pegbar->isFullKeyframe(frame)) {
TStageObject::Keyframe key = pegbar->getKeyframe(frame);
pegbar->removeKeyframeWithoutUndo(frame);
UndoRemoveKeyFrame *undo = new UndoRemoveKeyFrame(pegbar->getId(), frame, key, m_xsheetHandle);
undo->setObjectHandle(m_objectHandle);
TUndoManager::manager()->add(undo);
} else {
UndoSetKeyFrame *undo = new UndoSetKeyFrame(pegbar->getId(), frame, m_xsheetHandle);
pegbar->setKeyframeWithoutUndo(frame);
undo->setObjectHandle(m_objectHandle);
TUndoManager::manager()->add(undo);
}
m_objectHandle->notifyObjectIdChanged(false);
}
示例4: updateScene
void StageSchematicScene::updateScene()
{
clearAllItems();
QPointF firstPos = sceneRect().center();
m_nextNodePos = TPointD(firstPos.x(), firstPos.y());
TStageObjectTree *pegTree = m_xshHandle->getXsheet()->getStageObjectTree();
m_nodeTable.clear();
m_GroupTable.clear();
m_groupEditorTable.clear();
m_gridDimension = pegTree->getDagGridDimension();
QMap<int, QList<TStageObject *>> groupedObj;
QMap<int, QList<SchematicNode *>> editedGroup;
// in order to draw the position-specified nodes first
QList<int> modifiedNodeIds;
for (int i = 0; i < pegTree->getStageObjectCount(); i++) {
TStageObject *pegbar = pegTree->getStageObject(i);
if (pegbar->getDagNodePos() == TConst::nowhere)
modifiedNodeIds.push_back(i);
else
modifiedNodeIds.push_front(i);
}
for (int i = 0; i < modifiedNodeIds.size(); i++) {
TStageObject *pegbar = pegTree->getStageObject(modifiedNodeIds.at(i));
if (pegbar->isGrouped() && !pegbar->isGroupEditing()) {
groupedObj[pegbar->getGroupId()].push_back(pegbar);
continue;
}
StageSchematicNode *node = addStageSchematicNode(pegbar);
if (node != 0) {
m_nodeTable[pegbar->getId()] = node;
if (pegbar->isGrouped())
editedGroup[pegbar->getEditingGroupId()].append(node);
}
}
//Motion Path
m_splineTable.clear();
for (int i = 0; i < pegTree->getSplineCount(); i++) {
TStageObjectSpline *spline = pegTree->getSpline(i);
StageSchematicSplineNode *node = addSchematicSplineNode(spline);
if (node != 0) {
m_splineTable[spline] = node;
connect(node, SIGNAL(currentObjectChanged(const TStageObjectId &, bool)), this,
SLOT(onCurrentObjectChanged(const TStageObjectId &, bool)));
}
}
示例5: restoreCamera
TStageObjectId TCameraDataElement::restoreCamera(TXsheet *xsh, bool copyPosition) const
{
TStageObjectTree *tree = xsh->getStageObjectTree();
// Search the first unused camera id in the xsheet
int index = 0;
while (tree->getStageObject(TStageObjectId::CameraId(index), false))
++index;
// Create the new camera object and assign stored data
TStageObject *newCamera = tree->getStageObject(TStageObjectId::CameraId(index), true);
newCamera->assignParams(m_params);
*(newCamera->getCamera()) = m_camera;
if (copyPosition)
newCamera->setDagNodePos(m_dagPos);
return newCamera->getId();
}
示例6: restoreObject
TStageObjectId TStageObjectDataElement::restoreObject(TXsheet *xsh, bool copyPosition) const
{
int index = 2; // Skip the table and camera 1 (I guess)
// Search the first unused common (pegbar) id
TStageObjectTree *tree = xsh->getStageObjectTree();
while (tree->getStageObject(TStageObjectId::PegbarId(index), false))
++index;
// Create the new object to be inserted
TStageObject *newObj = tree->getStageObject(TStageObjectId::PegbarId(index), true);
newObj->setParent(m_params->m_parentId);
newObj->assignParams(m_params);
// If specified, copy the stored position in the viewer
if (copyPosition)
newObj->setDagNodePos(m_dagPos);
return newObj->getId();
}
示例7: getKeyframes
// data -> xsh
bool TKeyframeData::getKeyframes(std::set<Position> &positions, TXsheet *xsh) const
{
std::set<TKeyframeSelection::Position>::iterator it2 = positions.begin();
int r0 = it2->first;
int c0 = it2->second;
for (++it2; it2 != positions.end(); ++it2) {
r0 = std::min(r0, it2->first);
c0 = std::min(c0, it2->second);
}
positions.clear();
TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
Iterator it;
bool keyFrameChanged = false;
for (it = m_keyData.begin(); it != m_keyData.end(); ++it) {
Position pos = it->first;
int row = r0 + pos.first;
int col = c0 + pos.second;
positions.insert(std::make_pair(row, col));
TXshColumn *column = xsh->getColumn(col);
if (column && column->getSoundColumn())
continue;
TStageObject *pegbar = xsh->getStageObject(col >= 0 ? TStageObjectId::ColumnId(col) : cameraId);
if (pegbar->getId().isColumn() && xsh->getColumn(col) && xsh->getColumn(col)->isLocked())
continue;
keyFrameChanged = true;
assert(pegbar);
pegbar->setKeyframeWithoutUndo(row, it->second);
}
if (!keyFrameChanged)
return false;
for (auto const pegbar : m_isPegbarsCycleEnabled) {
int const col = pegbar.first;
TStageObjectId objectId = (col >= 0) ? TStageObjectId::ColumnId(col) : cameraId;
xsh->getStageObject(objectId)->enableCycle(pegbar.second);
}
return true;
}
示例8: 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);
}