Skip to content

Commit b24ac39

Browse files
committed
add teture to tga
1 parent eb42027 commit b24ac39

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sourceSDK++.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#import re
21
import string
32
import tkinter as tk
4-
#from turtle import st
5-
#from numpy import source
63
import srctools
74
import os
85
import subprocess
96
from tkinter import filedialog
107
import sys
118
from vtf2img import Parser
129
import shutil
13-
#from PIL import Image
1410
import git
1511
import ctypes as ct
1612
import urllib.request
@@ -396,6 +392,7 @@ def button_init():
396392
sdk.texture_menu.add_command(label="Build Texture", command=build_texture)
397393
sdk.texture_menu.add_command(label="Build All Textures", command=build_all_texture)
398394
sdk.texture_menu.add_command(label="See Texture", command=open_vtf)
395+
sdk.texture_menu.add_command(label="Texture To TGA", command=texture_to_tga)
399396

400397
sdk.model_menu.add_command(label="Build Model", command=build_model)
401398
sdk.model_menu.add_command(label="Build All Models", command=build_all_model)
@@ -709,6 +706,13 @@ def select_material(material):
709706
except Exception as e:
710707
print(f"Error: {e}")
711708

709+
def texture_to_tga():
710+
filenameVTF = filedialog.askopenfile(title="Select .vtf file", filetypes=[("VTF file", "*.vtf")], initialdir=sdk.selected_folder + "/materials")
711+
command = '"' + sdk.bin_folder + "/vtf2tga.exe" + '"'+ " -i " + '"' + filenameVTF.name + '"'
712+
result = subprocess.run(command, shell=True, capture_output=True, text=True)
713+
print(result)
714+
715+
712716
# Replace these with your GitHub repository owner and name
713717
repo_owner = "ChocoScaff"
714718
repo_name = "SourceSDK-"

0 commit comments

Comments
 (0)