Test inspector plugin.

This commit is contained in:
Relintai 2022-11-16 23:43:04 +01:00
parent 0c6ed1316a
commit 912e9b2f79
4 changed files with 22 additions and 1 deletions

View File

@ -52,6 +52,7 @@ func handle_mouse_button_down(local_position : Vector2, event: InputEvent) -> vo
var arr : Array = Array()
arr.push_back(cell_mouse_position)
arr.push_back(last_cell_mouse_position)
#STORE color here
arr.push_back(get_current_color())
elif current_tool == COLORPICKER:
print("TODO")

View File

@ -5,7 +5,7 @@
[node name="PaintProject" type="PaintProject"]
size = Vector2i( 128, 128 )
current_color = Color( 0.254063, 0.387148, 0.290244, 1 )
current_color = Color( 0.511169, 0.141401, 0.0907945, 1 )
script = ExtResource( 2 )
[node name="PaintCanvas" type="PaintCanvas" parent="."]

View File

@ -0,0 +1,9 @@
tool
extends EditorInspectorPlugin
func can_handle(object: Object) -> bool:
return object is PaintNode
func parse_begin(object: Object) -> void:
add_custom_control(PaintColorGrid.new())

View File

@ -1,7 +1,10 @@
tool
extends EditorPlugin
var ColorGridInspectorPlugin
var active_canvas : PaintCanvas = null
var ip : EditorInspectorPlugin
func handles(object: Object) -> bool:
return object is PaintCanvas
@ -10,6 +13,11 @@ func edit(object: Object) -> void:
active_canvas = object
func _enter_tree() -> void:
ColorGridInspectorPlugin = load("res://addons/paint_canvas/color_grid_inxpector_plugin.gd")
ip = ColorGridInspectorPlugin.new()
add_inspector_plugin(ip)
#get_tree().connect("node_removed", self, "on_node_removed")
var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin")
@ -20,6 +28,9 @@ func _enter_tree() -> void:
#print(sidebar)
func _exit_tree() -> void:
if ip:
remove_inspector_plugin(ip)
var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin")
if paint_editor_plugin: