Skip to content

Commit 6154f44

Browse files
committed
Added file dialog popup
utulized tkinter to have dialog popup to input the OriginalFBX & FaceTrackedFBX
1 parent eaffedd commit 6154f44

1 file changed

Lines changed: 33 additions & 26 deletions

File tree

FT_Builder.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22
from pickle import TRUE
3+
import tkinter as tk
4+
from tkinter import filedialog
35
import sys
46
import shutil
57
import subprocess
@@ -23,6 +25,22 @@ def print_ascii_art():
2325
print(credits)
2426

2527

28+
def get_file_path(prompt):
29+
root = tk.Tk()
30+
root.withdraw() # Hide the main window
31+
32+
file_path = filedialog.askopenfilename(title=prompt)
33+
34+
return file_path
35+
36+
def get_directory_path(prompt):
37+
root = tk.Tk()
38+
root.withdraw() # Hide the main window
39+
40+
directory_path = filedialog.askdirectory(title=prompt)
41+
42+
return directory_path
43+
2644
#remplaces the sick descriptions you've made for your product with what you input if you so please
2745
def replace_placeholders_in_files_in_directory(directory, AvatarName, AvatarCreatorName, BoothLink, PackageName, DirPatcher, DirPrefab):
2846
replacements = {
@@ -99,34 +117,27 @@ def modify_python_patcher_script(original_model_path, original_meta_file_path, d
99117

100118

101119

120+
121+
102122
def main():
103123

104124
print_ascii_art()
105125

106126
# Get the required info to proceed
107127

108-
# OriginalFBX = input("Drag and drop the original FBX here: ") Until we find a way to build the builder
109-
OriginalFBX = input("Please input the path to the original FBX: ")
110-
if OriginalFBX.startswith('"') and OriginalFBX.endswith('"'):
111-
OriginalFBX = OriginalFBX.strip('"')
112-
113-
while not os.path.isfile(OriginalFBX) :
114-
OriginalFBX = input("Please input the path to an original fbx file that exists")
115-
if OriginalFBX.startswith('"') and OriginalFBX.endswith('"'):
116-
OriginalFBX = OriginalFBX.strip('"')
117-
118-
119128

120-
# FaceTrackedFBX = input("Drag and drop the face tracked FBX here: ")
121-
FaceTrackedFBX = input("Please input the path to the Face tracked FBX: ")
122-
if FaceTrackedFBX.startswith('"') and FaceTrackedFBX.endswith('"'):
123-
FaceTrackedFBX = FaceTrackedFBX.strip('"')
124-
while not os.path.isfile(FaceTrackedFBX) :
125-
FaceTrackedFBX = input("Please input the path to an original fbx file that exists")
126-
if FaceTrackedFBX.startswith('"') and FaceTrackedFBX.endswith('"'):
127-
FaceTrackedFBX = FaceTrackedFBX.strip('"')
129+
OriginalFBX = get_file_path("Please select the original FBX file")
130+
while not os.path.isfile(OriginalFBX):
131+
OriginalFBX = get_file_path("Please select a valid original FBX file")
132+
133+
FaceTrackedFBX = get_file_path("Please select the Face tracked FBX file")
134+
while not os.path.isfile(FaceTrackedFBX):
135+
FaceTrackedFBX = get_file_path("Please select a valid Face tracked FBX file")
128136

129137

138+
139+
140+
130141
NameCustomDir = input("Please input the name of your custom directory: ")
131142

132143
while os.path.isfile(NameCustomDir) or os.path.isdir(NameCustomDir):
@@ -139,14 +150,10 @@ def main():
139150

140151

141152

142-
DescriptionDir = input("Please input the directory of your descriptions and readme files (will skip if left empty): ")
143153

144-
if DescriptionDir != '':
145-
if DescriptionDir.startswith('"') and DescriptionDir.endswith('"'):
146-
DescriptionDir = DescriptionDir.strip('"')
147-
while not os.path.isdir(DescriptionDir):
148-
DescriptionDir = input("Please input a valid directory with your descriptions and readme files (will not skip because you failed your first failed the first time bozo): ")
149-
154+
DescriptionDir = get_directory_path("Please select the directory with your descriptions and readme files (leave empty to skip)")
155+
156+
if DescriptionDir!="":
150157
CreatorName = input("Please input the name of the creator: ")
151158
BoothPage = input("Please input the page of the avatar: ")
152159
PackageName = input("Please input the name of the package that users will have: ")

0 commit comments

Comments
 (0)