コード例 #1
0
ファイル: levelcmds.py プロジェクト: xuebai5/TheZombieEngine
def postlevel_process(is_new_level):
    if not is_new_level:
        return
    # What follows should be done only for new and open level commands

    # Load the level preset
    apply_level_preset()

    # Set the new outdoor to the terrain state
    if servers.get_conjurer().getcurrentstate() == 'terrain':
        trn.get_terrain_module().setoutdoor(
            app.get_outdoor_obj() 
            )

    # End the persist-restore process (continue from prelevel_process)
    # Close guiDialog windows
    frame = app.get_top_window()
    for child in frame.get_child_dialogs():
        child.Close()
    # Refresh other GUI features
    frame.refresh_all()
    # Restore persisted guiDialog windows
    for data in prelevel_process.child_data:
        restore_window(data)
    prelevel_process.child_data = []
コード例 #2
0
    def on_save_outdoor(self, event):
        """Save the outdoor's navigation mesh on a user specified file"""
        outdoor = app.get_outdoor_obj()
        if outdoor == None:
            cjr.show_error_message("The current level doesn't have an outdoor")
            return
        dlg = wx.FileDialog(
            self.get_frame(), message="Enter a file name",
            wildcard="Navigation mesh ASCII file (*.txt)|*.txt|" \
                     "Navigation mesh binary file (*.nav)|*.nav|" \
                     "Navigation mesh compressed file (*.rle)|*.rle",
            defaultDir=format.mangle_path( "level:ai/" + \
                       hex(outdoor.getid())[2:] ),
            defaultFile="navmesh",
            style=wx.SAVE | wx.OVERWRITE_PROMPT
            )

        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            # Append extension if needed
            if dlg.GetFilterIndex() == 0 and not path.endswith(".txt"):
                path = path + ".txt"
            elif dlg.GetFilterIndex() == 1 and not path.endswith(".nav"):
                path = path + ".nav"
            elif dlg.GetFilterIndex() == 2 and not path.endswith(".rle"):
                path = path + ".rle"
            # Save the navigation mesh
            navbuilder = app.get_navbuilder()
            if not navbuilder.saveoutdoornavmesh(str(dlg.GetPath())):
                msg = "Unable to save the navigation mesh file '%s'" % dlg.GetPath(
                )
                cjr.show_error_message(msg)
        dlg.Destroy()
コード例 #3
0
ファイル: aicmds.py プロジェクト: xuebai5/TheZombieEngine
 def on_save_outdoor(self, event):
     """Save the outdoor's navigation mesh on a user specified file"""
     outdoor = app.get_outdoor_obj()
     if outdoor == None:
         cjr.show_error_message(
             "The current level doesn't have an outdoor"
             )
         return
     dlg = wx.FileDialog(
         self.get_frame(), message="Enter a file name",
         wildcard="Navigation mesh ASCII file (*.txt)|*.txt|" \
                  "Navigation mesh binary file (*.nav)|*.nav|" \
                  "Navigation mesh compressed file (*.rle)|*.rle",
         defaultDir=format.mangle_path( "level:ai/" + \
                    hex(outdoor.getid())[2:] ),
         defaultFile="navmesh",
         style=wx.SAVE | wx.OVERWRITE_PROMPT
         )
     
     if dlg.ShowModal() == wx.ID_OK:
         path = dlg.GetPath()
         # Append extension if needed
         if dlg.GetFilterIndex() == 0 and not path.endswith(".txt"):
             path = path + ".txt"
         elif dlg.GetFilterIndex() == 1 and not path.endswith(".nav"):
             path = path + ".nav"
         elif dlg.GetFilterIndex() == 2 and not path.endswith(".rle"):
             path = path + ".rle"
         # Save the navigation mesh
         navbuilder = app.get_navbuilder()
         if not navbuilder.saveoutdoornavmesh( str(dlg.GetPath()) ):
             msg = "Unable to save the navigation mesh file '%s'" % dlg.GetPath()
             cjr.show_error_message(msg)
     dlg.Destroy()
コード例 #4
0
    def __postterrain_process(self):
        # Set the new outdoor in the terrain state
        if app.get_current_state() == 'terrain':
            trn.get_terrain_module().setoutdoor(app.get_outdoor_obj())
        # Close and reopen the terrain editors dialogs
        children_data = []
        for child in self.get_frame().GetChildren():
            if isinstance(
                    child,
                (trntoolpanel.ToolDialog, trnlayersdlg.LayerManagerDialog)):
                data = levelcmds.persist_window(child)
                if data is not None:
                    children_data.append(data)
                child.Close()
        for data in children_data:
            levelcmds.restore_window(data)

        # Refresh terrain menu
        self.get_frame().get_menubar().get_menu('&Terrain').refresh()
コード例 #5
0
ファイル: trncmds.py プロジェクト: xuebai5/TheZombieEngine
    def __postterrain_process(self):
        # Set the new outdoor in the terrain state
        if app.get_current_state() == 'terrain':
            trn.get_terrain_module().setoutdoor( app.get_outdoor_obj() )
        # Close and reopen the terrain editors dialogs
        children_data = []
        for child in self.get_frame().GetChildren():
            if isinstance(
                child, 
                (trntoolpanel.ToolDialog, trnlayersdlg.LayerManagerDialog)
                ):
                data = levelcmds.persist_window(child)
                if data is not None:
                    children_data.append(data)
                child.Close()
        for data in children_data:
            levelcmds.restore_window(data)

        # Refresh terrain menu
        self.get_frame().get_menubar().get_menu('&Terrain').refresh()
コード例 #6
0
def postlevel_process(is_new_level):
    if not is_new_level:
        return
    # What follows should be done only for new and open level commands

    # Load the level preset
    apply_level_preset()

    # Set the new outdoor to the terrain state
    if servers.get_conjurer().getcurrentstate() == 'terrain':
        trn.get_terrain_module().setoutdoor(app.get_outdoor_obj())

    # End the persist-restore process (continue from prelevel_process)
    # Close guiDialog windows
    frame = app.get_top_window()
    for child in frame.get_child_dialogs():
        child.Close()
    # Refresh other GUI features
    frame.refresh_all()
    # Restore persisted guiDialog windows
    for data in prelevel_process.child_data:
        restore_window(data)
    prelevel_process.child_data = []