本文整理汇总了C++中nlgeorges::UFormElm::getNodeByName方法的典型用法代码示例。如果您正苦于以下问题:C++ UFormElm::getNodeByName方法的具体用法?C++ UFormElm::getNodeByName怎么用?C++ UFormElm::getNodeByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nlgeorges::UFormElm
的用法示例。
在下文中一共展示了UFormElm::getNodeByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importForm
void CBackgroundSound::importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot)
{
NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
formRoot.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "background_sound.dfn");
// Call the base class
CSound::importForm(filename, formRoot);
// Read the array of sound with there respective filter.
{
_Sounds.clear();
NLGEORGES::UFormElm *psoundList;
formRoot.getNodeByName(&psoundList, ".SoundType.Sounds");
if (psoundList != 0 && psoundList->isArray())
{
uint size;
psoundList->getArraySize(size);
for (uint i=0; i<size; ++i)
{
TSoundInfo sound;
NLGEORGES::UFormElm *psoundItem;
psoundList->getArrayNode(&psoundItem, i);
if (psoundItem != NULL)
{
// Read the sound name.
std::string soundName;
psoundItem->getValueByName(soundName, "Sound");
sound.SoundName = CStringMapper::map(CFile::getFilenameWithoutExtension(soundName));
// Read the environnement flag.
for (uint j=0; j<UAudioMixer::TBackgroundFlags::NB_BACKGROUND_FLAGS; j++)
{
char tmp[200];
sprintf(tmp, "Filter%2.2u", j);
psoundItem->getValueByName(sound.Filter.Flags[j], tmp);
}
}
_Sounds.push_back(sound);
}
}
}
_DurationValid = false;
}
示例2: build
//===============================================================================
void CWorldSheet::build(const NLGEORGES::UFormElm &item)
{
const UFormElm *pElt;
uint size;
nlverify (item.getNodeByName (&pElt, "continents list"));
if(!pElt)
{
nlwarning("node 'continents list' not found in a .world");
}
else
{
nlverify (pElt->getArraySize (size));
ContLocs.reserve(size);
for (uint32 i = 0; i <size; ++i)
{
const UFormElm *pEltOfList;
// Get the continent
if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
{
SContLoc clTmp;
clTmp.build (pEltOfList);
ContLocs.push_back (clTmp);
}
}
item.getValueByName (Name, "name");
}
// Maps loading
nlverify (item.getNodeByName (&pElt, "maps list"));
if(!pElt)
{
nlwarning("node 'maps list' is not found in a .world");
}
else
{
nlverify (pElt->getArraySize (size));
Maps.reserve(size);
for (uint32 i = 0; i < size; ++i)
{
const UFormElm *pEltOfList;
// Get the continent
if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
{
SMap mapTmp;
mapTmp.build (pEltOfList);
Maps.push_back (mapTmp);
}
}
}
}
示例3: build
//=============================================================================
void CWeatherFunctionSheet::build(const NLGEORGES::UFormElm &item)
{
const NLGEORGES::UFormElm *elm;
uint numSetups = 0;
// get list of weather setups from the form
if(item.getNodeByName (&elm, "WeatherSetups") && elm)
{
// Get number of setups
nlverify (elm->getArraySize (numSetups));
SetupNames.resize(numSetups);
// For each setup
for(uint k = 0; k < numSetups; ++k)
{
if (!elm->getArrayValue(SetupNames[k], k))
{
nlwarning("Can't read weather setup from form");
}
}
}
uint numWeights = 0;
SetupWeights.resize(numSetups);
// get weight of each weather setup. Setup that are not given are assumed to be 1
if(item.getNodeByName (&elm, "SetupsWeights") && elm)
{
// Get number of setups
nlverify (elm->getArraySize (numWeights));
numWeights = std::min(numSetups, numWeights);
// For each setup
for(uint k = 0; k < numWeights; ++k)
{
if (!elm->getArrayValue(SetupWeights[k], k))
{
nlwarning("Can't read weather setup from form");
}
SetupWeights[k] = std::max((uint32) 1, SetupWeights[k]);
}
}
// complete other weights if not same size
std::fill(SetupWeights.begin() + numWeights, SetupWeights.begin() + numSetups, 1);
//
getWeatherFuncFormValue(item, VegetableMinBendIntensity, "Visual.VegetableMinBendIntensity");
getWeatherFuncFormValue(item, VegetableMaxBendIntensity, "Visual.VegetableMaxBendIntensity");
getWeatherFuncFormValue(item, VegetableMinWindFrequency, "Visual.VegetableMinWindFrequency");
getWeatherFuncFormValue(item, VegetableMaxWindFrequency, "Visual.VegetableMaxWindFrequency");
getWeatherFuncFormValue(item, VegetableMaxBendOffset, "Visual.VegetableMaxBendOffset");
getWeatherFuncFormValue(item, VegetableWindIntensityThatStartBendOffset, "Visual.VegetableWindIntensityThatStartBendOffset");
//
getWeatherFuncFormValue(item, TreeMinWindIntensity, "Visual.TreeMinWindIntensity");
getWeatherFuncFormValue(item, TreeMaxWindIntensity, "Visual.TreeMaxWindIntensity");
}
示例4: build
//-----------------------------------------------
// build :
// Build the sheet from an external script.
//-----------------------------------------------
void CMissionSheet::build(const NLGEORGES::UFormElm &item)
{
// Load the descriptors.
if(!item.getValueByName(Name, "Name"))
debug("key 'Name' not found.");
if(!item.getValueByName(Description, "Description"))
debug("key 'Description' not found.");
if(!item.getValueByName(RewardDescription, "RewardDescription"))
debug("key 'RewardDescription' not found.");
// load mission steps description
for (uint i =1; i< NB_STEPS_PER_MISSION + 1;i++)
{
const UFormElm * stepStruct;
string varName = string("step") + NLMISC::toString(i);
item.getNodeByName (&stepStruct, varName.c_str());
if (stepStruct)
{
string stepDesc;
stepStruct->getValueByName(stepDesc,"Description");
if ( !stepDesc.empty() )
StepsDescription.push_back(stepDesc);
}
}
}// build //
示例5: build
//=========================================================================
void CContinentSheet::build(const NLGEORGES::UFormElm &item)
{
Continent.build(item);
const UFormElm *elm;
// Load the village list
if(item.getNodeByName (&elm, "Villages") && elm)
{
// Get number of village
uint numVillage;
nlverify (elm->getArraySize (numVillage));
Villages.resize(numVillage);
// For each village
for(uint k = 0; k < numVillage; ++k)
{
// Village pointer
const UFormElm *villageForm;
if (elm->getArrayNode (&villageForm, k) && villageForm)
{
Villages[k].build(*villageForm);
elm->getArrayNodeName(Villages[k].Name, k);
}
}
}
// load the weather functions
// Build season descriptor
static const char *seasonFuncName[] =
{
"SpringWeatherFunction",
"SummerWeatherFunction",
"AutumnWeatherFunction",
"WinterWeatherFunction"
};
// added - 1 because there is an invalid season
nlctassert(sizeof(seasonFuncName) / sizeof(seasonFuncName[0]) == EGSPD::CSeason::Invalid );
// Load weather functions & sky sheets
for(uint k = 0; k < EGSPD::CSeason::Invalid; ++k)
{
const NLGEORGES::UFormElm *elm;
if (item.getNodeByName(&elm, seasonFuncName[k]) && elm)
{
WeatherFunction[k].build(*elm);
}
}
}
示例6: init
void CSampleBankManager::init(NLGEORGES::UFormElm *mixerConfig)
{
if (mixerConfig == 0)
return;
NLGEORGES::UFormElm *virtualBanks;
mixerConfig->getNodeByName(&virtualBanks, ".VirtualBanks");
if (virtualBanks == 0)
return;
uint size;
virtualBanks->getArraySize(size);
for (uint i=0; i<size; ++i)
{
NLGEORGES::UFormElm *virtualBank;
virtualBanks->getArrayNode(&virtualBank, i);
if (virtualBank != 0)
{
std::vector<TFilteredBank> vfb;
std::string virtualName;
virtualBank->getValueByName(virtualName, ".VirtualName");
NLGEORGES::UFormElm *realBanks;
virtualBank->getNodeByName(&realBanks, ".FilteredBank");
if (realBanks != 0)
{
uint size2;
realBanks->getArraySize(size2);
for (uint j=0; j<size2; ++j)
{
TFilteredBank fb;
std::string bankName;
NLGEORGES::UFormElm *realBank;
realBank->getArrayNode(&realBank, j);
realBank->getValueByName(bankName, ".SampleBank");
fb.BankName = CStringMapper::map(bankName);
realBank->getValueByName(fb.Filter, ".Filter");
vfb.push_back(fb);
}
}
if (!vfb.empty())
{
TStringId virtualNameId = CStringMapper::map(virtualName);
m_VirtualBanks.insert(std::make_pair(virtualNameId, vfb));
// create the sample bank
CSampleBank *sampleBank = new CSampleBank(virtualNameId, this);
}
}
}
}
示例7: build
//-----------------------------------------------
bool CDirLightSetup::build(const NLGEORGES::UFormElm &item)
{
NLMISC::CRGBA amb, dif, spe;
NLMISC::CVector dir;
const NLGEORGES::UFormElm *pElt;
// Light Direction
if (item.getNodeByName (&pElt, ".Direction") && pElt)
{
if (!CGeorgesHelper::convert(dir, *pElt)) return false;
}
// Light Ambiant
if (item.getNodeByName (&pElt, ".Ambiant") && pElt)
{
if (!CGeorgesHelper::convert(amb, *pElt)) return false;
}
// Light Diffuse
if (item.getNodeByName (&pElt, ".Diffuse") && pElt)
{
if (!CGeorgesHelper::convert(dif, *pElt)) return false;
}
// Light Specular
if (item.getNodeByName (&pElt, ".Specular") && pElt)
{
if (!CGeorgesHelper::convert(spe, *pElt)) return false;
}
Ambiant = amb;
Diffuse = dif;
Specular = spe;
Direction = dir;
return true;
}
示例8: nlassert
/// Load the sound parameters from georges' form
void CContextSound::importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot)
{
NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
formRoot.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "context_sound.dfn");
// Call the base class
CSound::importForm(filename, formRoot);
// Read the pattern name
formRoot.getValueByName(_PatternName, ".SoundType.PatternName");
}
示例9: build
// *******************************************************************************************
void CIDToStringArraySheet::build(const NLGEORGES::UFormElm &item)
{
const UFormElm *stringArray = NULL;
if (item.getNodeByName(&stringArray, "Array") && stringArray)
{
std::string str;
uint numStr;
nlverify(stringArray->getArraySize(numStr));
Array.reserve(numStr);
for(uint k = 0; k < numStr; ++k)
{
const UFormElm *strNode = NULL;
if (stringArray->getArrayNode(&strNode, k) && strNode)
{
Array.push_back(CIDToString());
Array.back().build(*strNode);
}
}
}
}
示例10:
/**
* Load the sound parameters from georges' form
*/
void CSimpleSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root)
{
NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
root.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "simple_sound.dfn");
// Call the base class
CSound::importForm(filename, root);
// Name
_Filename = CStringMapper::map(filename);
// Buffername
std::string bufferName;
root.getValueByName(bufferName, ".SoundType.Filename");
bufferName = CFile::getFilenameWithoutExtension(bufferName);
_Buffername = CStringMapper::map(bufferName);
setBuffer(NULL);
// contain % so it need a context to play
if (bufferName.find ("%") != string::npos)
{
_NeedContext = true;
}
// MaxDistance
root.getValueByName(_MaxDist, ".SoundType.MaxDistance");
// MinDistance
root.getValueByName(_MinDist, ".SoundType.MinDistance");
// Alpha
root.getValueByName(_Alpha, ".SoundType.Alpha");
}
示例11: importForm
void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root)
{
NLGEORGES::UFormElm *psoundType;
std::string dfnName;
// some basic checking.
root.getNodeByName(&psoundType, ".SoundType");
nlassert(psoundType != NULL);
psoundType->getDfnName(dfnName);
nlassert(dfnName == "stream_sound.dfn");
// Call the base class
CSound::importForm(filename, root);
// MaxDistance
root.getValueByName(_MaxDist, ".SoundType.MaxDistance");
// MinDistance
root.getValueByName(_MinDist, ".SoundType.MinDistance");
// Alpha
root.getValueByName(m_Alpha, ".SoundType.Alpha");
}
示例12: build
// ***************************************************************************************************
void CFloraSheet::build(const NLGEORGES::UFormElm &item)
{
const UFormElm *plantArray = NULL;
if (item.getNodeByName(&plantArray, "Plants") && plantArray)
{
uint numPlants;
nlverify(plantArray->getArraySize(numPlants));
_Plants.reserve(numPlants);
for(uint k = 0; k < numPlants; ++k)
{
const UFormElm *subNode = NULL;
if (plantArray->getArrayNode(&subNode, k) && subNode)
{
CPlantInfo pi;
pi.build(*subNode);
pi.CumulatedWeight = _TotalWeight;
_TotalWeight += pi.Weight;
_Plants.push_back(pi);
}
}
}
item.getValueByName(MicroLifeThreshold, "MicroLifeThreshold");
}
示例13: build
//-----------------------------------------------
// build :
// Build the sheet from an external script.
//-----------------------------------------------
void CItemSheet::build(const NLGEORGES::UFormElm &item)
{
// Load the name.
string Shape;
if(!item.getValueByName(Shape, "3d.shape"))
debug("key '3d.shape' not found.");
IdShape = ClientSheetsStrings.add(Shape);
// Load the name.
string ShapeFemale;
if(!item.getValueByName(ShapeFemale, "3d.shape_female"))
debug("key '3d.shape_female' not found.");
IdShapeFemale = ClientSheetsStrings.add(ShapeFemale);
// Get the icon associated.
string IconMain;
if(!item.getValueByName (IconMain, "3d.icon"))
debug("key '3d.icon' not found.");
IconMain = strlwr (IconMain);
IdIconMain = ClientSheetsStrings.add(IconMain);
// Get the icon associated.
string IconBack;
if(!item.getValueByName (IconBack, "3d.icon background"))
debug("key '3d.icon background' not found.");
IconBack = strlwr (IconBack);
IdIconBack = ClientSheetsStrings.add(IconBack);
// Get the icon associated.
string IconOver;
if(!item.getValueByName (IconOver, "3d.icon overlay"))
debug("key '3d.icon overlay' not found.");
IconOver = strlwr (IconOver);
IdIconOver = ClientSheetsStrings.add(IconOver);
// Get the icon associated.
string IconOver2;
if(!item.getValueByName (IconOver2, "3d.icon overlay2"))
debug("key '3d.icon overlay2' not found.");
IconOver2 = strlwr (IconOver2);
IdIconOver2 = ClientSheetsStrings.add(IconOver2);
// Get Special modulate colors
item.getValueByName (IconColor, "3d.IconColor" );
item.getValueByName (IconBackColor, "3d.IconBackColor");
item.getValueByName (IconOverColor, "3d.IconOverColor");
item.getValueByName (IconOver2Color, "3d.IconOver2Color");
// Get the icon text associated.
string IconText;
if(!item.getValueByName (IconText, "3d.text overlay"))
debug("key '3d.text overlay' not found.");
IconText = strlwr (IconText);
IdIconText = ClientSheetsStrings.add(IconText);
// See if this item can be hiden when equiped
if(!item.getValueByName (NeverHideWhenEquiped, "3d.never hide when equiped"))
debug("key '3d.never hide when equiped.");
// Load the different slot in wicth the item can be equipped.
const UFormElm *pElt = 0;
// check uint32 is OK!
nlassert( SLOTTYPE::NB_SLOT_TYPE <= 32 );
SlotBF= 0;
if(item.getNodeByName(&pElt, "basics.EquipmentInfo.EquipmentSlots") && pElt)
{
// Get all slots.
uint size;
if(pElt->getArraySize(size))
{
for(uint i = 0; i < size; ++i)
{
string slotName;
if(pElt->getArrayValue(slotName, i))
{
// Check name.
if(slotName.empty())
debug(toString("The slot name %d is Empty.", i));
// Push the possible slots for the item in the list.
SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpper(slotName)));
}
}
}
else
debug("The element 'basics.Equipment Slot' is not an array.");
}
else
debug("Cannot create the element from the name 'basics.Equipment Slot'.");
// Get the Item Family.
string family;
if(!item.getValueByName(family, "basics.family"))
{
debug("Key 'basics.family' not found.");
Family = ITEMFAMILY::UNDEFINED;
//.........这里部分代码省略.........
示例14: computeIGBBoxFromContinent
/** Load additionnal ig from a continent (ryzom specific)
* \param parameter a config file that contains the name of the continent containing the zones we are processing
* \param zone2bbox This will be filled with the name of a zone and the bbox of the village it contains
* \param a map of shape
* \param a vector that will be filled with a zone name and the bbox of the village it contains
*/
static void computeIGBBoxFromContinent(NLMISC::CConfigFile ¶meter,
TShapeMap &shapeMap,
TString2LightingBBox &zone2BBox
)
{
try
{
CConfigFile::CVar &continent_name_var = parameter.getVar ("continent_name");
CConfigFile::CVar &level_design_directory = parameter.getVar ("level_design_directory");
CConfigFile::CVar &level_design_world_directory = parameter.getVar ("level_design_world_directory");
CConfigFile::CVar &level_design_dfn_directory = parameter.getVar ("level_design_dfn_directory");
CPath::addSearchPath(level_design_dfn_directory.asString(), true, false);
CPath::addSearchPath(level_design_world_directory.asString(), true, false);
std::string continentName = continent_name_var.asString();
if (CFile::getExtension(continentName).empty())
continentName += ".continent";
// Load the form
NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader();
//
std::string pathName = level_design_world_directory.asString() + "/" + continentName;
if (pathName.empty())
{
nlwarning("Can't find continent form : %s", continentName.c_str());
return;
}
NLGEORGES::UForm *villageForm;
villageForm = loader->loadForm(pathName.c_str());
if(villageForm != NULL)
{
NLGEORGES::UFormElm &rootItem = villageForm->getRootNode();
// try to get the village list
// Load the village list
NLGEORGES::UFormElm *villagesItem;
if(!(rootItem.getNodeByName (&villagesItem, "Villages") && villagesItem))
{
nlwarning("No villages where found in %s", continentName.c_str());
return;
}
// Get number of village
uint numVillage;
nlverify (villagesItem->getArraySize (numVillage));
// For each village
for(uint k = 0; k < numVillage; ++k)
{
NLGEORGES::UFormElm *currVillage;
if (!(villagesItem->getArrayNode (&currVillage, k) && currVillage))
{
nlwarning("Couldn't get village %d in continent %s", continentName.c_str(), k);
continue;
}
// check that this village is in the dependency zones
NLGEORGES::UFormElm *zoneNameItem;
if (!currVillage->getNodeByName (&zoneNameItem, "Zone") && zoneNameItem)
{
nlwarning("Couldn't get zone item of village %d in continent %s", continentName.c_str(), k);
continue;
}
std::string zoneName;
if (!zoneNameItem->getValue(zoneName))
{
nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k);
continue;
}
zoneName = NLMISC::toLower(CFile::getFilenameWithoutExtension(zoneName));
CLightingBBox result;
// ok, it is in the dependant zones
computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result);
if (!result.OccludingBox.IsVoid || result.ReceivingBox.IsVoid)
{
zone2BBox[zoneName] = result;
}
}
}
else
{
nlwarning("Can't load continent form : %s", continentName.c_str());
}
}
catch (NLMISC::EUnknownVar &e)
{
nlinfo(e.what());
}
}
示例15: build
//.........这里部分代码省略.........
}
// Get the creature collision Length.
if(!item.getValueByName(ColLength, "Collision.Length"))
{
ColLength = 1.f;
debug("Key 'Collision.Length' not found.");
}
// CLIP
if(!item.getValueByName(ClipRadius, "Collision.ClipRadius"))
{
ClipRadius = 0.f;
debug("Key 'Collision.ClipRadius' not found.");
}
if(!item.getValueByName(ClipHeight, "Collision.ClipHeight"))
{
ClipHeight = 0.f;
debug("Key 'Collision.ClipHeight' not found.");
}
// SPEED //
// Get the creature Max Speed (Run).
if(!item.getValueByName(MaxSpeed, "Basics.MovementSpeeds.RunSpeed"))
{
MaxSpeed = 10.f;
debug("Key 'Basics.MovementSpeeds.RunSpeed' not found.");
}
const UFormElm *elm = NULL;
// Get all alternative Clothes.
static const char alternativeClothesKey[] = "Basics.Alternative Clothes";
if(item.getNodeByName(&elm, alternativeClothesKey) && elm)
{
// Check array.
if(elm->isArray())
{
// Get Array Size
uint altClothesArraySize;
if(elm->getArraySize(altClothesArraySize))
{
// Get values.
string altClothes;
for(uint i=0; i<altClothesArraySize; ++i)
{
if(elm->getArrayValue(altClothes, i))
{
if(!altClothes.empty())
{
TSStringId IdAltClothes = ClientSheetsStrings.add(altClothes);
IdAlternativeClothes.push_back(IdAltClothes);
}
else
debug(toString("'%s' field empty for the index '%d'.", alternativeClothesKey, i));
}
else
debug(toString("'%s' cannot get the array value for the index '%d'.", alternativeClothesKey, i));
}
}
else
debug(toString("'%s' cannot get the array size.", alternativeClothesKey));
}
else
debug(toString("'%s' is not an array.", alternativeClothesKey));
}