Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSai Vineet <saivineet89@gmail.com>2013-12-21 09:58:57 (GMT)
committer Sai Vineet <saivineet89@gmail.com>2013-12-21 13:09:34 (GMT)
commit85f586e69d4e3386b03acbd07f6ee6a7a33739ee (patch)
tree10d6f0fbf3a4c51621efccca2b5e1550c7f58a81
parentcc32238f702bed25ed0aff77eef1b75089b222fa (diff)
Fix pen color bug
Color problem - Weird color behavior - * Add a box, and a pen to the box. Let some points be plotted. * After a bit of time, remove the box, and the attached pen * Exit using Stop button, and thus save to journal * Restart the above journal project. * Now add a box, and a pen to it. * Notice that the points plotted before change color to the new box's color. Also, fixed the destroy tool's malfuntioning bug, caused by track_indices. Solution: Save tracked_bodies too.
-rw-r--r--physics.py6
-rw-r--r--tools.py13
2 files changed, 12 insertions, 7 deletions
diff --git a/physics.py b/physics.py
index e89e12a..fff69ca 100644
--- a/physics.py
+++ b/physics.py
@@ -81,7 +81,8 @@ class PhysicsGame:
self.world.add.remove_mouseJoint()
additional_data = {
"trackinfo": self.trackinfo,
- "full_pos_list": self.full_pos_list
+ "full_pos_list": self.full_pos_list,
+ "tracked_bodies": self.tracked_bodies
}
self.world.json_save(path, additional_data, serialize=True)
@@ -123,6 +124,9 @@ class PhysicsGame:
self.world.additional_vars['full_pos_list']
if 'trackinfo' in self.world.additional_vars:
self.trackinfo = self.world.additional_vars['trackinfo']
+ if 'tracked_bodies' in self.world.additional_vars:
+ self.tracked_bodies = \
+ self.world.additional_vars['tracked_bodies']
while self.loop:
while gtk.events_pending():
diff --git a/tools.py b/tools.py
index d9c107b..f896e1b 100644
--- a/tools.py
+++ b/tools.py
@@ -601,12 +601,13 @@ class DestroyTool(Tool):
destroyed_body = False
for key, info in tracklist:
trackdex = info[4]
- if trackdex in tokill[0].userData['track_indices'] and \
- info[3] is False:
- self.game.world.world.DestroyBody(info[1])
- self.game.trackinfo[key][3] = True
- destroyed_body = True
- break
+ if "track_indices" in tokill[0].userData:
+ if trackdex in tokill[0].userData['track_indices'] and \
+ info[3] is False:
+ self.game.world.world.DestroyBody(info[1])
+ self.game.trackinfo[key][3] = True
+ destroyed_body = True
+ break
jointnode = tokill[0].GetJointList()
if jointnode and not destroyed_body: