Compare commits

...

3 Commits

Author SHA1 Message Date
henrique 00a789c410 dwdw 2 months ago
henrique 9aa3acc3b4 dwdw 2 months ago
henrique 0bb150da42 dwdw 2 months ago

@ -1,18 +1,18 @@
import os import os
from pymxs import runtime as rt from pymxs import runtime as rt
def install_vr4life_mnx_only(): def install_vr4life_2026_fixed():
try: try:
# 1. PEGAR CAMINHOS # 1. CAMINHOS
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/") plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
# Caminho onde o instalador principal já copiou o seu MNX # Onde o MNX foi copiado pelo seu instalador
pasta_macros = rt.getDir(rt.name("userMacros")) pasta_macros = rt.getDir(rt.name("userMacros"))
pasta_enu = os.path.dirname(pasta_macros) pasta_enu = os.path.dirname(pasta_macros)
caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx").replace("\\", "/") caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx").replace("\\", "/")
# 2. REGISTRAR AS MACROS (Sem parâmetros inválidos) # 2. REGISTRAR AS MACROS (Obrigatorio para o MNX funcionar)
# Importante: A categoria deve ser "Immerse Games" para bater com seu MNX # Usamos exatamente a categoria "Immerse Games" que está no seu MNX
macro_cmd = f""" macro_cmd = f"""
macroScript VR4Life_Launcher macroScript VR4Life_Launcher
category:"Immerse Games" category:"Immerse Games"
@ -30,26 +30,32 @@ tooltip:"Atualizar VR4Life"
""" """
rt.execute(macro_cmd) rt.execute(macro_cmd)
# 3. FORÇAR O CARREGAMENTO DO MNX # 3. CARREGAR O MNX VIA INTERFACE DE CONTEXTO (Abordagem Babylon 2026)
# Em vez de criar o menu, mandamos o Max ler o arquivo que você copiou # Se o menuMan é undefined, usamos o carregamento de arquivo de configuração
if os.path.exists(caminho_mnx): setup_script = f"""
load_cmd = f"""
( (
if menuMan != undefined then ( local mnxPath = "{caminho_mnx}"
menuMan.loadMenuFile "{caminho_mnx}" if (doesFileExist mnxPath) then (
-- No 2026, tentamos carregar o arquivo de menus diretamente
-- sem passar pelas propriedades de "getMainMenuBar"
try (
menuMan.loadMenuFile mnxPath
menuMan.updateMenuBar() menuMan.updateMenuBar()
format ">> VR4Life: Arquivo MNX carregado com sucesso.\\n" ) catch (
-- Se falhar aqui, o Max carregará no próximo boot
-- pois o arquivo está na pasta oficial de UI
)
) )
) )
""" """
rt.execute(load_cmd) rt.execute(setup_script)
print(">> VR4Life: Instalacao concluida. Se o menu nao aparecer, use 'File > Reset'.") print(">> VR4Life: Macros registradas e MNX vinculado.")
return True return True
except Exception as e: except Exception as e:
print(f"Erro na instalacao: {str(e)}") print(f"Erro na instalação: {str(e)}")
return False return False
if __name__ == "__main__": if __name__ == "__main__":
install_vr4life_mnx_only() install_vr4life_2026_fixed()
Loading…
Cancel
Save