//======================================================================= ///////////////////////////////////////// // temp until there is a clone method // ///////////////////////////////////////// NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in) { if (!in) return NULL; try { // if no owner, can copy the object directy if (in->getOwner() == NULL) { return DupSerializable<CDupPolymorphicObjPolicy>(in); } else { CParticleSystem *srcPS = in->getOwner()->getOwner(); std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS)); // scene pointer is not serialised, but 'detach' may need the scene to be specified newPS->setScene(in->getOwner()->getOwner()->getScene()); // uint index = srcPS->getIndexOf(*(in->getOwner())); uint subIndex = in->getOwner()->getIndexOf(in); // newPS->setScene(in->getOwner()->getScene()); // 'unbind' require the scene to be attached CPSLocated *loc = NLMISC::safe_cast<CPSLocated *>(newPS->getProcess(index)); return loc->unbind(subIndex); } } catch (NLMISC::EStream &e) { nlwarning (e.what()); return NULL; } }