Skip to content

Transform your 3D texturing workflow with the power of generative AI, directly within Blender!

fix issues regarding uv inpainting mode

sakalonde629a7a74c05
diff --git a/stablegen/generator.py b/stablegen/generator.py
index b80a274..c54f5d4 100644
--- a/stablegen/generator.py
+++ b/stablegen/generator.py
@@ -438,7 +438,7 @@ class ComfyUIGenerate(bpy.types.Operator):
bake_texture(context, obj, texture_resolution=2048, output_dir=get_dir_path(context, "baked"))
# Export visibility masks for each object
- export_visibility(context, obj)
+ export_visibility(context, None, obj)
self.prompt_text = context.scene.comfyui_prompt
diff --git a/stablegen/render_tools.py b/stablegen/render_tools.py
index 3fe72b5..cc5912b 100644
--- a/stablegen/render_tools.py
+++ b/stablegen/render_tools.py
@@ -41,7 +41,12 @@ def apply_uv_inpaint_texture(context, obj, baked_image_path):
# Traverse from the output input to find a MIX_RGB node with unlinked Color2
mix_node = None
- current_node = output_node.inputs[0].links[0].from_node.inputs[0].links[0].from_node
+ before_output = output_node.inputs["Surface"].links[0].from_node
+ if before_output.type == 'BSDF_PRINCIPLED':
+ current_node = output_node.inputs[0].links[0].from_node.inputs[0].links[0].from_node
+ else:
+ # Already a color mix node
+ current_node = before_output
while current_node:
# Base case: Found a MIX_RGB node with unlinked Color2 or linked to image texture
if (current_node.type == 'MIX_RGB' and