tool
extends Spatial


func _on_Document_add_track(track: SummerDayTrack):
	var instance = MeshInstance.new()
	instance.add_to_group("SummerDaySpatialTransform")
	instance.mesh = track.blueprint.model
	
	var mesh = instance.mesh
	for i in range(mesh.get_surface_count()):
		var mat = mesh.surface_get_material(i)
		mat.set_shader_param("table", track.table.texture)
	# I think this will bug with multiple meshes. Please fix, if so!
	
	add_child(instance, true)
