shared_ptr<class LWF> LWFNode::attachLWF( const char *pszFilename, const char *pszTarget, const char *pszAttachName) { if (!lwf) return shared_ptr<class LWF>(); shared_ptr<LWFData> data = LWFResourceCache::sharedLWFResourceCache()->loadLWFData(pszFilename); if (!data) return shared_ptr<class LWF>(); shared_ptr<LWFRendererFactory> factory = make_shared<LWFRendererFactory>(this); shared_ptr<class LWF> child = make_shared<class LWF>(data, factory); if (!child) { LWFResourceCache::sharedLWFResourceCache()->unloadLWFData(data); return child; } Movie *movie = lwf->SearchMovieInstance(pszTarget); if (!movie) { LWFResourceCache::sharedLWFResourceCache()->unloadLWFData(data); return shared_ptr<class LWF>(); } movie->AttachLWF(child, pszAttachName); return child; }