Skip to content

Commit

Permalink
add export to bam option
Browse files Browse the repository at this point in the history
  • Loading branch information
drewc5131 committed Feb 10, 2021
1 parent 8d9db1a commit 206f03e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ notice.txt
screenshots/
maps/
phase_*/
leveleditor/*.bam

# VS Code
.history
Expand Down
30 changes: 27 additions & 3 deletions toontown/leveleditor/LevelEditorPanel.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion ver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.11
1.1.12

0 comments on commit 206f03e

Please sign in to comment.