<commit_before>class_name Test
extends Node


signal wait_done()

export var _enable_debug_collision = true

var _timer
var _timer_started = false

var _wait_physics_ticks_counter = 0

var _drawn_nodes = []


func _enter_tree():
	if not _enable_debug_collision:
		get_tree().debug_collisions_hint = false


func _physics_process(_delta):
	if _wait_physics_ticks_counter > 0:
		_wait_physics_ticks_counter -= 1
		if _wait_physics_ticks_counter == 0:
			emit_signal("wait_done")


func add_sphere(pos, radius, color):
	var sphere = MeshInstance.new()

	var sphere_mesh = SphereMesh.new()
	sphere_mesh.radius = radius
	sphere_mesh.height = radius * 2.0
	sphere.mesh = sphere_mesh

	var material = SpatialMaterial.new()
	material.flags_unshaded = true
	material.albedo_color = color
	sphere.material_override = material

	_drawn_nodes.push_back(sphere)
	add_child(sphere)

	sphere.global_transform.origin = pos


func add_shape(shape, transform, color):
	var body = StaticBody.new()
	body.collision_layer = 0
	body.collision_mask = 0

	var collision = CollisionShape.new()
	collision.transform = transform
	collision.shape = shape

	body.add_child(collision)

	add_child(body)
	_drawn_nodes.push_back(body)

	call_deferred("initialize_shape_material", body, color)


func initialize_shape_material(body, color):
	var mesh_instance = body.get_child(1)
	var material = SpatialMaterial.new()
	material.flags_unshaded = true
	material.albedo_color = color
	mesh_instance.material_override = material


func clear_drawn_nodes():
	for node in _drawn_nodes:
		remove_child(node)
		node.queue_free()
	_drawn_nodes.clear()


func create_rigidbody(shape, pickable = false, transform = Transform.IDENTITY):
	var collision = CollisionShape.new()
	collision.shape = shape
	collision.transform = transform

	var body = RigidBody.new()<commit_msg>Fix hack to draw shapes in 3D physics tests<commit_after>class_name Test
extends Node


signal wait_done()

export var _enable_debug_collision = true

var _timer
var _timer_started = false

var _wait_physics_ticks_counter = 0

var _drawn_nodes = []


func _enter_tree():
	if not _enable_debug_collision:
		get_tree().debug_collisions_hint = false


func _physics_process(_delta):
	if _wait_physics_ticks_counter > 0:
		_wait_physics_ticks_counter -= 1
		if _wait_physics_ticks_counter == 0:
			emit_signal("wait_done")


func add_sphere(pos, radius, color):
	var sphere = MeshInstance.new()

	var sphere_mesh = SphereMesh.new()
	sphere_mesh.radius = radius
	sphere_mesh.height = radius * 2.0
	sphere.mesh = sphere_mesh

	var material = SpatialMaterial.new()
	material.flags_unshaded = true
	material.albedo_color = color
	sphere.material_override = material

	_drawn_nodes.push_back(sphere)
	add_child(sphere)

	sphere.global_transform.origin = pos


func add_shape(shape, transform, color):
	var debug_mesh = shape.get_debug_mesh()

	var mesh_instance = MeshInstance.new()
	mesh_instance.transform = transform
	mesh_instance.mesh = debug_mesh

	var material = SpatialMaterial.new()
	material.flags_unshaded = true
	material.albedo_color = color
	mesh_instance.material_override = material

	add_child(mesh_instance)
	_drawn_nodes.push_back(mesh_instance)


func clear_drawn_nodes():
	for node in _drawn_nodes:
		remove_child(node)
		node.queue_free()
	_drawn_nodes.clear()


func create_rigidbody(shape, pickable = false, transform = Transform.IDENTITY):
	var collision = CollisionShape.new()
	collision.shape = shape
	collision.transform = transform

	var body = RigidBody.new()
{'fraction_non_alphanumeric': 0.08352337514253136, 'fraction_numerical': 0.004561003420752566, 'mean_word_length': 5.4981481481481485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3793435', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1172, 'n_words': 257}