From fba61ac174aa91bde7e8e3ff74b9adc7f944c1a2 Mon Sep 17 00:00:00 2001 From: henrique Date: Mon, 23 Feb 2026 16:56:35 -0300 Subject: [PATCH] aa --- install_vr4life.py | 92 ++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 57 deletions(-) diff --git a/install_vr4life.py b/install_vr4life.py index fab59e1..6eaa747 100644 --- a/install_vr4life.py +++ b/install_vr4life.py @@ -2,17 +2,16 @@ import os import sys from pymxs import runtime as rt -# Versão v1.1.1 - Acesso Universal 2026 -VERSION = "1.1.1" +VERSION = "1.1.2" def log(msg): print(f"[VR4Life Install Log] {msg}") def install_plugin(): rt.clearListener() - log(f"=== INICIANDO INSTALAÇÃO v{VERSION} ===") + log(f"=== INSTALAÇÃO TOOLBAR v{VERSION} ===") - # 1. SETUP DE PASTAS E PATH + # 1. SETUP DE PASTAS user_scripts_dir = rt.getDir(rt.name("userScripts")) plugin_dir = os.path.join(user_scripts_dir, "VR4Life_Plugin").replace("\\", "/") @@ -22,78 +21,57 @@ def install_plugin(): run_script = os.path.join(plugin_dir, "run_vr4life.py").replace("\\", "/") update_script = os.path.join(plugin_dir, "vr4life_updater.py").replace("\\", "/") - # 2. REGISTRO DE MACROS (Sempre funciona) - log("Registrando Comandos...") + # 2. REGISTRO DE MACROS + log("Registrando Macros...") mxs_macros = f''' ( - macroScript VR4Life_Open category:"Immerse Games" buttonText:"VR4Life Engine" (on execute do python.ExecuteFile @"{run_script}") - macroScript VR4Life_Update category:"Immerse Games" buttonText:"Atualizar VR4Life" (on execute do python.ExecuteFile @"{update_script}") + macroScript VR4Life_Open category:"VR4Life" buttonText:"Engine" tooltip:"Abrir VR4Life Engine" (on execute do python.ExecuteFile @"{run_script}") + macroScript VR4Life_Update category:"VR4Life" buttonText:"Update" tooltip:"Atualizar Plugin" (on execute do python.ExecuteFile @"{update_script}") ) ''' rt.execute(mxs_macros) - # 3. INJEÇÃO NO MENU 'RENDERING' (Lógica Multi-Versão para 2026) - log("Injetando no menu de Renderização...") + # 3. CRIAÇÃO DA TOOLBAR (Barra de Ferramentas) + log("Criando Barra de Ferramentas...") - # Este bloco tenta acessar o novo Gerenciador de Interface (CUI) - # sem causar erro de 'undefined' ou 'unknown property' - mxs_ui_fix = ''' + toolbar_script = ''' ( - local manager = undefined + local tbName = "VR4Life_Toolbar" - -- Tentativa 1: Novo padrão 2025/2026 - try ( manager = cui.getContentManager() ) catch () - - -- Tentativa 2: Interface Global (se a primeira falhar) - if manager == undefined then ( - try ( manager = (maxOps.GetICuiContentManager()) ) catch () + -- Se a barra já existir, ela será atualizada + if (cui.getToolbarVisibility tbName) then ( + cui.showToolbar tbName false ) - - if manager != undefined then ( - local mainBar = manager.mainMenuBar - local renderMenu = undefined - - -- Busca o menu Rendering pelo nome técnico - for i = 0 to mainBar.numItems - 1 do ( - local item = mainBar.getItem i - if (matchPattern item.displayText pattern:"*Rendering*") then ( - renderMenu = item - exit - ) - ) - - if renderMenu != undefined then ( - renderMenu.addActionItem "VR4Life_Open" "Immerse Games" - renderMenu.addActionItem "VR4Life_Update" "Immerse Games" - manager.updateMainMenuBar() - "Sucesso no CUI" - ) else ( "Menu Rendering não achado" ) - ) else ( - -- Tentativa 3: Fallback para MenuMan (Max 2024 ou inferior) - if menuMan != undefined then ( - local mBar = menuMan.getMainMenuBar() - local rIdx = menuMan.findMenu "&Rendering" - if rIdx != -1 then ( - local rMenu = menuMan.getMenu rIdx - rMenu.addItem (menuMan.createActionItem "VR4Life_Open" "Immerse Games") -1 - menuMan.updateMenuBar() - "Sucesso no MenuMan" - ) else ( "MenuMan falhou" ) - ) else ( "Todos os sistemas de menu falharam" ) + + -- Cria a toolbar via CUI (Método compatível com 2026) + try ( + cui.createToolbar tbName + cui.addMacroButton tbName "VR4Life" "VR4Life_Open" + cui.addMacroButton tbName "VR4Life" "VR4Life_Update" + cui.showToolbar tbName true + "Toolbar Criada" + ) catch ( + "Erro ao criar Toolbar automaticamente" ) ) ''' - ui_result = rt.execute(mxs_ui_fix) - log(f"Resultado da Interface: {ui_result}") + tb_result = rt.execute(toolbar_script) + log(f"Resultado: {tb_result}") # 4. EXECUÇÃO DA JANELA if os.path.exists(run_script): - log(f"Executando v{VERSION}...") rt.python.ExecuteFile(run_script) - log(f"=== INSTALAÇÃO CONCLUÍDA v{VERSION} ===") - rt.messageBox(f"VR4Life v{VERSION} Instalado!\nResultado: {ui_result}", title="VR4Life") + log(f"=== FINALIZADO v{VERSION} ===") + + msg = f"VR4Life v{VERSION} Instalado!\n\n" + if tb_result == "Toolbar Criada": + msg += "Uma barra de ferramentas flutuante apareceu na tela.\nVocê pode acoplá-la onde preferir." + else: + msg += "Não foi possível criar a barra automaticamente.\nAdicione manualmente: Botão direito na barra de menus > VR4Life." + + rt.messageBox(msg, title="VR4Life") if __name__ == "__main__": install_plugin() \ No newline at end of file