diff --git a/src/Classes/Cel3DParent.gd b/src/Classes/Cel3DParent.gd deleted file mode 100644 index 398816acd..000000000 --- a/src/Classes/Cel3DParent.gd +++ /dev/null @@ -1,92 +0,0 @@ -#class_name Cel3DParent -#extends Spatial -# -#signal selected_object(object) -# -#var cel #: Cel3D -#var hovering: Cel3DObject = null -#var selected: Cel3DObject = null setget _set_selected -#var dragging := false -#var has_been_dragged := false -#var prev_mouse_pos := Vector2.ZERO -# -#onready var camera := get_viewport().get_camera() -# -# -#func _ready() -> void: -# Global.connect("cel_changed", self, "_cel_changed") -# -# -#func _inputo(event: InputEvent) -> void: -# if event.is_action_pressed("delete") and is_instance_valid(selected): -# selected.delete() -# self.selected = null -# if not event is InputEventMouse: -# return -# if not cel.layer.can_layer_get_drawn(): -# return -# var found_cel := false -# for frame_layer in Global.current_project.selected_cels: -# if cel == Global.current_project.frames[frame_layer[0]].cels[frame_layer[1]]: -# found_cel = true -# if not found_cel: -# return -# var mouse_pos: Vector2 = event.position -# if event is InputEventMouseButton: -# if event.button_index == BUTTON_LEFT and event.pressed == true: -# if is_instance_valid(hovering): -# self.selected = hovering -# dragging = true -# prev_mouse_pos = mouse_pos -# else: -# # We're not hovering -# if is_instance_valid(selected): -# # If we're not clicking on a gizmo, unselect -# if selected.applying_gizmos == Cel3DObject.Gizmos.NONE: -# self.selected = null -# else: -# dragging = true -# prev_mouse_pos = mouse_pos -# elif event.button_index == BUTTON_LEFT and event.pressed == false: -# dragging = false -# if is_instance_valid(selected) and has_been_dragged: -# selected.finish_changing_property() -# has_been_dragged = false -# -# var ray_from := camera.project_ray_origin(mouse_pos) -# var ray_to := ray_from + camera.project_ray_normal(mouse_pos) * 20 -# var space_state := get_world().direct_space_state -# var selection := space_state.intersect_ray(ray_from, ray_to) -# -# if dragging and event is InputEventMouseMotion: -# has_been_dragged = true -# var proj_mouse_pos := camera.project_position(mouse_pos, camera.translation.z) -# var proj_prev_mouse_pos := camera.project_position(prev_mouse_pos, camera.translation.z) -# selected.change_transform(proj_mouse_pos, proj_prev_mouse_pos) -# prev_mouse_pos = mouse_pos -# -# # Hover logic -# if selection.empty(): -# if is_instance_valid(hovering): -# hovering.unhover() -# hovering = null -# else: -# if is_instance_valid(hovering): -# hovering.unhover() -# hovering = selection["collider"].get_parent() -# hovering.hover() -# -# -#func _set_selected(value: Cel3DObject) -> void: -# if value == selected: -# return -# if is_instance_valid(selected): # Unselect previous object if we selected something else -# selected.unselect() -# selected = value -# if is_instance_valid(selected): # Select new object -# selected.select() -# emit_signal("selected_object", value) -# -# -#func _cel_changed() -> void: -# self.selected = null diff --git a/src/UI/3D Options.tscn b/src/UI/3D Options.tscn deleted file mode 100644 index cc200192a..000000000 --- a/src/UI/3D Options.tscn +++ /dev/null @@ -1,823 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://src/UI/Options3D.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=2] -[ext_resource path="res://src/UI/Nodes/ValueSliderV2.tscn" type="PackedScene" id=3] -[ext_resource path="res://src/UI/Nodes/CollapsibleContainer.gd" type="Script" id=4] -[ext_resource path="res://src/UI/Nodes/ValueSliderV3.tscn" type="PackedScene" id=5] -[ext_resource path="res://src/UI/Nodes/ValueSlider.gd" type="Script" id=6] - -[node name="3D Options" type="PanelContainer"] -anchor_right = 1.0 -anchor_bottom = 1.0 -script = ExtResource( 1 ) - -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 7.0 -margin_top = 7.0 -margin_right = 1273.0 -margin_bottom = 713.0 - -[node name="HeaderHBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_right = 1266.0 -margin_bottom = 14.0 - -[node name="Label" type="Label" parent="VBoxContainer/HeaderHBoxContainer"] -margin_right = 73.0 -margin_bottom = 14.0 -theme_type_variation = "Header" -text = "3D Options" - -[node name="HSeparator" type="HSeparator" parent="VBoxContainer/HeaderHBoxContainer"] -margin_left = 77.0 -margin_right = 1266.0 -margin_bottom = 14.0 -size_flags_horizontal = 3 - -[node name="SelectedObjectontainer" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 18.0 -margin_right = 1266.0 -margin_bottom = 38.0 - -[node name="Label" type="Label" parent="VBoxContainer/SelectedObjectontainer"] -margin_top = 3.0 -margin_right = 631.0 -margin_bottom = 17.0 -size_flags_horizontal = 3 -text = "Selected object" - -[node name="ObjectOptionButton" type="OptionButton" parent="VBoxContainer/SelectedObjectontainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_right = 1266.0 -margin_bottom = 20.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "None" -items = [ "None", null, false, 0, null ] -selected = 0 - -[node name="NewObjectMenuButton" type="MenuButton" parent="VBoxContainer"] -margin_top = 42.0 -margin_right = 1266.0 -margin_bottom = 62.0 -mouse_default_cursor_shape = 2 -text = "Add new object" - -[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] -margin_top = 66.0 -margin_right = 1266.0 -margin_bottom = 706.0 -size_flags_vertical = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] -margin_right = 1266.0 -margin_bottom = 640.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="LayerOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer"] -unique_name_in_owner = true -margin_right = 1266.0 -margin_bottom = 640.0 -size_flags_vertical = 3 - -[node name="CameraOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions"] -margin_right = 1266.0 -margin_bottom = 128.0 -theme_type_variation = "CollapsibleContainer" -script = ExtResource( 4 ) -text = "Camera" -visible_content = true - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/CameraOptions"] -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 128.0 -columns = 2 - -[node name="ProjectionLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/CameraOptions/GridContainer"] -margin_top = 3.0 -margin_right = 631.0 -margin_bottom = 17.0 -size_flags_horizontal = 3 -text = "Projection" - -[node name="ProjectionOptionButton" type="OptionButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/CameraOptions/GridContainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_right = 1266.0 -margin_bottom = 20.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Perspective" -items = [ "Perspective", null, false, 0, null, "Orthogonal", null, false, 1, null, "Frustum", null, false, 2, null ] -selected = 0 - -[node name="RotationLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/CameraOptions/GridContainer"] -margin_top = 24.0 -margin_right = 631.0 -margin_bottom = 38.0 -size_flags_horizontal = 3 -size_flags_vertical = 0 -text = "Rotation" - -[node name="CameraRotation" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/CameraOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 104.0 -size_flags_horizontal = 3 -min_value = Vector3( -180, -180, -180 ) -max_value = Vector3( 180, 180, 180 ) -step = 0.1 -suffix_x = "°" -suffix_y = "°" -suffix_z = "°" - -[node name="EnvironmentOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions"] -margin_top = 132.0 -margin_right = 1266.0 -margin_bottom = 152.0 -theme_type_variation = "CollapsibleContainer" -script = ExtResource( 4 ) -text = "Environment" - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/EnvironmentOptions"] -visible = false -margin_right = 1266.0 -margin_bottom = 48.0 -columns = 2 - -[node name="AmbientColorLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/EnvironmentOptions/GridContainer"] -margin_top = 3.0 -margin_right = 631.0 -margin_bottom = 17.0 -size_flags_horizontal = 3 -text = "Ambient color" - -[node name="AmbientColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/EnvironmentOptions/GridContainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_right = 1266.0 -margin_bottom = 20.0 -size_flags_horizontal = 3 -edit_alpha = false - -[node name="AmbientEnergyLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/EnvironmentOptions/GridContainer"] -margin_top = 29.0 -margin_right = 631.0 -margin_bottom = 43.0 -size_flags_horizontal = 3 -text = "Ambient color energy" - -[node name="AmbientEnergy" parent="VBoxContainer/ScrollContainer/VBoxContainer/LayerOptions/EnvironmentOptions/GridContainer" instance=ExtResource( 2 )] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 48.0 -max_value = 16.0 -step = 0.01 -value = 1.0 -allow_greater = true - -[node name="ObjectOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer"] -unique_name_in_owner = true -visible = false -margin_top = 334.0 -margin_right = 1266.0 -margin_bottom = 664.0 -size_flags_vertical = 3 - -[node name="TransformOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions"] -margin_right = 1266.0 -margin_bottom = 272.0 -theme_type_variation = "CollapsibleContainer" -script = ExtResource( 4 ) -text = "Transform" -visible_content = true - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions"] -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 272.0 -columns = 2 - -[node name="PositionLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer"] -margin_right = 631.0 -margin_bottom = 80.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -text = "Position" - -[node name="ObjectPosition" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -size_flags_horizontal = 3 -min_value = Vector3( -20, -20, -20 ) -max_value = Vector3( 20, 20, 20 ) -step = 0.01 -allow_greater = true -allow_lesser = true -suffix_x = "m" -suffix_y = "m" -suffix_z = "m" - -[node name="RotationLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer"] -margin_top = 84.0 -margin_right = 631.0 -margin_bottom = 164.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -text = "Rotation" - -[node name="ObjectRotation" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -margin_top = -226.0 -margin_right = 631.0 -margin_bottom = -146.0 -size_flags_horizontal = 3 -min_value = Vector3( -180, -180, -180 ) -max_value = Vector3( 180, 180, 180 ) -step = 0.1 -suffix_x = "°" -suffix_y = "°" -suffix_z = "°" - -[node name="ScaleLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer"] -margin_top = 168.0 -margin_right = 631.0 -margin_bottom = 248.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -text = "Scale" - -[node name="ObjectScale" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/TransformOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -margin_bottom = 80.0 -size_flags_horizontal = 3 -value = Vector3( 100, 100, 100 ) -step = 0.01 -allow_greater = true -allow_lesser = true -show_ratio = true -suffix_x = "%" -suffix_y = "%" -suffix_z = "%" - -[node name="MeshOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions"] -unique_name_in_owner = true -margin_top = 276.0 -margin_right = 1266.0 -margin_bottom = 296.0 -theme_type_variation = "CollapsibleContainer" -script = ExtResource( 4 ) -text = "Mesh" - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions"] -visible = false -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 104.0 -columns = 2 - -[node name="MeshSizeLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Size" - -[node name="MeshSize" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -size_flags_horizontal = 3 -max_value = Vector3( 10, 10, 10 ) -step = 0.01 -allow_greater = true -show_ratio = true - -[node name="MeshSizeLabel2" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Size" - -[node name="MeshSizeV2" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer" instance=ExtResource( 3 )] -unique_name_in_owner = true -margin_right = 52.0 -size_flags_horizontal = 3 -max_value = Vector2( 10, 10 ) -allow_greater = true -show_ratio = true -snap_step = 0.01 - -[node name="MeshCenterOffsetLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Center offset" - -[node name="MeshCenterOffset" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer" instance=ExtResource( 5 )] -unique_name_in_owner = true -size_flags_horizontal = 3 -max_value = Vector3( 10, 10, 10 ) -step = 0.01 -allow_greater = true -allow_lesser = true -show_ratio = true - -[node name="MeshLeftToRightLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Left to right" - -[node name="MeshLeftToRight" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = -2.0 -max_value = 2.0 -step = 0.1 -value = 0.5 -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshRadiusLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Radius" - -[node name="MeshRadius" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 0.001 -max_value = 10.0 -step = 0.01 -value = 1.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshHeightLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Height" - -[node name="MeshHeight" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 0.001 -max_value = 10.0 -step = 0.01 -value = 2.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshRadialSegmentsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Radial segments" - -[node name="MeshRadialSegments" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 4.0 -max_value = 640.0 -value = 64.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshRingsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Rings" - -[node name="MeshRings" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 1.0 -max_value = 320.0 -value = 32.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshIsHemisphereLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Is hemisphere" - -[node name="MeshIsHemisphere" type="CheckBox" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 24.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "On" - -[node name="MeshMidHeightLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Mid height" - -[node name="MeshMidHeight" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 0.001 -max_value = 10.0 -step = 0.01 -value = 1.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshTopRadiusLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Top radius" - -[node name="MeshTopRadius" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -max_value = 10.0 -step = 0.01 -value = 1.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshBottomRadiusLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Bottom radius" - -[node name="MeshBottomRadius" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -max_value = 10.0 -step = 0.01 -value = 1.0 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshTextLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Text" - -[node name="MeshText" type="LineEdit" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 58.0 -margin_bottom = 24.0 -size_flags_horizontal = 3 - -[node name="MeshPixelSizeLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Pixel size" - -[node name="MeshPixelSize" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 0.001 -max_value = 10.0 -step = 0.001 -value = 0.01 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) -snap_step = 0.01 - -[node name="MeshCurveStepLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Curve step" - -[node name="MeshCurveStep" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -min_value = 0.1 -max_value = 10.0 -step = 0.1 -value = 0.5 -allow_greater = true -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="MeshHorizontalAlignmentLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -margin_top = -583.0 -margin_right = 631.0 -margin_bottom = -569.0 -size_flags_horizontal = 3 -text = "Horizontal alignment" - -[node name="MeshHorizontalAlignment" type="OptionButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/MeshOptions/GridContainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = -586.0 -margin_right = 1266.0 -margin_bottom = -566.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Center" -items = [ "Left", null, false, 0, null, "Center", null, false, 1, null, "Right", null, false, 2, null ] -selected = 1 - -[node name="LightOptions" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions"] -unique_name_in_owner = true -margin_top = 276.0 -margin_right = 1266.0 -margin_bottom = 296.0 -theme_type_variation = "CollapsibleContainer" -script = ExtResource( 4 ) -text = "Light" - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions"] -visible = false -margin_top = 24.0 -margin_right = 1266.0 -margin_bottom = 104.0 -columns = 2 - -[node name="LightColorLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = -499.0 -margin_right = 631.0 -margin_bottom = -485.0 -size_flags_horizontal = 3 -text = "Color" - -[node name="LightColor" type="ColorPickerButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = -502.0 -margin_right = 1266.0 -margin_bottom = -482.0 -size_flags_horizontal = 3 -color = Color( 1, 1, 1, 1 ) -edit_alpha = false - -[node name="LightEnergyLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = -473.0 -margin_right = 631.0 -margin_bottom = -459.0 -size_flags_horizontal = 3 -text = "Energy" - -[node name="LightEnergy" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer" instance=ExtResource( 2 )] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = -478.0 -margin_right = 1266.0 -margin_bottom = -454.0 -max_value = 16.0 -step = 0.01 -value = 1.0 -allow_greater = true - -[node name="LightNegativeLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Negative" - -[node name="LightNegative" type="CheckBox" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 47.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "On" - -[node name="ShadowEnabledLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Shadow" - -[node name="ShadowEnabled" type="CheckBox" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 47.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "On" - -[node name="ShadowColorLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = -499.0 -margin_right = 631.0 -margin_bottom = -485.0 -size_flags_horizontal = 3 -text = "Shadow color" - -[node name="ShadowColor" type="ColorPickerButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_left = 635.0 -margin_top = -502.0 -margin_right = 1266.0 -margin_bottom = -482.0 -size_flags_horizontal = 3 -edit_alpha = false - -[node name="OmniRangeLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Range" - -[node name="OmniRange" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -max_value = 4096.0 -step = 0.01 -value = 5.0 -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="SpotRangeLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Range" - -[node name="SpotRange" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -max_value = 4096.0 -step = 0.01 -value = 5.0 -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="SpotAngleLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -margin_top = 33.0 -margin_right = 631.0 -margin_bottom = 47.0 -size_flags_horizontal = 3 -text = "Angle" - -[node name="SpotAngle" type="TextureProgress" parent="VBoxContainer/ScrollContainer/VBoxContainer/ObjectOptions/LightOptions/GridContainer"] -unique_name_in_owner = true -margin_right = 6.0 -margin_bottom = 6.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -theme_type_variation = "ValueSlider" -max_value = 180.0 -step = 0.01 -value = 45.0 -nine_patch_stretch = true -stretch_margin_left = 3 -stretch_margin_top = 3 -stretch_margin_right = 3 -stretch_margin_bottom = 3 -script = ExtResource( 6 ) - -[node name="UndoRedoTimer" type="Timer" parent="."] -wait_time = 0.2 -one_shot = true - -[node name="LoadModelDialog" type="FileDialog" parent="."] -margin_top = 590.0 -margin_right = 515.0 -margin_bottom = 938.0 -rect_min_size = Vector2( 515, 348 ) -window_title = "Open File(s)" -resizable = true -mode = 1 -access = 2 -filters = PoolStringArray( "*.obj" ) -show_hidden_files = true - -[connection signal="item_selected" from="VBoxContainer/SelectedObjectontainer/ObjectOptionButton" to="." method="_on_ObjectOptionButton_item_selected"] -[connection signal="timeout" from="UndoRedoTimer" to="." method="_on_UndoRedoTimer_timeout"] -[connection signal="files_selected" from="LoadModelDialog" to="." method="_on_LoadModelDialog_files_selected"] -[connection signal="popup_hide" from="LoadModelDialog" to="." method="_on_LoadModelDialog_popup_hide"] diff --git a/src/UI/Options3D.gd b/src/UI/Options3D.gd deleted file mode 100644 index 5b9b99c95..000000000 --- a/src/UI/Options3D.gd +++ /dev/null @@ -1,310 +0,0 @@ -extends PanelContainer - -var cel: Cel3D -var can_start_timer := true - -onready var object_option_button := $"%ObjectOptionButton" as OptionButton -onready var new_object_menu_button: MenuButton = $VBoxContainer/NewObjectMenuButton -onready var layer_options: Container = $"%LayerOptions" -onready var object_options: Container = $"%ObjectOptions" -onready var mesh_options: VBoxContainer = $"%MeshOptions" -onready var light_options: VBoxContainer = $"%LightOptions" -onready var undo_redo_timer: Timer = $UndoRedoTimer -onready var load_model_dialog: FileDialog = $LoadModelDialog - -onready var layer_properties := { - "camera:projection": $"%ProjectionOptionButton", - "camera:rotation_degrees": $"%CameraRotation", - "viewport:world:environment:ambient_light_color": $"%AmbientColorPickerButton", - "viewport:world:environment:ambient_light_energy": $"%AmbientEnergy", -} - -onready var object_properties := { - "translation": $"%ObjectPosition", - "rotation_degrees": $"%ObjectRotation", - "scale": $"%ObjectScale", - "node3d_type:mesh:size": $"%MeshSize", - "node3d_type:mesh:sizev2": $"%MeshSizeV2", - "node3d_type:mesh:center_offset": $"%MeshCenterOffset", - "node3d_type:mesh:left_to_right": $"%MeshLeftToRight", - "node3d_type:mesh:radius": $"%MeshRadius", - "node3d_type:mesh:height": $"%MeshHeight", - "node3d_type:mesh:radial_segments": $"%MeshRadialSegments", - "node3d_type:mesh:rings": $"%MeshRings", - "node3d_type:mesh:is_hemisphere": $"%MeshIsHemisphere", - "node3d_type:mesh:mid_height": $"%MeshMidHeight", - "node3d_type:mesh:top_radius": $"%MeshTopRadius", - "node3d_type:mesh:bottom_radius": $"%MeshBottomRadius", - "node3d_type:mesh:text": $"%MeshText", - "node3d_type:mesh:pixel_size": $"%MeshPixelSize", - "node3d_type:mesh:curve_step": $"%MeshCurveStep", - "node3d_type:mesh:horizontal_alignment": $"%MeshHorizontalAlignment", - "node3d_type:light_color": $"%LightColor", - "node3d_type:light_energy": $"%LightEnergy", - "node3d_type:light_negative": $"%LightNegative", - "node3d_type:shadow_enabled": $"%ShadowEnabled", - "node3d_type:shadow_color": $"%ShadowColor", - "node3d_type:omni_range": $"%OmniRange", - "node3d_type:spot_range": $"%SpotRange", - "node3d_type:spot_angle": $"%SpotAngle", -} - - -func _ready() -> void: - Global.connect("cel_changed", self, "_cel_changed") - var new_object_popup := new_object_menu_button.get_popup() - new_object_popup.add_item("Box") - new_object_popup.add_item("Sphere") - new_object_popup.add_item("Capsule") - new_object_popup.add_item("Cylinder") - new_object_popup.add_item("Prism") - new_object_popup.add_item("Plane") - new_object_popup.add_item("Text") - new_object_popup.add_item("Directional light") - new_object_popup.add_item("Spotlight") - new_object_popup.add_item("Omnidirectional (point) light") - new_object_popup.add_item("Load model from file") - new_object_popup.connect("id_pressed", self, "_add_new_object") - for prop in layer_properties: - var node: Control = layer_properties[prop] - if node is ValueSliderV3: - node.connect("value_changed", self, "_layer_property_vector3_changed", [prop]) - elif node is Range: - node.connect("value_changed", self, "_layer_property_value_changed", [prop]) - elif node is OptionButton: - node.connect("item_selected", self, "_layer_property_item_selected", [prop]) - elif node is ColorPickerButton: - node.connect("color_changed", self, "_layer_property_color_changed", [prop]) - for prop in object_properties: - var node: Control = object_properties[prop] - if node is ValueSliderV3: - node.connect("value_changed", self, "_object_property_vector3_changed", [prop]) - elif node is ValueSliderV2: - var property_path: String = prop - if property_path.ends_with("v2"): - property_path = property_path.replace("v2", "") - node.connect("value_changed", self, "_object_property_vector2_changed", [property_path]) - elif node is Range: - node.connect("value_changed", self, "_object_property_value_changed", [prop]) - elif node is OptionButton: - node.connect("item_selected", self, "_object_property_item_selected", [prop]) - elif node is ColorPickerButton: - node.connect("color_changed", self, "_object_property_color_changed", [prop]) - elif node is CheckBox: - node.connect("toggled", self, "_object_property_toggled", [prop]) - elif node is LineEdit: - node.connect("text_changed", self, "_object_property_text_changed", [prop]) - - -func _on_ObjectOptionButton_item_selected(index: int) -> void: - if not cel is Cel3D: - return - var id := object_option_button.get_item_id(index) - 1 - var parent: Cel3DParent = cel.parent_node - var object := cel.get_object_from_id(id) - if not is_instance_valid(object): - parent.selected = null - return - parent.selected = object - - -func _cel_changed() -> void: - if not Global.current_project.get_current_cel() is Cel3D: - get_child(0).visible = false - return - get_child(0).visible = true - cel = Global.current_project.get_current_cel() - var layer: Layer3D = cel.layer - if not layer.is_connected("property_changed", self, "_set_layer_node_values"): - layer.connect("property_changed", self, "_set_layer_node_values") - layer.connect("objects_changed", self, "_fill_object_option_button") - var parent: Cel3DParent = cel.parent_node - if not is_instance_valid(parent): - print("Parent not found") - return - if not parent.is_connected("selected_object", self, "_selected_object"): - parent.connect("selected_object", self, "_selected_object") - layer_options.visible = true - object_options.visible = false - _set_layer_node_values() - _fill_object_option_button() - - -func _add_new_object(id: int) -> void: - if id == Cel3DObject.Type.IMPORTED: - load_model_dialog.popup_centered() - Global.dialog_open(true) - else: - cel.layer.add_object(id) - - -func _selected_object(object: Cel3DObject) -> void: - if is_instance_valid(object): - layer_options.visible = false - object_options.visible = true - for prop in object_properties: # Hide irrelevant nodes - var node: Control = object_properties[prop] - var property_path: String = prop - if property_path.ends_with("v2"): - property_path = property_path.replace("v2", "") - var prev_node: Control = node.get_parent().get_child(node.get_index() - 1) - var property = object.get_indexed(property_path) - var property_exists: bool = property != null - # Differentiate between the mesh size of a box/prism (Vector3) and a plane (Vector2) - if node is ValueSliderV3 and typeof(property) != TYPE_VECTOR3: - property_exists = false - elif node is ValueSliderV2 and typeof(property) != TYPE_VECTOR2: - property_exists = false - prev_node.visible = property_exists - node.visible = property_exists - mesh_options.visible = object.node3d_type is MeshInstance - light_options.visible = object.node3d_type is Light - _set_object_node_values() - if not object.is_connected("property_changed", self, "_set_object_node_values"): - object.connect("property_changed", self, "_set_object_node_values") - object_option_button.select(object_option_button.get_item_index(object.id + 1)) - else: - layer_options.visible = true - object_options.visible = false - object_option_button.select(0) - - -func _set_layer_node_values() -> void: - can_start_timer = false - _set_node_values(cel, layer_properties) - can_start_timer = true - - -func _set_object_node_values() -> void: - var object: Cel3DObject = cel.parent_node.selected - if not is_instance_valid(object): - return - can_start_timer = false - _set_node_values(object, object_properties) - can_start_timer = true - - -func _set_node_values(to_edit: Object, properties: Dictionary) -> void: - for prop in properties: - var property_path: String = prop - if property_path.ends_with("v2"): - property_path = property_path.replace("v2", "") - var value = to_edit.get_indexed(property_path) - if value == null: - continue - if "scale" in prop: - value *= 100 - var node: Control = properties[prop] - if node is Range or node is ValueSliderV3 or node is ValueSliderV2: - if typeof(node.value) != typeof(value) and typeof(value) != TYPE_INT: - continue - node.value = value - elif node is OptionButton: - node.selected = value - elif node is ColorPickerButton: - node.color = value - elif node is CheckBox: - node.pressed = value - elif node is LineEdit: - node.text = value - - -func _set_value_from_node(to_edit: Object, value, prop: String) -> void: - if "mesh_" in prop: - prop = prop.replace("mesh_", "") - to_edit = to_edit.node3d_type.mesh - if "scale" in prop: - value /= 100 - to_edit.set_indexed(prop, value) - - -func _layer_property_vector3_changed(value: Vector3, prop: String) -> void: - _set_value_from_node(cel, value, prop) - _value_handle_change() - Global.canvas.gizmos_3d.update() - - -func _layer_property_value_changed(value: float, prop: String) -> void: - _set_value_from_node(cel, value, prop) - _value_handle_change() - Global.canvas.gizmos_3d.update() - - -func _layer_property_item_selected(value: int, prop: String) -> void: - _set_value_from_node(cel, value, prop) - _value_handle_change() - Global.canvas.gizmos_3d.update() - - -func _layer_property_color_changed(value: Color, prop: String) -> void: - _set_value_from_node(cel, value, prop) - _value_handle_change() - Global.canvas.gizmos_3d.update() - - -func _object_property_vector3_changed(value: Vector3, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_vector2_changed(value: Vector2, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_value_changed(value: float, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_item_selected(value: int, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_color_changed(value: Color, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_toggled(value: bool, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _object_property_text_changed(value: String, prop: String) -> void: - _set_value_from_node(cel.parent_node.selected, value, prop) - _value_handle_change() - - -func _value_handle_change() -> void: - if can_start_timer: - undo_redo_timer.start() - - -func _fill_object_option_button() -> void: - if not cel is Cel3D: - return - var layer: Layer3D = cel.layer - object_option_button.clear() - object_option_button.add_item("None", 0) - for id in layer.objects: - var item_name: String = Cel3DObject.Type.keys()[layer.objects[id]] - object_option_button.add_item(item_name, id + 1) - - -func _on_UndoRedoTimer_timeout() -> void: - if is_instance_valid(cel.parent_node.selected): - cel.parent_node.selected.finish_changing_property() - else: - var new_properties := cel.serialize_layer_properties() - cel.layer.change_properties(new_properties) - - -func _on_LoadModelDialog_files_selected(paths: PoolStringArray) -> void: - for path in paths: - cel.layer.add_object(Cel3DObject.Type.IMPORTED, true, path) - - -func _on_LoadModelDialog_popup_hide() -> void: - Global.dialog_open(false)