Created
November 24, 2023 06:19
-
-
Save markserena/7a6869c725729e387f549b5b77d9dab9 to your computer and use it in GitHub Desktop.
unreal notification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from threading import Timer | |
| import unreal | |
| @unreal.uclass() | |
| class DeletedUnusedMaterials(unreal.EditorUtilityTask): | |
| pass | |
| def update_notification(notification, message): | |
| notification.set_task_notification_text(str(message)) | |
| notification.finish_executing_task() | |
| def create_notification(): | |
| notification = DeletedUnusedMaterials() | |
| util_subsystem = unreal.get_editor_subsystem(unreal.EditorUtilitySubsystem) | |
| notification.receive_begin_execution() | |
| notification.finish_executing_task() | |
| util_subsystem.register_and_execute_task(notification) | |
| return notification | |
| def my_function(): | |
| # Create a notification dialog popup | |
| notification = create_notification() | |
| # Create a threaded timer to force notification to close | |
| t = Timer(2.0, lambda: update_notification(notification, 'Successfully Completed.')) | |
| t.start() | |
| print("...code...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment