本文整理汇总了C++中SoNode::getField方法的典型用法代码示例。如果您正苦于以下问题:C++ SoNode::getField方法的具体用法?C++ SoNode::getField怎么用?C++ SoNode::getField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoNode
的用法示例。
在下文中一共展示了SoNode::getField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SoUnknownNode::createFromIsA(SoMFString *isA)
//
////////////////////////////////////////////////////////////////////////
{
for (int i = 0; i < isA->getNum(); i++) {
SoType t = SoType::fromName((*isA)[i]);
if (t.canCreateInstance() &&
t.isDerivedFrom(SoNode::getClassTypeId())) {
SoNode *alternateRep = (SoNode *)t.createInstance();
alternateRep->ref();
#ifdef DEBUG
if (alternateRep == NULL) {
SoDebugError::post("SoUnknownNode::createFromIsA",
"SoType.createInstance returned "
"NULL (type %s)",
t.getName().getString());
return;
}
#endif
// Copy over all fields that are shared:
int num = instanceFieldData->getNumFields();
for (int j=0; j<num; j++) {
const SbName &fieldName = instanceFieldData->getFieldName(j);
SoField *f = instanceFieldData->getField(this, j);
// Don't copy over fields with default values:
if (f->isDefault()) continue;
SoField *nf = alternateRep->getField(fieldName);
if (nf != NULL && nf->getTypeId() == f->getTypeId()) {
nf->copyFrom(*f);
if (f->isConnectedFromField()) {
SoField *cf;
f->getConnectedField(cf);
nf->connectFrom(cf);
} else if (f->isConnectedFromEngine()) {
SoEngineOutput *eo;
f->getConnectedEngine(eo);
nf->connectFrom(eo);
}
}
}
// And if alternateRep is a group, copy over hidden
// children:
if (alternateRep->isOfType(SoGroup::getClassTypeId())) {
SoGroup *g = (SoGroup *)alternateRep;
for (int kid = 0; kid < hiddenChildren.getLength();
kid++) {
g->addChild(hiddenChildren[kid]);
}
}
addChild(alternateRep);
return;
}
}
}