Atualizações de Versionamento 313

### 🛠️ Refatoração da Arquitetura do Material Físico (P6 -> P7)
- **Preservação da Cena Original no Max:** O Motor de Bake (P6) foi totalmente reescrito para NÃO destruir e nem injetar materiais nos objetos originais da cena após o render. O ambiente de trabalho do 3ds Max, incluindo a visualização da Viewport e a árvore de materiais complexos (SME), agora permanece 100% intacta e limpa.
- **Injeção Tardia (Clone Web):** A geração do material otimizado com a textura do bake foi deslocada exclusivamente para o Motor de Exportação do GLB (P7). O material é construído apenas nos clones invisíveis que vão pra web.
- **Isolamento de UV Mapping:** Os modificadores de planificação de UV (Merge do Canal 2 para o Canal 1) agora só afetam os clones da exportação, evitando a quebra de texturas nodais na viewport original do artista.
### ☀️ Calibragem de Iluminação Web (Fix "Objeto Preto" vs "Branco Estourado")
- Substituição total do "Unlit improvisado" (Canal Emission) pela ligação padrão correta exigida pelos visualizadores GLTF.
- A textura do Bake agora é injetada estritamente no slot `Base Color Map` de um `PhysicalMaterial` limpo (estilo Principled BSDF), com o `Base Color` fixado em branco perfeito e `Emission` desligado (Zero absoluto).
- Essa arquitetura soluciona os 100% de estouro ("Blow Out") luminoso originado pelas claraboias de bibliotecas JS e previne o bug do objeto parecer absolutamente preto.
### 🐛 Correções de Escopo (Engine Bugs)
- Resolvido um `NameError` da variável `p_bk` que impedia o P7 de achar a textura salva no SSD após o isolamento do motor P6. Variável refatorada apontando precisamente paras os campos de texto UI de Bake Path originais (`edt_p_bake`).
- Resolvido um problema no `f-string` interno do MaxScript onde a variável `tgt_uv_state` vazava com formatação de escopo quebrada e congelava o Export GLTF.
main
PauloHNCosta 4 weeks ago
parent 5e779cf9ec
commit 46d0ea6fda

@ -1 +1 @@
[{"name": "ETICHETTA", "status": "DONE V19", "polys": "5,966", "res": "256px", "id": "60.0"}, {"name": "Object003", "status": "DONE V19", "polys": "7,470", "res": "1024px", "id": "2394.0"}, {"name": "ETICHE_005", "status": "DONE V19", "polys": "2,977", "res": "256px", "id": "56.0"}, {"name": "IMBOTT_002", "status": "DONE V19", "polys": "6,628", "res": "1024px", "id": "2751.4"}, {"name": "Object005", "status": "DONE V19", "polys": "2,846", "res": "1024px", "id": "2456.7"}, {"name": "Object004", "status": "DONE V19", "polys": "2,962", "res": "1024px", "id": "1377.5"}, {"name": "Object006", "status": "DONE V19", "polys": "2,878", "res": "1024px", "id": "764.3"}, {"name": "CUCITURE", "status": "DONE V19", "polys": "936", "res": "256px", "id": "65.8"}]
[{"name": "3d66-Editable_Poly-23107237-414", "status": "Pronto", "polys": "27,680", "res": "2048px", "id": "979.0"}, {"name": "3d66-Editable_Poly-23107237-415", "status": "Pronto", "polys": "15,776", "res": "2048px", "id": "797.2"}, {"name": "3d66diban-020", "status": "Pronto", "polys": "600", "res": "2048px", "id": "861.0"}]

@ -500,14 +500,8 @@ def process_bake_logic_v19(ui, auto_export=False):
)
-------------------------------------------------------------------------
-- 4. MATERIAL CREATION
-- 4. MATERIAL CREATION (MOVED TO EXPORT ENGINE P7)
-------------------------------------------------------------------------
local newMat = PhysicalMaterial()
newMat.name = (obj.name + "_Baked_Mat")
newMat.base_color = color 255 255 255
newMat.roughness = 1.0
newMat.emission = 0.0
local fileFound = false
local waitForFile = 0
while (waitForFile < 50) and (fileFound == false) do (
@ -515,12 +509,7 @@ def process_bake_logic_v19(ui, auto_export=False):
else ( sleep 0.1; waitForFile += 1 )
)
if fileFound then (
local bmpTex = BitmapTexture filename:be.filename
if {tgt_uv_state} == 2 then bmpTex.coords.mapChannel = 2 else bmpTex.coords.mapChannel = 1
newMat.base_color_map = bmpTex
showTextureMap newMat newMat.base_color_map on
) else (
if not fileFound do (
print ("ERROR: Texture file not found: " + be.filename)
return -2
)
@ -529,13 +518,8 @@ def process_bake_logic_v19(ui, auto_export=False):
-- 5. FINAL CLEANUP
-------------------------------------------------------------------------
sleep 1.0
obj.material = newMat
if {tgt_uv_state} == 1 then (
channelInfo.CopyChannel obj 3 2
channelInfo.PasteChannel obj 3 1
channelInfo.ClearChannel obj 2
)
-- Preserva o material original da tela e nao suja a viewport!
collapseStack obj
return 1
) catch (
@ -592,6 +576,9 @@ def export_glb_v19(ui):
mprint("Aviso: Nenhum item valido na lista para exportar.")
return
p_bk = ui.edt_p_bake.text().replace("\\", "/")
if not p_bk.endswith("/"): p_bk += "/"
tgt_uv = 2 if ui.rdo_uv2.isChecked() else 1
if len(tgs) == 1: f_name = f"{tgs[0]['name']}_Export"
@ -618,7 +605,33 @@ def export_glb_v19(ui):
c.name = orig.name + "_EXP"
convertToPoly c -- Forca o colapso de toda a arvore antes de manipular a UV
-- APENAS CLONAR PARA EXPORTACAO, SEM MANIPULAR UV OU MATERIAIS
-- APLICA O NOVO MATERIAL E A NOVA UV APENAS NO CLONE QUE VAI SER EXPORTADO
local pBk = @"{p_bk}"
local fileExt = ".jpg"
local texPath = (pBk + orig.name + "_Baked" + fileExt)
if doesFileExist texPath do (
local newMat = PhysicalMaterial()
newMat.name = (orig.name + "_GLTF_Mat")
-- GLTF PBR Padrao: Textura limpa no Base Color sem frescuras
newMat.base_color = color 255 255 255
newMat.roughness = 1.0
newMat.emission = 0.0
local bmpTex = BitmapTexture filename:texPath
bmpTex.coords.mapChannel = 1
newMat.base_color_map = bmpTex
c.material = newMat
)
if {tgt_uv} == 2 do (
try ( channelInfo.CopyChannel c 3 2 ) catch()
try ( channelInfo.PasteChannel c 3 1 ) catch()
try ( channelInfo.ClearChannel c 2 ) catch()
)
collapseStack c
append clones c
)
)

@ -21,7 +21,7 @@ def get_max_window_safe():
class AutoBakeManager(QtWidgets.QDialog):
def __init__(self):
super(AutoBakeManager, self).__init__(get_max_window_safe())
self.setWindowTitle("VR4LIFE AUTO-BAKE V312 - MODULAR ENTERPRISE")
self.setWindowTitle("VR4LIFE AUTO-BAKE V313 - MODULAR ENTERPRISE")
self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowCloseButtonHint)
self.resize(570, 890); self.bake_items = []; self._is_cancelled = False
p = self.palette(); p.setColor(QtGui.QPalette.Window, QtGui.QColor(43, 43, 43)); self.setPalette(p); self.setAutoFillBackground(True)
@ -31,7 +31,8 @@ class AutoBakeManager(QtWidgets.QDialog):
def init_ui(self):
layout = QtWidgets.QVBoxLayout(self)
# --- TOP HEADER ---
lbl_t = QtWidgets.QLabel("VR4LIFE - V312 (Modular) ( ultima alteração 2:56 AM 11-03- 2026)"); lbl_t.setAlignment(QtCore.Qt.AlignCenter); lbl_t.setStyleSheet("font-size: 24px; font-weight: bold; color: #00FF00;")
# ultima alteração 2:56 AM 11-03- 2026
lbl_t = QtWidgets.QLabel("VR4LIFE - V313 (Modular)"); lbl_t.setAlignment(QtCore.Qt.AlignCenter); lbl_t.setStyleSheet("font-size: 24px; font-weight: bold; color: #00FF00;")
layout.addWidget(lbl_t)
self.tabs = QtWidgets.QTabWidget()

Loading…
Cancel
Save