本文整理汇总了C++中NodeGroup类的典型用法代码示例。如果您正苦于以下问题:C++ NodeGroup类的具体用法?C++ NodeGroup怎么用?C++ NodeGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _l
//! Toggle group playback
void
RouteWindow::_toggleGroupRolling()
{
if (!m_selectedGroupID)
return;
NodeGroup* g;
status_t err = m_routingView->manager->findGroup(m_selectedGroupID, &g);
if (err < B_OK)
return;
Autolock _l(g);
uint32 startAction = (g->runMode() == BMediaNode::B_OFFLINE)
? NodeGroup::M_ROLL : NodeGroup::M_START;
BMessenger m(g);
switch (g->transportState()) {
case NodeGroup::TRANSPORT_STOPPED:
m.SendMessage(startAction);
break;
case NodeGroup::TRANSPORT_RUNNING:
case NodeGroup::TRANSPORT_ROLLING:
m.SendMessage(NodeGroup::M_STOP);
break;
default:
break;
}
}
示例2: QDialog
LinkToKnobDialog::LinkToKnobDialog(const KnobGuiPtr& from,
QWidget* parent)
: QDialog(parent)
, _imp( new LinkToKnobDialogPrivate(from) )
{
_imp->mainLayout = new QVBoxLayout(this);
_imp->firstLine = new QWidget(this);
_imp->firstLineLayout = new QHBoxLayout(_imp->firstLine);
_imp->mainLayout->addWidget(_imp->firstLine);
_imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
Qt::Horizontal, this);
QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
_imp->mainLayout->addWidget(_imp->buttons);
_imp->selectNodeLabel = new Label(tr("Parent:"), _imp->firstLine);
_imp->firstLineLayout->addWidget(_imp->selectNodeLabel);
EffectInstance* isEffect = dynamic_cast<EffectInstance*>( from->getKnob()->getHolder() );
assert(isEffect);
if (!isEffect) {
throw std::logic_error("");
}
boost::shared_ptr<NodeCollection> group = isEffect->getNode()->getGroup();
group->getActiveNodes(&_imp->allNodes);
NodeGroup* isGroup = dynamic_cast<NodeGroup*>( group.get() );
if (isGroup) {
_imp->allNodes.push_back( isGroup->getNode() );
}
QStringList nodeNames;
for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
nodeNames.push_back(name);
//_imp->nodeSelectionCombo->addItem(name);
}
nodeNames.sort();
_imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
_imp->nodeSelectionCombo->setToolTip( GuiUtils::convertFromPlainText(tr("Input the name of a node in the current project."), Qt::WhiteSpaceNormal) );
_imp->firstLineLayout->addWidget(_imp->nodeSelectionCombo);
_imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) );
_imp->knobSelectionCombo = new ComboBox(_imp->firstLine);
_imp->firstLineLayout->addWidget(_imp->knobSelectionCombo);
QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );
_imp->firstLineLayout->addStretch();
}
示例3:
NodeGroup *StrokeTesselator::Tesselate(StrokeVertexIterator begin, StrokeVertexIterator end)
{
NodeGroup *group = new NodeGroup;
NodeShape *tshape = new NodeShape;
group->AddChild(tshape);
// tshape->material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
tshape->setFrsMaterial(_FrsMaterial);
for (StrokeVertexIterator c = begin, cend = end; c != cend; c++) {
tshape->AddRep(Tesselate((*c)));
}
return group;
}
示例4: assert
void
GuiAppInstance::onGroupCreationFinished(const NodePtr& node,
CreateNodeReason reason)
{
if (reason == eCreateNodeReasonUserCreate) {
NodeGraph* graph = 0;
boost::shared_ptr<NodeCollection> collection = node->getGroup();
assert(collection);
NodeGroup* isGrp = dynamic_cast<NodeGroup*>( collection.get() );
if (isGrp) {
NodeGraphI* graph_i = isGrp->getNodeGraph();
assert(graph_i);
graph = dynamic_cast<NodeGraph*>(graph_i);
} else {
graph = _imp->_gui->getNodeGraph();
}
assert(graph);
if (!graph) {
throw std::logic_error("");
}
NodesGuiList selectedNodes = graph->getSelectedNodes();
NodeGuiPtr selectedNode;
if ( !selectedNodes.empty() ) {
selectedNode = selectedNodes.front();
if ( dynamic_cast<BackdropGui*>( selectedNode.get() ) ) {
selectedNode.reset();
}
}
boost::shared_ptr<NodeGuiI> node_gui_i = node->getNodeGui();
assert(node_gui_i);
NodeGuiPtr nodeGui = boost::dynamic_pointer_cast<NodeGui>(node_gui_i);
graph->moveNodesForIdealPosition(nodeGui, selectedNode, true);
}
AppInstance::onGroupCreationFinished(node, reason);
/*std::list<ViewerInstance* > viewers;
node->hasViewersConnected(&viewers);
for (std::list<ViewerInstance* >::iterator it2 = viewers.begin(); it2 != viewers.end(); ++it2) {
(*it2)->renderCurrentFrame(false);
}*/
}
示例5: createNodeGroup
void CircuitICNDocument::slotAssignNodeGroups()
{
ICNDocument::slotAssignNodeGroups();
const ECNodeMap::iterator end = m_ecNodeList.end();
for ( ECNodeMap::iterator it = m_ecNodeList.begin(); it != end; ++it )
{
NodeGroup *ng = createNodeGroup ( *it );
if ( ng ) ng->init();
}
// We've destroyed the old node groups, so any collapsed flowcontainers
// containing new node groups need to update them to make them invisible.
const ItemMap::const_iterator itemListEnd = m_itemList.end();
for ( ItemMap::const_iterator it = m_itemList.begin(); it != itemListEnd; ++it )
{
if ( FlowContainer * fc = dynamic_cast<FlowContainer*> ( *it ) )
fc->updateContainedVisibility();
}
}
示例6: PORTNOTETRACE
void PrintMarksComponent::EndImportCustomPrintMark(CamelotRecordHandler *pHandler)
{
PORTNOTETRACE("print","PrintMarksComponent::EndImportCustomPrintMark - do nothing");
#ifndef EXCLUDE_FROM_XARALX
ERROR3IF(CustomCurrentContext == NULL || pNewMark == NULL, "EndImportCustomPrintMark - StartImportCustomMark not called/failed");
// Find the Print mark manager and it's PrintMark cache
PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
if (pMarksMan == NULL)
return;
// Restore the previous import context node
pHandler->SetInsertContextNode(CustomPreviousContext);
// Complete the mark and add it to the PMM cache
NodeGroup *Glyph = (NodeGroup *)CustomCurrentContext->FindFirstChild();
ERROR3IF(Glyph == NULL, "Import of custom mark subtree must have failed");
if (Glyph != NULL)
{
ERROR3IF(!Glyph->IsKindOf(CC_RUNTIME_CLASS(NodeGroup)), "Imported print mark doesn't start with a group");
Glyph->UnlinkNodeFromTree(NULL);
UINT32 MarkHandle = pMarksMan->PMMCache.AddNewMark(pNewMark, Glyph);
// Add a reference to the mark to ourself, so the mark is enabled
AddMark(MarkHandle);
}
else
{
// Try not to leak too much!
delete pNewMark;
}
// Tidy up
pNewMark = NULL;
CustomPreviousContext = NULL;
delete CustomCurrentContext;
CustomCurrentContext = NULL;
#endif
}
示例7: logMsg
void RouteAppNodeManager::nodeCreated(
NodeRef* ref) {
// prepare the log message
BMessage logMsg(M_LOG);
BString title = "Node '";
title << ref->name() << "' created";
logMsg.AddString("title", title);
// create a default group for the node
// [em 8feb00]
NodeGroup* g = createGroup(ref->name());
if(ref->kind() & B_TIME_SOURCE) {
// notify observers
BMessage m(M_TIME_SOURCE_CREATED);
m.AddInt32("nodeID", ref->id());
notify(&m);
}
// adopt node's time source if it's not the system clock (the default)
// [em 20mar00]
media_node systemClock;
status_t err = roster->GetSystemTimeSource(&systemClock);
if(err == B_OK)
{
BTimeSource* ts = roster->MakeTimeSourceFor(ref->node());
if(ts->Node() != systemClock)
{
g->setTimeSource(ts->Node());
logMsg.AddString("line", "Synced to system clock");
}
ts->Release();
}
g->addNode(ref);
m_logTarget.SendMessage(&logMsg);
}
示例8: D_METHOD
void MediaRoutingView::_initContent()
{
D_METHOD(("MediaRoutingView::_initContent()\n"));
Autolock lock(manager);
void *cookie = 0;
NodeRef *ref;
while (manager->getNextRef(&ref, &cookie) == B_OK)
{
// add self as observer
add_observer(this, ref);
// create & place node view (+++++ defer until observer status confirmed!)
_addPanelFor(ref->id(), BPoint(M_CLEANUP_H_MARGIN, M_CLEANUP_V_MARGIN));
}
cookie = 0;
Connection connection;
while (manager->getNextConnection(&connection, &cookie) == B_OK)
{
_addWireFor(connection);
}
// create default groups
NodeGroup* group;
NodeRef* videoIn = manager->videoInputNode();
if (videoIn)
{
group = manager->createGroup("Video Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(videoIn);
}
NodeRef* audioIn = manager->audioInputNode();
if (audioIn)
{
group = manager->createGroup("Audio Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(audioIn);
}
NodeRef* videoOut = manager->videoOutputNode();
if (videoOut)
{
group = manager->createGroup("Video Output");
group->addNode(videoOut);
}
}
示例9: QDialog
PickKnobDialog::PickKnobDialog(DockablePanel* panel,
QWidget* parent)
: QDialog(parent)
, _imp( new PickKnobDialogPrivate(panel) )
{
NodeSettingsPanel* nodePanel = dynamic_cast<NodeSettingsPanel*>(panel);
assert(nodePanel);
if (!nodePanel) {
throw std::logic_error("PickKnobDialog::PickKnobDialog()");
}
NodeGuiPtr nodeGui = nodePanel->getNode();
NodePtr node = nodeGui->getNode();
NodeGroup* isGroup = node->isEffectGroup();
boost::shared_ptr<NodeCollection> collec = node->getGroup();
NodeGroup* isCollecGroup = dynamic_cast<NodeGroup*>( collec.get() );
NodesList collectNodes = collec->getNodes();
for (NodesList::iterator it = collectNodes.begin(); it != collectNodes.end(); ++it) {
if ( !(*it)->getParentMultiInstance() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) {
_imp->allNodes.push_back(*it);
}
}
if (isCollecGroup) {
_imp->allNodes.push_back( isCollecGroup->getNode() );
}
if (isGroup) {
NodesList groupnodes = isGroup->getNodes();
for (NodesList::iterator it = groupnodes.begin(); it != groupnodes.end(); ++it) {
if ( !(*it)->getParentMultiInstance() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) {
_imp->allNodes.push_back(*it);
}
}
}
QStringList nodeNames;
for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
nodeNames.push_back(name);
}
nodeNames.sort();
_imp->mainLayout = new QGridLayout(this);
_imp->selectNodeLabel = new Label( tr("Node:") );
_imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
_imp->nodeSelectionCombo->setToolTip( GuiUtils::convertFromPlainText(tr("Input the name of a node in the current project."), Qt::WhiteSpaceNormal) );
_imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
_imp->knobSelectionCombo = new ComboBox(this);
QObject::connect( _imp->knobSelectionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onKnobComboIndexChanged(int)) );
QString useAliasTt = GuiUtils::convertFromPlainText(tr("If checked, an alias of the selected parameter will be created, coyping entirely its state. "
"Only the script-name, label and tooltip will be editable.\n"
"For choice parameters this will also "
"dynamically refresh the menu entries when the original parameter's menu is changed.\n"
"When unchecked, a simple expression will be set linking the two parameters, but things such as dynamic menus "
"will be disabled."), Qt::WhiteSpaceNormal);
_imp->useAliasLabel = new Label(tr("Make Alias:"), this);
_imp->useAliasLabel->setToolTip(useAliasTt);
_imp->useAliasCheckBox = new QCheckBox(this);
_imp->useAliasCheckBox->setToolTip(useAliasTt);
_imp->useAliasCheckBox->setChecked(true);
QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );
_imp->destPageLabel = new Label(tr("Page:"), this);
QString pagett = GuiUtils::convertFromPlainText(tr("Select the page into which the parameter will be created."), Qt::WhiteSpaceNormal);
_imp->destPageLabel->setToolTip(pagett);
_imp->destPageCombo = new ComboBox(this);
_imp->destPageCombo->setToolTip(pagett);
QObject::connect( _imp->destPageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPageComboIndexChanged(int)) );
const KnobsVec& knobs = node->getKnobs();
for (std::size_t i = 0; i < knobs.size(); ++i) {
if ( knobs[i]->isUserKnob() ) {
boost::shared_ptr<KnobPage> isPage = boost::dynamic_pointer_cast<KnobPage>(knobs[i]);
if (isPage) {
_imp->pages.push_back(isPage);
_imp->destPageCombo->addItem( QString::fromUtf8( isPage->getName().c_str() ) );
} else {
boost::shared_ptr<KnobGroup> isGrp = boost::dynamic_pointer_cast<KnobGroup>(knobs[i]);
if (isGrp) {
_imp->groups.push_back(isGrp);
}
}
}
}
if (_imp->destPageCombo->count() == 0) {
_imp->destPageLabel->hide();
_imp->destPageCombo->hide();
}
_imp->groupLabel = new Label(tr("Group:"), this);
QString grouptt = GuiUtils::convertFromPlainText(tr("Select the group into which the parameter will be created."), Qt::WhiteSpaceNormal);
_imp->groupCombo = new ComboBox(this);
_imp->groupLabel->setToolTip(grouptt);
_imp->groupCombo->setToolTip(grouptt);
onPageComboIndexChanged(0);
_imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
Qt::Horizontal, this);
QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
//.........这里部分代码省略.........
示例10: loader
int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
{
BlenderFileLoader loader(re, srl);
loader.setRenderMonitor(_pRenderMonitor);
_Chrono.start();
NodeGroup *blenderScene = loader.Load();
if (blenderScene == NULL) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Cannot load scene" << endl;
}
return 1;
}
if (blenderScene->numberOfChildren() < 1) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Empty scene" << endl;
}
blenderScene->destroy();
delete blenderScene;
return 1;
}
real duration = _Chrono.stop();
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Scene loaded" << endl;
printf("Mesh cleaning : %lf\n", duration);
printf("View map cache : %s\n", _EnableViewMapCache ? "enabled" : "disabled");
}
_SceneNumFaces += loader.numFacesRead();
#if 0
if (loader.minEdgeSize() < _minEdgeSize) {
_minEdgeSize = loader.minEdgeSize();
}
#endif
#if 0 // DEBUG
ScenePrettyPrinter spp;
blenderScene->accept(spp);
#endif
_RootNode->AddChild(blenderScene);
_RootNode->UpdateBBox(); // FIXME: Correct that by making a Renderer to compute the bbox
_pView->setModel(_RootNode);
//_pView->FitBBox();
if (_pRenderMonitor->testBreak())
return 0;
if (_EnableViewMapCache) {
NodeCamera *cam;
if (g_freestyle.proj[3][3] != 0.0)
cam = new NodeOrthographicCamera;
else
cam = new NodePerspectiveCamera;
double proj[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
proj[i * 4 + j] = g_freestyle.proj[i][j];
}
}
cam->setProjectionMatrix(proj);
_RootNode->AddChild(cam);
_RootNode->AddChild(new NodeSceneRenderLayer(*re->scene, *srl));
sceneHashFunc.reset();
//blenderScene->accept(sceneHashFunc);
_RootNode->accept(sceneHashFunc);
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Scene hash : " << sceneHashFunc.toString() << endl;
}
if (hitViewMapCache()) {
ClearRootNode();
return 0;
}
else {
delete _ViewMap;
_ViewMap = NULL;
}
}
_Chrono.start();
WXEdgeBuilder wx_builder;
wx_builder.setRenderMonitor(_pRenderMonitor);
blenderScene->accept(wx_builder);
_winged_edge = wx_builder.getWingedEdge();
duration = _Chrono.stop();
if (G.debug & G_DEBUG_FREESTYLE) {
printf("WEdge building : %lf\n", duration);
}
#if 0
//.........这里部分代码省略.........
示例11: mapToScene
void
NodeGraph::mouseMoveEvent(QMouseEvent* e)
{
QPointF newPos = mapToScene( e->pos() );
QPointF lastMousePosScene = mapToScene( _imp->_lastMousePos.x(), _imp->_lastMousePos.y() );
double dx, dy;
{
QPointF newPosRoot = _imp->_root->mapFromScene(newPos);
QPointF lastMousePosRoot = _imp->_root->mapFromScene(lastMousePosScene);
dx = newPosRoot.x() - lastMousePosRoot.x();
dy = newPosRoot.y() - lastMousePosRoot.y();
}
_imp->_hasMovedOnce = true;
bool mustUpdate = true;
boost::shared_ptr<NodeCollection> collection = getGroup();
NodeGroup* isGroup = dynamic_cast<NodeGroup*>( collection.get() );
bool isGroupEditable = true;
bool groupEdited = true;
if (isGroup) {
isGroupEditable = isGroup->isSubGraphEditable();
groupEdited = isGroup->getNode()->hasPyPlugBeenEdited();
}
if (!groupEdited && isGroupEditable) {
///check if user is nearby unlock
int iw = _imp->unlockIcon.width();
int ih = _imp->unlockIcon.height();
int w = width();
if ( ( e->x() >= (w - iw - 10 - 15) ) && ( e->x() <= (w - 10 + 15) ) &&
( e->y() >= (10 - 15) ) && ( e->y() <= (10 + ih + 15) ) ) {
assert(isGroup);
QPoint pos = mapToGlobal( e->pos() );
QToolTip::showText( pos, GuiUtils::convertFromPlainText(QCoreApplication::translate("NodeGraph", "Clicking the unlock button will convert the PyPlug to a regular group saved in the project and dettach it from the script.\n"
"Any modification will not be written to the Python script. Subsequent loading of the project will no longer load this group from the python script."), Qt::WhiteSpaceNormal) );
}
}
QRectF sceneR = visibleSceneRect();
if ( groupEdited && (_imp->_evtState != eEventStateSelectionRect) && (_imp->_evtState != eEventStateDraggingArrow) ) {
// Set cursor
std::set<NodeGui*> visibleNodes;
getNodesWithinViewportRect(visibleWidgetRect(), &visibleNodes);
NodeGuiPtr selected;
Edge* selectedEdge = 0;
bool optionalInputsAutoHidden = areOptionalInputsAutoHidden();
for (std::set<NodeGui*>::iterator it = visibleNodes.begin(); it != visibleNodes.end(); ++it) {
QPointF evpt = (*it)->mapFromScene(newPos);
QRectF bbox = (*it)->mapToScene( (*it)->boundingRect() ).boundingRect();
if ( (*it)->isActive() && bbox.intersects(sceneR) ) {
if ( (*it)->contains(evpt) ) {
selected = (*it)->shared_from_this();
if (optionalInputsAutoHidden) {
(*it)->refreshEdgesVisility(true);
} else {
break;
}
} else {
Edge* edge = (*it)->hasEdgeNearbyPoint(newPos);
if (edge) {
selectedEdge = edge;
if (!optionalInputsAutoHidden) {
break;
}
} else if ( optionalInputsAutoHidden && !(*it)->getIsSelected() ) {
(*it)->refreshEdgesVisility(false);
}
}
}
}
if (selected) {
_imp->cursorSet = true;
setCursor( QCursor(Qt::OpenHandCursor) );
} else if (selectedEdge) {
} else if (!selectedEdge && !selected) {
if (_imp->cursorSet) {
_imp->cursorSet = false;
unsetCursor();
}
}
}
bool mustUpdateNavigator = false;
///Apply actions
switch (_imp->_evtState) {
case eEventStateDraggingArrow: {
QPointF np = _imp->_arrowSelected->mapFromScene(newPos);
if ( _imp->_arrowSelected->isOutputEdge() ) {
_imp->_arrowSelected->dragDest(np);
} else {
_imp->_arrowSelected->dragSource(np);
}
checkAndStartAutoScrollTimer(newPos);
mustUpdate = true;
break;
}
case eEventStateDraggingNode: {
//.........这里部分代码省略.........
示例12: _isNull
//.........这里部分代码省略.........
if ( !knobs[i]->isUserKnob() &&
knobs[i]->getIsPersistant() &&
!isGroup && !isPage
&& knobs[i]->hasModificationsForSerialization() ) {
///For choice do a deepclone because we need entries
//bool doCopyKnobs = isChoice ? true : copyKnobs;
boost::shared_ptr<KnobSerialization> newKnobSer( new KnobSerialization(knobs[i]) );
_knobsValues.push_back(newKnobSer);
}
}
_nbKnobs = (int)_knobsValues.size();
for (std::list<KnobPtr >::const_iterator it = userPages.begin(); it != userPages.end(); ++it) {
boost::shared_ptr<GroupKnobSerialization> s( new GroupKnobSerialization(*it) );
_userPages.push_back(s);
}
_knobsAge = n->getKnobsAge();
_nodeLabel = n->getLabel_mt_safe();
_nodeScriptName = n->getScriptName_mt_safe();
_cacheID = n->getCacheID();
_pluginID = n->getPluginID();
if ( !n->hasPyPlugBeenEdited() ) {
_pythonModule = n->getPluginPythonModule();
_pythonModuleVersion = n->getMajorVersion();
}
_pluginMajorVersion = n->getMajorVersion();
_pluginMinorVersion = n->getMinorVersion();
if (serializeInputs) {
n->getInputNames(_inputs);
}
NodePtr masterNode = n->getMasterNode();
if (masterNode) {
_masterNodeName = masterNode->getFullyQualifiedName();
}
boost::shared_ptr<RotoContext> roto = n->getRotoContext();
if ( roto && !roto->isEmpty() ) {
_hasRotoContext = true;
roto->save(&_rotoContext);
} else {
_hasRotoContext = false;
}
boost::shared_ptr<TrackerContext> tracker = n->getTrackerContext();
if (tracker) {
_hasTrackerContext = true;
tracker->save(&_trackerContext);
} else {
_hasTrackerContext = false;
}
NodeGroup* isGrp = n->isEffectGroup();
if (isGrp) {
NodesList nodes;
isGrp->getActiveNodes(&nodes);
_children.clear();
for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) {
if ( (*it)->isPartOfProject() ) {
boost::shared_ptr<NodeSerialization> state( new NodeSerialization(*it) );
_children.push_back(state);
}
}
}
_multiInstanceParentName = n->getParentMultiInstanceName();
NodesList childrenMultiInstance;
_node->getChildrenMultiInstance(&childrenMultiInstance);
if ( !childrenMultiInstance.empty() ) {
assert(!isGrp);
for (NodesList::iterator it = childrenMultiInstance.begin(); it != childrenMultiInstance.end(); ++it) {
assert( (*it)->getParentMultiInstance() );
if ( (*it)->isActivated() ) {
boost::shared_ptr<NodeSerialization> state( new NodeSerialization(*it) );
_children.push_back(state);
}
}
}
n->getUserCreatedComponents(&_userComponents);
_isNull = false;
}
}
示例13: JunctionNode
Connector *CircuitICNDocument::createConnector(Connector *con1, Connector *con2, const QPoint &pos1, const QPoint &pos2, QPointList *pointList )
{
if ( !canConnect( con1, con2 ) ) return 0;
const bool con1UsedManual = con1->usesManualPoints();
const bool con2UsedManual = con2->usesManualPoints();
QList<QPointList> oldCon1Points = con1->splitConnectorPoints(pos1);
QList<QPointList> oldCon2Points = con2->splitConnectorPoints(pos2);
ECNode *node1a = dynamic_cast<ECNode*> ( con1->startNode() );
ECNode *node1b = dynamic_cast<ECNode*> ( con1->endNode( ) );
ECNode *node2a = dynamic_cast<ECNode*> ( con2->startNode() );
ECNode *node2b = dynamic_cast<ECNode*> ( con2->endNode( ) );
if ( !node1a || !node1b || !node2a || !node2b ) return 0;
con1->hide();
con2->hide();
// from this point forward, we are dealing with a circuit document -> all nodes are electronic
ECNode *newNode1 = new JunctionNode( this, 0, pos1 );
ECNode *newNode2 = new JunctionNode( this, 0, pos2 );
Connector *con1a = newNode1->createConnector(node1a);
node1a->addConnector(con1a);
Connector *con1b = newNode1->createConnector(node1b);
node1b->addConnector(con1b);
Connector *newCon = newNode1->createConnector(newNode2);
newNode2->addConnector(newCon);
Connector *con2a = node2a->createConnector(newNode2);
newNode2->addConnector(con2a);
Connector *con2b = node2b->createConnector(newNode2);
newNode2->addConnector(con2b);
if(!con1a || !con1b || !con2a || !con2b ) {
// This should never happen, as the canConnect function should strictly
// determine whether the connectors could be created before hand.
kWarning() << k_funcinfo << "Not all the connectors were created, this should never happen" << endl;
if(con1a) con1a->removeConnector();
if(con1b) con1b->removeConnector();
if(con2a) con2a->removeConnector();
if(con2b) con2b->removeConnector();
newNode1->removeNode();
newNode2->removeNode();
flushDeleteList();
return 0;
}
con1a->setRoutePoints(oldCon1Points.at(0), con1UsedManual );
con1b->setRoutePoints(oldCon1Points.at(1), con1UsedManual );
con2a->setRoutePoints(oldCon2Points.at(0), con2UsedManual );
con2b->setRoutePoints(oldCon2Points.at(1), con2UsedManual );
QPointList autoPoints;
if (!pointList) {
addAllItemConnectorPoints();
ConRouter cr(this);
cr.mapRoute( pos1.x(), pos1.y(), pos2.x(), pos2.y() );
autoPoints = cr.pointList(false);
pointList = &autoPoints;
}
newCon->setRoutePoints(*pointList,true);
// Avoid flicker: tell them to update their draw lists now
con1->updateConnectorPoints(false);
con2->updateConnectorPoints(false);
newCon->updateDrawList();
con1a->updateDrawList();
con1b->updateDrawList();
con2a->updateDrawList();
con2b->updateDrawList();
// Now it's safe to remove the connectors
con1->removeConnector();
con2->removeConnector();
flushDeleteList();
deleteNodeGroup(node1a);
deleteNodeGroup(node1b);
deleteNodeGroup(node2a);
deleteNodeGroup(node2b);
NodeGroup *ng = createNodeGroup(newNode1);
ng->addNode( newNode2, true );
ng->init();
//.........这里部分代码省略.........
示例14: D_HOOK
void RouteAppNodeManager::connectionMade(
Connection* connection) {
D_HOOK((
"@ RouteAppNodeManager::connectionMade()\n"));
status_t err;
// prepare the log message
BMessage logMsg(M_LOG);
BString title = "Connection ";
if (strcmp(connection->outputName(), connection->inputName()) == 0) {
title << "'" << connection->outputName() << "' ";
}
title << "made";
logMsg.AddString("title", title);
if(!(connection->flags() & Connection::INTERNAL))
// don't react to connection Cortex didn't make
return;
// create or merge groups
NodeRef *producer, *consumer;
err = getNodeRef(connection->sourceNode(), &producer);
if(err < B_OK) {
D_HOOK((
"!!! RouteAppNodeManager::connectionMade():\n"
" sourceNode (%ld) not found\n",
connection->sourceNode()));
return;
}
err = getNodeRef(connection->destinationNode(), &consumer);
if(err < B_OK) {
D_HOOK((
"!!! RouteAppNodeManager::connectionMade():\n"
" destinationNode (%ld) not found\n",
connection->destinationNode()));
return;
}
// add node names to log messages
BString line = "Between:";
logMsg.AddString("line", line);
line = " ";
line << producer->name() << " and ";
line << consumer->name();
logMsg.AddString("line", line);
// add format to log message
line = "Negotiated format:";
logMsg.AddString("line", line);
line = " ";
line << MediaString::getStringFor(connection->format(), false);
logMsg.AddString("line", line);
NodeGroup *group = 0;
BString groupName = "Untitled group ";
if(_canGroup(producer) && _canGroup(consumer))
{
if (producer->group() && consumer->group() &&
!(producer->group()->groupFlags() & NodeGroup::GROUP_LOCKED) &&
!(consumer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{
// merge into consumers group
group = consumer->group();
mergeGroups(producer->group(), group);
}
else if (producer->group() &&
!(producer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{ // add consumer to producers group
group = producer->group();
group->addNode(consumer);
}
else if (consumer->group() &&
!(consumer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{ // add producer to consumers group
group = consumer->group();
group->addNode(producer);
}
else
{ // make new group for both
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(producer);
group->addNode(consumer);
}
}
else if(_canGroup(producer) && !producer->group())
{ // make new group for producer
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(producer);
}
else if(_canGroup(consumer) && !consumer->group())
{ // make new group for consumer
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(consumer);
}
//.........这里部分代码省略.........
示例15: loader
int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
{
BlenderFileLoader loader(re, srl);
loader.setRenderMonitor(_pRenderMonitor);
_Chrono.start();
NodeGroup *blenderScene = loader.Load();
if (blenderScene == NULL) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Cannot load scene" << endl;
}
return 1;
}
if (blenderScene->numberOfChildren() < 1) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Empty scene" << endl;
}
blenderScene->destroy();
delete blenderScene;
return 1;
}
real duration = _Chrono.stop();
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Scene loaded" << endl;
printf("Mesh cleaning : %lf\n", duration);
}
_SceneNumFaces += loader.numFacesRead();
if (loader.minEdgeSize() < _minEdgeSize) {
_minEdgeSize = loader.minEdgeSize();
}
#if 0 // DEBUG
ScenePrettyPrinter spp;
blenderScene->accept(spp);
#endif
_RootNode->AddChild(blenderScene);
_RootNode->UpdateBBox(); // FIXME: Correct that by making a Renderer to compute the bbox
_pView->setModel(_RootNode);
//_pView->FitBBox();
if (_pRenderMonitor->testBreak())
return 0;
_Chrono.start();
WXEdgeBuilder wx_builder;
wx_builder.setRenderMonitor(_pRenderMonitor);
blenderScene->accept(wx_builder);
_winged_edge = wx_builder.getWingedEdge();
duration = _Chrono.stop();
if (G.debug & G_DEBUG_FREESTYLE) {
printf("WEdge building : %lf\n", duration);
}
#if 0
_pView->setDebug(_DebugNode);
// delete stuff
if (0 != ws_builder) {
delete ws_builder;
ws_builder = 0;
}
soc QFileInfo qfi(iFileName);
soc string basename((const char*)qfi.fileName().toAscii().data());
char cleaned[FILE_MAX];
BLI_strncpy(cleaned, iFileName, FILE_MAX);
BLI_cleanup_file(NULL, cleaned);
string basename = string(cleaned);
#endif
_ListOfModels.push_back("Blender_models");
_Scene3dBBox = _RootNode->bbox();
_bboxDiag = (_RootNode->bbox().getMax() - _RootNode->bbox().getMin()).norm();
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Triangles nb : " << _SceneNumFaces << endl;
cout << "Bounding Box : " << _bboxDiag << endl;
}
ClearRootNode();
return 0;
}