diff --git a/Bullshit/THIS SHOULD FIX IThoefully.tres b/Bullshit/THIS SHOULD FIX IThoefully.tres index 90c4e87..f0941bf 100644 --- a/Bullshit/THIS SHOULD FIX IThoefully.tres +++ b/Bullshit/THIS SHOULD FIX IThoefully.tres @@ -2,7 +2,7 @@ [sub_resource type="Image" id=1] data = { -"data": PoolByteArray( 146, 121, 211, 61, 105, 86, 230, 188, 0, 0, 0, 0, 252, 152, 127, 63, 240, 63, 201, 188, 72, 62, 73, 62, 0, 0, 0, 0, 29, 23, 26, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 225, 221, 100, 62, 58, 251, 45, 189, 0, 0, 0, 0, 220, 162, 139, 62, 30, 240, 195, 188, 186, 74, 183, 62, 0, 0, 0, 0, 248, 30, 185, 62, 11, 245, 66, 60, 50, 221, 41, 189, 0, 0, 0, 0, 0, 0, 128, 191, 11, 245, 66, 188, 50, 221, 41, 61, 0, 0, 0, 0, 0, 0, 128, 63 ), +"data": PoolByteArray( 163, 97, 129, 190, 169, 186, 124, 187, 0, 0, 0, 0, 134, 159, 23, 62, 35, 171, 151, 187, 128, 246, 130, 190, 0, 0, 0, 0, 174, 147, 27, 62, 235, 149, 61, 61, 170, 244, 29, 61, 0, 0, 0, 0, 0, 0, 128, 63, 235, 149, 61, 61, 170, 244, 29, 61, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 43, 243, 217, 188, 0, 0, 0, 0, 194, 193, 28, 190, 74, 160, 139, 188, 18, 181, 131, 190, 0, 0, 0, 0, 105, 78, 11, 190, 170, 140, 27, 62, 130, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 170, 140, 27, 190, 130, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), "format": "RGBAFloat", "height": 1, "mipmaps": false, diff --git a/addons/summer_day/data/blueprint/editable.gd b/addons/summer_day/data/blueprint/editable.gd index f9d8438..b2d91ee 100644 --- a/addons/summer_day/data/blueprint/editable.gd +++ b/addons/summer_day/data/blueprint/editable.gd @@ -4,6 +4,7 @@ class_name SummerDayEditable export(Resource) var table +var z_range := SummerDayZRange.new() var preference_number = 0 @@ -44,3 +45,7 @@ func draw_line(position_1: Vector3, position_2: Vector3, SummerDay.interaction_hint.draw_line( position_1, position_2, color, color_2 ) + + +func get_z_range() -> Array: + return [] diff --git a/addons/summer_day/data/blueprint/template_editables/tube.gd b/addons/summer_day/data/blueprint/template_editables/tube.gd index d20b450..73c136d 100644 --- a/addons/summer_day/data/blueprint/template_editables/tube.gd +++ b/addons/summer_day/data/blueprint/template_editables/tube.gd @@ -17,6 +17,10 @@ export(PoolVector2Array) var vertices = PoolVector2Array([ var picked_point = -1 +func _init(): + z_range.index = 0 + + func _check_for_selection_candidate(event: InputEvent) -> bool: # Virtual. if event is InputEventMouseButton: if event.button_index == BUTTON_LEFT and event.pressed: diff --git a/addons/summer_day/data/blueprint/z_range.gd b/addons/summer_day/data/blueprint/z_range.gd new file mode 100644 index 0000000..bbd1b84 --- /dev/null +++ b/addons/summer_day/data/blueprint/z_range.gd @@ -0,0 +1,30 @@ +extends Reference +class_name SummerDayZRange + + +signal changed_from_external + + +var listed: bool = false +var index: int setget _set_index, _get_index +var _index: int + +var real_z_rear_limit: float +var real_z_front_limit: float + +var squished_z_rear_limit: float +var squished_z_front_limit: float + + +func _set_index(value: int): + if listed: + SummerDay.z_range_manager.move_z_range(self, value) + _index = value + else: + _index = value + SummerDay.z_range_manager.add_z_range(self) + listed = true + + +func _get_index(): + return _index diff --git a/addons/summer_day/data/blueprint/z_range_manager.gd b/addons/summer_day/data/blueprint/z_range_manager.gd new file mode 100644 index 0000000..d7ce917 --- /dev/null +++ b/addons/summer_day/data/blueprint/z_range_manager.gd @@ -0,0 +1,56 @@ +tool +extends Reference +class_name SummerDayZRangeManager + +var z_ranges := [] + + +# FIXME: Binary is probably only relevant when readding all the z_ranges +# from a loaded document. But not when adding entirely new ones, as the +# z_index should be aquivalent to the array index. + +func load_z_index(z_range_instance): + var from = z_range_instance._index + var dest = z_ranges.bsearch_custom(from, self, "_compare_index") + for i in range(from, z_ranges.size()): + z_ranges[i]._index += 1 + z_ranges.insert(dest, z_range_instance) + + _print_indices() + + +func add_z_range(z_range_instance): + var from = z_range_instance._index + for i in range(from, z_ranges.size()): + z_ranges[i]._index += 1 + z_ranges.insert(from, z_range_instance) + + _print_indices() + + +func move_z_range(z_range_instance, to: int): + var from = z_range_instance._index + + if from < to: # Index raises. + z_ranges.remove(from) + for i in range(from, to): + z_ranges[i]._index -= 1 + z_ranges.insert(to, z_range_instance) + else: # Index lowers. + for i in range(to, from): + z_ranges[i]._index += 1 + z_ranges.remove(from) + z_ranges.insert(to, z_range_instance) + + _print_indices() + + +func _compare_index(a, b) -> bool: + return a._index < b + + +func _print_indices(): + var debug_str = "" + for j in z_ranges: + debug_str += str(j._index) + ",\n" + SummerDay.debug_info.text = debug_str diff --git a/addons/summer_day/summer_day.gd b/addons/summer_day/summer_day.gd index 9a8282f..48a8e6e 100644 --- a/addons/summer_day/summer_day.gd +++ b/addons/summer_day/summer_day.gd @@ -46,6 +46,8 @@ func _exit_tree(): remove_custom_type("SummerDayDocument") remove_custom_type("SummerDayDisplay") remove_control_from_bottom_panel(timeline_instance) +# $"/root/SummerDay".canvas_state.free() +# $"/root/SummerDay".z_range_manager.free() func enable_plugin(): diff --git a/addons/summer_day/user_interface/canvas/canvas.gd b/addons/summer_day/user_interface/canvas/canvas.gd index 0539da8..15fec94 100644 --- a/addons/summer_day/user_interface/canvas/canvas.gd +++ b/addons/summer_day/user_interface/canvas/canvas.gd @@ -13,6 +13,7 @@ var tool_pool := SummerDayCanvasToolPool.new() func _ready(): SummerDay.canvas_state = canvas_state SummerDay.interaction_hint = InteractionHint + SummerDay.debug_info = $Render/DebugInfo canvas_state.connect("view_transform_changed", self, "_on_view_transform_changed") canvas_state.connect("canvas_polygon_changed", @@ -48,7 +49,6 @@ func _on_SummerDay_document_changed(new_doc): canvas_state.update_fill_transform() new_doc.connect("resolution_changed", self, "_on_scene_aspect_ratio_changed") - $Render/Label.text = str(new_doc) + "\n" + str(new_doc.resolution) func _on_Canvas_resized(): diff --git a/addons/summer_day/user_interface/canvas/canvas.tscn b/addons/summer_day/user_interface/canvas/canvas.tscn index cc06236..94fb20c 100644 --- a/addons/summer_day/user_interface/canvas/canvas.tscn +++ b/addons/summer_day/user_interface/canvas/canvas.tscn @@ -51,7 +51,7 @@ void fragment() { [sub_resource type="ShaderMaterial" id=7] render_priority = 1 shader = SubResource( 6 ) -shader_param/canvas_transform = Basis( 0.715913, 0, -0.474076, 0, -1.32223, 0.449119, 0, 0, 1 ) +shader_param/canvas_transform = Basis( 0.00240964, 0, -1, 0, -0.00326797, 1, 0, 0, 1 ) [node name="Canvas" type="PanelContainer"] anchor_right = 1.0 @@ -130,6 +130,6 @@ usage = 0 render_target_update_mode = 3 gui_disable_input = true -[node name="Label" type="Label" parent="Render"] +[node name="DebugInfo" type="Label" parent="Render"] margin_right = 40.0 margin_bottom = 14.0 diff --git a/addons/summer_day/utilities/summer_day_globals.gd b/addons/summer_day/utilities/summer_day_globals.gd index e4c5bae..fd5d348 100644 --- a/addons/summer_day/utilities/summer_day_globals.gd +++ b/addons/summer_day/utilities/summer_day_globals.gd @@ -4,4 +4,7 @@ extends Node var document: SummerDayDocument var canvas_state: SummerDayCanvasState +var z_range_manager := SummerDayZRangeManager.new() + var interaction_hint: SummerDayInteractionHint +var debug_info: Label diff --git a/cylinder.dae.import b/cylinder.dae.import index 500e502..0e3625c 100644 --- a/cylinder.dae.import +++ b/cylinder.dae.import @@ -20,6 +20,7 @@ nodes/use_legacy_names=false materials/location=1 materials/storage=1 materials/keep_on_reimport=true +meshes/octahedral_compression=true meshes/compress=true meshes/ensure_tangents=true meshes/storage=0 diff --git a/production/ann.tres b/production/ann.tres index 10746c0..439df3d 100644 --- a/production/ann.tres +++ b/production/ann.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" load_steps=20 format=2] +[gd_resource type="Resource" load_steps=13 format=2] [ext_resource path="res://addons/summer_day/data/document/document.gd" type="Script" id=1] [ext_resource path="res://addons/summer_day/data/document/cell.gd" type="Script" id=2] @@ -38,52 +38,7 @@ blueprint = ExtResource( 5 ) table = SubResource( 2 ) cells = [ SubResource( 4 ) ] -[sub_resource type="Image" id=6] -data = { -"data": PoolByteArray( 232, 246, 173, 190, 47, 95, 49, 189, 0, 0, 0, 0, 246, 232, 104, 62, 58, 231, 73, 188, 112, 8, 93, 190, 0, 0, 0, 0, 123, 148, 148, 61, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 60, 243, 217, 188, 0, 0, 0, 0, 206, 193, 28, 190, 104, 160, 139, 188, 17, 181, 131, 190, 0, 0, 0, 0, 95, 78, 11, 190, 159, 140, 27, 62, 126, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 159, 140, 27, 190, 126, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), -"format": "RGBAFloat", -"height": 1, -"mipmaps": false, -"width": 8 -} - -[sub_resource type="Image" id=13] -data = { -"data": PoolByteArray( 232, 246, 173, 190, 47, 95, 49, 189, 0, 0, 0, 0, 246, 232, 104, 62, 58, 231, 73, 188, 112, 8, 93, 190, 0, 0, 0, 0, 123, 148, 148, 61, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 60, 243, 217, 188, 0, 0, 0, 0, 206, 193, 28, 190, 104, 160, 139, 188, 17, 181, 131, 190, 0, 0, 0, 0, 95, 78, 11, 190, 159, 140, 27, 62, 126, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 159, 140, 27, 190, 126, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), -"format": "RGBAFloat", -"height": 1, -"mipmaps": false, -"width": 8 -} - -[sub_resource type="ImageTexture" id=8] -flags = 0 -flags = 0 -image = SubResource( 13 ) -size = Vector2( 8, 1 ) - -[sub_resource type="Resource" id=9] -script = ExtResource( 3 ) -allocation_size = 2 -texture = SubResource( 8 ) -image = SubResource( 6 ) - -[sub_resource type="Resource" id=10] -script = ExtResource( 6 ) -table = SubResource( 9 ) -vertices = PoolVector2Array( -0.756447, -0.652097, 0.124979, -0.403235, 0.123889, 0.100852, -0.396248, 0.0976196, -0.1, -0.1, 0.4, -0.1, 1.3759, 0.677717, -0.1, 0.4 ) - -[sub_resource type="Resource" id=11] -script = ExtResource( 2 ) -editable_list = [ SubResource( 10 ) ] - -[sub_resource type="Resource" id=12] -script = ExtResource( 4 ) -blueprint = ExtResource( 5 ) -table = SubResource( 9 ) -cells = [ SubResource( 11 ) ] - [resource] script = ExtResource( 1 ) resolution = Vector2( 1920, 1080 ) -tracks = [ SubResource( 5 ), SubResource( 12 ) ] +tracks = [ SubResource( 5 ) ] diff --git a/production/blueprints/mannequin/mat.tres b/production/blueprints/mannequin/mat.tres index fc2b89a..f1ba588 100644 --- a/production/blueprints/mannequin/mat.tres +++ b/production/blueprints/mannequin/mat.tres @@ -1,4 +1,6 @@ -[gd_resource type="ShaderMaterial" load_steps=4 format=2] +[gd_resource type="ShaderMaterial" load_steps=3 format=2] + +[ext_resource path="res://Bullshit/THIS SHOULD FIX IThoefully.tres" type="Texture" id=1] [sub_resource type="Shader" id=1] code = "shader_type spatial; @@ -53,22 +55,7 @@ void fragment() { ALBEDO = texture(table, UV).rgb; }" -[sub_resource type="Image" id=9] -data = { -"data": PoolByteArray( 146, 121, 211, 61, 105, 86, 230, 188, 0, 0, 0, 0, 252, 152, 127, 63, 240, 63, 201, 188, 72, 62, 73, 62, 0, 0, 0, 0, 29, 23, 26, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 225, 221, 100, 62, 58, 251, 45, 189, 0, 0, 0, 0, 220, 162, 139, 62, 30, 240, 195, 188, 186, 74, 183, 62, 0, 0, 0, 0, 248, 30, 185, 62, 11, 245, 66, 60, 50, 221, 41, 189, 0, 0, 0, 0, 0, 0, 128, 191, 11, 245, 66, 188, 50, 221, 41, 61, 0, 0, 0, 0, 0, 0, 128, 63 ), -"format": "RGBAFloat", -"height": 1, -"mipmaps": false, -"width": 8 -} - -[sub_resource type="ImageTexture" id=8] -flags = 0 -flags = 0 -image = SubResource( 9 ) -size = Vector2( 8, 1 ) - [resource] shader = SubResource( 1 ) -shader_param/canvas_transform = Basis( 0.715913, 0, -0.474076, 0, -1.32223, 0.449119, 0, 0, 1 ) -shader_param/table = SubResource( 8 ) +shader_param/canvas_transform = Basis( 1.08434, 0, -0.963855, 0, -2, 1, 0, 0, 1 ) +shader_param/table = ExtResource( 1 ) diff --git a/project.godot b/project.godot index 8f2935b..b629784 100644 --- a/project.godot +++ b/project.godot @@ -179,6 +179,16 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/summer_day/user_interface/canvas/rendering/viewport_handler.gd" }, { +"base": "Reference", +"class": "SummerDayZRange", +"language": "GDScript", +"path": "res://addons/summer_day/data/blueprint/z_range.gd" +}, { +"base": "Reference", +"class": "SummerDayZRangeManager", +"language": "GDScript", +"path": "res://addons/summer_day/data/blueprint/z_range_manager.gd" +}, { "base": "SummerDayTool", "class": "SummerDayZoomCanvasTool", "language": "GDScript", @@ -224,6 +234,8 @@ _global_script_class_icons={ "SummerDayToolPool": "", "SummerDayTrack": "", "SummerDayViewportHandler": "", +"SummerDayZRange": "", +"SummerDayZRangeManager": "", "SummerDayZoomCanvasTool": "", "VeryWorse": "" }