henrique 2 months ago
parent b3e6f7e8c3
commit d577713243

@ -3,7 +3,7 @@ from pymxs import runtime as rt
def carregar_menu_mnx():
print("\n" + "="*50)
print("AGENDANDO CARREGAMENTO DE INTERFACE - VR4LIFE")
print("AGENDANDO CARREGAMENTO - VR4LIFE (MODO SEGURO)")
print("="*50)
try:
@ -14,7 +14,7 @@ def carregar_menu_mnx():
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
run_script = f"{plugin_dir}/run_vr4life.py"
# 2. Registrar MacroScript (Isso pode ser feito agora, não depende de UI)
# 2. Registrar MacroScript
macro_cmd = (
'macroScript VR4Life_Launcher\n'
'category:"Immerse Games"\n'
@ -25,38 +25,31 @@ def carregar_menu_mnx():
)
rt.execute(macro_cmd)
# 3. AGENDAMENTO (O Timer de 2 segundos)
# Criamos um timer que espera o menuMan acordar para carregar o seu MNX
# 3. TIMER COM EXECUÇÃO TARDIA (Late Bound)
# Usamos execute dentro do timer para o compilador não travar no 'menuMan' agora
timer_cmd = f"""
(
fn tryLoadVRMenu = (
if menuMan != undefined then (
menuMan.loadMenuFile "{caminho_mnx}"
menuMan.updateMenuBar()
format ">> VR4Life: Menu carregado via Timer com sucesso.\\n"
return true
) else (
format ">> VR4Life: Aguardando interface...\\n"
return false
)
)
global _vr4life_timer = dotNetObject "System.Windows.Forms.Timer"
_vr4life_timer.interval = 3000 -- 3 segundos para garantir
-- Cria um timer de 2000ms (2 segundos)
local theTimer = dotNetObject "System.Windows.Forms.Timer"
theTimer.interval = 2000
dotNet.addEventHandler theTimer "Tick" (fn onTick s e = (
if (tryLoadVRMenu()) do (
dotNet.addEventHandler _vr4life_timer "Tick" (fn onTick s e = (
-- tentamos acessar o menuMan aqui dentro, após o tempo passar
if (execute "menuMan") != undefined then (
execute "menuMan.loadMenuFile \\"{caminho_mnx}\\""
execute "menuMan.updateMenuBar()"
format ">> VR4Life: Menu carregado com sucesso apos espera.\\n"
s.stop()
s.dispose()
) else (
format ">> VR4Life: Interface ainda carregando...\\n"
)
))
theTimer.start()
_vr4life_timer.start()
format "[*] Aguardando 3 segundos para injetar o menu...\\n"
)
"""
rt.execute(timer_cmd)
print("[*] Timer iniciado. O menu aparecera em 2 segundos.")
except Exception as e:
print(f"\n[EXCEPTION] Falha no agendamento:\n{str(e)}")

Loading…
Cancel
Save