File size: 916 Bytes
0c51b93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import copy

with open("envs/assets_v2/objects/assets/xyz_base.xml", "r") as f:
    lines = f.readlines()

new_lines = []
for line in lines:
    new_line = copy.deepcopy(line)
    if 'rgba="' in line:
        # print(line)
        start = line.find('rgba="') + len('rgba="')
        end = line.find('"', start)
        r, g, b, a = line[start:end].split(" ")
        a = 0
        new_line = line[:start] + f"{r} {g} {b} {a}" + line[end:]
        print(line)
    if "'rgba='" in line:
        # print(line)
        start = line.find("rgba='") + len("rgba='")
        end = line.find("'", start)
        r, g, b, a = line[start:end].split(" ")
        a = 0
        new_line = line[:start] + f"{r} {g} {b} {a}" + line[end:]
    
        
    new_lines.append(new_line)
    
    
string = "".join(new_lines)
print(string)
with open("envs/assets_v2/objects/assets/xyz_base.xml", "w") as f:
    f.write(string)