本文整理汇总了C++中XmlElement::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlElement::GetAttribute方法的具体用法?C++ XmlElement::GetAttribute怎么用?C++ XmlElement::GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElement
的用法示例。
在下文中一共展示了XmlElement::GetAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteToFilePosRotScaleBoxFlags
/**
* @brief
* Writes the scene node position, rotation, scale, bounding box and flags into a file
*/
void PLSceneNode::WriteToFilePosRotScaleBoxFlags(XmlElement &cNodeElement) const
{
// Currently ONLY the center of the container the node is in use used to make it relative
const Point3 vParentWorldSpaceCenter = GetContainer() ? GetContainer()->GetWorldSpaceCenter() : Point3(0.0f, 0.0f, 0.0f);
// Write down the position
PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Position", (GetType() != TypeScene && GetType() != TypeCell) ? m_vPos-vParentWorldSpaceCenter : static_cast<const PLSceneContainer*>(this)->GetWorldSpaceCenter(), Point3(0.0f, 0.0f, 0.0f));
// Write down the rotation
PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Rotation", m_vRot, Point3(0.0f, 0.0f, 0.0f));
// Write down the scale
PLTools::XmlElementSetAttributeWithDefault(cNodeElement, "Scale", m_vScale, Point3(1.0f, 1.0f, 1.0f));
// Are there any flags?
if (m_sFlags.GetLength()) {
String sFlags = cNodeElement.GetAttribute("Flags");
if (sFlags.GetLength())
sFlags += '|' + m_sFlags;
else
sFlags = m_sFlags;
sFlags.Trim();
cNodeElement.SetAttribute("Flags", sFlags);
}
}
示例2: WriteVariables
/**
* @brief
* Writes the flexible scene node variables
*/
void PLSceneNode::WriteVariables(XmlElement &cNodeElement) const
{
// Export variables?
if (g_SEOptions.bUserPropVariables) {
// Is there a 3ds Max node (No 3ds Max node, no properties)
INode *pMaxNode = GetMaxNode();
if (pMaxNode) {
// Check for variables
TSTR s3dsMaxString;
if (pMaxNode->GetUserPropString(_T("Vars"), s3dsMaxString)) {
// Get all expressions
static RegEx cExpressionRegEx("\\s*((\\w*\\s*=\\s*\"[^\"]*\")|(\\w*\\s*=\\s*[\\w|]*))");
const String sString = s3dsMaxString;
uint32 nExpressionParsePos = 0;
while (cExpressionRegEx.Match(sString, nExpressionParsePos)) {
// Get expression
nExpressionParsePos = cExpressionRegEx.GetPosition();
const String sExpression = cExpressionRegEx.GetResult(0);
// Process the found expression
static RegEx cRegEx("\\s*(\\w*)\\s*=\\s*\"?\\s*([^\"]*)\\s*\"?");
if (cRegEx.Match(sExpression)) {
// Get name and value
const String sName = cRegEx.GetResult(0);
const String sValue = cRegEx.GetResult(1);
// Flags variable?
if (sName == "Flags") {
// Update attribute
String sFlags = cNodeElement.GetAttribute(sName);
if (sFlags.GetLength())
sFlags += '|' + sValue;
else
sFlags = sValue;
sFlags.Trim();
cNodeElement.SetAttribute(sName, sFlags);
} else {
// Set attribute
cNodeElement.SetAttribute(sName, sValue);
}
}
}
}
}
}
}