Skip to content

Commit

Permalink
temp: not useful changes
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Aug 20, 2024
1 parent 7f30a54 commit bd87595
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/models/icosahedron/components/Icosahedron.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ const EDGE_NOISE = preload('res://src/models/icosahedron/resources/edge_noise.re
@export var DEBUG_VISUAL: bool
@export var scaling_enabled = false
@export var scale_factor: float
@export var shader_type: int
@export var inital_transfrm: Quaternion
@export var shader_type: int = 0:
set(val):
shader_type = val
set_shader_type(val)
@export var inital_transfrm := Quaternion()
@onready var cut_plane: CutPlane = $CutPlane
@onready var mesh_icosahedron: MeshIcosahedron = $MeshIcosahedron

var cutplane_vector := Vector3(1,1,1).normalized()
var scale_timer: ScaleTimer
var sf: float

func set_shader_type(_type: int):
var variant = IcosahedronVarints.figure_variants[_type]
if variant.get("cutplane"):
set_cutplane(variant.cutplane)
set_color(G.theme.figure_variants.get(variant.name, G.theme.base_color))

func init(shader_args: Dictionary, transform_args: Dictionary = {}) -> Icosahedron:
scale_factor = G.settings.SCALE_FACTOR
scaling_enabled = G.settings.get("SCALING_ENABLED", true)
Expand Down
35 changes: 35 additions & 0 deletions src/models/icosahedron/test/variant_test.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@tool
extends Node3D

const IcosahedronScene = preload('res://src/models/icosahedron/Icosahedron.tscn')
var G: Globals = Globals.new()
@onready var icosahedron: Icosahedron = $Icosahedron

@export var a := false:
set(val):
var new_figure = IcosahedronScene.instantiate()
new_figure.shader_type = 1
self.add_child(new_figure)
new_figure.owner = get_tree().edited_scene_root
print_debug(new_figure.shader_type)
print_debug(G.tw)

@export var b := false:
set(val):
for i in self.get_children():
remove_child(i)


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#if not get_tree().edited_scene_root.get_node_or_null('./globals'):
#var globals = Globals.new()
#globals.set_name('globals')
#get_tree().edited_scene_root.call_deferred('add_child', globals)
#G = get_tree().edited_scene_root.get_node('./globals')
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
12 changes: 12 additions & 0 deletions src/models/icosahedron/test/variant_test.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://cd21bp42ng8gy"]

[ext_resource type="Script" path="res://src/models/icosahedron/test/variant_test.gd" id="1_4av47"]
[ext_resource type="PackedScene" uid="uid://c28nbcejwepp8" path="res://src/models/icosahedron/Icosahedron.tscn" id="2_d25gj"]
[ext_resource type="Script" path="res://src/models/icosahedron/components/Icosahedron.gd" id="3_bof8s"]

[node name="VariantTest" type="Node3D"]
script = ExtResource("1_4av47")

[node name="Icosahedron" type="MeshInstance3D" parent="." instance=ExtResource("2_d25gj")]
script = ExtResource("3_bof8s")
shader_type = 1

0 comments on commit bd87595

Please sign in to comment.