-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclothid.py
72 lines (51 loc) · 2.48 KB
/
clothid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Might be deprecated. Left here if someone is interested by this stuff.
import os
import argparse
from glob import glob
from shutil import copy
from shared.functions import *
parser = argparse.ArgumentParser(
description='''Change the starting number of an addon cloth. \033[31mYou must do it type by type (jbib, accs, etc.).\033[0m''',
epilog="""Written by tholeb <tholeb.fr>""")
parser.add_argument('acc', type=int, default=1, help='The number to accumulate to the texture name. Default to 1')
parser.add_argument('--input', type=str, default='./input', help='The input folder. Default to "./input"')
parser.add_argument('--output', type=str, default='./output', help='The input folder. Default to "./output"')
args = parser.parse_args()
# Get all .ydd and .ytd files in the input folder
input = glob(f'{args.input}/*.ydd') + glob(f'{args.input}/*.ytd')
os.makedirs(args.output, exist_ok=True)
# Loop every files from the input directory
for i, path in enumerate(input):
# Get file name
file = path.split('/')[-1]
# Get ped model
model = file.split('^')[0]
# Get the clothing component
outfit = file.split('^')[1]
# Check if it's a texture
texture = is_a_texture(outfit)
# Get the model type (jbib, accs, etc.)
type = outfit.split('_')[0]
if not texture:
# Model
# Get the number of the texture and make it an integer
number = int(outfit.split('_')[1])
# Destination of the texture : <output>/<model>^<type>_<number>_u.ydd
dest = f'{args.output}/{model}^{type}_{str(int(number) + args.acc).zfill(3)}_u.ydd'
# copy the model to the output folder
copy(path, dest)
else:
# Texture
# Get the number of the texture and make it an integer
number = int(outfit.split('_')[2])
textureLetter = outfit.split('_')[3]
# Destination of the texture : <output>/<model>^<type>_diff_<number>_<textureLetter>_uni.ydd
dest = f'{args.output}/{model}^{type}_diff_{str(number + args.acc).zfill(3)}_{textureLetter}_uni.ytd'
# Copy the texture to the output folder
copy(path, dest)
# Print all the info
print(f"\033[35m#{i}\033[0m \033[96m{path}\033[0m : model = \033[32m{model}\033[0m \ outfit = \033[32m{outfit}\033[0m \n\
texture = \033[33m{texture}\033[0m \n\
type = \033[33m{type}\033[0m \n\
number = \033[33m{number}\033[0m --> \033[32m{number + args.acc}\033[0m \n\
Dest = \033[31m{dest}\033[0m\n")