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.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
import os
|
|
from pymxs import runtime as rt
|
|
|
|
def force_menu_load():
|
|
try:
|
|
# 1. Caminho onde o arquivo foi copiado pelo script principal
|
|
pasta_macros = rt.pathConfig.getDir(rt.name("userMacros"))
|
|
pasta_enu = os.path.dirname(pasta_macros)
|
|
caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx")
|
|
|
|
if os.path.exists(caminho_mnx):
|
|
print(f"Carregando menu: {caminho_mnx}")
|
|
# Comando para carregar o arquivo de menu imediatamente
|
|
rt.menuMan.loadMenuFile(caminho_mnx)
|
|
rt.menuMan.updateMenuBar()
|
|
print("Menu VR4Life carregado com sucesso!")
|
|
else:
|
|
print("Arquivo .mnx ainda não encontrado no destino final.")
|
|
|
|
# 2. Registrar a Macro (para o botão saber o que executar)
|
|
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
|
|
macro_script = f"""
|
|
macroScript VR4Life_Launcher
|
|
category:"VR4Life"
|
|
tooltip:"Abrir VR4Life"
|
|
(
|
|
python.executeFile @{plugin_dir}/run_vr4life.py@
|
|
)
|
|
"""
|
|
rt.execute(macro_script)
|
|
|
|
return True
|
|
except Exception as e:
|
|
print(f"Erro ao carregar menu: {str(e)}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
force_menu_load() |