Mercurial > fife-parpg
annotate engine/python/fife/extensions/loaders.py @ 607:eab690c748a3
This is a more permanent fix for the timer issues. Pychan was using the timers incorrectly. This has now been fixed. It has eliminated the need to have global lists of timers in fife_timer. This has not been tested extensivly.
[t:483]
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 17 Sep 2010 19:55:15 +0000 |
parents | c2de5aafe788 |
children | b84dbc4665b0 |
rev | line source |
---|---|
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # #################################################################### |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 # Copyright (C) 2005-2009 by the FIFE team |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # http://www.fifengine.de |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # This file is part of FIFE. |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # FIFE is free software; you can redistribute it and/or |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # modify it under the terms of the GNU Lesser General Public |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # License as published by the Free Software Foundation; either |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # version 2.1 of the License, or (at your option) any later version. |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # This library is distributed in the hope that it will be useful, |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # Lesser General Public License for more details. |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # You should have received a copy of the GNU Lesser General Public |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # License along with this library; if not, write to the |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # Free Software Foundation, Inc., |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # #################################################################### |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 # Loader interface for FIFE's native xml format. |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 from fife import fife |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 from fife.extensions.serializers.xmlmap import XMLMapLoader |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 from fife.extensions.serializers import WrongFileType, NameClash |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 from fife.extensions.serializers.xmlobject import XMLObjectLoader |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 fileExtensions = ('xml',) |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
35 def loadMapFile(path, engine, callback=None, debug=True): |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 """ load map file and get (an optional) callback if major stuff is done: |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 - map creation |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 - parsed imports |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 - parsed layers |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 - parsed cameras |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 the callback will send both a string and a float (which shows |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 the overall process), callback(string, float) |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
43 |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
44 @type engine: object |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
45 @param engine: FIFE engine instance |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
46 @type callback: function |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
47 @param callback: callback for maploading progress |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
48 @type debug: bool |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
49 @param debug: flag to activate / deactivate print statements |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
50 |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
51 @type map: object |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
52 @return map: FIFE map object |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 """ |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
54 map_loader = XMLMapLoader(engine, callback, debug) |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 map = map_loader.loadResource(fife.ResourceLocation(path)) |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
56 if debug: print "--- Loading map took: ", map_loader.time_to_load, " seconds." |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 return map |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
60 def loadImportFile(path, engine, debug=False): |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
61 """ uses XMLObjectLoader to load import files from path |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
62 |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
63 @type path: string |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
64 @param path: path to import file |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
65 @type engine: object |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
66 @param engine: FIFE engine instance |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
67 @type debug: bool |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
68 @param debug: flag to activate / deactivate print statements |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
69 """ |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 object_loader = XMLObjectLoader(engine.getImagePool(), engine.getAnimationPool(), engine.getModel(), engine.getVFS()) |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 res = None |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 try: |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 res = object_loader.loadResource(fife.ResourceLocation(path)) |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
74 if debug: print 'imported object file ' + path |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 except WrongFileType: |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 pass |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 # print 'ignored non-object file ' + path |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 except NameClash: |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 pass |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 # print 'ignored already loaded file ' + path |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 return res |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
83 def loadImportDir(path, engine, debug=False): |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
84 """ helper function to call loadImportFile on a directory |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
85 |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
86 @type path: string |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
87 @param path: path to import directory |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
88 @type engine: object |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
89 @param engine: FIFE engine instance |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
90 @type debug: bool |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
91 @param debug: flag to activate / deactivate print statements |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
92 """ |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 for file in filter(lambda f: f.split('.')[-1] == 'xml', engine.getVFS().listFiles(path)): |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
94 loadImportFile('/'.join([path, file]), engine, debug) |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
95 |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
96 def loadImportDirRec(path, engine, debug=False): |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
97 """ helper function to call loadImportFile recursive on a directory |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
99 @type path: string |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
100 @param path: path to import directory |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
101 @type engine: object |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
102 @param engine: FIFE engine instance |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
103 @type debug: bool |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
104 @param debug: flag to activate / deactivate print statements |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
105 """ |
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
106 loadImportDir(path, engine, debug) |
378
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 |
64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 for dir in filter(lambda d: not d.startswith('.'), engine.getVFS().listDirectories(path)): |
585
c2de5aafe788
- added debug flag to loaders to enable/disable annoying print spam on maploading
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
378
diff
changeset
|
109 loadImportDirRec('/'.join([path, dir]), engine, debug) |