Merge pull request #88 from DeemosTech/rodin-intergration
Bugfix: not finding parent_obj correctly when importing glb from rodin generated results
This commit is contained in:
commit
ce7b80fb00
14
addon.py
14
addon.py
@ -1190,8 +1190,13 @@ class BlenderMCPServer:
|
||||
mesh_obj = imported_objects[0]
|
||||
print("Single mesh imported, no cleanup needed.")
|
||||
else:
|
||||
parent_obj = imported_objects[0]
|
||||
if parent_obj.type == 'EMPTY' and len(parent_obj.children) == 1:
|
||||
if len(imported_objects) == 2:
|
||||
empty_objs = [i for i in imported_objects if i.type == "EMPTY"]
|
||||
if len(empty_objs) != 1:
|
||||
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
||||
return
|
||||
parent_obj = empty_objs.pop()
|
||||
if len(parent_obj.children) == 1:
|
||||
potential_mesh = parent_obj.children[0]
|
||||
if potential_mesh.type == 'MESH':
|
||||
print("GLB structure confirmed: Empty node with one mesh child.")
|
||||
@ -1210,6 +1215,9 @@ class BlenderMCPServer:
|
||||
else:
|
||||
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
||||
return
|
||||
else:
|
||||
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
||||
return
|
||||
|
||||
# Rename the mesh if needed
|
||||
try:
|
||||
@ -1272,6 +1280,8 @@ class BlenderMCPServer:
|
||||
return {"succeed": False, "error": str(e)}
|
||||
|
||||
break
|
||||
else:
|
||||
return {"succeed": False, "error": "Generation failed. Please first make sure that all jobs of the task are done and then try again later."}
|
||||
|
||||
try:
|
||||
obj = self._clean_imported_glb(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user