Browse Source

*** empty log message ***

Mike Goslin 25 years ago
parent
commit
0ac40455aa

+ 10 - 0
direct/src/particles/ParticleTest.py

@@ -0,0 +1,10 @@
+from DirectSessionGlobal import *
+import ParticleEffect
+pe = ParticleEffect.ParticleEffect('particle-fx')
+pe.reparentTo(render)
+pe.setPos(0.0, 5.0, 4.0)
+import ParticlePanel
+p = pe.particles[0]
+ParticlePanel.ParticlePanel(pe, p)
+base.enableParticles()
+pe.enable()

+ 1 - 1
direct/src/particles/Particles.py

@@ -64,7 +64,7 @@ class Particles(ParticleSystem.ParticleSystem):
 
     def enable(self):
 	"""enable(self)"""
-	physicsMgr.attachPhysical(self.node)
+	physicsMgr.attachPhysical(self)
 	particleMgr.attachParticlesystem(self)
 
     def disable(self):

+ 2 - 2
direct/src/tkpanels/ParticlePanel.py

@@ -658,9 +658,9 @@ class ParticlePanel(AppShell):
 
     def toggleParticleSystem(self):
         if self.systemActive.get():
-            self.particleEffect.activate()
+            self.particleEffect.enable()
         else:
-            self.particleEffect.deactivate()
+            self.particleEffect.disable()
 	return None
             
     ## SYSTEM PAGE ##

+ 5 - 1
panda/src/particlesystem/particleSystemManager.I

@@ -31,7 +31,11 @@ get_frame_stepping(void) const {
 INLINE void ParticleSystemManager::
 attach_particlesystem(ParticleSystem *ps) {
   ps->_manager = this;
-  _ps_list.push_back(ps);
+  list< PT(ParticleSystem) >::iterator found;
+  PT(ParticleSystem) ptps = ps;
+  found = find(_ps_list.begin(), _ps_list.end(), ptps);
+  if (found == _ps_list.end())
+    _ps_list.push_back(ps);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 10 - 0
panda/src/physics/angularForce.cxx

@@ -46,3 +46,13 @@ get_vector(const PhysicsObject *po) {
   LVector3f v = get_child_vector(po);
   return v;
 }
+
+////////////////////////////////////////////////////////////////////
+//    Function : is_linear 
+//      Access : public
+// Description : access query
+////////////////////////////////////////////////////////////////////
+bool AngularForce::
+is_linear(void) const {
+  return false;
+}

+ 2 - 1
panda/src/physics/angularForce.h

@@ -20,11 +20,12 @@ protected:
   AngularForce(void);
   AngularForce(const AngularForce &copy);
 
-public:
+PUBLISHED:
   virtual ~AngularForce(void);
 
   virtual AngularForce *make_copy(void) const = 0;
   LVector3f get_vector(const PhysicsObject *po);
+  virtual bool is_linear(void) const;
 
 public:
   static TypeHandle get_class_type(void) {

+ 1 - 0
panda/src/physics/baseForce.h

@@ -35,6 +35,7 @@ public:
 
   INLINE bool get_active(void) const;
   INLINE void set_active(bool active);
+  virtual bool is_linear(void) const = 0;
 
   INLINE ForceNode *get_force_node(void) const;
 

+ 9 - 0
panda/src/physics/linearForce.cxx

@@ -67,3 +67,12 @@ get_vector(const PhysicsObject *po) {
 
   return child_vector;
 }
+
+////////////////////////////////////////////////////////////////////
+//    Function : is_linear 
+//      Access : Public
+////////////////////////////////////////////////////////////////////
+bool LinearForce::
+is_linear(void) const {
+  return true;
+}

+ 2 - 0
panda/src/physics/linearForce.h

@@ -43,6 +43,8 @@ PUBLISHED:
 
   virtual LinearForce *make_copy(void) = 0;
 
+  virtual bool is_linear(void) const;
+
 public:
   static TypeHandle get_class_type(void) {
     return _type_handle;

+ 14 - 3
panda/src/physics/physicsManager.I

@@ -11,7 +11,10 @@
 INLINE void PhysicsManager::
 attach_physical(Physical *p) {
   p->_physics_manager = this;
-  _physicals.push_back(p);
+  vector< Physical * >::iterator found;
+  found = find(_physicals.begin(), _physicals.end(), p);
+  if (found == _physicals.end())
+    _physicals.push_back(p);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -21,7 +24,11 @@ attach_physical(Physical *p) {
 ////////////////////////////////////////////////////////////////////
 INLINE void PhysicsManager::
 add_linear_force(LinearForce *f) {
-  _linear_forces.push_back(f);
+  vector< PT(LinearForce) >::iterator found;
+  PT(LinearForce) ptlf = f;
+  found = find(_linear_forces.begin(), _linear_forces.end(), ptlf);
+  if (found == _linear_forces.end())
+    _linear_forces.push_back(f);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -52,7 +59,11 @@ clear_linear_forces(void) {
 ////////////////////////////////////////////////////////////////////
 INLINE void PhysicsManager::
 add_angular_force(AngularForce *f) {
-  _angular_forces.push_back(f);
+  vector< PT(AngularForce) >::iterator found;
+  PT(AngularForce) ptaf = f;
+  found = find(_angular_forces.begin(), _angular_forces.end(), ptaf);
+  if (found == _angular_forces.end())
+    _angular_forces.push_back(f);
 }
 
 ////////////////////////////////////////////////////////////////////