예제 #1
0
    def on_save_temp_mesh(self, event):
        """Show a file browser and save the temporary mesh to the selected
        file"""
        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",
            style=wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR
            )

        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.savenavmesh(str(dlg.GetPath())):
                msg = "Unable to save the navigation mesh file '%s'" % dlg.GetPath(
                )
                cjr.show_error_message(msg)

        dlg.Destroy()
예제 #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
 def on_save_temp_mesh(self, event):
     """Show a file browser and save the temporary mesh to the selected
     file"""
     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",
         style=wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR
         )
     
     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.savenavmesh( str(dlg.GetPath()) ):
             msg = "Unable to save the navigation mesh file '%s'" % dlg.GetPath()
             cjr.show_error_message(msg)
     
     dlg.Destroy()
예제 #4
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()
예제 #5
0
 def on_nav_gen_params(self, event):
     """Open an object inspector for the navigation mesh builder state"""
     navbuilder = app.get_navbuilder()
     win = objdlg.create_window(
                 self.get_frame(), 
                 navbuilder.getfullname() 
                 )
     win.display()
예제 #6
0
 def on_build_outdoor(self, event):
     """Build a navigation mesh for the outdoor"""
     dlg = waitdlg.WaitDialog(self.get_frame(),
                              "Building navigation mesh...")
     navbuilder = app.get_navbuilder()
     success = navbuilder.buildnavmesh()
     dlg.Destroy()
     if not success:
         cjr.show_error_message("Unable to create the navigation mesh")
예제 #7
0
 def on_build_outdoor(self, event):
     """Build a navigation mesh for the outdoor"""
     dlg = waitdlg.WaitDialog( self.get_frame(),
         "Building navigation mesh..." )
     navbuilder = app.get_navbuilder()
     success = navbuilder.buildnavmesh()
     dlg.Destroy()
     if not success:
         cjr.show_error_message(
             "Unable to create the navigation mesh"
             )
예제 #8
0
    def on_load_temp_mesh(self, event):
        """Show a file browser and load the selected navigation mesh file
        as the temporary mesh"""
        dlg = wx.FileDialog(
            self.get_frame(), message="Choose a file",
            wildcard="Navigation mesh files (*.txt,*.nav,*.rle)|*.txt;*.nav;*.rle",
            style=wx.OPEN | wx.CHANGE_DIR
            )
        
        if dlg.ShowModal() == wx.ID_OK:
            navbuilder = app.get_navbuilder()
            if not navbuilder.loadnavmesh( str(dlg.GetPath()) ):
                msg = "Unable to load navigation mesh file '%s'"  % dlg.GetPath()
                cjr.show_error_message(msg)

        dlg.Destroy()
예제 #9
0
    def on_load_temp_mesh(self, event):
        """Show a file browser and load the selected navigation mesh file
        as the temporary mesh"""
        dlg = wx.FileDialog(
            self.get_frame(),
            message="Choose a file",
            wildcard=
            "Navigation mesh files (*.txt,*.nav,*.rle)|*.txt;*.nav;*.rle",
            style=wx.OPEN | wx.CHANGE_DIR)

        if dlg.ShowModal() == wx.ID_OK:
            navbuilder = app.get_navbuilder()
            if not navbuilder.loadnavmesh(str(dlg.GetPath())):
                msg = "Unable to load navigation mesh file '%s'" % dlg.GetPath(
                )
                cjr.show_error_message(msg)

        dlg.Destroy()
예제 #10
0
 def on_build_indoors(self, event):
     """Build navigation meshes for all selected indoors"""
     state = app.get_object_state()
     navbuilder = app.get_navbuilder()
     dlg = waitdlg.WaitDialog( self.get_frame(),
         "Building navigation mesh for indoor 00/00..." )
     num_entities = state.getselectioncount()
     for i in range( num_entities ):
         dlg.set_message( "Building navigation mesh for indoor " \
             + str(i+1) + "/" + str(num_entities) + "..." )
         entity = state.getselectedentity(i)
         success = True
         if entity.isa('neindoor'):
             success = navbuilder.buildindoornavmesh( entity )
         elif entity.isa('newalkablebrush'):
             success = navbuilder.buildbrushnavmesh( entity )
         if not success:
             msg = "Unable to create navigation mesh for entity %s" % str( entity.getid() )
             cjr.show_error_message(msg)
     dlg.Destroy()
예제 #11
0
 def on_build_indoors(self, event):
     """Build navigation meshes for all selected indoors"""
     state = app.get_object_state()
     navbuilder = app.get_navbuilder()
     dlg = waitdlg.WaitDialog(
         self.get_frame(), "Building navigation mesh for indoor 00/00...")
     num_entities = state.getselectioncount()
     for i in range(num_entities):
         dlg.set_message( "Building navigation mesh for indoor " \
             + str(i+1) + "/" + str(num_entities) + "..." )
         entity = state.getselectedentity(i)
         success = True
         if entity.isa('neindoor'):
             success = navbuilder.buildindoornavmesh(entity)
         elif entity.isa('newalkablebrush'):
             success = navbuilder.buildbrushnavmesh(entity)
         if not success:
             msg = "Unable to create navigation mesh for entity %s" % str(
                 entity.getid())
             cjr.show_error_message(msg)
     dlg.Destroy()
예제 #12
0
 def on_nav_gen_params(self, event):
     """Open an object inspector for the navigation mesh builder state"""
     navbuilder = app.get_navbuilder()
     win = objdlg.create_window(self.get_frame(), navbuilder.getfullname())
     win.display()
예제 #13
0
 def on_link_nav_graphs(self, event):
     """Generate external links to connect superimposed navigation graphs"""
     navbuilder = app.get_navbuilder()
     navbuilder.generateexternallinks()
예제 #14
0
 def on_link_nav_graphs(self, event):
     """Generate external links to connect superimposed navigation graphs"""
     navbuilder = app.get_navbuilder()
     navbuilder.generateexternallinks()