PUParticleSystem3D* PUParticleSystem3D::create( const std::string &filePath )
{
    PUParticleSystem3D *ret = new (std::nothrow) PUParticleSystem3D();
    if (ret && ret->initWithFilePath(filePath))
    {
        ret->autorelease();
        return ret;
    }
    else
    {
        CC_SAFE_DELETE(ret);
        return nullptr;
    }
}
Example #2
0
 Node* Particle3DReader::createNodeWithFlatBuffers(const flatbuffers::Table *particle3DOptions)
 {
     auto options = (Particle3DOptions*)particle3DOptions;
     
     auto fileData = options->fileData();
     std::string path = fileData->path()->c_str();
     
     PUParticleSystem3D* ret = PUParticleSystem3D::create();
     if (FileUtils::getInstance()->isFileExist(path))
     {
         ret->initWithFilePath(path);
     }
     
     setPropsWithFlatBuffers(ret, particle3DOptions);
     
     if(ret)
     {
         ret->startParticleSystem();
     }
     
     return ret;
 }