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.

55 lines
1.8 KiB
Python

import os
from pymxs import runtime as rt
def install_vr4life_mnx_only():
try:
# 1. PEGAR CAMINHOS
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
# Caminho onde o instalador principal já copiou o seu MNX
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("\\", "/")
# 2. REGISTRAR AS MACROS (Sem parâmetros inválidos)
# Importante: A categoria deve ser "Immerse Games" para bater com seu MNX
macro_cmd = f"""
macroScript VR4Life_Launcher
category:"Immerse Games"
tooltip:"Abrir VR4Life"
(
on execute do python.executeFile "{plugin_dir}/run_vr4life.py"
)
macroScript VR4Life_Update
category:"Immerse Games"
tooltip:"Atualizar VR4Life"
(
on execute do python.executeFile "{plugin_dir}/vr4life_updater.py"
)
"""
rt.execute(macro_cmd)
# 3. FORÇAR O CARREGAMENTO DO MNX
# Em vez de criar o menu, mandamos o Max ler o arquivo que você copiou
if os.path.exists(caminho_mnx):
load_cmd = f"""
(
if menuMan != undefined then (
menuMan.loadMenuFile "{caminho_mnx}"
menuMan.updateMenuBar()
format ">> VR4Life: Arquivo MNX carregado com sucesso.\\n"
)
)
"""
rt.execute(load_cmd)
print(">> VR4Life: Instalacao concluida. Se o menu nao aparecer, use 'File > Reset'.")
return True
except Exception as e:
print(f"Erro na instalacao: {str(e)}")
return False
if __name__ == "__main__":
install_vr4life_mnx_only()