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.

64 lines
2.2 KiB
Python

import os
from pymxs import runtime as rt
def install_vr4life_clean():
try:
# 1. PEGAR CAMINHOS
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
# 2. REGISTRAR AS MACROS COM AS CATEGORIAS VISTAS NO SEU PRINT
# Usamos "Immerse Games" para bater com o que já existe no seu Menu Editor
macro_cmd = f"""
macroScript VR4Life_Launcher
category:"Immerse Games"
tooltip:"Abrir VR4Life"
(
on execute do python.executeFile "{plugin_dir}/run_vr4life.py"
)
macroScript VR4Life_Update
category:"Immerse Games"
tooltip:"Atualizar VR4Life"
(
on execute do python.executeFile "{plugin_dir}/vr4life_updater.py"
)
"""
rt.execute(macro_cmd)
# 3. CONSTRUÇÃO DO MENU (Lógica Babylon/Direct UI)
setup_script = """
(
local menuMgr = menuMan
local mainMenuBar = menuMgr.getMainMenuBar()
-- Limpar se já existir para não duplicar
local existingMenu = menuMgr.findMenu "VR4Life"
if existingMenu != undefined do menuMgr.unRegisterMenu existingMenu
-- Criar o novo menu "VR4Life"
local newMenu = menuMgr.createMenu "VR4Life"
-- Adicionar os itens usando o nome da macro e a categoria exata
local itemLauncher = menuMgr.createActionItem "VR4Life_Launcher" "Immerse Games"
local itemUpdate = menuMgr.createActionItem "VR4Life_Update" "Immerse Games"
newMenu.addItem itemLauncher -1
newMenu.addItem itemUpdate -1
-- Injetar na barra principal antes do Help
local subMenuItem = menuMgr.createSubMenuItem "VR4Life" newMenu
mainMenuBar.addItem subMenuItem (mainMenuBar.numItems())
menuMgr.updateMenuBar()
)
"""
rt.execute(setup_script)
print(">> VR4Life: Menu instalado com sucesso via Script Direto.")
return True
except Exception as e:
print(f"Erro na instalacao: {str(e)}")
return False
if __name__ == "__main__":
install_vr4life_clean()