Play around with internal nodes

They are selectable, isn't that interesting?
This commit is contained in:
Vojta committed 2025-02-25 22:49:55 +01:00
1 parent ac50e8eee7
commit 1fa1e709ff
6 files changed
+89 -2

No files matched your search

-1
View File
@@ -162,7 +162,6 @@ portal = NodePath("../Portal A")
[node name="Outer" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 2.78925)
visible = false
size = Vector3(2.2, 3.2, 0.25)
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="Outer"]
+43
View File
@@ -0,0 +1,43 @@
@tool
extends Node3D
func _add_inspector_buttons() -> Array:
var buttons: Array = []
buttons.push_back({
"name": "Regular cube mesh",
"pressed": _add_regular_cube_mesh
})
buttons.push_back({
"name": "Internal cube mesh",
"pressed": _add_internal_cube_mesh
})
buttons.push_back({
"name": "Delete all children",
"pressed": func(): for child in get_children(true): child.queue_free()
})
return buttons
func _add_regular_cube_mesh() -> void:
var m = MeshInstance3D.new()
var b = BoxMesh.new()
m.mesh = b
add_child(m, true)
m.owner = self
m.position.x = 1.5 * get_child_count(true)
func _add_internal_cube_mesh() -> void:
var m = MeshInstance3D.new()
var b = BoxMesh.new()
m.mesh = b
add_child(m, true, Node.INTERNAL_MODE_BACK)
var mat = StandardMaterial3D.new()
mat.albedo_color = Color("ff4c4e")
b.material = mat
m.owner = self
m.position.x = 1.5 * get_child_count(true)
+1
View File
@@ -0,0 +1 @@
uid://ouk76qr5gpq0
+38
View File
@@ -0,0 +1,38 @@
[gd_scene load_steps=8 format=3 uid="uid://bnrph4k6wpruy"]
[ext_resource type="Script" uid="uid://ouk76qr5gpq0" path="res://levels/test_internal_nodes.gd" id="1_glqbe"]
[sub_resource type="BoxMesh" id="BoxMesh_glqbe"]
[sub_resource type="BoxMesh" id="BoxMesh_dodl2"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wgeau"]
albedo_color = Color(1, 0.298039, 0.305882, 1)
[sub_resource type="BoxMesh" id="BoxMesh_j0q2q"]
material = SubResource("StandardMaterial3D_wgeau")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_47wcs"]
albedo_color = Color(1, 0.298039, 0.305882, 1)
[sub_resource type="BoxMesh" id="BoxMesh_bkhqo"]
material = SubResource("StandardMaterial3D_47wcs")
[node name="test_internal_nodes" type="Node3D"]
script = ExtResource("1_glqbe")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 0, 0)
mesh = SubResource("BoxMesh_glqbe")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.5, 0, 0)
mesh = SubResource("BoxMesh_dodl2")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0)
mesh = SubResource("BoxMesh_j0q2q")
[node name="MeshInstance3D4" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0)
mesh = SubResource("BoxMesh_bkhqo")