mirror of
https://github.com/Relintai/godot-resources-as-sheets-plugin.git
synced 2024-11-10 10:12:08 +01:00
Bug fixes, example changes and docks setup
This commit is contained in:
parent
7dba17f840
commit
7f30ee06fd
@ -8,6 +8,7 @@ export(Array, Script) var cell_editor_classes := []
|
||||
export var path_folder_path := NodePath("")
|
||||
export var path_recent_paths := NodePath("")
|
||||
export var path_table_root := NodePath("")
|
||||
export var path_property_editors := NodePath("")
|
||||
|
||||
var editor_interface : EditorInterface
|
||||
var editor_plugin : EditorPlugin
|
||||
@ -82,7 +83,7 @@ func display_folder(folderpath : String, sort_by : String = "", sort_reverse : b
|
||||
if columns.size() == 0: return
|
||||
|
||||
get_node(path_folder_path).text = folderpath
|
||||
_create_table(get_node(path_table_root), force_rebuild || current_path != folderpath)
|
||||
_create_table(get_node(path_table_root), force_rebuild or current_path != folderpath)
|
||||
current_path = folderpath
|
||||
|
||||
|
||||
@ -189,7 +190,6 @@ func _create_table(root_node : Control, columns_changed : bool):
|
||||
column_editors[j].set_color(new_node, next_color)
|
||||
|
||||
|
||||
|
||||
func add_path_to_recent(path : String, is_loading : bool = false):
|
||||
if path in recent_paths: return
|
||||
|
||||
@ -273,6 +273,13 @@ func select_cell(cell : Control):
|
||||
column_editors[column_index].set_selected(cell, true)
|
||||
edited_cells.append(cell)
|
||||
edit_cursor_positions.append(column_editors[column_index].get_text_length(cell))
|
||||
|
||||
for x in get_node(path_property_editors).get_children():
|
||||
x.visible = x.can_edit_value(
|
||||
column_editors[column_index].get_value(cell),
|
||||
column_types[_get_cell_column(cell)],
|
||||
column_hints[_get_cell_column(cell)]
|
||||
)
|
||||
return
|
||||
|
||||
if column_index != _get_cell_column(edited_cells[edited_cells.size() - 1]):
|
||||
@ -284,6 +291,10 @@ func select_cell(cell : Control):
|
||||
|
||||
for i in range(row_end, row_start, 1 if row_start > row_end else -1):
|
||||
var cur_cell := table_root.get_child(i * columns.size() + column_index)
|
||||
if !cur_cell.visible:
|
||||
# When search is active, some cells will be hidden.
|
||||
continue
|
||||
|
||||
column_editors[column_index].set_selected(cur_cell, true)
|
||||
edited_cells.append(cur_cell)
|
||||
edit_cursor_positions.append(column_editors[column_index].get_text_length(cur_cell))
|
||||
@ -315,6 +326,9 @@ func _get_cell_row(cell) -> int:
|
||||
|
||||
func _on_cell_gui_input(event : InputEvent, cell : Control):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index != BUTTON_LEFT:
|
||||
return
|
||||
|
||||
grab_focus()
|
||||
if event.pressed:
|
||||
if cell in edited_cells:
|
||||
@ -353,7 +367,7 @@ func _input(event : InputEvent):
|
||||
if column_types[_get_cell_column(edited_cells[0])] == TYPE_OBJECT:
|
||||
return
|
||||
|
||||
if event.scancode == KEY_CONTROL || event.scancode == KEY_SHIFT:
|
||||
if event.scancode == KEY_CONTROL or event.scancode == KEY_SHIFT:
|
||||
# Modifier keys do not get processed.
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/editor_view.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_cells/cell_editor_string.gd" type="Script" id=2]
|
||||
@ -6,6 +6,8 @@
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/editor_icon_button.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_cells/cell_editor_bool.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/table_header.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_editors/dock_color.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_editors/dock_number.tscn" type="PackedScene" id=8]
|
||||
|
||||
[sub_resource type="Image" id=3]
|
||||
data = {
|
||||
@ -47,6 +49,7 @@ cell_editor_classes = [ ExtResource( 3 ), ExtResource( 5 ), ExtResource( 2 ) ]
|
||||
path_folder_path = NodePath("HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path")
|
||||
path_recent_paths = NodePath("HeaderContentSplit/VBoxContainer/HBoxContainer/RecentPaths")
|
||||
path_table_root = NodePath("HeaderContentSplit/MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid")
|
||||
path_property_editors = NodePath("HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/PropertyEditors")
|
||||
|
||||
[node name="HeaderContentSplit" type="VBoxContainer" parent="."]
|
||||
margin_left = 2.0
|
||||
|
@ -17,6 +17,7 @@ __meta__ = {
|
||||
show_behind_parent = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
focus_mode = 0
|
||||
mouse_filter = 2
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
editable = false
|
||||
|
@ -9,7 +9,7 @@ func can_edit_value(value, type, property_hint) -> bool:
|
||||
|
||||
func get_value(node : Control):
|
||||
var val = TextEditingUtils.revert_non_typing(node.text)
|
||||
if val.length() == 3 || val.length() == 6 || val.length() == 8:
|
||||
if val.length() == 3 or val.length() == 6 or val.length() == 8:
|
||||
return Color(val)
|
||||
|
||||
else:
|
||||
|
@ -1 +0,0 @@
|
||||
class_name ResourceSpreadsheetEditor
|
@ -0,0 +1,7 @@
|
||||
tool
|
||||
class_name SheetsDockEditor
|
||||
extends Control
|
||||
|
||||
# Override to define when to show the dock.
|
||||
func can_edit_value(value, type, property_hint) -> bool:
|
||||
return true
|
@ -0,0 +1,6 @@
|
||||
tool
|
||||
extends SheetsDockEditor
|
||||
|
||||
|
||||
func can_edit_value(value, type, property_hint) -> bool:
|
||||
return type == TYPE_COLOR
|
414
addons/resources_speadsheet_view/typed_editors/dock_color.tscn
Normal file
414
addons/resources_speadsheet_view/typed_editors/dock_color.tscn
Normal file
@ -0,0 +1,414 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_editors/dock_color.gd" type="Script" id=1]
|
||||
|
||||
[node name="EditColor" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 86.0
|
||||
rect_pivot_offset = Vector2( -460, -28 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Header"]
|
||||
margin_right = 455.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="Header/HBoxContainer"]
|
||||
margin_right = 70.0
|
||||
margin_bottom = 14.0
|
||||
text = "EDIT: Color"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Header/HBoxContainer"]
|
||||
margin_left = 74.0
|
||||
margin_right = 455.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label2" type="Label" parent="Header"]
|
||||
margin_left = 459.0
|
||||
margin_right = 565.0
|
||||
margin_bottom = 14.0
|
||||
text = "PROPERTY NAME"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="Header"]
|
||||
margin_left = 569.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="EditColor" type="HBoxContainer" parent="."]
|
||||
margin_top = 18.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 86.0
|
||||
alignment = 1
|
||||
|
||||
[node name="VSeparator7" type="Control" parent="EditColor"]
|
||||
margin_right = 188.0
|
||||
margin_bottom = 68.0
|
||||
rect_min_size = Vector2( 16, 0 )
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VSeparator3" type="Control" parent="EditColor"]
|
||||
visible = false
|
||||
margin_right = 16.0
|
||||
margin_bottom = 68.0
|
||||
rect_min_size = Vector2( 16, 0 )
|
||||
|
||||
[node name="ButtonRowTemplate" type="Control" parent="EditColor"]
|
||||
visible = false
|
||||
margin_left = 20.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[node name="Button3" type="Button" parent="EditColor/ButtonRowTemplate"]
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button2" type="Button" parent="EditColor/ButtonRowTemplate"]
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label" type="Label" parent="EditColor/ButtonRowTemplate"]
|
||||
margin_left = 87.0
|
||||
margin_top = 3.0
|
||||
margin_right = 111.0
|
||||
margin_bottom = 17.0
|
||||
text = "Red"
|
||||
align = 1
|
||||
|
||||
[node name="Button5" type="Button" parent="EditColor/ButtonRowTemplate"]
|
||||
margin_left = 147.0
|
||||
margin_right = 175.0
|
||||
margin_bottom = 20.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button6" type="Button" parent="EditColor/ButtonRowTemplate"]
|
||||
margin_left = 179.0
|
||||
margin_right = 207.0
|
||||
margin_bottom = 20.0
|
||||
text = "+X"
|
||||
|
||||
[node name="RGBGrid" type="GridContainer" parent="EditColor"]
|
||||
margin_left = 192.0
|
||||
margin_right = 353.0
|
||||
margin_bottom = 68.0
|
||||
columns = 5
|
||||
|
||||
[node name="Button3" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 1, 0.780392, 0.780392, 1 )
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button2" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 1, 0.780392, 0.780392, 1 )
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label" type="Label" parent="EditColor/RGBGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 3.0
|
||||
margin_right = 97.0
|
||||
margin_bottom = 17.0
|
||||
text = "Red"
|
||||
align = 1
|
||||
|
||||
[node name="Button5" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 1, 0.780392, 0.780392, 1 )
|
||||
margin_left = 101.0
|
||||
margin_right = 129.0
|
||||
margin_bottom = 20.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button6" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 1, 0.780392, 0.780392, 1 )
|
||||
margin_left = 133.0
|
||||
margin_right = 161.0
|
||||
margin_bottom = 20.0
|
||||
text = "+X"
|
||||
|
||||
[node name="Button7" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.666667, 1, 0.745098, 1 )
|
||||
margin_top = 24.0
|
||||
margin_right = 25.0
|
||||
margin_bottom = 44.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button8" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.666667, 1, 0.745098, 1 )
|
||||
margin_left = 29.0
|
||||
margin_top = 24.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 44.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label2" type="Label" parent="EditColor/RGBGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 27.0
|
||||
margin_right = 97.0
|
||||
margin_bottom = 41.0
|
||||
text = "Green"
|
||||
align = 1
|
||||
|
||||
[node name="Button11" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.666667, 1, 0.745098, 1 )
|
||||
margin_left = 101.0
|
||||
margin_top = 24.0
|
||||
margin_right = 129.0
|
||||
margin_bottom = 44.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button12" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.666667, 1, 0.745098, 1 )
|
||||
margin_left = 133.0
|
||||
margin_top = 24.0
|
||||
margin_right = 161.0
|
||||
margin_bottom = 44.0
|
||||
text = "+X"
|
||||
|
||||
[node name="Button13" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.772549, 0.792157, 1, 1 )
|
||||
margin_top = 48.0
|
||||
margin_right = 25.0
|
||||
margin_bottom = 68.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button14" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.772549, 0.792157, 1, 1 )
|
||||
margin_left = 29.0
|
||||
margin_top = 48.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 68.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label3" type="Label" parent="EditColor/RGBGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 51.0
|
||||
margin_right = 97.0
|
||||
margin_bottom = 65.0
|
||||
text = "Blue"
|
||||
align = 1
|
||||
|
||||
[node name="Button17" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.772549, 0.792157, 1, 1 )
|
||||
margin_left = 101.0
|
||||
margin_top = 48.0
|
||||
margin_right = 129.0
|
||||
margin_bottom = 68.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button18" type="Button" parent="EditColor/RGBGrid"]
|
||||
modulate = Color( 0.772549, 0.792157, 1, 1 )
|
||||
margin_left = 133.0
|
||||
margin_top = 48.0
|
||||
margin_right = 161.0
|
||||
margin_bottom = 68.0
|
||||
text = "+X"
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="EditColor"]
|
||||
margin_left = 357.0
|
||||
margin_right = 361.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="ColorProper" type="VBoxContainer" parent="EditColor"]
|
||||
margin_left = 365.0
|
||||
margin_right = 461.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="EditColor/ColorProper"]
|
||||
margin_right = 96.0
|
||||
margin_bottom = 44.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Button" type="Button" parent="EditColor/ColorProper"]
|
||||
margin_top = 48.0
|
||||
margin_right = 96.0
|
||||
margin_bottom = 68.0
|
||||
text = "Choose Color"
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="EditColor/ColorProper/Button"]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -157.5
|
||||
margin_top = -529.0
|
||||
margin_right = 157.5
|
||||
margin_bottom = -53.0
|
||||
|
||||
[node name="Panel2" type="Panel" parent="EditColor/ColorProper/Button/Panel"]
|
||||
self_modulate = Color( 1.5, 1.5, 1.5, 1 )
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 316.0
|
||||
margin_bottom = 477.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="EditColor/ColorProper/Button/Panel"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 316.0
|
||||
margin_bottom = 477.0
|
||||
custom_constants/margin_right = 4
|
||||
custom_constants/margin_top = 4
|
||||
custom_constants/margin_left = 4
|
||||
custom_constants/margin_bottom = 4
|
||||
|
||||
[node name="ColorPicker" type="ColorPicker" parent="EditColor/ColorProper/Button/Panel/MarginContainer"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 305.0
|
||||
margin_bottom = 466.0
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="EditColor"]
|
||||
margin_left = 465.0
|
||||
margin_right = 469.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HSVGrid" type="GridContainer" parent="EditColor"]
|
||||
margin_left = 473.0
|
||||
margin_right = 630.0
|
||||
margin_bottom = 68.0
|
||||
columns = 5
|
||||
|
||||
[node name="Button3" type="Button" parent="EditColor/HSVGrid"]
|
||||
modulate = Color( 1, 0.913725, 0.776471, 1 )
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button2" type="Button" parent="EditColor/HSVGrid"]
|
||||
modulate = Color( 0.898039, 1, 0.698039, 1 )
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label" type="Label" parent="EditColor/HSVGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 3.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 17.0
|
||||
text = "Hue"
|
||||
align = 1
|
||||
|
||||
[node name="Button5" type="Button" parent="EditColor/HSVGrid"]
|
||||
modulate = Color( 0.717647, 1, 0.980392, 1 )
|
||||
margin_left = 97.0
|
||||
margin_right = 125.0
|
||||
margin_bottom = 20.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button6" type="Button" parent="EditColor/HSVGrid"]
|
||||
modulate = Color( 0.74902, 0.729412, 1, 1 )
|
||||
margin_left = 129.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 20.0
|
||||
text = "+X"
|
||||
|
||||
[node name="Button7" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_top = 24.0
|
||||
margin_right = 25.0
|
||||
margin_bottom = 44.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button8" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 29.0
|
||||
margin_top = 24.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 44.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label2" type="Label" parent="EditColor/HSVGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 27.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 41.0
|
||||
text = "Sat"
|
||||
align = 1
|
||||
|
||||
[node name="Button11" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 97.0
|
||||
margin_top = 24.0
|
||||
margin_right = 125.0
|
||||
margin_bottom = 44.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button12" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 129.0
|
||||
margin_top = 24.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 44.0
|
||||
text = "+X"
|
||||
|
||||
[node name="Button13" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_top = 48.0
|
||||
margin_right = 25.0
|
||||
margin_bottom = 68.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button14" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 29.0
|
||||
margin_top = 48.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 68.0
|
||||
text = "-5"
|
||||
|
||||
[node name="Label3" type="Label" parent="EditColor/HSVGrid"]
|
||||
margin_left = 58.0
|
||||
margin_top = 51.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 65.0
|
||||
text = "Value"
|
||||
align = 1
|
||||
|
||||
[node name="Button17" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 97.0
|
||||
margin_top = 48.0
|
||||
margin_right = 125.0
|
||||
margin_bottom = 68.0
|
||||
text = "+5"
|
||||
|
||||
[node name="Button18" type="Button" parent="EditColor/HSVGrid"]
|
||||
margin_left = 129.0
|
||||
margin_top = 48.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 68.0
|
||||
text = "+X"
|
||||
|
||||
[node name="VSeparator4" type="VSeparator" parent="EditColor"]
|
||||
margin_left = 634.0
|
||||
margin_right = 638.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="CustomX" type="VBoxContainer" parent="EditColor"]
|
||||
margin_left = 642.0
|
||||
margin_right = 832.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label" type="Label" parent="EditColor/CustomX"]
|
||||
margin_top = 13.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 27.0
|
||||
size_flags_vertical = 6
|
||||
text = "Custom Value (for +X buttons)"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="EditColor/CustomX"]
|
||||
margin_top = 44.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 68.0
|
||||
text = "20"
|
||||
|
||||
[node name="VSeparator6" type="Control" parent="EditColor"]
|
||||
margin_left = 836.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 68.0
|
||||
rect_min_size = Vector2( 16, 0 )
|
||||
size_flags_horizontal = 3
|
@ -0,0 +1,27 @@
|
||||
tool
|
||||
extends SheetsDockEditor
|
||||
|
||||
onready var number_panel = $"HBoxContainer/CustomX/HBoxContainer/NumberPanel"
|
||||
|
||||
var mouse_down := false
|
||||
|
||||
|
||||
func can_edit_value(value, type, property_hint) -> bool:
|
||||
return type == TYPE_REAL or type == TYPE_INT
|
||||
|
||||
|
||||
func _on_NumberPanel_gui_input(event):
|
||||
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
|
||||
if event.pressed:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
mouse_down = true
|
||||
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
if mouse_down:
|
||||
Input.warp_mouse_position(number_panel.rect_global_position + number_panel.rect_size * 0.5)
|
||||
|
||||
mouse_down = false
|
||||
|
||||
if mouse_down and event is InputEventMouseMotion:
|
||||
number_panel.get_child(0).text = str(float(number_panel.get_child(0).text) + event.relative.x * 0.01)
|
156
addons/resources_speadsheet_view/typed_editors/dock_number.tscn
Normal file
156
addons/resources_speadsheet_view/typed_editors/dock_number.tscn
Normal file
@ -0,0 +1,156 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_editors/dock_number.gd" type="Script" id=1]
|
||||
|
||||
[node name="EditNumber" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 86.0
|
||||
rect_pivot_offset = Vector2( -460, -28 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Header"]
|
||||
margin_right = 455.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="Header/HBoxContainer"]
|
||||
margin_right = 89.0
|
||||
margin_bottom = 14.0
|
||||
text = "EDIT: Number"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Header/HBoxContainer"]
|
||||
margin_left = 93.0
|
||||
margin_right = 455.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label2" type="Label" parent="Header"]
|
||||
margin_left = 459.0
|
||||
margin_right = 565.0
|
||||
margin_bottom = 14.0
|
||||
text = "PROPERTY NAME"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="Header"]
|
||||
margin_left = 569.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_top = 18.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 84.0
|
||||
alignment = 1
|
||||
|
||||
[node name="CustomX" type="VBoxContainer" parent="HBoxContainer"]
|
||||
margin_left = 275.0
|
||||
margin_right = 748.0
|
||||
margin_bottom = 66.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/CustomX"]
|
||||
margin_right = 473.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="Button4" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
text = "-X"
|
||||
|
||||
[node name="Button10" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 29.0
|
||||
margin_right = 70.0
|
||||
margin_bottom = 20.0
|
||||
text = "-100"
|
||||
|
||||
[node name="Button7" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 74.0
|
||||
margin_right = 107.0
|
||||
margin_bottom = 20.0
|
||||
text = "-10"
|
||||
|
||||
[node name="Button11" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 111.0
|
||||
margin_right = 136.0
|
||||
margin_bottom = 20.0
|
||||
text = "-1"
|
||||
|
||||
[node name="Button14" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 140.0
|
||||
margin_right = 177.0
|
||||
margin_bottom = 20.0
|
||||
text = "-0.1"
|
||||
|
||||
[node name="NumberPanel" type="Panel" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 181.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 96, 0 )
|
||||
mouse_default_cursor_shape = 10
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/CustomX/HBoxContainer/NumberPanel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_right = -4.0
|
||||
text = "1"
|
||||
valign = 1
|
||||
clip_text = true
|
||||
|
||||
[node name="Button15" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 281.0
|
||||
margin_right = 321.0
|
||||
margin_bottom = 20.0
|
||||
text = "+0.1"
|
||||
|
||||
[node name="Button12" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 325.0
|
||||
margin_right = 353.0
|
||||
margin_bottom = 20.0
|
||||
text = "+1"
|
||||
|
||||
[node name="Button8" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 357.0
|
||||
margin_right = 393.0
|
||||
margin_bottom = 20.0
|
||||
text = "+10"
|
||||
|
||||
[node name="Button13" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 397.0
|
||||
margin_right = 441.0
|
||||
margin_bottom = 20.0
|
||||
text = "+100"
|
||||
|
||||
[node name="Button9" type="Button" parent="HBoxContainer/CustomX/HBoxContainer"]
|
||||
margin_left = 445.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 20.0
|
||||
text = "+X"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/CustomX"]
|
||||
margin_top = 24.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/CustomX/HBoxContainer2"]
|
||||
margin_right = 190.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_vertical = 6
|
||||
text = "Custom Value (for +X buttons)"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="HBoxContainer/CustomX/HBoxContainer2"]
|
||||
margin_left = 194.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="HBoxContainer/CustomX"]
|
||||
margin_top = 42.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 66.0
|
||||
text = "20"
|
||||
|
||||
[connection signal="gui_input" from="HBoxContainer/CustomX/HBoxContainer/NumberPanel" to="." method="_on_NumberPanel_gui_input"]
|
@ -5,7 +5,6 @@ extends Resource
|
||||
export var color1 := Color.white
|
||||
export var max_duplicates := 0
|
||||
export var tags := "tag_1 tag_2 tag_3"
|
||||
export var requires_one_of_tags := ""
|
||||
export var color2 := Color.white
|
||||
export(String) var tag_delimeter = " "
|
||||
export var base_weight := 10.0
|
||||
|
@ -8,7 +8,6 @@ script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 1, 1 )
|
||||
max_duplicates = 9
|
||||
tags = "magic"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.189457, 0.452246, 0.902344, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -8,7 +8,6 @@ script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 1, 1 )
|
||||
max_duplicates = 9
|
||||
tags = "strength"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.988235, 0.584314, 0.192157, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Axe"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon strength aoe melee"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.988235, 0.584314, 0.192157, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Blizzard"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon magic aoe elemental"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.189457, 0.452246, 0.902344, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Chaos Blast"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon magic legendary chaosblast aoe"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.40631, 0.190945, 0.832031, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 1.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Daggers"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon strength dagger projectile"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.988235, 0.584314, 0.192157, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Fireball"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon magic fireball projectile elemental"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.189457, 0.452246, 0.902344, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Giga Sword"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon strength legendary gigasword melee"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.988235, 0.93848, 0.192157, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 1.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Lightning"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon magic lightning elemental"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.189457, 0.452246, 0.902344, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -6,9 +6,8 @@
|
||||
resource_name = "Weapon: Spear"
|
||||
script = ExtResource( 1 )
|
||||
color1 = Color( 1, 1, 0.2, 1 )
|
||||
max_duplicates = 0
|
||||
max_duplicates = 1
|
||||
tags = "weapon strength spear melee"
|
||||
requires_one_of_tags = ""
|
||||
color2 = Color( 0.988235, 0.584314, 0.192157, 1 )
|
||||
tag_delimeter = " "
|
||||
base_weight = 10.0
|
||||
|
@ -19,10 +19,10 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://example/my_custom_resource.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "ResourceSpreadsheetEditor",
|
||||
"base": "Control",
|
||||
"class": "SheetsDockEditor",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/resources_speadsheet_view/typed_editors/base.gd"
|
||||
"path": "res://addons/resources_speadsheet_view/typed_editors/dock_base.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "TextEditingUtils",
|
||||
@ -42,7 +42,7 @@ _global_script_classes=[ {
|
||||
_global_script_class_icons={
|
||||
"CellEditor": "",
|
||||
"DynamicWheelItem": "",
|
||||
"ResourceSpreadsheetEditor": "",
|
||||
"SheetsDockEditor": "",
|
||||
"TextEditingUtils": "",
|
||||
"ThemeIconButton": "",
|
||||
"ThemeStylebox": ""
|
||||
|
Loading…
Reference in New Issue
Block a user