We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39e8f05 commit 9d85792Copy full SHA for 9d85792
examples/rotate_texture.py
@@ -5,11 +5,17 @@
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())
+ data = asset.texture_get_source_data()
+
+ size = (asset.texture_get_width(), asset.texture_get_height())
+ img = Image.frombytes('RGBA', size, bytes(data))
+ out = img.rotate(degrees)
16
+ asset.texture_set_source_data(out.tobytes())
17
18
19
20
21
+rotate_selected_assets_data(45)
0 commit comments