You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
import os
|
|
from pymxs import runtime as rt
|
|
|
|
def carregar_menu_mnx():
|
|
rt.clearListener()
|
|
print("\n" + "="*50)
|
|
print("LOG DE INSTALAÇÃO DE INTERFACE - VR4LIFE")
|
|
print("="*50)
|
|
|
|
try:
|
|
# 1. Definir caminhos (Usando barras normais / para evitar conflitos)
|
|
pasta_macros = rt.getDir(rt.name("userMacros"))
|
|
pasta_enu = os.path.dirname(pasta_macros)
|
|
caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx").replace("\\", "/")
|
|
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
|
|
run_script = f"{plugin_dir}/run_vr4life.py"
|
|
|
|
print(f"[*] Pasta do Plugin: {plugin_dir}")
|
|
print(f"[*] Caminho do MNX: {caminho_mnx}")
|
|
|
|
# 2. Registrar MacroScript
|
|
macro_cmd = (
|
|
'macroScript VR4Life_Launcher\n'
|
|
'category:"Immerse Games"\n'
|
|
'tooltip:"Abrir VR4Life"\n'
|
|
'(\n'
|
|
f' on execute do python.executeFile "{run_script}"\n'
|
|
')'
|
|
)
|
|
rt.execute(macro_cmd)
|
|
|
|
# 3. Carregar MNX (Corrigido para evitar o erro de sintaxe @C)
|
|
if os.path.exists(caminho_mnx):
|
|
print(f"[!] Arquivo MNX encontrado. Solicitando carregamento...")
|
|
|
|
# Aqui usamos aspas duplas e formatamos o caminho para o MaxScript
|
|
cmd_load = (
|
|
'(\n'
|
|
' if menuMan != undefined then (\n'
|
|
f' local result = menuMan.loadMenuFile "{caminho_mnx}"\n'
|
|
' menuMan.updateMenuBar()\n'
|
|
' format ">> MaxScript: loadMenuFile result: %\\n" result\n'
|
|
' ) else (\n'
|
|
' format ">> MaxScript Erro: menuMan ainda e undefined\\n"\n'
|
|
' )\n'
|
|
')'
|
|
)
|
|
rt.execute(cmd_load)
|
|
else:
|
|
print(f"[X] ERRO: Arquivo {caminho_mnx} NAO existe no disco.")
|
|
|
|
print("="*50)
|
|
|
|
except Exception as e:
|
|
print(f"\n[EXCEPTION] Falha grave:\n{str(e)}")
|
|
|
|
if __name__ == "__main__":
|
|
carregar_menu_mnx() |