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.
77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
import os
|
|
import sys
|
|
from pymxs import runtime as rt
|
|
|
|
VERSION = "1.1.2"
|
|
|
|
def log(msg):
|
|
print(f"[VR4Life Install Log] {msg}")
|
|
|
|
def install_plugin():
|
|
rt.clearListener()
|
|
log(f"=== INSTALAÇÃO TOOLBAR 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("\\", "/")
|
|
|
|
# 2. REGISTRO DE MACROS
|
|
log("Registrando Macros...")
|
|
mxs_macros = f'''
|
|
(
|
|
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. CRIAÇÃO DA TOOLBAR (Barra de Ferramentas)
|
|
log("Criando Barra de Ferramentas...")
|
|
|
|
toolbar_script = '''
|
|
(
|
|
local tbName = "VR4Life_Toolbar"
|
|
|
|
-- Se a barra já existir, ela será atualizada
|
|
if (cui.getToolbarVisibility tbName) then (
|
|
cui.showToolbar tbName false
|
|
)
|
|
|
|
-- 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"
|
|
)
|
|
)
|
|
'''
|
|
|
|
tb_result = rt.execute(toolbar_script)
|
|
log(f"Resultado: {tb_result}")
|
|
|
|
# 4. EXECUÇÃO DA JANELA
|
|
if os.path.exists(run_script):
|
|
rt.python.ExecuteFile(run_script)
|
|
|
|
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() |