Skip to content

Commit 3bed2f3

Browse files
committed
- add the anim notify proeprties editing script
1 parent c6a7be5 commit 3bed2f3

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# _
2+
# (_)
3+
# _ __ ___ __ _ _ __ ___ ___ _ __ _ ___ _ __ ___
4+
# | '_ ` _ \ / _` | '_ ` _ \ / _ \| '_ \| |/ _ \ '_ ` _ \
5+
# | | | | | | (_| | | | | | | (_) | | | | | __/ | | | | |
6+
# |_| |_| |_|\__,_|_| |_| |_|\___/|_| |_|_|\___|_| |_| |_|
7+
# www.mamoniem.com
8+
# www.ue4u.xyz
9+
#Copyright 2021 Muhammad A.Moniem (@_mamoniem). All Rights Reserved.
10+
#
11+
12+
import unreal
13+
14+
@unreal.uclass()
15+
class GetEditorUtility(unreal.GlobalEditorUtilityBase):
16+
pass
17+
18+
@unreal.uclass()
19+
class GetEditorAssetLibrary(unreal.EditorAssetLibrary):
20+
pass
21+
22+
@unreal.uclass()
23+
class GetAnimationLibrary(unreal.AnimationLibrary):
24+
pass
25+
26+
editorUtility = GetEditorUtility()
27+
animLib = GetAnimationLibrary()
28+
29+
selectedAssets = editorUtility.get_selected_assets()
30+
31+
for selectedAsset in selectedAssets:
32+
allEventsForSelectedAsset = animLib.get_animation_notify_events(selectedAsset)
33+
if len(allEventsForSelectedAsset) != 0:
34+
print("For the animation [%s] found [%d] notifies" % (selectedAsset.get_name(), len(allEventsForSelectedAsset)))
35+
36+
selectedAsset.modify(True)
37+
38+
for notifyEvent in allEventsForSelectedAsset:
39+
40+
notifyEvent.set_editor_property("trigger_on_dedicated_server", False)
41+
notifyEvent.set_editor_property("trigger_on_follower", True)
42+
notifyEvent.set_editor_property("notify_trigger_chance", 0.5)
43+
44+
#Can also change the memebr variables right away, they are exposed as memebers to python API
45+
#notifyEvent.trigger_on_dedicated_server = False
46+
#notifyEvent.trigger_on_follower = True
47+
#notifyEvent.notify_trigger_chance = 0.5
48+
49+
#Can get some more detials about the notify, like it's name & color
50+
notifyItself = notifyEvent.notify
51+
Notifycolor = notifyItself.notify_color
52+
NotifyName = notifyItself.get_notify_name()
53+
print("The notify [%s] has the color is {%d, %d, %d, %d}" % (NotifyName, Notifycolor.r, Notifycolor.g, Notifycolor.b, Notifycolor.a))
54+
55+
#Can also change the notify colors. Keep in mind we can't use the notifyItself.notify_color as it is read-only, but we can use the set_editor_property("notify_color", VALUE)
56+
clr = unreal.Color(0, 0, 255, 255)
57+
notifyItself.set_editor_property("notify_color", clr)
58+
else:
59+
print("No notifies found within the animation [%s]" % (selectedAsset.get_name()))

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Don't forget to follow this repo, [YouTube](http://www.youtube.com/channel/UCBBc
2828

2929
## Aimation ##
3030

31-
- **[CleanNotifiesFromAnimations.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Animation/CleanNotifiesFromAnimations.py)** Run on a selected single or multiple animation file(s) in order to clean up the selected file(s) from any animation notifies.
31+
- **[CleanNotifiesFromAnimations.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Animation/CleanNotifiesFromAnimations.py)** Run on a selected single or multiple animation file(s) in order to clean up the selected file(s) from any animation notifies.
32+
- **[SetAllAnimNotifyProperty.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Animation/SetAllAnimNotifyProperty.py)** Run on a selected single or multiple animation file(s) in order set some values for all the animation notifies exists in the selected animations (notify name, notify color, notify trigger settings,...etc.). NOTE that the later part of the scrip (color fetch & change) won't work with the custom notifies (the ones that call a function/Event), as those notifies are meant to have fixed color by design.
3233

3334
## Assets ##
3435

0 commit comments

Comments
 (0)