[docs]defreset_modules():"""Resets the modules from the library. """to_delete=[]formodname,_insys.modules.items():ifmodname.startswith("goo"):to_delete.append(modname)formodnameinto_delete:delsys.modules[modname]
[docs]defreset_scene():bpy.app.handlers.frame_change_pre.clear()bpy.app.handlers.frame_change_post.clear()bpy.context.scene.frame_set(1)bpy.context.scene.frame_start=1bpy.context.scene.frame_end=250ifbpy.context.active_objectandbpy.context.active_object.mode!="OBJECT":bpy.ops.object.mode_set(mode="OBJECT")formeshinbpy.data.meshes:bpy.data.meshes.remove(mesh,do_unlink=True)forobjinbpy.data.objects:# if obj.type in ["CAMERA", "LIGHT"]:# continuebpy.data.objects.remove(obj,do_unlink=True)formatinbpy.data.materials:bpy.data.materials.remove(mat,do_unlink=True)forcolinbpy.data.collections:bpy.data.collections.remove(col)