예제 #1
0
void SchematicScenePanel::onExplodeChild(QList<TStageObjectId> ids) {
  int i;
  for (i = 0; i < ids.size(); i++) {
    TStageObjectId id = ids[i];
    if (id.isColumn()) SubsceneCmd::explode(id.getIndex());
  }
}
예제 #2
0
// return true iff column ancestorIndex is column descentIndex or its parent or the parent of the parent, etc.
bool isAncestorOf(int ancestorIndex, int descendentIndex)
{
	TStageObjectId ancestorId = TStageObjectId::ColumnId(ancestorIndex);
	TStageObjectId descendentId = TStageObjectId::ColumnId(descendentIndex);
	TXsheet *xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet();
	while (descendentId != ancestorId && descendentId.isColumn())
		descendentId = xsh->getStageObjectParent(descendentId);
	return descendentId == ancestorId;
}
예제 #3
0
TStageObject *ViewerKeyframeNavigator::getStageObject() const {
  if (!m_xsheetHandle || !m_objectHandle) return 0;

  TStageObjectId objectId = m_objectHandle->getObjectId();
  TXsheet *xsh            = m_xsheetHandle->getXsheet();
  // Se e' una colonna sound non posso settare chiavi
  if (objectId.isColumn()) {
    TXshColumn *column = xsh->getColumn(objectId.getIndex());
    if (column && column->getSoundColumn()) return 0;
  }
  return xsh->getStageObject(objectId);
}
예제 #4
0
void SceneViewerContextMenu::onSetCurrent() {
  TStageObjectId id;
  id.setCode(qobject_cast<QAction *>(sender())->data().toUInt());
  TApp *app = TApp::instance();
  if (id.isColumn()) {
    app->getCurrentColumn()->setColumnIndex(id.getIndex());
    app->getCurrentObject()->setObjectId(id);
  } else {
    app->getCurrentObject()->setObjectId(id);
    app->getCurrentTool()->setTool(T_Edit);
  }
}
예제 #5
0
bool canShowBone(Skeleton::Bone *bone, TXsheet *xsh, int row)
{
	TStageObjectId id = bone->getStageObject()->getId();
	if (!xsh->getCell(row, id.getIndex()).isEmpty() && xsh->getColumn(id.getIndex())->isCamstandVisible())
		return true;
	int i;
	for (i = 0; i < bone->getChildCount(); i++) {
		if (canShowBone(bone->getChild(i), xsh, row))
			return true;
	}
	return false;
}
예제 #6
0
bool SkeletonTool::doesApply() const
{
	TTool::Application *app = TTool::getApplication();
	TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
	assert(xsh);
	TStageObjectId objId = app->getCurrentObject()->getObjectId();
	if (objId.isColumn()) {
		TXshColumn *column = xsh->getColumn(objId.getIndex());
		if (column && column->getSoundColumn())
			return false;
	}
	return true;
}
예제 #7
0
void addShowHideStageObjectCmd(QMenu *menu, const TStageObjectId &id,
                               bool isShow) {
  TXsheet *xsh         = TApp::instance()->getCurrentXsheet()->getXsheet();
  TStageObject *pegbar = xsh->getStageObject(id);
  QString cmdStr;
  if (id.isCamera())
    cmdStr = (isShow ? "Show " : "Hide ") +
             QString::fromStdString(pegbar->getName());
  else
    cmdStr = (isShow ? "Show Column" : "Hide Column") +
             QString::fromStdString(pegbar->getName());
  QAction *showHideAction = new QAction(cmdStr, menu);
  showHideAction->setData((int)id.getCode());
  menu->addAction(showHideAction);
}
예제 #8
0
void SchematicViewer::updateScenes() {
  TStageObjectId id = m_stageScene->getCurrentObject();
  if (id.isColumn()) {
    m_stageScene->update();
    TXsheet *xsh = m_stageScene->getXsheetHandle()->getXsheet();
    if (!xsh) return;
    TXshColumn *column = xsh->getColumn(id.getIndex());
    if (!column) {
      m_fxScene->getFxHandle()->setFx(0, false);
      return;
    }
    TFx *fx = column->getFx();
    m_fxScene->getFxHandle()->setFx(fx, false);
    m_fxScene->update();
  }
}
예제 #9
0
	void notify() const
	{
		m_tool->invalidate();
		TXsheet *xsh = getXsheet();
		int index = m_columnIndex;
		if (index < 0)
			index = m_oldColumnIndex;
		if (index >= 0) {
			TStageObjectId id = TStageObjectId::ColumnId(index);
			TStageObjectId parentId;
			while (parentId = xsh->getStageObjectParent(id), parentId.isColumn())
				id = parentId;
			xsh->getStageObject(id)->invalidate();
			TTool::getApplication()->getCurrentXsheet()->notifyXsheetChanged();
			TTool::getApplication()->getCurrentObject()->notifyObjectIdChanged(false);
		}
	}
