diff pyink/MBScene.py @ 1177:ec1ea8555911

Stop selectSceneObject() from using private variable _keys of frameline
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 31 Dec 2010 10:29:21 +0800
parents 0c1ceecb8ddb
children 416e41952b76
line wrap: on
line diff
--- a/pyink/MBScene.py	Fri Dec 31 10:12:44 2010 +0800
+++ b/pyink/MBScene.py	Fri Dec 31 10:29:21 2010 +0800
@@ -660,29 +660,16 @@
 	    pass
 	pass
     
-    def selectSceneObject(self,frameline, nth):
-        i = 0
-        while i < len(frameline._keys):
-	    s = frameline._keys[i]
-	    if s.right_tween is False:
-	        if nth == s.idx+1:
-		    self.enterGroup(s.ref)
-	            self.setTweenType(frameline.get_tween_type(s.idx))
-		    return
-		else:
-		    pass
-		i = i + 1
-		continue
+    def selectSceneObject(self, frameline, nth):
+	try:
+	    start, stop, tween_type = frameline.get_frame_block(nth - 1)
+	except:
+	    return
 
-	    if nth >= (s.idx+1) and nth <= (frameline._keys[i+1].idx+1):
-	        self.enterGroup(s.ref)
-	        self.setTweenType(frameline.get_tween_type(s.idx))
-		return
-	    else:
-	        pass
-	    i = i + 2
-	    pass
-        pass
+	scene_group = frameline.get_frame_data(start)
+	self.enterGroup(scene_group)
+	self.setTweenType(tween_type)
+	pass
 
     def setTweenType(self, tween_type):
 	sel_type = MBScene._frameline_tween_types.index(tween_type)