Skip to content

Commit 0ac4045

Browse files
author
Mike Goslin
committed
*** empty log message ***
1 parent e34085f commit 0ac4045

File tree

10 files changed

+56
-8
lines changed

10 files changed

+56
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from DirectSessionGlobal import *
2+
import ParticleEffect
3+
pe = ParticleEffect.ParticleEffect('particle-fx')
4+
pe.reparentTo(render)
5+
pe.setPos(0.0, 5.0, 4.0)
6+
import ParticlePanel
7+
p = pe.particles[0]
8+
ParticlePanel.ParticlePanel(pe, p)
9+
base.enableParticles()
10+
pe.enable()

direct/src/particles/Particles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, name = None, poolSize = 1024):
6464

6565
def enable(self):
6666
"""enable(self)"""
67-
physicsMgr.attachPhysical(self.node)
67+
physicsMgr.attachPhysical(self)
6868
particleMgr.attachParticlesystem(self)
6969

7070
def disable(self):

direct/src/tkpanels/ParticlePanel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,9 @@ def updateInfo(self, page = 'System'):
658658

659659
def toggleParticleSystem(self):
660660
if self.systemActive.get():
661-
self.particleEffect.activate()
661+
self.particleEffect.enable()
662662
else:
663-
self.particleEffect.deactivate()
663+
self.particleEffect.disable()
664664
return None
665665

666666
## SYSTEM PAGE ##

panda/src/particlesystem/particleSystemManager.I

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ get_frame_stepping(void) const {
3131
INLINE void ParticleSystemManager::
3232
attach_particlesystem(ParticleSystem *ps) {
3333
ps->_manager = this;
34-
_ps_list.push_back(ps);
34+
list< PT(ParticleSystem) >::iterator found;
35+
PT(ParticleSystem) ptps = ps;
36+
found = find(_ps_list.begin(), _ps_list.end(), ptps);
37+
if (found == _ps_list.end())
38+
_ps_list.push_back(ps);
3539
}
3640

3741
////////////////////////////////////////////////////////////////////

panda/src/physics/angularForce.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@ get_vector(const PhysicsObject *po) {
4646
LVector3f v = get_child_vector(po);
4747
return v;
4848
}
49+
50+
////////////////////////////////////////////////////////////////////
51+
// Function : is_linear
52+
// Access : public
53+
// Description : access query
54+
////////////////////////////////////////////////////////////////////
55+
bool AngularForce::
56+
is_linear(void) const {
57+
return false;
58+
}

panda/src/physics/angularForce.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class EXPCL_PANDAPHYSICS AngularForce : public BaseForce {
2020
AngularForce(void);
2121
AngularForce(const AngularForce &copy);
2222

23-
public:
23+
PUBLISHED:
2424
virtual ~AngularForce(void);
2525

2626
virtual AngularForce *make_copy(void) const = 0;
2727
LVector3f get_vector(const PhysicsObject *po);
28+
virtual bool is_linear(void) const;
2829

2930
public:
3031
static TypeHandle get_class_type(void) {

panda/src/physics/baseForce.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class EXPCL_PANDAPHYSICS BaseForce : public TypedReferenceCount {
3535

3636
INLINE bool get_active(void) const;
3737
INLINE void set_active(bool active);
38+
virtual bool is_linear(void) const = 0;
3839

3940
INLINE ForceNode *get_force_node(void) const;
4041

panda/src/physics/linearForce.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,12 @@ get_vector(const PhysicsObject *po) {
6767

6868
return child_vector;
6969
}
70+
71+
////////////////////////////////////////////////////////////////////
72+
// Function : is_linear
73+
// Access : Public
74+
////////////////////////////////////////////////////////////////////
75+
bool LinearForce::
76+
is_linear(void) const {
77+
return true;
78+
}

panda/src/physics/linearForce.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class EXPCL_PANDAPHYSICS LinearForce : public BaseForce {
4343

4444
virtual LinearForce *make_copy(void) = 0;
4545

46+
virtual bool is_linear(void) const;
47+
4648
public:
4749
static TypeHandle get_class_type(void) {
4850
return _type_handle;

panda/src/physics/physicsManager.I

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
INLINE void PhysicsManager::
1212
attach_physical(Physical *p) {
1313
p->_physics_manager = this;
14-
_physicals.push_back(p);
14+
vector< Physical * >::iterator found;
15+
found = find(_physicals.begin(), _physicals.end(), p);
16+
if (found == _physicals.end())
17+
_physicals.push_back(p);
1518
}
1619

1720
////////////////////////////////////////////////////////////////////
@@ -21,7 +24,11 @@ attach_physical(Physical *p) {
2124
////////////////////////////////////////////////////////////////////
2225
INLINE void PhysicsManager::
2326
add_linear_force(LinearForce *f) {
24-
_linear_forces.push_back(f);
27+
vector< PT(LinearForce) >::iterator found;
28+
PT(LinearForce) ptlf = f;
29+
found = find(_linear_forces.begin(), _linear_forces.end(), ptlf);
30+
if (found == _linear_forces.end())
31+
_linear_forces.push_back(f);
2532
}
2633

2734
////////////////////////////////////////////////////////////////////
@@ -52,7 +59,11 @@ clear_linear_forces(void) {
5259
////////////////////////////////////////////////////////////////////
5360
INLINE void PhysicsManager::
5461
add_angular_force(AngularForce *f) {
55-
_angular_forces.push_back(f);
62+
vector< PT(AngularForce) >::iterator found;
63+
PT(AngularForce) ptaf = f;
64+
found = find(_angular_forces.begin(), _angular_forces.end(), ptaf);
65+
if (found == _angular_forces.end())
66+
_angular_forces.push_back(f);
5667
}
5768

5869
////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)