def timer_add_menu(menu_dict, delta):
            global __tick_menu_elapsed__
            __tick_menu_elapsed__ += delta

            # NOTE avoid frequently executing
            if __tick_menu_elapsed__ < 0.5:
                return

            __tick_menu_elapsed__ = 0

            # NOTE all menu added the clear the tick callback
            if not menu_dict:
                global __py_add_menu_tick__
                unreal.unregister_slate_post_tick_callback(
                    __py_add_menu_tick__)
                return

            flag = False
            menu_list = []
            for tool_menu, config in menu_dict.items():
                menu = menus.find_menu(tool_menu)
                if not menu:
                    continue
                menu_list.append(tool_menu)
                flag = True
                config.setdefault("menu", menu)
                handle_menu(config)

            if flag:
                [menu_dict.pop(m) for m in menu_list]
                menus.refresh_all_widgets()
Example #2
0
    def _callback(self, _):
        if self._current is None:
            if self.schedule:
                self._current = self.schedule.popleft()

            else:
                print('Done jobs')
                unreal.unregister_slate_post_tick_callback(
                    self._delegate_handle)
                return

        try:
            task = next(self._current)

            if task is not None and isinstance(task, Iterable):
                # reschedule current task, and do the new one
                self.schedule.appendleft(self._current)
                self._current = task

        except StopIteration:
            self._current = None

        except:
            self._current = None
            raise
def assetregistry_postload_handle(deltaTime):
    """
        Run callback method after registry run to prevent crashed when create new asset at startupS
    """
    unreal.log_warning("..Checking Asset Registy Status...")
    if AssetRegistry.is_loading_assets():
        unreal.log_warning("..Asset registy still loading...")
    else:
        unreal.log_warning("Asset registy ready!")
        unreal.unregister_slate_post_tick_callback(assetregistry_pretickhandle)
        AssetRegistryPostLoad.run_callbacks()
Example #4
0
def __QtAppQuit__():
	unreal.unregister_slate_post_tick_callback(tick_handle)
Example #5
0
 def _app_quit():
     unreal.unregister_slate_post_tick_callback(tick_handle)
Example #6
0
def engine_shutdown():
    """Called when unreal shuts down"""
    unreal.unregister_slate_post_tick_callback(slate_tick_handle)
    unreal.unregister_python_shutdown_callback(engine_shutdown_handle)