@@ -222,7 +222,13 @@ def loadModel(filename):
222222 bpy .ops .wm .alembic_import (filepath = filename )
223223 root = bpy .data .objects ['mvgRoot' ]
224224 root .rotation_euler .rotate_axis ('X' , math .radians (- 90.0 ))
225- return bpy .data .objects ['mvgPointCloud' ], bpy .data .meshes ['particleShape1' ]
225+
226+ obj = bpy .data .objects ['mvgPointCloud' ]
227+
228+ mesh = None
229+ if "particleShape1" in [c .name for c in bpy .data .meshes ]:
230+ mesh = bpy .data .meshes ['particleShape1' ]
231+ return obj , mesh
226232
227233
228234def setupWireframeShading (mesh , color ):
@@ -290,21 +296,27 @@ def setupPointCloudShading(obj, color, size):
290296 # Setup nodes
291297 nodeInput = geo .nodes .new (type = 'NodeGroupInput' )
292298 nodeOutput = geo .nodes .new (type = 'NodeGroupOutput' )
293- nodeM2P = geo .nodes .new (type = 'GeometryNodeMeshToPoints' )
294299 nodeIoP = geo .nodes .new (type = 'GeometryNodeInstanceOnPoints' )
295300 nodeCube = geo .nodes .new (type = 'GeometryNodeMeshCube' )
296301 nodeSize = geo .nodes .new (type = 'ShaderNodeValue' )
297302 nodeSize .outputs ['Value' ].default_value = size
298303 nodeMat = geo .nodes .new (type = 'GeometryNodeSetMaterial' )
299304 nodeMat .inputs [2 ].default_value = material
305+
306+ # Create sockets
307+ if hasattr (geo , 'interface' ):
308+ geo .interface .new_socket ('Geometry' , in_out = 'INPUT' , socket_type = 'NodeSocketGeometry' )
309+ geo .interface .new_socket ('Geometry' , in_out = 'OUTPUT' , socket_type = 'NodeSocketGeometry' )
310+ else :
311+ geo .inputs .new ('NodeSocketGeometry' , 'Geometry' )
312+ geo .outputs .new ('NodeSocketGeometry' , 'Geometry' )
313+
300314 # Connect nodes
301- geo .links .new (nodeInput .outputs [0 ], nodeM2P .inputs ['Mesh' ])
302- geo .links .new (nodeM2P .outputs ['Points' ], nodeIoP .inputs ['Points' ])
315+ geo .links .new (nodeInput .outputs ['Geometry' ], nodeIoP .inputs ['Points' ])
303316 geo .links .new (nodeCube .outputs ['Mesh' ], nodeIoP .inputs ['Instance' ])
304317 geo .links .new (nodeSize .outputs ['Value' ], nodeIoP .inputs ['Scale' ])
305318 geo .links .new (nodeIoP .outputs ['Instances' ], nodeMat .inputs ['Geometry' ])
306- geo .links .new (nodeMat .outputs [0 ], nodeOutput .inputs [0 ])
307-
319+ geo .links .new (nodeMat .outputs [0 ], nodeOutput .inputs ['Geometry' ])
308320
309321
310322def main ():
0 commit comments