Transform your 3D texturing workflow with the power of generative AI, directly within Blender!
bake the normals of a masked edit layered over a bake
sakalond6bcc005be2e5
diff --git a/stablegen/texturing/masked_edit.py b/stablegen/texturing/masked_edit.pyindex 51aaec2..c76c8ee 100644--- a/stablegen/texturing/masked_edit.py+++ b/stablegen/texturing/masked_edit.py@@ -19,7 +19,7 @@ import numpy as npfrom ..core import ADDON_PKG, legacy_panel_enabledfrom ..utils import sg_modal_active, get_file_pathfrom .pbr_emission import emission_from_hsv, emission_from_residual-from .rendering import _RenderStateTransaction+from .rendering import _RenderStateTransaction, EDIT_NORMAL_LAYER as NORMAL_LAYERfrom ..core.architectures import MASKED_EDIT_ARCHITECTURES, QWEN_ARCHITECTURES, SDXL_GRAPH_ARCHITECTURESMASK_UV = 'SG Edit Mask UV'@@ -708,9 +708,6 @@ def resolve_layers(scene, apply):del scene['_sg_mask_original_engine']-NORMAL_LAYER = 'Masked Edit normal'--def pbr_targets(material):"""Inputs that carry projected PBR maps: {channel: input socket}.diff --git a/stablegen/texturing/rendering.py b/stablegen/texturing/rendering.pyindex a9235eb..8d4fb8f 100644--- a/stablegen/texturing/rendering.py+++ b/stablegen/texturing/rendering.py@@ -2915,6 +2915,10 @@ def _remove_stale_pbr_maps(output_dir, object_name, channels):return removed+# The label of a Masked Edit's decoded normal layers (masked_edit.world_normal_layer).+EDIT_NORMAL_LAYER = 'Masked Edit normal'++def _find_pbr_bake_sources(mat):"""Inspect a Principled BSDF material and return bakeable PBR channel sources.@@ -2975,6 +2979,10 @@ def _find_pbr_bake_sources(mat):ci = n_node.inputs.get("Color")if ci and ci.links:sources['normal'] = ci.links[0].from_socket+ elif n_node.label == EDIT_NORMAL_LAYER:+ # A Masked Edit's normals decoded over the map: the normal bake+ # takes the shading normal, so the layered result is the source.+ sources['normal'] = ni.links[0].from_socket# ── Emission ─────────────────────────────────────────────────────ei = principled.inputs.get("Emission Color") or principled.inputs.get("Emission")