Outsource Asset Processor - Main Script
JO00
python
2 months ago
29 kB
8
Indexable
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
from PIL import ImageTk,Image
import os
from PIL import Image
import csv
import glob
import time
import subprocess
root = tk.Tk()
root.title("Outsource Asset Manager")
root.geometry("1000x600+50+100") #ommits 50 from left and 100 from top to spawn window
folder_images=str(os.path.dirname(__file__))+"/icons/"
folder_script=str(os.path.dirname(__file__))+"/shader_graphs/"
folder_themes=str(os.path.dirname(__file__))+"/theme/awthemes-10.4.0"
###images used elsewhere must be exported with
ue_icon=ImageTk.PhotoImage(Image.open(folder_images+'ue_light.png'))
ue_icon_dark=ImageTk.PhotoImage(Image.open(folder_images+'ue_dark.png'))
folder_icon=ImageTk.PhotoImage(Image.open(folder_images+'folder.png'))
success_icon=ImageTk.PhotoImage(Image.open(folder_images+'status_green.png'))
fail_icon=ImageTk.PhotoImage(Image.open(folder_images+'status_red.png'))
lightbulb=ImageTk.PhotoImage(Image.open(folder_images+'lightbulb.png'))
mint=ImageTk.PhotoImage(Image.open(folder_images+'mint.png'))
#setting icon in program
root.iconbitmap(folder_images+'mint.ico')
##making dark and light mode
#swaps between two themes it has locally downloaded
root.tk.call('lappend', 'auto_path', folder_themes)
root.tk.call('package', 'require', 'awdark')
light_image_button=ttk.Label(root, text="Defualt")
UE_executable=""
ue_project=""
blender_path=""
config_file=str(os.path.dirname(__file__))+"/shader_graphs/config.txt"
def config_bake_settings(writemode):
try:
if writemode==True:
print("trying to write bake changed settings")
with open(config_file, "r", newline="", encoding="utf-8") as f:
original_lines=f.readlines()
with open(config_file, "w", newline="", encoding="utf-8") as f:
#get resolution and image format then compare then number it is for proper setting
total_res_count=len(text_resolution)
res_count=0
while resolution_var.get()!=text_resolution[res_count]:
res_count+=1
original_lines[3]=str(res_count)+"\n"
#print(original_lines)
img_type_count=len(format_options)
res_count_2=0
while format_var.get()!=format_options[res_count_2]:
res_count_2+=1
original_lines[4]=str(res_count_2)+"\n"
#print(original_lines)
#original_lines[4]=format_var.get()+"\n"
original_lines[5]=bake_extrusion_val.get().strip("\n")+"\n"
original_lines[6]=ao_intensity_val.get().strip("\n")+"\n"
original_lines[7]=position_mask_val.get()#+"\n"
f.writelines(original_lines)
#print(original_lines)
if writemode==False: #this just reads set back to ui
#print("false mode")
with open(config_file, "r", newline="", encoding="utf-8") as f:
all_lines=f.readlines()
resolution_var.set(text_resolution[int(all_lines[3])])
format_var.set(format_options[int(all_lines[4])])
bake_extrusion_val.set(str(all_lines[5]).strip("\n"))
ao_intensity_val.set(str(all_lines[6]).strip("\n"))
position_mask_val.set(str(all_lines[7]).strip("\n"))
except:
print("failed to write")
#uefolder="E:/My_Website_/project/outsource-tool/ue/Outsource_Tool/Content"
#mybackups
#UE_executable="D:/Games/RealityCapture_here/UE_5.5/Engine/Binaries/Win64/UnrealEditor.exe"
#ue_project="E:/My_Website_/project/outsource-tool/ue/Outsource_Tool/Outsource_Tool.uproject"
#blender_path="C:/Program Files/Blender Foundation/Blender 5.0/blender.exe"
def fail_config():
#config_file=str(os.path.dirname(__file__))+"/shader_graphs/config.txt"
variables_to_default=["Default","Default","Default","2","0","1","1","1"]
with open(config_file, "w", newline="", encoding="utf-8") as f:
tk.messagebox.showwarning(title="Missing Paths", message="Missing executable paths in config file! Please paste .exe paths into shader_graph folder")
writer = csv.writer(f)
for var in variables_to_default:
writer.writerow([var])
def config_loader():
try:
#line by line, #0 is ue exe location, #1 is blender exe loc, #2 is ue project path
if os.path.isfile(config_file):
with open(config_file, 'r') as file:
contents = file.readlines()
line_count=len(contents)
if line_count>=7:
with open(config_file, "r+", newline="", encoding="utf-8") as f:
all_lines=f.readlines()
if os.path.isfile(os.path.abspath(all_lines[0].strip())):
#print("found ue executable setting")
global UE_executable
UE_executable=all_lines[0]
if os.path.isfile(os.path.abspath(all_lines[1].strip())):
#print("found blender executable setting")
global blender_path
blender_path=all_lines[1]
if os.path.isfile(os.path.abspath(all_lines[2].strip())):
#print("found ue project!")
global ue_project
ue_project=all_lines[2]
ue_content_folder_status.config(image=success_icon)
ue_folder_readout.config(text="Project loaded")
else:
#print("too small")
fail_config()
else:
fail_config()
except:
print("failed config load")
def theme_switcher():
style = ttk.Style()
getting_theme=style.theme_use()
if getting_theme=="awdark":
style.theme_use('awlight')
UE_Logo.config(image=ue_icon_dark)
else:
style.theme_use('awdark')
UE_Logo.config(image=ue_icon)
##############
lstbox_master=[
[], # name of mesh here
[], # texture progress and normal status here
[] #engine import
]
####
###finding folder of meshes and checking if meshes and textures there
folder_meshes_path=""
folder_meshes_status_bool=False
mesh_name_arr=[]
def set_listbox_refresh():
listbox_choice_file.set(lstbox_master[0])
listbox_choice_text.set(lstbox_master[1])
listbox_choice_engine.set(lstbox_master[2])
############# baking textures start
#### checking if normal map is there then launch blender
#import time #debug forcing blender to exist for a little while
import traceback
baker_script_path=str(os.path.dirname(__file__))+"/"+"finalised_baker_script.py"
#baker_script_path="e:/My_Website_/project/outsource-tool/python/finalised_baker_script.py"
def baking_noises():
try:
print("baking noise")
#print(folder_meshes_path)
thepath=[]
thepath.append(str(folder_meshes_path))
#put into storage csv file for blender
#check if exists
low_poly_csv_path=folder_script+"mesh_data.csv"
with open(low_poly_csv_path, "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(thepath)
print("wrote stuff")
writer.writerow(lstbox_master[0])
print("openin blender")
subprocess.run([blender_path.strip() , "--background", "--python", str(baker_script_path)])
print("blender completed..")
#to attempt to channel pack
mesh_amount = len(lstbox_master[0])
text_count=0
while text_count!=mesh_amount:
bake_folder_check=folder_meshes_path+"/"+lstbox_master[0][text_count]
if os.path.isdir(bake_folder_check):
lstbox_master[1][text_count] = "Completed Baking"
else:
lstbox_master[1][text_count] = "Failed Baking"
text_count+=1
if text_count!=0:
print("baking can commence")
set_listbox_refresh()
channel_pack_after_bake()
else:
set_listbox_refresh()
####
except Exception as e:
print("failed to bake noise")
traceback.print_exc()
mesh_amount = len(lstbox_master[0])
text_count=0
while text_count!=mesh_amount:
lstbox_master[1][text_count] = "Failed Baking"
text_count+=1
set_listbox_refresh()
#####
#### PACKING TEXTURES BEHAVIOUR
####
#numbers are RGBA _P0 AO, _P1 CURVATURE, _P2 DIRT EDGES, _P3 DIRT GROUND
def channel_pack_after_bake():
try:
#get saved mesh path from csv
with open(folder_script+"mesh_data.csv", newline="", encoding="utf-8") as f:
reader = csv.reader(f)
rows = list(reader)
file_exten_image=format_var.get()
folder_path = rows[0][0]
folder_loc=folder_path
print("channel packing now")
mesh_amount = len(lstbox_master[0])
#folder_loc="C:/Users/Jesse/Downloads/baking_test"
#temp_array=["sm_barrel","sm_hammer"]
bake_counter=0
print("startin..")
for selected_mesh in lstbox_master[0]:
texture_name=selected_mesh[3:]
print(texture_name)
print(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P0"+file_exten_image)
find_ao=os.path.isfile(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P0"+file_exten_image)
print(find_ao)
print(selected_mesh)
if find_ao:
ao_image= Image.open(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P0"+file_exten_image).convert('L')
curvature_image=Image.open(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P1"+file_exten_image).convert('L')
dirt_edges_image=Image.open(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P2"+file_exten_image).convert('L')
dirt_ground_image=Image.open(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_EMIT_P3"+file_exten_image).convert('L')
print("opened")
#CHANNEL PACK
channel_packed= Image.merge('RGBA', (ao_image,curvature_image,dirt_edges_image,dirt_ground_image))
#new_image.show()
#SAVE
print("saving")
channel_packed.save(folder_loc+"/"+selected_mesh+"/T_"+texture_name+"_AOCEP"+file_exten_image)
####now to rename the normal correctly
old_normal_map=Image.open(folder_loc+"/"+selected_mesh+"/T_"+selected_mesh+"_NORMAL"+file_exten_image)
rename=(folder_loc+"/"+selected_mesh+"/T_"+texture_name+"_N"+file_exten_image)
old_normal_map.save(rename)
lstbox_master[1][bake_counter] = "Completed Channel Packing"
print("channel packing success!!")
bake_counter+=1
else:
lstbox_master[1][bake_counter] = "Failed Channel Packing"
bake_counter+=1
print("channel packing failure!!")
except:
print("packing failure")
mesh_amount = len(lstbox_master[0])
text_count=0
while text_count!=mesh_amount:
lstbox_master[1][text_count] = "Failed Channel Packing"
text_count+=1
set_listbox_refresh()
############
######run second script in blender to bake out texture maps then return
##### second define to pack textures together the color channels and name all correctly
def ue_import_test():
#ue_import_script=str(os.path.dirname(__file__))+"/"+"shader_graphs/ue_import.py"
try:
ue_import_script=os.path.realpath(str(os.path.dirname(__file__))+"/"+"shader_graphs/ue_import.py")
subprocess.run([UE_executable.strip(),ue_project.strip(),"-run=PythonScript",f"-script={str(ue_import_script)}","-unattended", "-NoSplash" ])
count_success=0
for selected_mesh in lstbox_master[0]:
lstbox_master[2][count_success] = "Completed Engine Import"
print("ue import success!")
set_listbox_refresh()
except:
print("failed import")
for selected_mesh in lstbox_master[0]:
lstbox_master[2][count_success] = "Failed Engine Import"
print("ue import success!")
set_listbox_refresh()
def mesh_folder_find():
try:
folder_search=filedialog.askdirectory(initialdir=os.path.dirname(__file__),title="Select folder full of high and low poly meshes",mustexist=True)
fbx_count=0
mesh_name_arr=[]
lstbox_master[0].clear()
lstbox_master[1].clear()
lstbox_master[2].clear()
low_list=[]
#get name check if its a fbx file
for file in os.listdir(folder_search):
filename=str(file)
#print(filename)
#only low poly is fbx
if filename.lower().endswith(('.fbx')):
no_fbx=filename[:-4]
if not no_fbx.lower().endswith(('_high')):
print(no_fbx)
low_list.append(no_fbx)
#print("appended "+no_fbx)
for low_file in low_list:
#high_name=low_file[:-4]
file_path=os.path.join(folder_search, low_file + "_high.obj")
if os.path.isfile(file_path):
print("found high file")
lstbox_master[0].append(low_file)
lstbox_master[1].append("Not ran")
lstbox_master[2].append("Not ran")
fbx_count+=1
#if found fbxs in folder then
global folder_meshes_path
global folder_meshes_status_bool
if fbx_count!=0:
mesh_folder_status.config(image=success_icon)
folder_readout.config(text=str(folder_search))
folder_meshes_path=str(folder_search)
folder_meshes_status_bool=True
else:
mesh_folder_status.config(image=fail_icon)
folder_readout.config(text="No meshes found inside folder, try again")
folder_meshes_status_bool=False
set_listbox_refresh()
#mesh_folder_status.config(image=success_icon)
except:
print("Failed to read folder or no meshes found, try again")
#statistics_sum="Failed to read folder or no meshes found, try again"
#mesh_folder_path="Directory_Not_Found"
#mesh_folder_status.config(image=fail_icon)
import webbrowser
from datetime import datetime
from trello import TrelloClient
def trello_card_maker():
print("sending to trello")
trello_config=str(os.path.dirname(__file__))+"/shader_graphs/trello_config.txt"
with open(trello_config, "r", newline="", encoding="utf-8") as f:
all_lines=f.readlines()
trello_api_key=str(all_lines[0].strip())
trello_token=str(all_lines[1].strip())
board_name=str(all_lines[2].strip())
list_to_import_to=str(all_lines[3].strip())
client = TrelloClient(
api_key=trello_api_key,
api_secret=None, # not required for basic token
token=trello_token,
token_secret=None
)
###the folder of images is where the static meshes are
#now to import the original path and the list of meshes
csv_location=str(os.path.dirname(__file__))+"/shader_graphs/mesh_data.csv"
with open(csv_location, newline="", encoding="utf-8") as f:
reader = csv.reader(f)
rows = list(reader)
folder_path = rows[0][0]
mesh_array = rows[1]
#get each trello board
board_name = board_name
board = next(b for b in client.list_boards() if b.name == board_name)
list_name = list_to_import_to
trello_list = next(l for l in board.list_lists() if l.name == list_name)
for mesh in mesh_array:
#for each mesh get its name, make a new card and upload to it
image_path=folder_path+"/"+mesh+".png"
if os.path.isfile(image_path):
#now to give it some data as it uploads up to the card
time_upload="Uploaded at " +str(datetime.now())
card = trello_list.add_card(mesh, desc=time_upload)
with open(image_path, "rb") as f:
card.attach(name=mesh + ".png", file=f)
#uploaded now can be manually approved and adjusted!!
tk.messagebox.showinfo(title="Completed Trello Upload", message="Check your Trello board, thumbnails have been uploaded!")
def documentation_link():
trello_card_maker()
def find_ue_content():
try:
#folder_search=filedialog.askopenfile(initialdir=os.path.dirname(__file__),title="Select Unreal Engine uproject file",mustexist=True)
folder_search=filedialog.askopenfilename(initialdir=os.path.dirname(__file__), title="Select Unreal Engine uproject file", filetypes=(("Unreal Project File", "*.uproject"), ("All files", "*.*")), multiple = False)
if os.path.isfile(folder_search):
ue_content_folder_status.config(image=success_icon)
ue_folder_readout.config(text="Project loaded")
config_file=str(os.path.dirname(__file__))+"/shader_graphs/config.txt"
with open(config_file, "r", newline="", encoding="utf-8") as f:
original_lines=f.readlines()
print(original_lines)
with open(config_file, "w", newline="", encoding="utf-8") as f:
#all_lines=f.readlines()
original_lines[2]=folder_search
f.writelines(original_lines)
#print("aye")
#folder_meshes_path=str(folder_search)
#folder_meshes_status_bool=True
else:
#uefolder=""
ue_content_folder_status.config(image=fail_icon)
ue_folder_readout.config(text="Project Load Failed")
#folder_meshes_status_bool=False
except:
print("empty...")
############
################# UI IS HERE AND PACKED ALL OF IT
################
#Important parameters from ui
mesh_fol_state=tk.BooleanVar()
overwrite_import_state=tk.BooleanVar()
#########
############
############## top frame with buttons for folder, ue and readout icons for statistics
Top_Frame=ttk.Frame(
root,
relief="groove"
)
Top_Frame.pack(side="top", fill="x")
UE_Frame=ttk.Frame(
Top_Frame,
relief="flat"
)
UE_Frame.pack(side="left", fill="y")
Lightmode_Toggle_Icon=ttk.Button(UE_Frame,image=lightbulb,command=theme_switcher).pack(side='left', anchor='w', expand=True)
Lightmode_Toggle=ttk.Label(UE_Frame,text="Dark Mode Switch ").pack(side='left',fill="both")
UE_Logo=ttk.Button(UE_Frame,image=ue_icon,command=find_ue_content)
UE_Logo.pack(side='left',fill="both")
#UE_Logo.pack(side='left', anchor='w', expand=True)
ue_status_message=ttk.Label(UE_Frame,text="UE Project Status:").pack(side='left',fill="both")
ue_folder_readout=ttk.Label(UE_Frame,text="No project found ")
ue_folder_readout.pack(side="left", fill="both")
ue_content_folder_status=ttk.Label(UE_Frame,image=fail_icon)
ue_content_folder_status.pack(side='left', anchor='w', expand=True)
light_image_button=UE_Logo
Mesh_Folder_Frame=ttk.Frame(
Top_Frame,
relief="flat"
)
Mesh_Folder_Frame.pack(side="left", fill="y")
Folder_Button_1=ttk.Button(Mesh_Folder_Frame,image=folder_icon,command=mesh_folder_find).pack(side='left',fill="both")
mesh_fold_label=ttk.Label(Mesh_Folder_Frame,text="Mesh Folder Directory:").pack(side='left',fill="both")
#mesh_folder_path=tk.StringVar(root)
folder_readout=ttk.Label(Mesh_Folder_Frame,text="No directory chosen ")
folder_readout.pack(side="left", fill="both")
mesh_folder_status=ttk.Label(Mesh_Folder_Frame,image=fail_icon)
mesh_folder_status.pack(side='left', anchor='w', expand=True)
############## left frame with readout stats and buttons to do things
##############
##############
Left_Frame=ttk.Frame(
root,
width=270,
height=480,
relief="groove"
)
Left_Frame.pack(side="left", fill="y")
label_overview=ttk.Label(Left_Frame,text="Instructions")
label_overview.pack(side="top",fill="none")
label_overview_2=ttk.Label(Left_Frame,text="Both high and low poly meshes require SM_ prefix. Your high poly mesh also needs to end in _high suffix.",wraplength=220,justify="left")
label_overview_2.pack(side="top",fill="none",anchor="w")
line_3_breakup=ttk.Label(Left_Frame,text="Both meshes need to be in the same folder to work.",wraplength=220,justify="left")
line_3_breakup.pack(side="top",fill="none",anchor="w")
line_5_breakup=ttk.Label(Left_Frame,text="Don't forget to set the content folder for your UE project directory prior to running.",wraplength=220,justify="left")
line_5_breakup.pack(side="top",fill="none",anchor="w")
line_2_breakup=ttk.Label(Left_Frame,text="To process assets: First press Find mesh Folder, after validation press Bake Mesh Maps.",wraplength=300,justify="left")
line_2_breakup.pack(side="top",fill="none",anchor="w")
line_4_breakup=ttk.Label(Left_Frame,text="For further reading and troubleshooting checkout the documentation.",wraplength=180,justify="left")
line_4_breakup.pack(side="top",fill="none",anchor="w")
overview_frame=ttk.Frame(Left_Frame,relief="groove")
overview_frame.pack(side="top", fill="both", expand=True)
###########bake settings
label_bake_settings=ttk.Label(overview_frame,text="Bake Settings")
label_bake_settings.pack(side="top",fill="none")
explain_label=ttk.Label(overview_frame,text="Adjust settings below to change tool behaviour.",justify="left")
explain_label.pack(side="top",fill="none")
text_width=26
resolution_frame=ttk.Frame(overview_frame,relief="flat")
resolution_frame.pack(side="top", fill="none",anchor="w")
resolution_label=ttk.Label(resolution_frame,text="Texture Resolution: ",width=text_width,wraplength=220,justify="left")
resolution_label.pack(side="left",fill="none",anchor="w")
resolution_var = tk.StringVar()
text_resolution=["512","1024","2048","4096"]
resolution_var.set(text_resolution[2])
resolution_dropdown=ttk.Combobox(resolution_frame,textvariable=resolution_var)
resolution_dropdown['values'] = text_resolution
resolution_dropdown.state(["readonly"])
resolution_dropdown.pack(side="left",fill="none",anchor="w")
format_frame=ttk.Frame(overview_frame,relief="flat")
format_frame.pack(side="top", fill="none",anchor="w")
format_label=ttk.Label(format_frame,text="Image Format: ",width=text_width,wraplength=220,justify="left")
format_label.pack(side="left",fill="none",anchor="w")
format_var = tk.StringVar()
format_options=[".tga",".png",".jpeg"]
format_var.set(format_options[0])
format_dropdown=ttk.Combobox(format_frame,textvariable=format_var)
format_dropdown['values'] = format_options
format_dropdown.state(["readonly"])
format_dropdown.pack(side="left",fill="none",anchor="w")
bake_extrusion_frame=ttk.Frame(overview_frame,relief="flat")
bake_extrusion_frame.pack(side="top", fill="none",anchor="w")
bake_extrusion_label=ttk.Label(bake_extrusion_frame,text="Normal Bake Cage Extrusion:",width=text_width,justify="left")
bake_extrusion_label.pack(side="left",fill="none",anchor="w")
bake_extrusion_val = tk.StringVar()
bake_extrusion_val.set(0.2)
bake_extrusion = ttk.Spinbox(bake_extrusion_frame, from_=0.1, to=2,increment=0.1, textvariable=bake_extrusion_val)
bake_extrusion.pack(side="left",fill="none",anchor="w")
ao_intensity_frame=ttk.Frame(overview_frame,relief="flat")
ao_intensity_frame.pack(side="top", fill="none",anchor="w")
ao_intensity_label=ttk.Label(ao_intensity_frame,text="AO Intensity:",width=text_width,justify="left")
ao_intensity_label.pack(side="left",fill="none",anchor="w")
ao_intensity_val = tk.StringVar()
ao_intensity_val.set(1)
ao_intensity = ttk.Spinbox(ao_intensity_frame, from_=0.5, to=3,increment=0.2, textvariable=ao_intensity_val)
ao_intensity.pack(side="left",fill="none",anchor="w")
position_mask_frame=ttk.Frame(overview_frame,relief="flat")
position_mask_frame.pack(side="top", fill="none",anchor="w")
position_mask_label=ttk.Label(position_mask_frame,text="Position Mask Intensity:",width=text_width,justify="left")
position_mask_label.pack(side="left",fill="none",anchor="w")
position_mask_val = tk.StringVar()
position_mask_val.set(1)
position_mask = ttk.Spinbox(position_mask_frame, from_=0.2, to=3,increment=0.5, textvariable=position_mask_val)
position_mask.pack(side="left",fill="none",anchor="w")
Bottom_Frame=ttk.Frame(Left_Frame,relief="flat")
Bottom_Frame.pack(side="bottom", fill="both", anchor="center", expand=True)
submit_frame=ttk.Frame(Bottom_Frame,relief="flat")
submit_frame.pack(side="top", fill="both",anchor="center",expand=True)
FindFolder_Button=ttk.Button(submit_frame,text="Find Mesh Folder",command=mesh_folder_find)
FindFolder_Button.pack(side="top", fill="both",anchor="center")
Submit_Button=ttk.Button(submit_frame,text="Bake Texture Maps",command=baking_noises)
Submit_Button.pack(side="top", fill="both",anchor="center")
#channel_pack_after_bake
documentation_frame=ttk.Frame(Bottom_Frame,relief="flat")
documentation_frame.pack(side="top", fill="both",anchor="center",expand=True)
Clear_Results_Button=ttk.Button(documentation_frame,text="Engine Import",command=ue_import_test)
Clear_Results_Button.pack(side="top", fill="both",anchor="center")
Documentation_Button=ttk.Button(documentation_frame,text="Send to Trello",command=documentation_link)
Documentation_Button.pack(side="top", fill="both",anchor="center")
##### right frame with listboxes of file data
################
##################
Right_Frame=ttk.Frame(
root,
width=730,
height=480,
relief="sunken",
)
Right_Frame.pack(side="right", fill="both", expand=True)
listbox_choice_file=tk.StringVar(value=lstbox_master[0])
listbox_choice_text=tk.StringVar(value=lstbox_master[1])
listbox_choice_engine=tk.StringVar(value=lstbox_master[2])
##for scroller later
def scroll_all(*args):
listbox_filename.yview(*args)
listbox_texture_map.yview(*args)
listbox_engine_import_status.yview(*args)
listbox_scroller=ttk.Scrollbar(Right_Frame,orient="vertical",command=scroll_all)
filename_frame=ttk.Frame(Right_Frame,relief="flat")
filename_frame.pack(side="left", fill="both", expand=True,anchor="nw")
label_filename=ttk.Label(filename_frame,text="High & Low Mesh Files").pack()
listbox_filename=tk.Listbox(filename_frame,listvariable=listbox_choice_file,yscrollcommand=listbox_scroller.set)
listbox_filename.pack(side="left", fill="both", expand=True,anchor="center")
texture_map_frame=ttk.Frame(Right_Frame,relief="flat")
texture_map_frame.pack(side="left", fill="both", expand=True,anchor="nw")
label_texture_map=ttk.Label(texture_map_frame,text="Baking & Packing").pack()
listbox_texture_map=tk.Listbox(texture_map_frame,listvariable=listbox_choice_text,yscrollcommand=listbox_scroller.set)
listbox_texture_map.pack(side="left", fill="both", expand=True,anchor="center")
engine_import_status_frame=ttk.Frame(Right_Frame,relief="flat")
engine_import_status_frame.pack(side="left", fill="both", expand=True,anchor="center")
label_engine_import_status=ttk.Label(engine_import_status_frame,text="Importing into Unreal Engine").pack()
listbox_engine_import_status=tk.Listbox(engine_import_status_frame,listvariable=listbox_choice_engine,yscrollcommand=listbox_scroller.set)
listbox_engine_import_status.pack(side="left", fill="both", expand=True,anchor="center")
#get scroller back packed after or itll be too early
listbox_scroller.pack(side="left",fill="both")
#######################
############### runtime
###########
#run theme at least once
theme_switcher()
config_loader()
config_bake_settings(False)
def on_bake_setting_changed(*args):
config_bake_settings(True)
###on change update config
resolution_var.trace_add('write',on_bake_setting_changed)
format_var.trace_add('write',on_bake_setting_changed)
bake_extrusion_val.trace_add('write',on_bake_setting_changed)
ao_intensity_val.trace_add('write',on_bake_setting_changed)
position_mask_val.trace_add('write',on_bake_setting_changed)
root.mainloop()
Editor is loading...
Leave a Comment