Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #-----------------------------------------------------------------------------
- # Name: panel.py
- # Purpose: simplify obj2pie options
- #
- # Author: <Berg>
- #
- # Created: 2011/10/31
- # RCS-ID: $Id: panel.py $
- # Copyright: (c) 2006
- # Licence: <your licence>
- #-----------------------------------------------------------------------------
- from Tkinter import *
- import Tkinter
- import tkMessageBox
- import tkFileDialog
- import os
- # a place to store our filename
- objectfile=''
- piefile=''
- texturefile=''
- yaxis=''
- reverswind=''
- mask=''
- pie=''
- slider='-s 0 '
- global path
- path = 'C:\\your\\file\\path\\to\\obj2pie.exe'
- top = Tkinter.Tk()
- top.title("Object to Pie Converter")
- top.geometry('550x300+100+100')#geometry window size
- #Pick a file and store it in global variable objectfile
- def ObjectFile():
- global objectfile # use global variable
- objectfile = tkFileDialog.askopenfilename()
- return
- def PieFile():
- global piefile # use global variable
- piefile = tkFileDialog.asksaveasfilename()#this should be a save file browers not open ..pie to save to
- return
- def TextureFile():
- global texturefile # use global variable
- file2 = tkFileDialog.askopenfilename()#this should be texture only
- texturefile=os.path.basename(file2)
- return
- def SetY():
- global yaxis
- yaxis = '-y '
- return
- def UnSetY():
- global yaxis
- yaxis = ''
- return
- def Revers():
- global reverswind
- reverswind = '-r '
- return
- def UnRevers():
- global reverswind
- reverswind = ''
- return
- def Mask():
- global mask
- mask = '-m '
- return
- def UnMask():
- global mask
- mask = ''
- return
- def PieThree():
- global pie
- pie = '-v 3 '
- return
- def PieTwo():
- global pie
- pie = '-v 2 '
- return
- def SliderNumber(num):
- global slider
- slider = '-s ' + num + ' '
- return
- #-----------------------------------------------------------------------------------------------------------------------
- #-------------------showing what output
- def CallBack(): #define a command for a button
- tkMessageBox.showinfo( "show file ", " This is the file selected \r\n" + path + " -y -v 3 -r -s 8 " + objectfile + " " + piefile + " " + texturefile ) #open another message box with this info in
- os.system(path + " " + slider + mask + pie + reverswind + yaxis + objectfile + " " + piefile + " " + texturefile )
- print path + " " + slider + mask + pie + reverswind + yaxis + objectfile + " " + piefile + " " + texturefile
- #-----------------------------------------------------------------------------------------------------------------------
- #-------------------end what output
- v = IntVar()
- Radiobutton(top, text="Y is Up ", variable=v, value=1, command = SetY).place(x=20, y=20)
- Radiobutton(top, text="Leave Y as is ", variable=v, value=2, command = UnSetY).place(x=250, y=20)
- label=Label(text='<--select for -y').place(x=150, y=20)
- w = IntVar()
- Radiobutton(top, text="Revers Winding", variable=w, value=1, command = Revers).place(x=20, y=40)
- Radiobutton(top, text="leave -r off ", variable=w, value=2, command = UnRevers).place(x=250, y=40)
- label1=Label(text='<--select for -r').place(x=150, y=40)
- x = IntVar()
- Radiobutton(top, text="Enable Tcmask ", variable=x, value=1, command = Mask).place(x=20, y=60)
- Radiobutton(top, text="No Tcmask ", variable=x, value=2, command = UnMask).place(x=250, y=60)
- label2=Label(text='<--select for -m').place(x=150, y=60)
- y = IntVar()
- Radiobutton(top, text="Pie 3 ", variable=y, value=1, command = PieThree).place(x=20, y=80)
- Radiobutton(top, text="Pie 2 ", variable=y, value=2, command = PieTwo).place(x=250, y=80)
- sliderscale = Scale(top, from_=-100, to=100, orient=HORIZONTAL, command = SliderNumber)
- label3=Label(text='slide to adjust model size +/- \r\nDo not set on 0 as size x 0 = 0').place(x=250, y=105)
- global num
- num=sliderscale.get()
- sliderscale['bg']='cyan'
- sliderscale.place(x=100, y=110)
- mybutton1 = Tkinter.Button(top, text ="input file.obj", command = ObjectFile)
- mybutton2 = Tkinter.Button(top, text ="output file.pie", command = PieFile)
- mybutton3 = Tkinter.Button(top, text ="Model Texture.png", command = TextureFile)
- mybutton = Tkinter.Button(top, text ="Convert", command = CallBack)
- mybutton['bg']='orange'
- exitbutton = Tkinter.Button(top, text ="Exit", command=top.destroy)
- #label=Label(text='Usage: obj2pie [options] input_filename output_filename texturefilename').place(row=11, column=2)
- #label2=Label(text= '-y Do not swap Y and Z axis. Exporter uses Y-axis as "up".').place(row=12, column=2)
- mybutton1.place(x=20, y=200)
- mybutton2.place(x=150, y=200)
- mybutton3.place(x=280, y=200)
- mybutton.place(x=20, y=260)
- exitbutton.place(x=370, y=260)
- top.mainloop()
- if __name__ == '__main__':
- pass # add a call to run your script here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement