本文整理汇总了C++中PUParticleSystem3D::addBehaviourTemplate方法的典型用法代码示例。如果您正苦于以下问题:C++ PUParticleSystem3D::addBehaviourTemplate方法的具体用法?C++ PUParticleSystem3D::addBehaviourTemplate怎么用?C++ PUParticleSystem3D::addBehaviourTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PUParticleSystem3D
的用法示例。
在下文中一共展示了PUParticleSystem3D::addBehaviourTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translate
//-------------------------------------------------------------------------
void PUBehaviourTranslator::translate(PUScriptCompiler* compiler, PUAbstractNode *node)
{
PUObjectAbstractNode* obj = reinterpret_cast<PUObjectAbstractNode*>(node);
PUObjectAbstractNode* parent = obj->parent ? reinterpret_cast<PUObjectAbstractNode*>(obj->parent) : 0;
// The name of the obj is the type of the Behaviour
std::string type;
if(!obj->name.empty())
{
type = obj->name;
}
else
{
//compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, obj->file, obj->line);
return;
}
//// Get the factory
//ParticleBehaviourFactory* behaviourFactory = ParticleSystemManager::getSingletonPtr()->getBehaviourFactory(type);
//if (!behaviourFactory)
//{
// //compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, obj->file, obj->line);
// return;
//}
PUScriptTranslator *particleBehaviourTranlator = PUBehaviourManager::Instance()->getTranslator(type);
if (!particleBehaviourTranlator) return;
// Create the Behaviour
_behaviour = PUBehaviourManager::Instance()->createBehaviour(type);
if (!_behaviour)
{
//compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, obj->file, obj->line);
return;
}
_behaviour->setBehaviourType(type);
if (parent && parent->context)
{
PUParticleSystem3D* system = static_cast<PUParticleSystem3D*>(parent->context);
system->addBehaviourTemplate(_behaviour);
}
else
{
//// It is an alias
//_behaviour->setAliasName(parent->name);
//ParticleSystemManager::getSingletonPtr()->addAlias(mBehaviour);
}
// Set it in the context
obj->context = _behaviour;
// Run through properties
for(PUAbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
{
// No properties of its own
if((*i)->type == ANT_PROPERTY)
{
PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>((*i));
if (particleBehaviourTranlator->translateChildProperty(compiler, *i))
{
// Parsed the property by another translator; do nothing
}
else
{
errorUnexpectedProperty(compiler, prop);
}
}
else if((*i)->type == ANT_OBJECT)
{
if (particleBehaviourTranlator->translateChildObject(compiler, *i))
{
// Parsed the object by another translator; do nothing
}
else
{
processNode(compiler, *i);
}
}
else
{
errorUnexpectedToken(compiler, *i);
}
}
}