comparison engine/extensions/serializers/xmlobject.py @ 140:3fddb45c0304

edited the loaders, images are now loaded only once into memory
author thebastion@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 28 Sep 2008 11:12:36 +0000
parents 9a1529f9625e
children 679ed3e15513
comparison
equal deleted inserted replaced
139:2cc01d9433ab 140:3fddb45c0304
97 # paths are relative to this resource's path 97 # paths are relative to this resource's path
98 path = self.filename.split('/') 98 path = self.filename.split('/')
99 path.pop() 99 path.pop()
100 path.append(str(source)) 100 path.append(str(source))
101 101
102 id = self.image_pool.addResourceFromFile('/'.join(path)) 102 id = self.image_pool.getIndex('/'.join(path))
103 object.get2dGfxVisual().addStaticImage(int( image.get('direction', 0) ), id) 103 object.get2dGfxVisual().addStaticImage(int( image.get('direction', 0) ), id)
104 img = self.image_pool.getImage(id) 104 img = self.image_pool.getImage(id)
105 img.setXShift(int( image.get('x_offset', 0) )) 105 img.setXShift(int( image.get('x_offset', 0) ))
106 img.setYShift(int( image.get('y_offset', 0) )) 106 img.setYShift(int( image.get('y_offset', 0) ))
107 107
124 # animation paths are relative to this resource's path 124 # animation paths are relative to this resource's path
125 path = self.filename.split('/') 125 path = self.filename.split('/')
126 path.pop() 126 path.pop()
127 path.append(str(source)) 127 path.append(str(source))
128 128
129 anim_id = self.anim_pool.addResourceFromFile('/'.join(path)) 129 anim_id = self.anim_pool.getIndex('/'.join(path))
130 animation = self.anim_pool.getAnimation(anim_id) 130 animation = self.anim_pool.getAnimation(anim_id)
131 action.get2dGfxVisual().addAnimation(int( anim.get('direction', 0) ), anim_id) 131 action.get2dGfxVisual().addAnimation(int( anim.get('direction', 0) ), anim_id)
132 action.setDuration(animation.getDuration()) 132 action.setDuration(animation.getDuration())