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(); }
if (m_subXSheetStack.empty()) cameraPlacement = m_cameraPlacement; else cameraPlacement = m_subXSheetStack.back().m_camera; TAffine columnZaff; bool columnBehindCamera = TStageObject::perspective( columnZaff, cameraPlacement.m_aff, cameraPlacement.m_z, columnAff, columnZ, columnNoScaleZ); if (!columnBehindCamera) return; TXshSimpleLevel *sl = xl->getSimpleLevel(); bool storePlayer = sl || (xl->getChildLevel() && locals::applyPlasticDeform(column.getPointer(), m_vs) && locals::isMeshDeformed(xsh, pegbar, m_vs)); if (storePlayer) { // Build and store a player Player player; player.m_sl = sl; player.m_fid = cell.m_frameId; player.m_xsh = xsh; player.m_column = col; player.m_frame = row; player.m_dpiAff = sl ? getDpiAffine(sl, cell.m_frameId) : TAffine(); player.m_onionSkinDistance = m_onionSkinDistance; player.m_isCurrentColumn = (m_currentColumnIndex == col); player.m_ancestorColumnIndex = m_ancestorColumnIndex;