-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add quodot plugin, viewports now work
- Loading branch information
1 parent
d9a6429
commit b47b054
Showing
87 changed files
with
6,437 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[plugin] | ||
|
||
name="Inspector Gadget" | ||
description="A general-purpose GDScript object-editing inspector UI for building your own editors inside Godot." | ||
author="Shifty" | ||
version="1.0.0" | ||
script="src/inspector_gadget_plugin.gd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://addons/inspector-gadget/src/inspector_gadget.gd" type="Script" id=1] | ||
[ext_resource path="res://addons/inspector-gadget/src/property_visualizer.gd" type="Script" id=2] | ||
|
||
[node name="InspectorGadgetExample" type="Control"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="ColorRect" type="ColorRect" parent="."] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
color = Color( 0, 0, 0, 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="HBoxContainer" type="HBoxContainer" parent="ColorRect"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="VisualizerScrollContainer" type="ScrollContainer" parent="ColorRect/HBoxContainer"] | ||
margin_right = 478.0 | ||
margin_bottom = 960.0 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="PropertyVisualizer" type="Control" parent="ColorRect/HBoxContainer/VisualizerScrollContainer"] | ||
margin_right = 466.0 | ||
margin_bottom = 4290.0 | ||
rect_min_size = Vector2( 0, 4290 ) | ||
size_flags_horizontal = 3 | ||
script = ExtResource( 2 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
float_value = 3.14159 | ||
quat_value = Quat( -0.176777, -0.306186, -0.306186, 0.883883 ) | ||
basis_value = Basis( 0.853553, 0.5, 0.146447, -0.146447, 0.5, -0.853553, -0.5, 0.707107, 0.5 ) | ||
dictionary_value = { | ||
"bar": "bar string", | ||
"baz": "baz string", | ||
"foo": "foo string" | ||
} | ||
|
||
[node name="InspectorGadgetScrollContainer" type="ScrollContainer" parent="ColorRect/HBoxContainer"] | ||
margin_left = 482.0 | ||
margin_right = 960.0 | ||
margin_bottom = 960.0 | ||
size_flags_horizontal = 3 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="InspectorGadget" type="MarginContainer" parent="ColorRect/HBoxContainer/InspectorGadgetScrollContainer"] | ||
margin_right = 466.0 | ||
margin_bottom = 4124.0 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
node_path = NodePath("../../VisualizerScrollContainer/PropertyVisualizer") | ||
subnames = "" | ||
editable = true | ||
property_blacklist = [ "blacklisted_property" ] | ||
custom_gadget_paths = { | ||
|
||
} | ||
custom_gadget_metadata = { | ||
|
||
} | ||
container_type_hints = { | ||
":array_value:4": 0, | ||
":array_value:5": "", | ||
":dictionary_value:[keys]": "", | ||
":dictionary_value:[values]": "" | ||
} | ||
filter_built_in_properties = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
class_name GadgetAABB | ||
extends InspectorGadgetBase | ||
tool | ||
|
||
func _init(in_node_path: NodePath = NodePath(), in_subnames: String = "").(in_node_path, in_subnames): | ||
pass | ||
|
||
func set_node_path(new_node_path: NodePath): | ||
.set_node_path(new_node_path) | ||
|
||
if not has_controls(): | ||
return | ||
|
||
var vbox = get_controls()[0] | ||
var position_gadget = vbox.get_node("PositionGadget") | ||
var size_gadget = vbox.get_node("SizeGadget") | ||
position_gadget.node_path = node_path | ||
size_gadget.node_path = node_path | ||
|
||
func set_subnames(new_subnames: String): | ||
.set_subnames(new_subnames) | ||
|
||
if not has_controls(): | ||
return | ||
|
||
var vbox = get_controls()[0] | ||
var position_gadget = vbox.get_node("PositionGadget") | ||
var size_gadget = vbox.get_node("SizeGadget") | ||
position_gadget.subnames = subnames + ":position" | ||
size_gadget.subnames = subnames + ":size" | ||
|
||
static func supports_type(value) -> bool: | ||
if value is AABB: | ||
return true | ||
return false | ||
|
||
func has_controls() -> bool: | ||
return has_node("VBoxContainer") | ||
|
||
func get_controls() -> Array: | ||
return [$VBoxContainer] | ||
|
||
func populate_controls() -> void: | ||
var position_label = Label.new() | ||
position_label.text = "Position" | ||
|
||
var size_label = Label.new() | ||
size_label.text = "Size" | ||
|
||
var position_gadget = GadgetVector3.new("../../" + node_path, subnames + ":position") | ||
position_gadget.name = "PositionGadget" | ||
position_gadget.size_flags_horizontal = SIZE_EXPAND_FILL | ||
position_gadget.connect("change_property_begin", self, "change_property_begin") | ||
position_gadget.connect("change_property_end", self, "change_property_end") | ||
|
||
var size_gadget = GadgetVector3.new("../../" + node_path, subnames + ":size") | ||
size_gadget.name = "SizeGadget" | ||
size_gadget.size_flags_horizontal = SIZE_EXPAND_FILL | ||
size_gadget.connect("change_property_begin", self, "change_property_begin") | ||
size_gadget.connect("change_property_end", self, "change_property_end") | ||
|
||
var vbox = VBoxContainer.new() | ||
vbox.name = "VBoxContainer" | ||
vbox.set_anchors_and_margins_preset(PRESET_WIDE) | ||
vbox.add_child(position_label) | ||
vbox.add_child(position_gadget) | ||
vbox.add_child(size_label) | ||
vbox.add_child(size_gadget) | ||
|
||
add_child(vbox) | ||
|
||
func populate_value(value) -> void: | ||
var vbox = get_controls()[0] | ||
var position_gadget = vbox.get_node("PositionGadget") | ||
var size_gadget = vbox.get_node("SizeGadget") | ||
position_gadget.populate_value(value.position) | ||
size_gadget.populate_value(value.size) | ||
|
||
func depopulate_value() -> void: | ||
var vbox = get_controls()[0] | ||
var position_gadget = vbox.get_node("PositionGadget") | ||
var size_gadget = vbox.get_node("SizeGadget") | ||
position_gadget.depopulate_value() | ||
size_gadget.depopulate_value() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
class_name GadgetBasis | ||
extends InspectorGadgetBase | ||
tool | ||
|
||
func _init(in_node_path: NodePath = NodePath(), in_subnames: String = "").(in_node_path, in_subnames): | ||
pass | ||
|
||
func set_node_path(new_node_path: NodePath): | ||
.set_node_path(new_node_path) | ||
|
||
if not has_controls(): | ||
return | ||
|
||
var hbox = get_controls()[0] | ||
var x_axis_gadget = hbox.get_node("XAxisGadget") | ||
var y_axis_gadget = hbox.get_node("YAxisGadget") | ||
var z_axis_gadget = hbox.get_node("ZAxisGadget") | ||
x_axis_gadget.node_path = node_path | ||
y_axis_gadget.node_path = node_path | ||
z_axis_gadget.node_path = node_path | ||
|
||
func set_subnames(new_subnames: String): | ||
.set_subnames(new_subnames) | ||
|
||
if not has_controls(): | ||
return | ||
|
||
var hbox = get_controls()[0] | ||
var x_axis_gadget = hbox.get_node("XAxisGadget") | ||
var y_axis_gadget = hbox.get_node("YAxisGadget") | ||
var z_axis_gadget = hbox.get_node("ZAxisGadget") | ||
x_axis_gadget.subnames = subnames + ":x" | ||
y_axis_gadget.subnames = subnames + ":y" | ||
z_axis_gadget.subnames = subnames + ":z" | ||
|
||
static func supports_type(value) -> bool: | ||
if value is Basis: | ||
return true | ||
return false | ||
|
||
func has_controls() -> bool: | ||
return has_node("VBoxContainer") | ||
|
||
func get_controls() -> Array: | ||
return [$VBoxContainer] | ||
|
||
func populate_controls() -> void: | ||
var label_x_axis = Label.new() | ||
label_x_axis.text = "X Axis" | ||
|
||
var label_y_axis = Label.new() | ||
label_y_axis.text = "Y Axis" | ||
|
||
var label_z_axis = Label.new() | ||
label_z_axis.text = "Z Axis" | ||
|
||
var x_axis_gadget = GadgetVector3.new("../../" + node_path, subnames + ":x") | ||
x_axis_gadget.name = "XAxisGadget" | ||
x_axis_gadget.size_flags_horizontal = SIZE_EXPAND_FILL | ||
x_axis_gadget.connect("change_property_begin", self, "change_property_begin") | ||
x_axis_gadget.connect("change_property_end", self, "change_property_end") | ||
|
||
var y_axis_gadget = GadgetVector3.new("../../" + node_path, subnames + ":y") | ||
y_axis_gadget.name = "YAxisGadget" | ||
y_axis_gadget.size_flags_horizontal = SIZE_EXPAND_FILL | ||
y_axis_gadget.connect("change_property_begin", self, "change_property_begin") | ||
y_axis_gadget.connect("change_property_end", self, "change_property_end") | ||
|
||
var z_axis_gadget = GadgetVector3.new("../../" + node_path, subnames + ":z") | ||
z_axis_gadget.name = "ZAxisGadget" | ||
z_axis_gadget.size_flags_horizontal = SIZE_EXPAND_FILL | ||
z_axis_gadget.connect("change_property_begin", self, "change_property_begin") | ||
z_axis_gadget.connect("change_property_end", self, "change_property_end") | ||
|
||
var hbox = VBoxContainer.new() | ||
hbox.name = "VBoxContainer" | ||
hbox.set_anchors_and_margins_preset(PRESET_WIDE) | ||
hbox.add_child(label_x_axis) | ||
hbox.add_child(x_axis_gadget) | ||
hbox.add_child(label_y_axis) | ||
hbox.add_child(y_axis_gadget) | ||
hbox.add_child(label_z_axis) | ||
hbox.add_child(z_axis_gadget) | ||
|
||
add_child(hbox) | ||
|
||
func populate_value(value) -> void: | ||
var hbox = get_controls()[0] | ||
var x_axis_gadget = hbox.get_node("XAxisGadget") | ||
var y_axis_gadget = hbox.get_node("YAxisGadget") | ||
var z_axis_gadget = hbox.get_node("ZAxisGadget") | ||
x_axis_gadget.populate_value(value.x) | ||
y_axis_gadget.populate_value(value.y) | ||
z_axis_gadget.populate_value(value.z) | ||
|
||
func depopulate_value() -> void: | ||
var hbox = get_controls()[0] | ||
var x_axis_gadget = hbox.get_node("XAxisGadget") | ||
var y_axis_gadget = hbox.get_node("YAxisGadget") | ||
var z_axis_gadget = hbox.get_node("ZAxisGadget") | ||
x_axis_gadget.depopulate_value() | ||
y_axis_gadget.depopulate_value() | ||
z_axis_gadget.depopulate_value() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
class_name GadgetBool | ||
extends InspectorGadgetBase | ||
tool | ||
|
||
func _init(in_node_path: NodePath = NodePath(), in_subnames: String = "").(in_node_path, in_subnames): | ||
pass | ||
|
||
static func supports_type(value) -> bool: | ||
if value is bool: | ||
return true | ||
return false | ||
|
||
func has_controls() -> bool: | ||
return has_node("CheckBox") | ||
|
||
func get_controls() -> Array: | ||
return [$CheckBox] | ||
|
||
func populate_controls() -> void: | ||
var check_box = CheckBox.new() | ||
check_box.name = "CheckBox" | ||
check_box.set_anchors_and_margins_preset(PRESET_WIDE) | ||
check_box.connect("toggled", self, "set_node_value") | ||
add_child(check_box) | ||
|
||
func populate_value(value) -> void: | ||
var check_box = get_controls()[0] | ||
check_box.set_block_signals(true) | ||
check_box.pressed = value | ||
check_box.set_block_signals(false) | ||
check_box.disabled = !editable | ||
|
||
func depopulate_value() -> void: | ||
var check_box = get_controls()[0] | ||
check_box.set_block_signals(true) | ||
check_box.pressed = false | ||
check_box.set_block_signals(false) | ||
check_box.disabled = true |
Oops, something went wrong.