diff --git a/game/PaintCanvas.gd b/game/PaintCanvas.gd index 49e816e..0b47184 100644 --- a/game/PaintCanvas.gd +++ b/game/PaintCanvas.gd @@ -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") diff --git a/game/Project.tscn b/game/Project.tscn index cfa7cb3..b10505e 100644 --- a/game/Project.tscn +++ b/game/Project.tscn @@ -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="."] diff --git a/game/addons/paint_canvas/color_grid_inxpector_plugin.gd b/game/addons/paint_canvas/color_grid_inxpector_plugin.gd new file mode 100644 index 0000000..47698e2 --- /dev/null +++ b/game/addons/paint_canvas/color_grid_inxpector_plugin.gd @@ -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()) diff --git a/game/addons/paint_canvas/plugin.gd b/game/addons/paint_canvas/plugin.gd index c9c8cf6..e243197 100644 --- a/game/addons/paint_canvas/plugin.gd +++ b/game/addons/paint_canvas/plugin.gd @@ -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: