From 46d0ea6fdaf6b7b3ad7931c450a3613348562887 Mon Sep 17 00:00:00 2001 From: PauloHNCosta Date: Mon, 16 Mar 2026 18:37:41 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=B5es=20de=20Versionamento=203?= =?UTF-8?q?13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### šŸ› ļø 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. --- __pycache__/vr4life_engine.cpython-310.pyc | Bin 27736 -> 28314 bytes __pycache__/vr4life_ui.cpython-310.pyc | Bin 13971 -> 13969 bytes vr4_state.json | 2 +- vr4life_engine.py | 55 +++++++++++++-------- vr4life_ui.py | 5 +- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/__pycache__/vr4life_engine.cpython-310.pyc b/__pycache__/vr4life_engine.cpython-310.pyc index bd820182b8b0daf691d5ace0f2a4da200b7b7b4e..ac3d02b17ca4a743e55cb679ef7fe0d3ea89db39 100644 GIT binary patch delta 1439 zcmah|TTC2P7@jk;?3GdFkt~lJSlX&{i=>2jqJ(JGcODjM`;S6c=BN;cJ;b*EFP2*~ z<;}XVhb`%b+(6G5vc^$jw26C%vG<_xq#@`8I~Ea&dp4o9=$v7t-0XwDy>sSXzn%T` zY){dA?zcMrxUKldv`sh(ZPVfTU;yG_2rfjzu{Z>0E=)U(2jEr@5LPV9alDaK|0vnOeV5Nw$UJrADs-Y(G;p-CfyCPL^{v9?h@4X-2()C*C@P%i)cei=SM!6B1%K7xVmEd~s#z96u47^!p$T zGvWC#O#9-&*rYE6LGT$CAI!~zFA|*b&7unaP#9+$oeRReZxUvMvGUY?fpBRC`)y`N zW_%q+;k;M;L139cBaXkDp}kI%u0}*{6@6_6q@y%k_I6-^Wkwp=(^D=>8F9o6BZ}$K z0e0A4!3xo8H54*zcpKu&l);ZKSf?SJM{eAy$Sfw)%j#<=tDmx9a@sq9 z4QB(WTZxs_@HM28RHJ0&O}Ls23o9h+oz}=w9~7I{ M`$$E|nyPgF1J#(I`v3p{ delta 1201 zcmah|O-vg{6rPz~uh%wS2MDoE5*Q$)5C@mPh)|VK*Ks0C_$L@wrAbBBo+TLUU1BeC zrL5&dw1@T(MNChnmh4k|OuFj1m-JMrO-?~bNIg_4r>d9sfYhH^8@C)Pb)?yO^WHb# z_h#Rl&ko?;9+Wh<+X>jXdGIuMaqF3MFzr0UwqZ6)d-S*IefWyLxZ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*-XEYiE-cL9fl7WuWz1dB*(~jXY&qY oDMqd*K<^Z@0SUIr?=>YRe=(WMBLn1dFz_&PaB|d7o^SdI08zeCssI20 diff --git a/vr4_state.json b/vr4_state.json index 489f4c9..034fa49 100644 --- a/vr4_state.json +++ b/vr4_state.json @@ -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"}] \ No newline at end of file +[{"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"}] \ No newline at end of file diff --git a/vr4life_engine.py b/vr4life_engine.py index b7051c8..0ae9cdd 100644 --- a/vr4life_engine.py +++ b/vr4life_engine.py @@ -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 ) ) diff --git a/vr4life_ui.py b/vr4life_ui.py index f303e55..41a5045 100644 --- a/vr4life_ui.py +++ b/vr4life_ui.py @@ -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()