예제 #10
0
void SceneViewerContextMenu::addSelectCommand(QMenu *menu,
                                              const TStageObjectId &id) {
  TXsheet *xsh              = TApp::instance()->getCurrentXsheet()->getXsheet();
  TStageObject *stageObject = xsh->getStageObject(id);
  if (!stageObject) return;
  QString text           = getName(stageObject);
  if (menu == this) text = "Select " + text;
  QAction *action        = new QAction(text, this);
  action->setData(id.getCode());
  connect(action, SIGNAL(triggered()), this, SLOT(onSetCurrent()));
  menu->addAction(action);
}
예제 #11
0
void getConnectedColumns(std::set<int> &connectedColumns, TXsheet *xsh, int col)
{
	TStageObjectId id;
	// insert col and all column ancestors
	id = TStageObjectId::ColumnId(col);
	do {
		connectedColumns.insert(id.getIndex());
		id = xsh->getStageObjectParent(id);
	} while (id.isColumn());
	// for each column
	for (int i = 0; i < xsh->getColumnCount(); i++) {
		id = TStageObjectId::ColumnId(i);
		std::vector<TStageObjectId> stack;
		// find a column ancestor already connected; put all the column ancestors in stack
		while (id.isColumn() && connectedColumns.count(id.getIndex()) == 0) {
			stack.push_back(id);
			id = xsh->getStageObjectParent(id);
		}
		if (id.isColumn()) {
			// the stack is connected
			for (int j = 0; j < (int)stack.size(); j++)
				connectedColumns.insert(stack[j].getIndex());
		}
	}
}
예제 #12
0
void onShowHideSelectObject(QAction *action) {
  TApp *app = TApp::instance();
  TStageObjectId id;
  id.setCode(action->data().toInt());
  if (id == TStageObjectId::NoneId) return;
  if (action->text().startsWith("Show ") ||
      action->text().startsWith("Hide ")) {
    if (id.isColumn()) {
      app->getCurrentXsheet()
          ->getXsheet()
          ->getColumn(id.getIndex())
          ->setCamstandVisible(action->text().startsWith("Show "));
      TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
    }
  } else if (action->text().startsWith("Select ")) {
    if (id.isColumn()) {
      app->getCurrentColumn()->setColumnIndex(id.getIndex());
      app->getCurrentObject()->setObjectId(id);
    } else {
      app->getCurrentObject()->setObjectId(id);
      app->getCurrentTool()->setTool(T_Edit);
    }
  }
}
예제 #13
0
TPointD XshHandleManager::getHandlePos(const TStageObjectId &id,
                                       const std::string &handle,
                                       int row) const {
  static const double unit = 8.0;

  assert(m_xsh->getScene());

  if (handle == "")
    return TPointD();

  else if (handle[0] == 'H' && handle.length() > 1) {
    // Hook port case

    if (!id.isColumn()) return TPointD();

    int hookIndex = 0;
    {
      int h, hLength = handle.length();
      for (h = 1; h != hLength; ++h)
        hookIndex = hookIndex * 10 + (handle[h] - '0');
    }

    TStageObject *obj = m_xsh->getStageObject(id);
    if (const PlasticSkeletonDeformationP &def =
            obj->getPlasticSkeletonDeformation()) {
      int skelId = def->skeletonId(row);

      PlasticSkeleton skel;
      def->storeDeformedSkeleton(skelId, row, skel);

      int v = def->vertexIndex(hookIndex, skelId);
      return (v >= 0) ? TScale(1.0 / Stage::inch) * skel.vertex(v).P()
                      : TPointD();
    }

    --hookIndex;

    int col = id.getIndex();
    TXshCell cell(m_xsh->getCell(row, col));

    TXshLevel *xl = cell.m_level.getPointer();
    if (!xl) return TPointD();

    TXshSimpleLevel *sl = xl->getSimpleLevel();
    if (!sl) return TPointD();

    Hook *hook = sl->getHookSet()->getHook(hookIndex);
    if (!hook) return TPointD();

    TFrameId fid(cell.m_frameId);

    TPointD pos = hook->getAPos(fid) * (1.0 / Stage::inch);
    TPointD delta;

    for (int r = row - 1; r >= 0; --r) {
      cell = m_xsh->getCell(r, col);
      if (cell.m_level.getPointer() != xl) break;

      const TFrameId &precFid = cell.m_frameId;
      delta += computePassHook(fid, precFid, sl, hook);
      fid = precFid;
    }

    pos += delta * (1.0 / Stage::inch);
    pos = getDpiAffine(sl, cell.m_frameId, true) * pos;

    return pos;
  } else if ('A' <= handle[0] && handle[0] <= 'Z')
    return TPointD(unit * (handle[0] - 'B'), 0);
  else if ('a' <= handle[0] && handle[0] <= 'z')
    return TPointD(0.5 * unit * (handle[0] - 'b'), 0);
  else
    return TPointD();
}
예제 #14
0
void SkeletonTool::draw()
{
	// parent object reference system
	//glColor3d(1,0,0);
	//tglDrawRect(0,0,100,100);

	if (m_label != "")
		ToolUtils::drawBalloon(m_labelPos, m_label, TPixel32::Red, TPoint(20, -20), false);

	bool ikEnabled = m_mode.getValue() == INVERSE_KINEMATICS;
	assert(glGetError() == GL_NO_ERROR);

	// l'xsheet, oggetto (e relativo placement), frame corrente
	TTool::Application *app = TTool::getApplication();
	TXsheet *xsh = getXsheet();
	assert(xsh);
	TStageObjectId objId = app->getCurrentObject()->getObjectId();
	// se l'oggetto corrente non e' una colonna non disegno nulla
	if (!objId.isColumn())
		return;

	TStageObject *pegbar = xsh->getStageObject(objId);
	int col = objId.getIndex();

	int frame = app->getCurrentFrame()->getFrame();
	if (m_currentFrame != frame)
		m_temporaryPinnedColumns.clear();

	TAffine aff = getMatrix();
	// puo' suggere che il placement degeneri (es.: c'e' uno h-scale = 0%)
	if (fabs(aff.det()) < 0.00001)
		return;

	// m_unit = getPixelSize() * sqrt(fabs(aff.det()));

	if (!ikEnabled)
		drawLevelBoundingBox(frame, col);

	glPushMatrix();
	tglMultMatrix(aff.inv());

	// camera stand reference system
	//glColor3d(0,1,0);
	//tglDrawRect(0,0,100,100);

	bool changingParent = dynamic_cast<ParentChangeTool *>(m_dragTool) != 0;

	// !changingParent &&
	if (m_mode.getValue() == BUILD_SKELETON && !xsh->getStageObjectParent(objId).isColumn()) {
		if (!changingParent)
			drawHooks();
	}

	Skeleton skeleton;
	buildSkeleton(skeleton, col);

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	drawSkeleton(skeleton, frame);
	glDisable(GL_BLEND);

	TXshCell cell = xsh->getCell(frame, objId.getIndex());
	Skeleton::Bone *rootBone = skeleton.getRootBone();
	for (int i = 0; i < skeleton.getBoneCount(); i++) {
		Skeleton::Bone *bone = skeleton.getBone(i);
		TStageObjectId currentId = bone->getStageObject()->getId();
		bool isCurrent = (currentId == objId);
		TPointD pos = bone->getCenter();
		if (isCurrent && m_mode.getValue() != BUILD_SKELETON) {
			drawDrawingBrowser(cell, pos);
		}

		bool isActiveChain = bone->isSelected();

		glColor3d(0, 1, 0);
		if (ikEnabled) {
			drawIKJoint(bone);
		} else {
			TPointD pos = bone->getCenter();
			if (isCurrent && m_mode.getValue() == ANIMATE) {
				drawMainGadget(pos);
			}
		}
	}
	m_currentFrame = frame;

	if (m_dragTool)
		m_dragTool->draw();
	glPopMatrix();
}
예제 #15
0
std::vector<TStageObjectId> StageObjectsData::restoreObjects(std::set<int> &columnIndices, std::list<int> &restoredSpline,
															 TXsheet *xsh, int fxFlags, const TPointD &pos) const
{
	bool doClone = (fxFlags & eDoClone);
	bool resetFxDagPositions = (fxFlags & eResetFxDagPositions);

	QMap<TStageObjectId, TStageObjectId> idTable; // Trace stored/restored id pairings
	std::map<TFx *, TFx *> fxTable;					  // Same for fxs here
	std::vector<TStageObjectId> restoredIds;

	std::set<int>::iterator idxt = columnIndices.begin();
	int index = -1; // The actual column insertion index

	int i, elementsCount = m_elements.size();
	for (i = 0; i < elementsCount; ++i) {
		TStageObjectDataElement *element = m_elements[i];

		TCameraDataElement *cameraElement = dynamic_cast<TCameraDataElement *>(element);
		TColumnDataElement *columnElement = dynamic_cast<TColumnDataElement *>(element);

		// Restore the object depending on its specific type
		TStageObjectId restoredId = TStageObjectId::NoneId;

		if (!cameraElement && !columnElement)
			restoredId = element->restoreObject(xsh, pos != TConst::nowhere);
		else if (cameraElement)
			restoredId = cameraElement->restoreCamera(xsh, pos != TConst::nowhere);
		else if (columnElement) {
			// Build the column insertion index
			if (idxt != columnIndices.end())
				index = *idxt++;
			else {
				++index;
				columnIndices.insert(index);
			}

			// Restore the column element
			restoredId = columnElement->restoreColumn(xsh, index, fxFlags, pos != TConst::nowhere);

			FxDag *fxDag = xsh->getFxDag();

			TXshColumn *column = columnElement->m_column.getPointer();
			TXshColumn *pastedColumn = xsh->getColumn(index);

			TFx *fx = column->getFx();
			TFx *pastedFx = pastedColumn->getFx();

			if (fx && pastedFx)
				fxTable[fx] = pastedFx;

			// Enforce the correct terminality. Added columns are terminal by default.
			bool terminal = (fx && (m_terminalFxs.count(fx) > 0));
			if (!terminal)
				fxDag->getTerminalFxs()->removeFx(pastedFx);

			// In case we've cloned a zerary fx column, update the actual fx's data
			if (TXshZeraryFxColumn *zc = dynamic_cast<TXshZeraryFxColumn *>(pastedColumn)) {
				TZeraryColumnFx *zfx = zc->getZeraryColumnFx();
				TFx *zeraryFx = zfx->getZeraryFx();
				if (zeraryFx && doClone) {
					std::wstring app = zeraryFx->getName();
					fxDag->assignUniqueId(zeraryFx);
					zeraryFx->setName(app);
				}
			}
		}

		// Remember stored/restored stage object pairings
		idTable[element->m_params->m_id] = restoredId;
		restoredIds.push_back(restoredId);
	}

	// Apply stage object-parental relationships
	for (i = 0; i < elementsCount; ++i) {
		TStageObjectDataElement *element = m_elements[i];

		TStageObjectId id = element->m_params->m_id;
		TStageObjectId parentId = element->m_params->m_parentId;

		TStageObjectId pastedId = idTable[id];
		TStageObjectId pastedParentId = parentId;

		if (parentId.isColumn()) // Why discriminating for columns only ?
		{
			//Columns are redirected to table ids. If no redirected parent exists, store
			//a void value that will be avoided later
			QMap<TStageObjectId, TStageObjectId>::iterator it = idTable.find(parentId);
			pastedParentId = (it == idTable.end()) ? TStageObjectId::NoneId : it.value();
		}

		if (pastedParentId != TStageObjectId::NoneId) {
			xsh->setStageObjectParent(pastedId, pastedParentId);
			TStageObject *pastedObj = xsh->getStageObject(pastedId);

			// Shouldn't these be done outside ?
			pastedObj->setHandle(element->m_params->m_handle);
			pastedObj->setParentHandle(element->m_params->m_parentHandle);
		}
	}

	// Iterate stored fxs
	std::set<TFx *>::const_iterator fxt, end = m_fxs.end();
	for (fxt = m_fxs.begin(); fxt != end; ++fxt) {
		TFx *fxOrig = *fxt, *fx = fxOrig;

		// Only NOT COLUMN fxs - ie internal fxs
		if (fxTable.find(fxOrig) != fxTable.end())
			continue;

		// Internal fxs

		if (doClone) {
			fx = fxOrig->clone(false);

			fx->setName(fxOrig->getName());
			fx->getAttributes()->setId(fxOrig->getAttributes()->getId());
			fx->getAttributes()->passiveCacheDataIdx() = -1;

			if (resetFxDagPositions)
				fx->getAttributes()->setDagNodePos(TConst::nowhere);

			xsh->getFxDag()->assignUniqueId(fx);
		}

		fxTable[fxOrig] = fx;

		// Insert the passed fx in the xsheet
		TOutputFx *outFx = dynamic_cast<TOutputFx *>(fx);
		if (!outFx)
			xsh->getFxDag()->getInternalFxs()->addFx(fx);
		else
			xsh->getFxDag()->addOutputFx(outFx);

		if (m_terminalFxs.count(fxOrig) > 0)
			xsh->getFxDag()->getTerminalFxs()->addFx(fx);

		if (!doClone) {
			// Err.... don't remember. Inquire further? :|
			int fxTypeCount = xsh->getFxDag()->getFxTypeCount(fx);

			int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
			xsh->getFxDag()->updateFxTypeTable(fx, maxFxTypeId);
			xsh->getFxDag()->updateFxIdTable(fx);
		}

		bool isLinked = (fxOrig->getLinkedFx() != fxOrig);
		if (isLinked) {
			if (m_fxs.find(fxOrig->getLinkedFx()) == m_fxs.end())
				fx->linkParams(fxOrig->getLinkedFx());
			else {
				TFx *linkedFx, *oldLinkedFx = fxOrig->getLinkedFx();
				if (doClone) {
					// Clone the linked fx too
					linkedFx = fx->clone(false);
					linkedFx->linkParams(fx);

					linkedFx->setName(oldLinkedFx->getName());
					linkedFx->getAttributes()->setId(oldLinkedFx->getAttributes()->getId());
					linkedFx->getAttributes()->passiveCacheDataIdx() = -1;

					if (resetFxDagPositions)
						linkedFx->getAttributes()->setDagNodePos(TConst::nowhere);
					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);
		objTree->insertSpline(spline);
		restoredSpline.push_back(spline->getId());
	}

	xsh->updateFrameCount();

	if (pos != TConst::nowhere) {
		// Update objects positions depending on the externally supplied pos

		TPointD middlePos;
		int count = 0;

		for (i = 0; i < (int)restoredIds.size(); ++i) {
			TStageObjectId id = restoredIds[i];
			TStageObject *obj = xsh->getStageObject(id);

			TPointD oldPos = obj->getDagNodePos();
			if (oldPos == TConst::nowhere)
				continue;

			middlePos += oldPos;
			++count;
		}

		middlePos = TPointD(middlePos.x / count, middlePos.y / count);
		TPointD offset = pos - middlePos;

		for (i = 0; i < (int)restoredIds.size(); ++i) {
			TStageObjectId id = restoredIds[i];
			TStageObject *obj = xsh->getStageObject(id);

			TPointD oldPos = obj->getDagNodePos();
			if (oldPos == TConst::nowhere)
				continue;

			obj->setDagNodePos(oldPos + offset);
		}
	}

	return restoredIds;
}
예제 #16
0
void StageObjectsData::storeObjects(const std::vector<TStageObjectId> &ids, TXsheet *xsh, int fxFlags)
{
	assert(m_fxTable.empty()); // Should be enforced OUTSIDE. Track implicit uses.
	m_fxTable.clear();		   // TO BE REMOVED

	int i, objCount = ids.size();

	// Discriminate sensible stage object types (ie cameras and columns from the rest).
	// Store them in a map, ordered by object index.

	std::map<int, TStageObjectId> cameraIds, columnIds, pegbarIds;
	for (i = 0; i < objCount; ++i) {
		TStageObjectId id = ids[i];
		if (id.isColumn())
			columnIds[id.getIndex()] = id;
		else if (id.isPegbar())
			pegbarIds[id.getIndex()] = id;
		else if (id.isCamera())
			cameraIds[id.getIndex()] = id;
	}

	// Store a suitable object for each
	std::map<int, TStageObjectId>::iterator it;
	for (it = cameraIds.begin(); it != cameraIds.end(); ++it) {
		// Cameras
		TCameraDataElement *cameraElement = new TCameraDataElement();
		cameraElement->storeCamera(it->second, xsh);
		m_elements.append(cameraElement);
	}

	for (it = pegbarIds.begin(); it != pegbarIds.end(); ++it) {
		// Pegbars (includes curves)
		TStageObjectDataElement *objElement = new TStageObjectDataElement();
		objElement->storeObject(it->second, xsh);
		m_elements.append(objElement);
	}

	for (it = columnIds.begin(); it != columnIds.end(); ++it) {
		// Columns
		int colIndex = it->second.getIndex();

		TXshColumn *column = xsh->getColumn(colIndex);
		if (!column)
			continue;

		TColumnDataElement *columnElement = new TColumnDataElement();
		columnElement->storeColumn(xsh, colIndex, fxFlags);
		m_elements.append(columnElement);

		TXshColumn *copiedColumn = columnElement->m_column.getPointer();
		if (column->getFx() && copiedColumn->getFx()) {
			// Store column fx pairings (even if the originals are not cloned)
			m_fxTable[column->getFx()] = copiedColumn->getFx();
			m_originalColumnFxs.insert(column->getFx());
		}
	}

	// Insert terminal fxs
	set<TFx *>::iterator jt;
	for (jt = m_originalColumnFxs.begin(); jt != m_originalColumnFxs.end(); ++jt) {
		if (isColumnSelectionTerminalFx(
				*jt, xsh->getFxDag()->getTerminalFxs(), m_originalColumnFxs)) {
			TFx *fx = m_fxTable[*jt];

			fx->addRef();
			m_terminalFxs.insert(fx);
		}
	}
}
예제 #17
0
void SceneViewerContextMenu::addLevelCommands(std::vector<int> &indices) {
  addSeparator();
  TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
  TStageObjectId currentId =
      TApp::instance()->getCurrentObject()->getObjectId();

  /*- Xsheet内の、空でないColumnを登録 -*/
  std::vector<TXshColumn *> columns;
  for (int i = 0; i < (int)indices.size(); i++) {
    if (xsh->isColumnEmpty(indices[i])) continue;
    TXshColumn *column = xsh->getColumn(indices[i]);
    if (column) {
      columns.push_back(column);
    }
  }

  if (!columns.empty()) {
    // show/hide
    if (columns.size() > 1) {
      QMenu *subMenu = addMenu("Show / Hide");
      for (int i = 0; i < (int)columns.size(); i++)
        addShowHideCommand(subMenu, columns[i]);
    } else
      addShowHideCommand(this, columns[0]);
    addSeparator();
  }

  // selection
  /*
    if(selectableColumns.size()==1)
    {
      addSelectCommand(this,
    TStageObjectId::ColumnId(selectableColumns[0]->getIndex()));
    }
    else
    */

  /*-- Scene内の全Objectを選択可能にする --*/
  TStageObjectId id;
  QMenu *cameraMenu = addMenu(tr("Select Camera"));
  QMenu *pegbarMenu = addMenu(tr("Select Pegbar"));
  QMenu *columnMenu = addMenu(tr("Select Column"));

  bool flag = false;

  for (int i = 0; i < xsh->getStageObjectTree()->getStageObjectCount(); i++) {
    id = xsh->getStageObjectTree()->getStageObject(i)->getId();
    if (id.isColumn()) {
      int columnIndex = id.getIndex();
      if (xsh->isColumnEmpty(columnIndex))
        continue;
      else {
        addSelectCommand(columnMenu, id);
        flag = true;
      }
    } else if (id.isTable())
      addSelectCommand(this, id);
    else if (id.isCamera())
      addSelectCommand(cameraMenu, id);
    else if (id.isPegbar())
      addSelectCommand(pegbarMenu, id);
  }

  /*- カラムがひとつも無かったらDisable -*/
  if (!flag) columnMenu->setEnabled(false);
}