本文整理汇总了C++中NiNodeRef::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ NiNodeRef::SetName方法的具体用法?C++ NiNodeRef::SetName怎么用?C++ NiNodeRef::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NiNodeRef
的用法示例。
在下文中一共展示了NiNodeRef::SetName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getcasesout
void getcasesout(QString etc)
{
hkroot=new hkRootLevelContainer();
if(etc.contains(".xml",Qt::CaseSensitive)==true)
{
hkOstream stream(etc.toStdString().c_str());
hkSerializeUtil::saveTagfile( hkroot, hkRootLevelContainerClass, stream.getStreamWriter(), HK_NULL, hkSerializeUtil::SAVE_TEXT_FORMAT);
}
if(etc.contains(".hkx",Qt::CaseSensitive)==true)
{
hkPackfileWriter::Options options;
hkOstream stream(etc.toStdString().c_str());
hkSerializeUtil::savePackfile( hkroot, hkRootLevelContainerClass, hkOstream(stream).getStreamWriter(), options );
//hkResult res = hkSerializeUtil::save(hkroot, stream.getStreamWriter(),hkSerializeUtil::SAVE_WRITE_ATTRIBUTES);
}
else if(etc.contains(".nif",Qt::CaseSensitive)==true)
{
niparentnode=new NiNode();
niparentnode->SetName("root");
WriteNifTree(etc.toStdString(),niparentnode,nifInfo);
}
else if(etc.contains(".kfm",Qt::CaseSensitive)==true)
{
niparentnode=new NiNode();
niparentnode->SetName("root");
WriteNifTree(etc.toStdString(),niparentnode,nifInfo);
}
else if(etc.contains(".dae",Qt::CaseSensitive)==true)
{
const aiScene* scene1;
aiExportScene(scene1,"dae","hihh",0);
}
else if(etc.contains(".obj",Qt::CaseSensitive)==true)
{
const aiScene* scene1;
aiExportScene(scene1,"obj","hihh",0);
}
else if(etc.contains(".FBX",Qt::CaseSensitive)==true)
{
//
}
else
{
QMessageBox* mes;
mes->setText("format isnt available for export");
mes->exec();
}
}
示例2: setName
void Exporter::setName(NiNodeRef node, const string& name)
{
USES_CONVERSION;
tstring tname = A2TString(name);
node->SetName(name);
mNameMap[tname] = node;
}
示例3: createNode
NiNodeRef Exporter::createNode(INode* maxNode, const string& name)
{
USES_CONVERSION;
bool ismatch = strmatch(T2A(maxNode->GetName()), name);
if (ismatch) {
NodeToNodeMap::iterator itr = mNodeMap.find(maxNode);
if (itr != mNodeMap.end())
return (*itr).second;
}
NiNodeRef node;
if (!findNode(name, node))
{
node = createNode();
BOOL noname = FALSE;
if (!maxNode->GetUserPropBool(NP_NONAME, noname) || !noname)
node->SetName(name);
}
if (wildmatch("noname*", name))
{
maxNode->SetUserPropBool(NP_NONAME, TRUE);
}
mNodeMap[maxNode] = node;
return node;
}
示例4: getNode
NiNodeRef Exporter::getNode(const string& name)
{
NodeMap::iterator itr = mNameMap.find(name);
if (itr != mNameMap.end())
return (*itr).second;
NiNodeRef node = CreateNiObject<NiNode>();
if ( IsFallout3() || IsSkyrim() ) {
node->SetFlags( 14 );
}
node->SetName(name);
mNameMap[name] = node;
return node;
}
示例5: convertShape
/*---------------------------------------------------------------------------*/
unsigned int NifConvertUtility::convertShape(string fileNameSrc, string fileNameDst, string fileNameTmpl)
{
NiNodeRef pRootInput (NULL);
NiNodeRef pRootOutput (NULL);
NiNodeRef pRootTemplate (NULL);
NiTriShapeRef pNiTriShapeTmpl(NULL);
vector<NiAVObjectRef> srcChildList;
bool fakedRoot (false);
// test on existing file names
if (fileNameSrc.empty()) return NCU_ERROR_MISSING_FILE_NAME;
if (fileNameDst.empty()) return NCU_ERROR_MISSING_FILE_NAME;
if (fileNameTmpl.empty()) return NCU_ERROR_MISSING_FILE_NAME;
// initialize user messages
_userMessages.clear();
logMessage(NCU_MSG_TYPE_INFO, "Source: " + (fileNameSrc.empty() ? "- none -" : fileNameSrc));
logMessage(NCU_MSG_TYPE_INFO, "Template: " + (fileNameTmpl.empty() ? "- none -" : fileNameTmpl));
logMessage(NCU_MSG_TYPE_INFO, "Destination: " + (fileNameDst.empty() ? "- none -" : fileNameDst));
logMessage(NCU_MSG_TYPE_INFO, "Texture: " + (_pathTexture.empty() ? "- none -" : _pathTexture));
// initialize used texture list
_usedTextures.clear();
_newTextures.clear();
// read input NIF
if ((pRootInput = getRootNodeFromNifFile(fileNameSrc, "source", fakedRoot)) == NULL)
{
logMessage(NCU_MSG_TYPE_ERROR, "Can't open '" + fileNameSrc + "' as input");
return NCU_ERROR_CANT_OPEN_INPUT;
}
// get template nif
pRootTemplate = DynamicCast<BSFadeNode>(ReadNifTree((const char*) fileNameTmpl.c_str()));
if (pRootTemplate == NULL)
{
logMessage(NCU_MSG_TYPE_ERROR, "Can't open '" + fileNameTmpl + "' as template");
return NCU_ERROR_CANT_OPEN_TEMPLATE;
}
// get shapes from template
// - shape root
pNiTriShapeTmpl = DynamicCast<NiTriShape>(pRootTemplate->GetChildren().at(0));
if (pNiTriShapeTmpl == NULL)
{
logMessage(NCU_MSG_TYPE_INFO, "Template has no NiTriShape.");
}
// template root is used as root of output
pRootOutput = pRootTemplate;
// get rid of unwanted subnodes
pRootOutput->ClearChildren(); // remove all children
pRootOutput->SetCollisionObject(NULL); // unlink collision object
// hold extra data and property nodes
// copy translation from input node
pRootOutput->SetLocalTransform(pRootInput->GetLocalTransform());
// copy name of root node
pRootOutput->SetName(pRootInput->GetName());
// get list of children from input node
srcChildList = pRootInput->GetChildren();
// unlink children 'cause moved to output
pRootInput->ClearChildren();
// iterate over source nodes and convert using template
for (vector<NiAVObjectRef>::iterator ppIter = srcChildList.begin(); ppIter != srcChildList.end(); ppIter++)
{
// NiTriShape
if (DynamicCast<NiTriShape>(*ppIter) != NULL)
{
pRootOutput->AddChild(&(*convertNiTriShape(DynamicCast<NiTriShape>(*ppIter), pNiTriShapeTmpl)));
}
// RootCollisionNode
else if (DynamicCast<RootCollisionNode>(*ppIter) != NULL)
{
// ignore node
}
// NiNode (and derived classes?)
else if (DynamicCast<NiNode>(*ppIter) != NULL)
{
pRootOutput->AddChild(&(*convertNiNode(DynamicCast<NiNode>(*ppIter), pNiTriShapeTmpl, pRootOutput)));
}
}
// write missing textures to log - as block
for (set<string>::iterator pIter(_newTextures.begin()); pIter != _newTextures.end(); ++pIter)
{
logMessage(NCU_MSG_TYPE_TEXTURE_MISS, *pIter);
}
// write modified nif file
WriteNifTree((const char*) fileNameDst.c_str(), pRootOutput, NifInfo(VER_20_2_0_7, 12, 83));
return NCU_OK;
}
示例6: convertShape
/*---------------------------------------------------------------------------*/
unsigned int NifConvertUtility::convertShape(string fileNameSrc, string fileNameDst, string fileNameTmpl)
{
cout << "Here3" << endl;
NiNodeRef pRootInput (NULL);
NiNodeRef pRootOutput (NULL);
NiNodeRef pRootTemplate (NULL);
NiTriShapeRef pNiTriShapeTmpl(NULL);
NiCollisionObjectRef pRootCollObject(NULL);
NifInfo nifInfo;
vector<NiAVObjectRef> srcChildList;
bool fakedRoot (false);
cout << "Here4" << endl;
// test on existing file names
if (fileNameSrc.empty()) return NCU_ERROR_MISSING_FILE_NAME;
if (fileNameDst.empty()) return NCU_ERROR_MISSING_FILE_NAME;
if (fileNameTmpl.empty()) return NCU_ERROR_MISSING_FILE_NAME;
cout << "Here5" << endl;
// initialize user messages
_userMessages.clear();
logMessage(NCU_MSG_TYPE_INFO, "Source: " + (fileNameSrc.empty() ? "- none -" : fileNameSrc));
logMessage(NCU_MSG_TYPE_INFO, "Template: " + (fileNameTmpl.empty() ? "- none -" : fileNameTmpl));
logMessage(NCU_MSG_TYPE_INFO, "Destination: " + (fileNameDst.empty() ? "- none -" : fileNameDst));
logMessage(NCU_MSG_TYPE_INFO, "Texture: " + (_pathTexture.empty() ? "- none -" : _pathTexture));
cout << "Here6" << endl;
// initialize used texture list
_usedTextures.clear();
_newTextures.clear();
cout << "Here7" << endl;
// read input NIF
if ((pRootInput = getRootNodeFromNifFile(fileNameSrc, "source", fakedRoot, &nifInfo)) == NULL)
{
logMessage(NCU_MSG_TYPE_ERROR, "Can't open '" + fileNameSrc + "' as input");
return NCU_ERROR_CANT_OPEN_INPUT;
}
cout << "Here8" << endl;
// get template nif
pRootTemplate = DynamicCast<BSFadeNode>(ReadNifTree((const char*) fileNameTmpl.c_str()));
if (pRootTemplate == NULL)
{
logMessage(NCU_MSG_TYPE_ERROR, "Can't open '" + fileNameTmpl + "' as template");
return NCU_ERROR_CANT_OPEN_TEMPLATE;
}
cout << "Here9" << endl;
// get shapes from template
// - shape root
pNiTriShapeTmpl = DynamicCast<NiTriShape>(pRootTemplate->GetChildren().at(0));
if (pNiTriShapeTmpl == NULL)
{
logMessage(NCU_MSG_TYPE_INFO, "Template has no NiTriShape.");
}
cout << "Here10" << endl;
// get data from input node
srcChildList = pRootInput->GetChildren();
pRootCollObject = pRootInput->GetCollisionObject();
cout << "Here11" << endl;
// template root is used as root of output
pRootOutput = pRootTemplate;
// move date from input to output
pRootInput ->SetCollisionObject(NULL);
pRootOutput->SetCollisionObject(pRootCollObject);
pRootOutput->SetLocalTransform(pRootInput->GetLocalTransform());
pRootOutput->SetName(pRootInput->GetName());
cout << "Here12" << endl;
// get rid of unwanted subnodes
pRootOutput->ClearChildren();
pRootInput->ClearChildren();
cout << "Here13" << endl;
// move children to output
for (auto pIter=srcChildList.begin(), pEnd=srcChildList.end(); pIter != pEnd; ++pIter)
{
pRootOutput->AddChild(*pIter);
}
cout << "Here14" << endl;
// iterate over source nodes and convert using template
root_bsafade = pRootOutput;
pRootOutput = convertNiNode(pRootOutput, pNiTriShapeTmpl, pRootOutput);
cout << "Here15" << endl;
// write missing textures to log - as block
for (auto pIter=_newTextures.begin(), pEnd=_newTextures.end(); pIter != pEnd; ++pIter)
{
logMessage(NCU_MSG_TYPE_TEXTURE_MISS, *pIter);
}
cout << "Here16" << endl;
// set version information
stringstream sStream;
cout << "Here17" << endl;
sStream << nifInfo.version << ';' << nifInfo.userVersion;
nifInfo.version = VER_20_2_0_7;
nifInfo.userVersion = 12;
nifInfo.userVersion2 = 83;
nifInfo.creator = "NifConvert";
nifInfo.exportInfo1 = MASTER_PRODUCT_VERSION_STR;
nifInfo.exportInfo2 = sStream.str();
cout << "Here18" << endl;
// write modified nif file
WriteNifTree((const char*) fileNameDst.c_str(), pRootOutput, nifInfo);
cout << "Here19" << endl;
return NCU_OK;
//.........这里部分代码省略.........
示例7: convertNiNode
NiNodeRef NifConvertUtility::convertNiNode(NiNodeRef pSrcNode, NiTriShapeRef pTmplNode, NiNodeRef pRootNode, NiAlphaPropertyRef pTmplAlphaProp)
{
NiNodeRef pDstNode (pSrcNode);
//pDstNode->SetName(pDstNode->GetName().replace(
string node_name_in = pDstNode->GetName();
string node_name_out = "";
for (int i = 0; i < node_name_in.length(); i++)
{
if (node_name_in[i] != '.' && node_name_in[i] != '_' && node_name_in[i] != ' ')
{
node_name_out = node_name_out + node_name_in[i];
}
}
pDstNode->SetName(node_name_out);
node_name_in = node_name_out;
if (node_name_in.compare("AttachLight") == 0)
{
Vector3 tr = pDstNode->GetLocalTranslation();
tr.z += 10.0f;
pDstNode->SetLocalTranslation(tr);
}
if (node_name_in.compare("ShadowBox") == 0)
{
cout << "Removing ShadowBox" << endl;
pDstNode->ClearChildren();
}
if (toLower(node_name_in).find("fireemit") != -1)
{
NiExtraDataRef ed = root_bsafade->GetExtraData().front();
NiIntegerExtraDataRef iref = DynamicCast<NiIntegerExtraData>(ed);
iref->SetData(147);
cout << "Adding TorchFlame Addon" << endl;
BSValueNodeRef candle_flame = new BSValueNode();
candle_flame->SetName("AddOnNode");
candle_flame->value = 46;
pDstNode->AddChild(DynamicCast<NiAVObject>(candle_flame));
}
else if (node_name_in.find("CandleFlame") != -1)
{
NiExtraDataRef ed = root_bsafade->GetExtraData().front();
NiIntegerExtraDataRef iref = DynamicCast<NiIntegerExtraData>(ed);
iref->SetData(147);
cout << "Adding CandleFlame Addon" << endl;
BSValueNodeRef candle_flame = new BSValueNode();
candle_flame->SetName("AddOnNode");
candle_flame->value = 49;
pDstNode->AddChild(DynamicCast<NiAVObject>(candle_flame));
}
vector<NiAVObjectRef> srcShapeList(pDstNode->GetChildren());
//if (!pDstNode->GetType().IsSameType(NiNode::TYPE) && !pDstNode->GetType().IsSameType(BSFadeNode::TYPE) && !pDstNode->GetType().IsSameType(NiTriShape::TYPE) && !pDstNode->GetType().IsSameType(NiTriStrips::TYPE))
{
}
// find NiAlphaProperty and use as template in sub-nodes
if (DynamicCast<NiAlphaProperty>(pDstNode->GetPropertyByType(NiAlphaProperty::TYPE)) != NULL)
{
pTmplAlphaProp = DynamicCast<NiAlphaProperty>(pDstNode->GetPropertyByType(NiAlphaProperty::TYPE));
}
// unlink protperties -> not used in new format
pDstNode->ClearProperties();
// shift extra data to new version
pDstNode->ShiftExtraData(VER_20_2_0_7);
// unlink children
pDstNode->ClearChildren();
pDstNode->ClearEffects();
pDstNode->ClearControllers();
if (!pDstNode->GetType().IsSameType(BSFadeNode::TYPE))
{
pDstNode->ClearExtraData();
}
// iterate over source nodes and convert using template
for (auto ppIter=srcShapeList.begin(), pEnd=srcShapeList.end(); ppIter != pEnd; ppIter++)
{
//DynamicCast<NiTriShape>(*ppIter) == NULL && DynamicCast<NiTriStrips>(*ppIter) == NULL ** DynamicCast<NiTriStrips>(*ppIter) != NULL
//.........这里部分代码省略.........