Bugfix: not finding parent_obj correctly
This commit is contained in:
parent
9b3b327853
commit
d5bcaaf18b
12
addon.py
12
addon.py
@ -1443,8 +1443,13 @@ class BlenderMCPServer:
|
|||||||
mesh_obj = imported_objects[0]
|
mesh_obj = imported_objects[0]
|
||||||
print("Single mesh imported, no cleanup needed.")
|
print("Single mesh imported, no cleanup needed.")
|
||||||
else:
|
else:
|
||||||
parent_obj = imported_objects[0]
|
if len(imported_objects) == 2:
|
||||||
if parent_obj.type == 'EMPTY' and len(parent_obj.children) == 1:
|
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]
|
potential_mesh = parent_obj.children[0]
|
||||||
if potential_mesh.type == 'MESH':
|
if potential_mesh.type == 'MESH':
|
||||||
print("GLB structure confirmed: Empty node with one mesh child.")
|
print("GLB structure confirmed: Empty node with one mesh child.")
|
||||||
@ -1463,6 +1468,9 @@ class BlenderMCPServer:
|
|||||||
else:
|
else:
|
||||||
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
print("Error: Expected an empty node with one mesh child or a single mesh object.")
|
||||||
|
return
|
||||||
|
|
||||||
# Rename the mesh if needed
|
# Rename the mesh if needed
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user