forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelEditor.py
More file actions
45 lines (37 loc) · 1.48 KB
/
LevelEditor.py
File metadata and controls
45 lines (37 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
This is just a sample code.
LevelEditor, ObjectHandler, ObjectPalette should be rewritten
to be game specific.
"""
from .LevelEditorUI import *
from .LevelEditorBase import *
from .ObjectMgr import *
from .AnimMgr import *
from .ObjectHandler import *
from .ObjectPalette import *
from .ProtoPalette import *
class LevelEditor(LevelEditorBase):
""" Class for Panda3D LevelEditor """
def __init__(self):
LevelEditorBase.__init__(self)
# define your own config file similar to this
self.settingsFile = os.path.dirname(__file__) + '/LevelEditor.cfg'
# If you have your own ObjectPalette and ObjectHandler
# connect them in your own LevelEditor class
self.objectMgr = ObjectMgr(self)
self.animMgr = AnimMgr(self)
self.objectPalette = ObjectPalette()
self.objectHandler = ObjectHandler(self)
self.protoPalette = ProtoPalette()
# Populating uderlined data-structures
self.ui = LevelEditorUI(self)
self.ui.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
self.objectPalette.populate()
self.protoPalette.populate()
# Updating UI-panels based on the above data
self.ui.objectPaletteUI.populate()
self.ui.protoPaletteUI.populate()
# When you define your own LevelEditor class inheriting LevelEditorBase
# you should call self.initialize() at the end of __init__() function
self.initialize()
self.ui.SetCursor(wx.Cursor(wx.CURSOR_ARROW))