예제 #1
0
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)));
		}
	}
예제 #2
0
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();
}
예제 #3
0
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();
}