From a76e7509f420dd53c12b447558e3e33eb0a224e3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 17 Nov 2022 11:57:04 +0100 Subject: [PATCH] Updated the engine. Also use the new PaintToolsPropertyInspector. --- HEADS | 2 +- game/PaintCanvas.gd | 20 ++++++------- game/addons/paint/plugin.gd | 28 +++++++++---------- .../color_grid_inxpector_plugin.gd | 5 ++++ game/project.pandemonium | 2 +- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/HEADS b/HEADS index eb742b8..de47bd5 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "64a9e86c5c20bd4bd5833f0563457d0126617489", "3.x": "9b512dd510207d32911064a1bbe15b80c91b006b"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "props": {"master": "2afd6eff45f9a921bdf4090ff3029def86df5cb5"}, "terraman_2d": {"master": "60a7e84a5dc2fc252b0c582dd8f877685d28d74a"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "rtile_map": {"master": "389070cfef387b69902e23e6c4ac53997b69e42e"}, "props_2d": {"master": "a45822b63519d7f9fb391ab6b1dced468c6f399d"}, "pandemonium_engine": {"master": "01f078e016ad640bb94a4973ef4b677cee8bd109"}} \ No newline at end of file +{"engine": {"3.2": "64a9e86c5c20bd4bd5833f0563457d0126617489", "3.x": "9b512dd510207d32911064a1bbe15b80c91b006b"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "props": {"master": "2afd6eff45f9a921bdf4090ff3029def86df5cb5"}, "terraman_2d": {"master": "60a7e84a5dc2fc252b0c582dd8f877685d28d74a"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "rtile_map": {"master": "389070cfef387b69902e23e6c4ac53997b69e42e"}, "props_2d": {"master": "a45822b63519d7f9fb391ab6b1dced468c6f399d"}, "pandemonium_engine": {"master": "526800fcf9e6ad96ac2041229ca2296de14c76fa"}} \ No newline at end of file diff --git a/game/PaintCanvas.gd b/game/PaintCanvas.gd index 0b47184..4d814ac 100644 --- a/game/PaintCanvas.gd +++ b/game/PaintCanvas.gd @@ -42,10 +42,10 @@ func handle_mouse_button_down(local_position : Vector2, event: InputEvent) -> vo last_mouse_position = mouse_position last_cell_mouse_position = local_position - if current_tool == CUT: + if current_tool == TOOL_CUT: if !event.is_pressed(): commit_action() - elif current_tool == BUCKET: + elif current_tool == TOOL_BUCKET: if !_current_action: _current_action = get_action() @@ -54,11 +54,11 @@ func handle_mouse_button_down(local_position : Vector2, event: InputEvent) -> vo arr.push_back(last_cell_mouse_position) #STORE color here arr.push_back(get_current_color()) - elif current_tool == COLORPICKER: + elif current_tool == TOOL_COLORPICKER: print("TODO") - elif current_tool == PASTECUT: + elif current_tool == TOOL_PASTECUT: print("TODO") - elif current_tool == PAINT: + elif current_tool == TOOL_PENCIL: tool_process(local_position, event) @@ -78,7 +78,7 @@ func commit_action() -> void: _actions_history.push_back(_current_action) _redo_history.clear() - if current_tool == CUT: + if current_tool == TOOL_CUT: print("TODO") return @@ -93,7 +93,7 @@ func has_point(var pos : Vector2) -> bool: func get_action() -> PaintAction: var action : PaintAction = null - if current_tool == PAINT: + if current_tool == TOOL_PENCIL: action = PencilAction.new() if action: @@ -102,7 +102,7 @@ func get_action() -> PaintAction: return action func _on_tool_changed() -> void: - if current_tool == COLORPICKER: + if current_tool == TOOL_COLORPICKER: if _current_action: _current_action = null return @@ -110,13 +110,13 @@ func _on_tool_changed() -> void: _current_action = get_action() func tool_process(local_position : Vector2, event: InputEvent) -> void: - if current_tool == COLORPICKER: + if current_tool == TOOL_COLORPICKER: return if !_current_action: _current_action = get_action() - if current_tool == PAINT: + if current_tool == TOOL_PENCIL: var arr : Array = Array() arr.push_back(cell_mouse_position) arr.push_back(last_cell_mouse_position) diff --git a/game/addons/paint/plugin.gd b/game/addons/paint/plugin.gd index f6060ec..86c9460 100644 --- a/game/addons/paint/plugin.gd +++ b/game/addons/paint/plugin.gd @@ -1,20 +1,20 @@ tool extends EditorPlugin -func _enter_tree() -> void: - var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") - - if paint_editor_plugin: - var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() - - #print(sidebar) - - -func _exit_tree() -> void: - var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") - - if paint_editor_plugin: - var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() +#func _enter_tree() -> void: +# var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") +# +# if paint_editor_plugin: +# var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() +# +# #print(sidebar) +# +# +#func _exit_tree() -> void: +# var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") +# +# if paint_editor_plugin: +# var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() #print(sidebar) diff --git a/game/addons/paint_canvas/color_grid_inxpector_plugin.gd b/game/addons/paint_canvas/color_grid_inxpector_plugin.gd index 18f499c..5e49767 100644 --- a/game/addons/paint_canvas/color_grid_inxpector_plugin.gd +++ b/game/addons/paint_canvas/color_grid_inxpector_plugin.gd @@ -8,3 +8,8 @@ func parse_begin(object: Object) -> void: var pc : PaintColorGrid = PaintColorGrid.new() pc.on_paint_node_selected(object) add_custom_control(pc) + + if object is PaintCanvas: + var ptool : PaintToolsPropertyInspector = PaintToolsPropertyInspector.new() + ptool.on_paint_node_selected(object) + add_custom_control(ptool) diff --git a/game/project.pandemonium b/game/project.pandemonium index 0209198..6f67f49 100644 --- a/game/project.pandemonium +++ b/game/project.pandemonium @@ -16,7 +16,7 @@ config/icon="res://icon.png" [editor_plugins] -enabled=PoolStringArray( "res://addons/paint/plugin.cfg", "res://addons/paint_canvas/plugin.cfg" ) +enabled=PoolStringArray( "res://addons/paint_canvas/plugin.cfg" ) [physics]