diff --git a/panda/src/bullet/bulletGhostNode.cxx b/panda/src/bullet/bulletGhostNode.cxx index d3dcb7aaf5..38ccb1811c 100644 --- a/panda/src/bullet/bulletGhostNode.cxx +++ b/panda/src/bullet/bulletGhostNode.cxx @@ -171,3 +171,27 @@ do_sync_b2p() { _sync_disable = false; } } + +/** + * Tells the BamReader how to create objects of type BulletGhostNode. + */ +void BulletGhostNode:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +/** + * This function is called by the BamReader's factory when a new object of + * this type is encountered in the Bam file. It should create the ghost node. + */ +TypedWritable *BulletGhostNode:: +make_from_bam(const FactoryParams ¶ms) { + BulletGhostNode *param = new BulletGhostNode; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} diff --git a/panda/src/bullet/bulletGhostNode.h b/panda/src/bullet/bulletGhostNode.h index a76c0ce8a1..1efc47a484 100644 --- a/panda/src/bullet/bulletGhostNode.h +++ b/panda/src/bullet/bulletGhostNode.h @@ -59,6 +59,12 @@ private: void do_transform_changed(); +public: + static void register_with_read_factory(); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 140c7d0efc..e4627c931e 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -189,6 +189,7 @@ init_libbullet() { BulletDebugNode::register_with_read_factory(); BulletPlaneShape::register_with_read_factory(); BulletRigidBodyNode::register_with_read_factory(); + BulletGhostNode::register_with_read_factory(); BulletSphereShape::register_with_read_factory(); BulletTriangleMesh::register_with_read_factory(); BulletTriangleMeshShape::register_with_read_factory();