Add lever and jump pad components with activation logic
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
class_name SS2D_NormalRangeEditor
|
||||
|
||||
signal value_changed
|
||||
|
||||
var start: float: get = _get_start, set = _set_start
|
||||
var end: float: get = _get_end, set = _set_end
|
||||
var zero_equals_full_circle := true
|
||||
|
||||
var _progress_bar: TextureProgressBar:
|
||||
get:
|
||||
if _progress_bar == null:
|
||||
_progress_bar = get_node_or_null("%TextureProgressBar")
|
||||
return _progress_bar
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_initial_angles()
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
_set_initial_angles()
|
||||
|
||||
|
||||
func _set_initial_angles() -> void:
|
||||
_set_start(_progress_bar.radial_initial_angle)
|
||||
_set_end(_progress_bar.radial_fill_degrees)
|
||||
|
||||
|
||||
func _on_startSlider_value_changed(value: float) -> void:
|
||||
_set_start(value)
|
||||
|
||||
|
||||
func _on_endSlider_value_changed(value: float) -> void:
|
||||
_set_end(value)
|
||||
|
||||
|
||||
func _set_start(value: float) -> void:
|
||||
var fill: float = _progress_bar.radial_fill_degrees
|
||||
var init_angle: float = 360.0 - fill - value + 90.0
|
||||
_progress_bar.radial_initial_angle = _mutate_angle_deg(init_angle)
|
||||
|
||||
|
||||
func _get_start() -> float:
|
||||
return _progress_bar.radial_initial_angle
|
||||
|
||||
|
||||
func _set_end(value: float) -> void:
|
||||
_progress_bar.radial_fill_degrees = _mutate_angle_deg(value)
|
||||
|
||||
|
||||
func _get_end() -> float:
|
||||
return _progress_bar.radial_fill_degrees
|
||||
|
||||
|
||||
func _on_SS2D_StartEditorSpinSlider_value_changed(value: float) -> void:
|
||||
_set_start(value)
|
||||
|
||||
|
||||
func _mutate_angle_deg(v: float) -> float:
|
||||
if zero_equals_full_circle and v == 0.0:
|
||||
return 360.0
|
||||
return v
|
||||
@@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cg1vy768oxwxr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dajqljvjm2d2q" path="res://addons/rmsmartshape/editors/NormalRangeEditor/progress_texture.png" id="1"]
|
||||
[ext_resource type="Script" path="res://addons/rmsmartshape/editors/NormalRangeEditor/NormalRangeEditor.gd" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgd4sbhsw1no3" path="res://addons/rmsmartshape/editors/NormalRangeEditor/over_texture.png" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cax163h05b60j" path="res://addons/rmsmartshape/editors/NormalRangeEditor/under_texture.png" id="4"]
|
||||
|
||||
[node name="NormalRangeEditor" type="VBoxContainer"]
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.087
|
||||
anchor_bottom = 0.027
|
||||
offset_right = 38.912
|
||||
offset_bottom = 203.8
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 9
|
||||
script = ExtResource("2")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="CenterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.0
|
||||
value = 1.0
|
||||
fill_mode = 4
|
||||
texture_under = ExtResource("4")
|
||||
texture_over = ExtResource("3")
|
||||
texture_progress = ExtResource("1")
|
||||
radial_initial_angle = 79.3
|
||||
radial_fill_degrees = 93.8
|
||||
@@ -0,0 +1,26 @@
|
||||
extends EditorProperty
|
||||
class_name SS2D_NormalRangeEditorProperty
|
||||
|
||||
var control: SS2D_NormalRangeEditor = preload(
|
||||
"res://addons/rmsmartshape/editors/NormalRangeEditor/NormalRangeEditor.tscn"
|
||||
).instantiate()
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
add_child(control)
|
||||
add_focusable(control)
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
control.connect("value_changed", self._value_changed)
|
||||
_value_changed()
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
control.disconnect("value_changed", self._value_changed)
|
||||
|
||||
|
||||
func _value_changed() -> void:
|
||||
var obj: SS2D_NormalRange = get_edited_object()
|
||||
control.end = obj.distance
|
||||
control.start = obj.begin
|
||||
BIN
addons/rmsmartshape/editors/NormalRangeEditor/over_texture.png
Normal file
BIN
addons/rmsmartshape/editors/NormalRangeEditor/over_texture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dgd4sbhsw1no3"
|
||||
path="res://.godot/imported/over_texture.png-8aa46a605c51c9642f0609a4a8bbd43d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rmsmartshape/editors/NormalRangeEditor/over_texture.png"
|
||||
dest_files=["res://.godot/imported/over_texture.png-8aa46a605c51c9642f0609a4a8bbd43d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dajqljvjm2d2q"
|
||||
path="res://.godot/imported/progress_texture.png-5c3ce00c522dd3c8b7a6f676bd7a3382.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rmsmartshape/editors/NormalRangeEditor/progress_texture.png"
|
||||
dest_files=["res://.godot/imported/progress_texture.png-5c3ce00c522dd3c8b7a6f676bd7a3382.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
addons/rmsmartshape/editors/NormalRangeEditor/under_texture.png
Normal file
BIN
addons/rmsmartshape/editors/NormalRangeEditor/under_texture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cax163h05b60j"
|
||||
path="res://.godot/imported/under_texture.png-87a243e17179ba2b162ef41ea65a8e51.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/rmsmartshape/editors/NormalRangeEditor/under_texture.png"
|
||||
dest_files=["res://.godot/imported/under_texture.png-87a243e17179ba2b162ef41ea65a8e51.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user