Skip to content

Commit 39e8f05

Browse files
author
Roberto De Ioris
authored
Create rotate_texture.py
1 parent 55104f0 commit 39e8f05

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/rotate_texture.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from PIL import Image
2+
import unreal_engine as ue
3+
from unreal_engine.classes import Texture2D
4+
5+
def rotate_selected_assets_data(degrees):
6+
for asset in ue.get_selected_assets():
7+
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())

0 commit comments

Comments
 (0)