Updated the engine. Also use the new PaintToolsPropertyInspector.

This commit is contained in:
Relintai 2022-11-17 11:57:04 +01:00
parent 35e6106815
commit a76e7509f4
5 changed files with 31 additions and 26 deletions

2
HEADS
View File

@ -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"}} {"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"}}

View File

@ -42,10 +42,10 @@ func handle_mouse_button_down(local_position : Vector2, event: InputEvent) -> vo
last_mouse_position = mouse_position last_mouse_position = mouse_position
last_cell_mouse_position = local_position last_cell_mouse_position = local_position
if current_tool == CUT: if current_tool == TOOL_CUT:
if !event.is_pressed(): if !event.is_pressed():
commit_action() commit_action()
elif current_tool == BUCKET: elif current_tool == TOOL_BUCKET:
if !_current_action: if !_current_action:
_current_action = get_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) arr.push_back(last_cell_mouse_position)
#STORE color here #STORE color here
arr.push_back(get_current_color()) arr.push_back(get_current_color())
elif current_tool == COLORPICKER: elif current_tool == TOOL_COLORPICKER:
print("TODO") print("TODO")
elif current_tool == PASTECUT: elif current_tool == TOOL_PASTECUT:
print("TODO") print("TODO")
elif current_tool == PAINT: elif current_tool == TOOL_PENCIL:
tool_process(local_position, event) tool_process(local_position, event)
@ -78,7 +78,7 @@ func commit_action() -> void:
_actions_history.push_back(_current_action) _actions_history.push_back(_current_action)
_redo_history.clear() _redo_history.clear()
if current_tool == CUT: if current_tool == TOOL_CUT:
print("TODO") print("TODO")
return return
@ -93,7 +93,7 @@ func has_point(var pos : Vector2) -> bool:
func get_action() -> PaintAction: func get_action() -> PaintAction:
var action : PaintAction = null var action : PaintAction = null
if current_tool == PAINT: if current_tool == TOOL_PENCIL:
action = PencilAction.new() action = PencilAction.new()
if action: if action:
@ -102,7 +102,7 @@ func get_action() -> PaintAction:
return action return action
func _on_tool_changed() -> void: func _on_tool_changed() -> void:
if current_tool == COLORPICKER: if current_tool == TOOL_COLORPICKER:
if _current_action: if _current_action:
_current_action = null _current_action = null
return return
@ -110,13 +110,13 @@ func _on_tool_changed() -> void:
_current_action = get_action() _current_action = get_action()
func tool_process(local_position : Vector2, event: InputEvent) -> void: func tool_process(local_position : Vector2, event: InputEvent) -> void:
if current_tool == COLORPICKER: if current_tool == TOOL_COLORPICKER:
return return
if !_current_action: if !_current_action:
_current_action = get_action() _current_action = get_action()
if current_tool == PAINT: if current_tool == TOOL_PENCIL:
var arr : Array = Array() var arr : Array = Array()
arr.push_back(cell_mouse_position) arr.push_back(cell_mouse_position)
arr.push_back(last_cell_mouse_position) arr.push_back(last_cell_mouse_position)

View File

@ -1,20 +1,20 @@
tool tool
extends EditorPlugin extends EditorPlugin
func _enter_tree() -> void: #func _enter_tree() -> void:
var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") # var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin")
#
if paint_editor_plugin: # if paint_editor_plugin:
var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() # var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar()
#
#print(sidebar) # #print(sidebar)
#
#
func _exit_tree() -> void: #func _exit_tree() -> void:
var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin") # var paint_editor_plugin : EditorPlugin = Engine.get_global("PaintEditorPlugin")
#
if paint_editor_plugin: # if paint_editor_plugin:
var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar() # var sidebar : PaintSidebar = paint_editor_plugin.get_sidebar()
#print(sidebar) #print(sidebar)

View File

@ -8,3 +8,8 @@ func parse_begin(object: Object) -> void:
var pc : PaintColorGrid = PaintColorGrid.new() var pc : PaintColorGrid = PaintColorGrid.new()
pc.on_paint_node_selected(object) pc.on_paint_node_selected(object)
add_custom_control(pc) add_custom_control(pc)
if object is PaintCanvas:
var ptool : PaintToolsPropertyInspector = PaintToolsPropertyInspector.new()
ptool.on_paint_node_selected(object)
add_custom_control(ptool)

View File

@ -16,7 +16,7 @@ config/icon="res://icon.png"
[editor_plugins] [editor_plugins]
enabled=PoolStringArray( "res://addons/paint/plugin.cfg", "res://addons/paint_canvas/plugin.cfg" ) enabled=PoolStringArray( "res://addons/paint_canvas/plugin.cfg" )
[physics] [physics]