Skip to content

Commit 8aee316

Browse files
feat: first real community plugin — random_yaw, remove fake placeholder entries
1 parent d1571af commit 8aee316

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

community_plugins/random_yaw.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""
2+
random_yaw — UEFN Toolbelt Community Plugin
3+
============================================
4+
Randomizes only the yaw (Z-axis rotation) of selected actors.
5+
Useful for natural prop placement where you want random facing
6+
directions without touching pitch or roll.
7+
8+
Author: Ocean Bennett (https://github.com/undergroundrap)
9+
Version: 1.0.0
10+
License: AGPL-3.0
11+
"""
12+
13+
import random
14+
import unreal
15+
from UEFN_Toolbelt.registry import register_tool
16+
17+
18+
@register_tool(
19+
name="random_yaw",
20+
category="Community",
21+
description="Randomize only the yaw (Z rotation) of selected actors. "
22+
"Preserves pitch and roll — ideal for natural prop variation.",
23+
tags=["randomize", "rotation", "props", "quick"],
24+
)
25+
def run(yaw_range: float = 360.0, **kwargs) -> dict:
26+
"""
27+
Args:
28+
yaw_range: Total arc to randomize within (default 360 = fully random).
29+
Use 45 to limit to ±22.5° from current facing.
30+
"""
31+
actors = unreal.EditorLevelLibrary.get_selected_level_actors()
32+
if not actors:
33+
return {"status": "error", "error": "No actors selected."}
34+
35+
half = yaw_range / 2.0
36+
count = 0
37+
with unreal.ScopedEditorTransaction("random_yaw") as _:
38+
for actor in actors:
39+
rot = actor.get_actor_rotation()
40+
new_yaw = rot.yaw + random.uniform(-half, half)
41+
actor.set_actor_rotation(
42+
unreal.Rotator(rot.pitch, new_yaw, rot.roll),
43+
teleport_physics=True,
44+
)
45+
count += 1
46+
47+
return {"status": "ok", "count": count, "yaw_range": yaw_range}

registry.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,21 @@
142142
"url": "https://github.com/undergroundrap/UEFN-TOOLBELT/blob/main/Content/Python/UEFN_Toolbelt/tools/api_explorer.py",
143143
"min_toolbelt_version": "1.0.0",
144144
"size_kb": 19
145+
},
146+
{
147+
"id": "random_yaw",
148+
"name": "Random Yaw",
149+
"version": "1.0.0",
150+
"author": "Ocean Bennett",
151+
"author_url": "https://github.com/undergroundrap",
152+
"type": "community",
153+
"description": "Randomizes only the yaw (Z rotation) of selected actors. Preserves pitch and roll — ideal for natural prop variation without a cluttered look.",
154+
"category": "Procedural",
155+
"tags": ["randomize", "rotation", "props", "quick"],
156+
"url": "https://github.com/undergroundrap/UEFN-TOOLBELT/blob/main/community_plugins/random_yaw.py",
157+
"download_url": "https://raw.githubusercontent.com/undergroundrap/UEFN-TOOLBELT/main/community_plugins/random_yaw.py",
158+
"min_toolbelt_version": "1.5.3",
159+
"size_kb": 2
145160
}
146161
]
147162
}

0 commit comments

Comments
 (0)