@@ -156,7 +156,7 @@ def importEnt(with_materials, filepath='', appearances=[], exclude_meshes=[], in
156156 animsinres .append (os .path .join (path ,anim ))
157157 # presto_stash.append(animsinres)
158158
159- if len (animsinres )> 0 :
159+ if len (animsinres )> 0 and os . path . exists ( animsinres [ 0 ]) :
160160 bpy .ops .io_scene_gltf .cp77 (with_materials , filepath = animsinres [0 ],scripting = True )
161161 #find what we just loaded
162162 arms = [x for x in bpy .data .objects if 'Armature' in x .name and x not in oldarms ]
@@ -300,15 +300,16 @@ def importEnt(with_materials, filepath='', appearances=[], exclude_meshes=[], in
300300 if c ['animations' ]['gameplay' ]!= None and len (c ['animations' ]['gameplay' ])> 0 : # get the armatures already in the model
301301 oldarms = [x for x in bpy .data .objects if 'Armature' in x .name ]
302302 animpath = os .path .join (path ,c ['animations' ]['gameplay' ][0 ]['animSet' ]['DepotPath' ]['$value' ]+ '.glb' )
303- bpy .ops .io_scene_gltf .cp77 (with_materials , filepath = animpath , scripting = True )
304- # find the armature we just loaded
305- arms = [x for x in bpy .data .objects if 'Armature' in x .name and x not in oldarms ]
306- rig = arms [0 ]
307- bones = rig .pose .bones
308- rig ["animset" ] = animpath
309- rig ["rig" ] = rig_path
310- rig ["ent" ] = ent_name + ".ent.json"
311- print ('anim rig loaded' )
303+ if os .path .exists (animpath ):
304+ bpy .ops .io_scene_gltf .cp77 (with_materials , filepath = animpath , scripting = True )
305+ # find the armature we just loaded
306+ arms = [x for x in bpy .data .objects if 'Armature' in x .name and x not in oldarms ]
307+ rig = arms [0 ]
308+ bones = rig .pose .bones
309+ rig ["animset" ] = animpath
310+ rig ["rig" ] = rig_path
311+ rig ["ent" ] = ent_name + ".ent.json"
312+ print ('anim rig loaded' )
312313 else :
313314 print ('another rig already loaded' )
314315 if not vehicle_slots :
0 commit comments