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.
67 lines
2.6 KiB
Python
67 lines
2.6 KiB
Python
import os
|
|
import sys
|
|
from pymxs import runtime as rt
|
|
|
|
# Versão de Teste Direto
|
|
VERSION = "1.0.8-DEBUG"
|
|
|
|
def install_plugin():
|
|
# Limpa o console para você ler com clareza
|
|
rt.clearListener()
|
|
|
|
print(f"--- DEBUG INICIADO v{VERSION} ---")
|
|
|
|
# 1. SETUP DE PASTAS
|
|
user_scripts_dir = rt.getDir(rt.name("userScripts"))
|
|
plugin_dir = os.path.join(user_scripts_dir, "VR4Life_Plugin").replace("\\", "/")
|
|
|
|
if plugin_dir not in sys.path:
|
|
sys.path.insert(0, plugin_dir)
|
|
|
|
run_script = os.path.join(plugin_dir, "run_vr4life.py").replace("\\", "/")
|
|
update_script = os.path.join(plugin_dir, "vr4life_updater.py").replace("\\", "/")
|
|
|
|
print(f"Pasta do Plugin: {plugin_dir}")
|
|
|
|
# 2. REGISTRO DE MACROS
|
|
print("Registrando Macros...")
|
|
rt.execute(f'macroScript VR4Life_Open category:"Immerse" buttonText:"VR4Life Engine" (on execute do python.ExecuteFile @"{run_script}")')
|
|
rt.execute(f'macroScript VR4Life_Update category:"Immerse" buttonText:"Atualizar VR4Life" (on execute do python.ExecuteFile @"{update_script}")')
|
|
|
|
# 3. TENTATIVA DE INJEÇÃO NO MENU RENDERING (SEM SUPRESSÃO DE ERRO)
|
|
print("Localizando CUI Content Manager...")
|
|
cui_mgr = rt.cui.getContentManager()
|
|
main_menu_bar = cui_mgr.mainMenuBar
|
|
|
|
render_menu = None
|
|
# No Max 2026 o nome pode variar entre "Rendering" e "&Rendering"
|
|
for i in range(main_menu_bar.numItems):
|
|
item = main_menu_bar.getItem(i)
|
|
if "Rendering" in item.displayText:
|
|
render_menu = item
|
|
print(f"Menu Rendering encontrado no índice: {i}")
|
|
break
|
|
|
|
if render_menu:
|
|
print("Adicionando itens ao menu Rendering...")
|
|
# Adiciona separador e itens
|
|
render_menu.addActionItem("VR4Life_Open", "Immerse")
|
|
render_menu.addActionItem("VR4Life_Update", "Immerse")
|
|
|
|
print("Forçando atualização da barra de menus...")
|
|
cui_mgr.updateMainMenuBar()
|
|
else:
|
|
print("ERRO: Não foi possível localizar o menu Rendering na barra principal!")
|
|
|
|
# 4. EXECUÇÃO DA JANELA
|
|
if os.path.exists(run_script):
|
|
print("Executando janela principal...")
|
|
rt.python.ExecuteFile(run_script)
|
|
else:
|
|
print(f"ERRO: Arquivo {run_script} não encontrado!")
|
|
|
|
print(f"--- DEBUG FINALIZADO v{VERSION} ---")
|
|
rt.messageBox(f"Instalação v{VERSION} finalizada.\nCheque o log (F11) para ver se houve erros no console.", title="VR4Life Debug")
|
|
|
|
if __name__ == "__main__":
|
|
install_plugin() |