diff --git a/.gitignore b/.gitignore index 466a9db..e669223 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,7 @@ notice.txt screenshots/ maps/ phase_*/ +leveleditor/*.bam # VS Code .history diff --git a/toontown/leveleditor/LevelEditorPanel.py b/toontown/leveleditor/LevelEditorPanel.py index a838713..0d79c55 100644 --- a/toontown/leveleditor/LevelEditorPanel.py +++ b/toontown/leveleditor/LevelEditorPanel.py @@ -1,8 +1,10 @@ import sys import Pmw +import os from tkinter import * from tkinter import ttk +from tkinter.filedialog import asksaveasfilename from direct.showbase.TkGlobal import * from direct.tkwidgets import Floater @@ -66,6 +68,11 @@ def __init__(self, levelEditor, parent = None, **kw): 'Save DNA File', label = 'Save DNA', command = DNASerializer.outputDNADefaultFile) + menuBar.addmenuitem('Level Editor', 'command', + 'Export level as .BAM', + label = 'Export as .BAM', + command = self.exportToBam) + menuBar.addmenuitem('Level Editor', 'separator') menuBar.addmenuitem('Level Editor', 'command', 'Edit Visibility Groups', @@ -84,6 +91,7 @@ def __init__(self, levelEditor, parent = None, **kw): 'Make Street Along Curve', label = 'Make Street Along Curve', command = self.levelEditor.makeStreetAlongCurve) + menuBar.addmenuitem('Level Editor', 'separator') menuBar.addmenuitem('Level Editor', 'command', 'Exit Level Editor Panel', @@ -206,7 +214,7 @@ def __init__(self, levelEditor, parent = None, **kw): 'min': 1, 'max': 60 }) - #self.autoSaverDialogMax = Pmw.Counter(self.autoSaverDialog.interior(), + # self.autoSaverDialogMax = Pmw.Counter(self.autoSaverDialog.interior(), # labelpos = 'w', # label_text = 'Max auto save files:', # entry_width = 10, @@ -215,7 +223,7 @@ def __init__(self, levelEditor, parent = None, **kw): # 'min': 0, 'max': 99 # }) - counters = (self.autoSaverEnable, self.autoSaverDialogInterval)#, self.autoSaverDialogMax) + counters = (self.autoSaverEnable, self.autoSaverDialogInterval) # , self.autoSaverDialogMax) Pmw.alignlabels(counters) for counter in counters: counter.pack(fill = 'both', expand = 1) @@ -1515,7 +1523,7 @@ def setAutoSaverInterval(self, i): try: settings['autosave-enabled'] = bool(self.autoSaverEnabled.get()) settings['autosave-interval'] = int(self.autoSaverDialogInterval.get()) - #settings['autosave-max-files'] = float(self.autoSaverDialogMax.get()) + # settings['autosave-max-files'] = float(self.autoSaverDialogMax.get()) # Reset the autosaver AutoSaver.initializeAutoSaver() except ValueError as e: @@ -1589,3 +1597,19 @@ def toggleDrive(self): self.levelEditor.useDriveMode() else: self.levelEditor.useDirectFly() + + def exportToBam(self): + """ + Export level geometry as .bam + :return: + """ + path = Filename.expandFrom(userfiles).toOsSpecific() + if not os.path.isdir(path): + path = '.' + fileName = asksaveasfilename(defaultextension = '.dna', + filetypes = (('Panda3D Model Files', '*.bam'), ('All files', '*')), + initialdir = path, + title = 'Export as .BAM', + parent = self.component('hull')) + if fileName: + self.levelEditor.getNPToplevel().writeBamFile(Filename.expandFrom(fileName)) diff --git a/ver b/ver index 5165303..d7f1518 100644 --- a/ver +++ b/ver @@ -1 +1 @@ -1.1.11 \ No newline at end of file +1.1.12 \ No newline at end of file