Skip to content

Commit 9d85792

Browse files
author
Roberto De Ioris
authored
Update rotate_texture.py
1 parent 39e8f05 commit 9d85792

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

examples/rotate_texture.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
def rotate_selected_assets_data(degrees):
66
for asset in ue.get_selected_assets():
77
if asset.is_a(Texture2D):
8-
tex = ue.load_object(Texture2D, asset.get_path_name())
9-
data = tex.texture_get_data()
10-
size = (asset.Blueprint_GetSizeX(), asset.Blueprint_GetSizeY())
11-
12-
img = Image.frombytes("RGB", size, data)
13-
img.show()
14-
out = img.rotate(degrees, expand=1)
15-
tex.texture_set_data(out.tobytes())
8+
data = asset.texture_get_source_data()
9+
10+
size = (asset.texture_get_width(), asset.texture_get_height())
11+
12+
img = Image.frombytes('RGBA', size, bytes(data))
13+
14+
out = img.rotate(degrees)
15+
16+
asset.texture_set_source_data(out.tobytes())
17+
18+
19+
20+
21+
rotate_selected_assets_data(45)

0 commit comments

Comments
 (0)