本文整理汇总了C++中SoPath::getNodeFromTail方法的典型用法代码示例。如果您正苦于以下问题:C++ SoPath::getNodeFromTail方法的具体用法?C++ SoPath::getNodeFromTail怎么用?C++ SoPath::getNodeFromTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoPath
的用法示例。
在下文中一共展示了SoPath::getNodeFromTail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doAction
void SoFCIndexedFaceSet::doAction(SoAction * action)
{
if (action->getTypeId() == Gui::SoGLSelectAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setSearchingAll(false);
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
if (!(coords && coords->getTypeId().isDerivedFrom(SoCoordinate3::getClassTypeId())))
return;
startSelection(action);
renderSelectionGeometry(static_cast<SoCoordinate3*>(coords)->point.getValues(0));
stopSelection(action);
}
else if (action->getTypeId() == Gui::SoVisibleFaceAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setSearchingAll(false);
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
if (!(coords && coords->getTypeId().isDerivedFrom(SoCoordinate3::getClassTypeId())))
return;
startVisibility(action);
renderVisibleFaces(static_cast<SoCoordinate3*>(coords)->point.getValues(0));
stopVisibility(action);
}
inherited::doAction(action);
}
示例2: ASSERT
void
IfWeeder::weedMaterial(SoNode *root, IfWeederMaterialEntry *entry)
{
// If the material affects no shapes at all, get rid of it. This
// can happen when vertex property nodes are used.
if (entry->shapes.getLength() == 0) {
SoSearchAction sa;
sa.setNode(entry->material);
sa.setInterest(SoSearchAction::ALL);
sa.apply(root);
for (int i = 0; i < sa.getPaths().getLength(); i++) {
SoPath *path = sa.getPaths()[i];
SoSeparator *parent = (SoSeparator *) path->getNodeFromTail(1);
int index = path->getIndexFromTail(0);
ASSERT(parent->isOfType(SoSeparator::getClassTypeId()));
ASSERT(parent->getChild(index) == entry->material);
parent->removeChild(index);
}
}
// Remove all material values from the material node that are
// not used by any dependent shapes. Adjust the indices in the
// dependent shapes accordingly.
removeDuplicateMaterials(entry);
// Now remove all material values that are not used by any
// dependent shapes. Again, adjust the indices in the dependent
// shapes.
removeUnusedMaterials(entry);
}
示例3: SoPath
SoPath *pickFilterCB(void *, const SoPickedPoint *pick)
{
SoPath *path = pick->getPath();
for (int i=0; i< path->getLength(); i++) {
LabObject *found = NULL;
if (LabObject::isLabObject(path->getNodeFromTail(i), &found)) {
//return path->copy(0, i+1);
return path->copy(0, path->getLength()-i);
}
}
return new SoPath();
}