@ -3,7 +3,7 @@ import sys
from pymxs import runtime as rt
from pymxs import runtime as rt
# Definição da Versão
# Definição da Versão
VERSION = " 1.0. 5 "
VERSION = " 1.0. 6 "
def log ( msg ) :
def log ( msg ) :
print ( f " [VR4Life Install Log] { msg } " )
print ( f " [VR4Life Install Log] { msg } " )
@ -36,43 +36,52 @@ def install_plugin():
( on execute do ( python . ExecuteFile @ " {update_script} " ) )
( on execute do ( python . ExecuteFile @ " {update_script} " ) )
''' )
''' )
# 3. Lógica para 3ds Max 2025/2026 (CUI )
# 3. Injeção no Menu Rendering (Para garantir visibilidade no 2026 )
try :
try :
log ( " Tentando injetar menu no sistema CUI ..." )
log ( " Buscando menu ' Rendering ' para injeção ..." )
cui_mgr = rt . cui . getContentManager ( )
cui_mgr = rt . cui . getContentManager ( )
main_menu_bar = cui_mgr . mainMenuBar
main_menu_bar = cui_mgr . mainMenuBar
# Limpa qualquer rastro anterior
# Localiza o menu Rendering
for i in range ( main_menu_bar . numItems - 1 , - 1 , - 1 ) :
render_menu = None
item = main_menu_bar . getItem ( i )
target_name = " Rendering " # Em inglês, padrão do Max
if item . displayText in [ product_name , " 1-VR4Life " ] :
main_menu_bar . removeItem ( item )
# Criação do Menu
new_menu = cui_mgr . createCustomMenu ( product_name )
new_menu . addActionItem ( " VR4Life_Open " , category )
new_menu . addActionItem ( " VR4Life_Update " , category )
# -1 coloca no final da lista
for i in range ( main_menu_bar . numItems ) :
main_menu_bar . addItem ( new_menu , - 1 )
item = main_menu_bar . getItem ( i )
# Verifica se é o menu Rendering (ou Renderização em PT)
if item . displayText == target_name or item . displayText == " &Rendering " :
render_menu = item
break
# FORÇAR REFRESH E SALVAMENTO (Crucial para o 2026)
if render_menu :
cui_mgr . updateMainMenuBar ( )
log ( " Menu Rendering encontrado. Adicionando itens... " )
log ( " Interface CUI atualizada. " )
# Verifica se já injetamos antes para não duplicar
# No CUI moderno, injetamos como ActionItems dentro do menu existente
render_menu . addActionItem ( " VR4Life_Open " , category )
render_menu . addActionItem ( " VR4Life_Update " , category )
cui_mgr . updateMainMenuBar ( )
log ( " Itens injetados no menu Rendering com sucesso. " )
else :
log ( " AVISO: Menu Rendering não encontrado. Criando menu próprio no final... " )
new_menu = cui_mgr . createCustomMenu ( product_name )
new_menu . addActionItem ( " VR4Life_Open " , category )
new_menu . addActionItem ( " VR4Life_Update " , category )
main_menu_bar . addItem ( new_menu , - 1 )
cui_mgr . updateMainMenuBar ( )
except AttributeError :
except AttributeError :
# Lógica Legada (2024)
# Lógica Legada (2024) - Injeta no Rendering via menuMan
if hasattr ( rt , " menuMan " ) :
main_menu = rt . menuMan . getMainMenuBar ( )
main_menu = rt . menuMan . getMainMenuBar ( )
# Procura o menu Rendering (índice ou nome)
existing = rt . menuMan . findMenu ( product_name )
render_idx = rt . menuMan . findMenu ( " &Rendering " )
if existing : rt . menuMan . unRegisterMenu ( existing )
if render_idx != - 1 :
new_menu = rt . menuMan . createMenu ( product_name )
r_menu = rt . menuMan . getMenu ( render_idx )
new_menu . addItem ( rt . menuMan . createActionItem ( " VR4Life_Open " , category ) , - 1 )
r_menu . addItem ( rt . menuMan . createSeparatorItem ( ) , - 1 )
new_menu . addItem ( rt . menuMan . createActionItem ( " VR4Life_Update " , category ) , - 1 )
r_menu . addItem ( rt . menuMan . createActionItem ( " VR4Life_Open " , category ) , - 1 )
sub_item = rt . menuMan . createSubMenuItem ( product_name , new_menu )
r_menu . addItem ( rt . menuMan . createActionItem ( " VR4Life_Update " , category ) , - 1 )
main_menu . addItem ( sub_item , - 1 )
rt . menuMan . updateMenuBar ( )
rt . menuMan . updateMenuBar ( )
log ( " In terface Legacy atualizada ." )
log ( " In jetado no Rendering (Legacy) ." )
# 4. EXECUTAR A JANELA
# 4. EXECUTAR A JANELA
if os . path . exists ( run_script ) :
if os . path . exists ( run_script ) :
@ -80,10 +89,7 @@ def install_plugin():
rt . python . ExecuteFile ( run_script )
rt . python . ExecuteFile ( run_script )
log ( f " === INSTALAÇÃO CONCLUÍDA v { VERSION } === " )
log ( f " === INSTALAÇÃO CONCLUÍDA v { VERSION } === " )
rt . messageBox ( f " VR4Life v { VERSION } instalado! \n \n Procure as opções no final do menu ' Rendering ' . " , title = f " VR4Life v { VERSION } " )
# Mensagem final com versão para o usuário
msg = f " VR4Life v { VERSION } instalado com sucesso! \n \n O menu deve aparecer ao final da lista superior. \n Caso não veja, reinicie o 3ds Max ou troque o Workspace. "
rt . messageBox ( msg , title = f " VR4Life v { VERSION } " )
if __name__ == " __main__ " :
if __name__ == " __main__ " :
install_plugin ( )
install_plugin ( )