diff --git a/Autoload/Cube.gd b/Autoload/Cube.gd index ce69fb49..15b12136 100644 --- a/Autoload/Cube.gd +++ b/Autoload/Cube.gd @@ -616,7 +616,7 @@ func get_cubescfg_modified_time(): # read_cubes_cfg() # # Refresh the display of anything that handles cubes # -# oOverheadGraphics.update_full_overhead_map(oOverheadGraphics.SINGLE_THREADED) +# oOverheadGraphics.update_full_overhead_map() # oPickSlabWindow.add_slabs() # oColumnEditor._on_ColumnEditor_visibility_changed() # oSlabsetWindow._on_SlabsetWindow_visibility_changed() diff --git a/Autoload/Version.gd b/Autoload/Version.gd index 2b96a82e..685bfdc4 100644 --- a/Autoload/Version.gd +++ b/Autoload/Version.gd @@ -1,6 +1,6 @@ extends Node -var major_minor = "0.48" +var major_minor = "0.49" var patch = "0000" var full = "" var unearth_map_format_version:float = 1.05 diff --git a/Scenes/CfgLoader.gd b/Scenes/CfgLoader.gd index c624c6eb..5a0fc0eb 100644 --- a/Scenes/CfgLoader.gd +++ b/Scenes/CfgLoader.gd @@ -48,7 +48,6 @@ func start(mapPath): var file_exists = File.new() for i in files_to_load.size(): - var CODETIME_START = OS.get_ticks_msec() var file_name = files_to_load[i] var combined_cfg = {} @@ -109,7 +108,6 @@ func load_objects_data(cfg): # 10ms var newEditorTab var newGenre - if Things.DATA_OBJECT.has(id) == true: newName = objSection.get("Name", Things.DATA_OBJECT[id][Things.NAME_ID]) diff --git a/Scenes/MapBrowser.gd b/Scenes/MapBrowser.gd index 106f8caf..d1821e7b 100644 --- a/Scenes/MapBrowser.gd +++ b/Scenes/MapBrowser.gd @@ -169,9 +169,6 @@ func _on_MapBrowser_visibility_changed(): func toggle_map_preview(togglePreview): - if togglePreview == false and oMapBrowser.visible == true: - yield(oOverheadGraphics, "graphics_thread_completed") - oQuickMapPreview.visible = togglePreview # Toggle to false if currently selecting the opened map diff --git a/Scenes/OpenMap.gd b/Scenes/OpenMap.gd index 5e3b78ab..83c113ba 100644 --- a/Scenes/OpenMap.gd +++ b/Scenes/OpenMap.gd @@ -192,7 +192,7 @@ func continue_load(map): oOverheadOwnership.start() oScriptHelpers.start() - oOverheadGraphics.update_full_overhead_map(oOverheadGraphics.MULTI_THREADED) + oOverheadGraphics.update_full_overhead_map() oDataClm.count_filled_clm_entries() @@ -203,14 +203,10 @@ func continue_load(map): oMenu.add_recent(map) - - - # Update for Undo oDisplaySlxNumbers.update() - if oColumnEditor.visible == true: oColumnEditor.visible = false Utils.popup_centered(oColumnEditor) diff --git a/Scenes/OverheadGraphics.gd b/Scenes/OverheadGraphics.gd index 6cee3866..fc863fbb 100644 --- a/Scenes/OverheadGraphics.gd +++ b/Scenes/OverheadGraphics.gd @@ -10,11 +10,6 @@ onready var oUndoStates = Nodelist.list["oUndoStates"] onready var oQuickMapPreviewDisplay = Nodelist.list["oQuickMapPreviewDisplay"] onready var oMessage = Nodelist.list["oMessage"] - -signal graphics_thread_completed - -var thread_currently_processing = false - var overheadImgData = Image.new() var overheadTexData = ImageTexture.new() @@ -26,16 +21,7 @@ var mutex = Mutex.new() var job_queue = [] var pixel_data = PoolByteArray() -enum { - SINGLE_THREADED, - MULTI_THREADED, -} - -func _ready(): - thread.start(self, "multi_threaded") - - -func update_full_overhead_map(threadType): +func update_full_overhead_map(): var CODETIME_START = OS.get_ticks_msec() if arrayOfColorRects.empty() == true: @@ -48,14 +34,8 @@ func update_full_overhead_map(threadType): for xSlab in range(0, M.xSize): shapePositionArray.append(Vector2(xSlab,ySlab)) - match threadType: - SINGLE_THREADED: - if thread_currently_processing == false: - overhead2d_update_rect_single_threaded(shapePositionArray) - MULTI_THREADED: - mutex.lock() - job_queue.append(shapePositionArray.duplicate(true)) # This duplicate somehow fixes a crash, or maybe just helps improve a race condition - mutex.unlock() + overhead2d_update_rect_single_threaded(shapePositionArray) + print('Overhead graphics done in '+str(OS.get_ticks_msec()-CODETIME_START)+'ms') @@ -66,36 +46,6 @@ func overhead2d_update_rect_single_threaded(shapePositionArray): overheadImgData.create_from_data(M.xSize * 3, M.ySize * 3, false, Image.FORMAT_RGB8, pixel_data) overheadTexData.create_from_image(overheadImgData, 0) - -func multi_threaded(): - while true: - if job_queue.size() == 0: - continue - thread_currently_processing = true - print("graphics multi_threaded start") - - mutex.lock() - var shapePositionArray = job_queue.pop_front() - mutex.unlock() - - var newPixelData = PoolByteArray() - print("graphics multi_threaded 1") - var resulting_pixel_data = generate_pixel_data(newPixelData, shapePositionArray) - print("graphics multi_threaded 2") - call_deferred("thread_done", resulting_pixel_data) - print("graphics multi_threaded end") - - -func thread_done(resulting_pixel_data): - if resulting_pixel_data != null: - pixel_data = resulting_pixel_data - overheadImgData.create_from_data(M.xSize * 3, M.ySize * 3, false, Image.FORMAT_RGB8, pixel_data) - overheadTexData.create_from_image(overheadImgData, 0) - else: - oMessage.quick("thread crashed") - - thread_currently_processing = false - emit_signal("graphics_thread_completed") func generate_pixel_data(pixData, shapePositionArray): print("generate_pixel_data START") diff --git a/Scenes/ResizeCurrentMapSize.gd b/Scenes/ResizeCurrentMapSize.gd index e5974835..b15e5da7 100644 --- a/Scenes/ResizeCurrentMapSize.gd +++ b/Scenes/ResizeCurrentMapSize.gd @@ -113,7 +113,7 @@ func _on_ResizeApplyButton_pressed(): update_editor_appearance() - oOverheadGraphics.update_full_overhead_map(oOverheadGraphics.SINGLE_THREADED) + oOverheadGraphics.update_full_overhead_map() # I need to update every slab on the map, it's bugged otherwise, it clears a diagonal streak of objects for some reason. diff --git a/Scenes/UndoStates.gd b/Scenes/UndoStates.gd index a3f1d17a..0b6c5e25 100644 --- a/Scenes/UndoStates.gd +++ b/Scenes/UndoStates.gd @@ -101,8 +101,9 @@ func perform_undo(): print('perform_undo: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms') var IDLE_FRAME_CODETIME_START = OS.get_ticks_msec() - yield(get_tree(), 'idle_frame') + print('Idle frame (after undo): ' + str(OS.get_ticks_msec() - IDLE_FRAME_CODETIME_START) + 'ms') + performing_undo = false