|
|
|
@ -2,17 +2,16 @@ import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
from pymxs import runtime as rt
|
|
|
|
from pymxs import runtime as rt
|
|
|
|
|
|
|
|
|
|
|
|
# Versão v1.1.1 - Acesso Universal 2026
|
|
|
|
VERSION = "1.1.2"
|
|
|
|
VERSION = "1.1.1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def log(msg):
|
|
|
|
def log(msg):
|
|
|
|
print(f"[VR4Life Install Log] {msg}")
|
|
|
|
print(f"[VR4Life Install Log] {msg}")
|
|
|
|
|
|
|
|
|
|
|
|
def install_plugin():
|
|
|
|
def install_plugin():
|
|
|
|
rt.clearListener()
|
|
|
|
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"))
|
|
|
|
user_scripts_dir = rt.getDir(rt.name("userScripts"))
|
|
|
|
plugin_dir = os.path.join(user_scripts_dir, "VR4Life_Plugin").replace("\\", "/")
|
|
|
|
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("\\", "/")
|
|
|
|
run_script = os.path.join(plugin_dir, "run_vr4life.py").replace("\\", "/")
|
|
|
|
update_script = os.path.join(plugin_dir, "vr4life_updater.py").replace("\\", "/")
|
|
|
|
update_script = os.path.join(plugin_dir, "vr4life_updater.py").replace("\\", "/")
|
|
|
|
|
|
|
|
|
|
|
|
# 2. REGISTRO DE MACROS (Sempre funciona)
|
|
|
|
# 2. REGISTRO DE MACROS
|
|
|
|
log("Registrando Comandos...")
|
|
|
|
log("Registrando Macros...")
|
|
|
|
mxs_macros = f'''
|
|
|
|
mxs_macros = f'''
|
|
|
|
(
|
|
|
|
(
|
|
|
|
macroScript VR4Life_Open category:"Immerse Games" buttonText:"VR4Life Engine" (on execute do python.ExecuteFile @"{run_script}")
|
|
|
|
macroScript VR4Life_Open category:"VR4Life" buttonText:"Engine" tooltip:"Abrir 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_Update category:"VR4Life" buttonText:"Update" tooltip:"Atualizar Plugin" (on execute do python.ExecuteFile @"{update_script}")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
rt.execute(mxs_macros)
|
|
|
|
rt.execute(mxs_macros)
|
|
|
|
|
|
|
|
|
|
|
|
# 3. INJEÇÃO NO MENU 'RENDERING' (Lógica Multi-Versão para 2026)
|
|
|
|
# 3. CRIAÇÃO DA TOOLBAR (Barra de Ferramentas)
|
|
|
|
log("Injetando no menu de Renderização...")
|
|
|
|
log("Criando Barra de Ferramentas...")
|
|
|
|
|
|
|
|
|
|
|
|
# Este bloco tenta acessar o novo Gerenciador de Interface (CUI)
|
|
|
|
toolbar_script = '''
|
|
|
|
# sem causar erro de 'undefined' ou 'unknown property'
|
|
|
|
|
|
|
|
mxs_ui_fix = '''
|
|
|
|
|
|
|
|
(
|
|
|
|
(
|
|
|
|
local manager = undefined
|
|
|
|
local tbName = "VR4Life_Toolbar"
|
|
|
|
|
|
|
|
|
|
|
|
-- Tentativa 1: Novo padrão 2025/2026
|
|
|
|
-- Se a barra já existir, ela será atualizada
|
|
|
|
try ( manager = cui.getContentManager() ) catch ()
|
|
|
|
if (cui.getToolbarVisibility tbName) then (
|
|
|
|
|
|
|
|
cui.showToolbar tbName false
|
|
|
|
-- Tentativa 2: Interface Global (se a primeira falhar)
|
|
|
|
|
|
|
|
if manager == undefined then (
|
|
|
|
|
|
|
|
try ( manager = (maxOps.GetICuiContentManager()) ) catch ()
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if manager != undefined then (
|
|
|
|
-- Cria a toolbar via CUI (Método compatível com 2026)
|
|
|
|
local mainBar = manager.mainMenuBar
|
|
|
|
try (
|
|
|
|
local renderMenu = undefined
|
|
|
|
cui.createToolbar tbName
|
|
|
|
|
|
|
|
cui.addMacroButton tbName "VR4Life" "VR4Life_Open"
|
|
|
|
-- Busca o menu Rendering pelo nome técnico
|
|
|
|
cui.addMacroButton tbName "VR4Life" "VR4Life_Update"
|
|
|
|
for i = 0 to mainBar.numItems - 1 do (
|
|
|
|
cui.showToolbar tbName true
|
|
|
|
local item = mainBar.getItem i
|
|
|
|
"Toolbar Criada"
|
|
|
|
if (matchPattern item.displayText pattern:"*Rendering*") then (
|
|
|
|
) catch (
|
|
|
|
renderMenu = item
|
|
|
|
"Erro ao criar Toolbar automaticamente"
|
|
|
|
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" )
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
ui_result = rt.execute(mxs_ui_fix)
|
|
|
|
tb_result = rt.execute(toolbar_script)
|
|
|
|
log(f"Resultado da Interface: {ui_result}")
|
|
|
|
log(f"Resultado: {tb_result}")
|
|
|
|
|
|
|
|
|
|
|
|
# 4. EXECUÇÃO DA JANELA
|
|
|
|
# 4. EXECUÇÃO DA JANELA
|
|
|
|
if os.path.exists(run_script):
|
|
|
|
if os.path.exists(run_script):
|
|
|
|
log(f"Executando v{VERSION}...")
|
|
|
|
|
|
|
|
rt.python.ExecuteFile(run_script)
|
|
|
|
rt.python.ExecuteFile(run_script)
|
|
|
|
|
|
|
|
|
|
|
|
log(f"=== INSTALAÇÃO CONCLUÍDA v{VERSION} ===")
|
|
|
|
log(f"=== FINALIZADO v{VERSION} ===")
|
|
|
|
rt.messageBox(f"VR4Life v{VERSION} Instalado!\nResultado: {ui_result}", title="VR4Life")
|
|
|
|
|
|
|
|
|
|
|
|
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__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
install_plugin()
|
|
|
|
install_plugin()
|