terrible
This commit is contained in:
PajamaBee 2025-07-20 03:16:17 -05:00
parent 23d6a5b516
commit d2e2276d43
18 changed files with 205 additions and 3 deletions

7
UI/MainUI.gd Normal file
View file

@ -0,0 +1,7 @@
extends CanvasLayer
func _ready() -> void:
$ShapeSelect.visible = false
func _on_shape_button_pressed() -> void:
$ShapeSelect.visible = true

1
UI/MainUI.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dhy3kcnievdpq

33
UI/MainUI.tscn Normal file
View file

@ -0,0 +1,33 @@
[gd_scene load_steps=3 format=3 uid="uid://c2qnrd7mneksy"]
[ext_resource type="Script" uid="uid://dhy3kcnievdpq" path="res://UI/MainUI.gd" id="1_xv1u1"]
[ext_resource type="Script" uid="uid://14odr4cov1sm" path="res://UI/ShapeSelectUI.gd" id="2_wwh41"]
[node name="MainUi" type="CanvasLayer"]
script = ExtResource("1_xv1u1")
[node name="ShapeButton" type="Button" parent="."]
offset_left = 869.0
offset_top = 533.0
offset_right = 1101.0
offset_bottom = 616.0
text = "Shape"
[node name="ShapeSelect" type="PanelContainer" parent="."]
offset_left = 169.0
offset_top = 52.0
offset_right = 896.0
offset_bottom = 516.0
script = ExtResource("2_wwh41")
[node name="ScrollContainer" type="ScrollContainer" parent="ShapeSelect"]
layout_mode = 2
[node name="ShapeButtons" type="HFlowContainer" parent="ShapeSelect/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/h_separation = 100
[connection signal="pressed" from="ShapeButton" to="." method="_on_shape_button_pressed"]

View file

@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://b3brrwp5525q2"]
[ext_resource type="PackedScene" uid="uid://djppmw257tqac" path="res://models/horse.glb" id="1_ercyr"]
[ext_resource type="Script" uid="uid://ck5f4x6jx82bk" path="res://UI/SelectableShape/2d_view_object.gd" id="1_t7wwi"]
[node name="2dViewObject" type="Node3D"]
script = ExtResource("1_t7wwi")
[node name="horse" parent="." instance=ExtResource("1_ercyr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.1146, 0)
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="CharacterBody3D"]
[node name="OmniLight3D" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.0143, 0)
[node name="OmniLight3D2" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.7226, -1.49836)
[node name="OmniLight3D3" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.39693, 1.80697)
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(-0.99875, -0.0266758, 0.0422761, -0.0149347, 0.966319, 0.256915, -0.0477056, 0.255962, -0.965509, 0.0691954, 3.33261, -8.46037)
fov = 43.6717
[editable path="horse"]

View file

@ -0,0 +1,12 @@
extends Node3D
var object
func _ready() -> void:
object = $horse
func change_object(newObject):
remove_child(object)
object.queue_free()
add_child(newObject)
object = newObject

View file

@ -0,0 +1 @@
uid://ck5f4x6jx82bk

View file

@ -0,0 +1,28 @@
extends Button
var rotationAmount
var rotationTimer = 0
func _ready() -> void:
set_rotation_amount()
func set_location_offset(offset):
%ViewObject.global_position = offset
func change_object(object):
%ViewObject.change_object(object)
func _process(delta):
var texture = $SubViewport.get_texture()
$TextureRect.texture = texture
rotationTimer -= delta
if rotationTimer <= 0:
if randi_range(0, 1) == 0:
set_rotation_amount()
rotationTimer = randf_range(0, 6)
%ViewObject.object.rotation += rotationAmount * delta
func set_rotation_amount():
rotationAmount = Vector3(randf_range(0, 3), randf_range(0, 3), randf_range(0, 3))

View file

@ -0,0 +1 @@
uid://ctan4kigqf4m4

View file

@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=3 uid="uid://bx2ydrg7xfp3f"]
[ext_resource type="Script" uid="uid://ctan4kigqf4m4" path="res://UI/SelectableShape/ShapeButton.gd" id="1_itppa"]
[ext_resource type="PackedScene" uid="uid://b3brrwp5525q2" path="res://UI/SelectableShape/2dViewObject.tscn" id="1_tvnn6"]
[node name="ShapeButton" type="Button"]
custom_minimum_size = Vector2(200, 200)
offset_left = 395.0
offset_top = 205.0
offset_right = 642.0
offset_bottom = 405.0
script = ExtResource("1_itppa")
[node name="SubViewport" type="SubViewport" parent="."]
[node name="ViewObject" parent="SubViewport" instance=ExtResource("1_tvnn6")]
unique_name_in_owner = true
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 0
offset_right = 200.0
offset_bottom = 200.0
expand_mode = 1
[editable path="SubViewport/ViewObject"]
[editable path="SubViewport/ViewObject/horse"]

22
UI/ShapeSelectUI.gd Normal file
View file

@ -0,0 +1,22 @@
extends PanelContainer
var shapeButtonScene = preload("res://UI/SelectableShape/ShapeButton.tscn")
var initialShapes = [
preload("res://models/horse.glb"),
preload("res://models/shark.glb")
]
var offset = Vector3(0, 10000, 10000)
func _ready() -> void:
setup_buttons()
func setup_buttons():
for shape in initialShapes:
var newButton = shapeButtonScene.instantiate()
var buttonObject = shape.instantiate()
%ShapeButtons.add_child(newButton)
newButton.set_location_offset(offset)
offset += Vector3(0, 10000, 10000)
newButton.change_object(buttonObject)

1
UI/ShapeSelectUI.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://14odr4cov1sm