Skip to content

Commit f32b206

Browse files
committed
Simplified Texture Editing
1 parent bfc063c commit f32b206

9 files changed

+181
-155
lines changed

Autoload/Version.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extends Node
22

3-
var major_minor = "0.46"
3+
var major_minor = "0.47"
44
var patch = "0000"
55
var full = ""
66
var unearth_map_format_version:float = 1.05

Scenes/CurrentTextures.gd

+8-9
Original file line numberDiff line numberDiff line change
@@ -160,33 +160,32 @@ func save_image_as_png(img, inputPath):
160160

161161

162162
func load_cache_filename(path):
163-
var fileName = path.get_file().get_basename().to_lower()
164-
165-
166-
var cachePath = Settings.unearthdata.plus_file(fileName + ".png")
167-
var tmapNumber = int(fileName.to_int())
163+
var baseName = path.get_file().get_basename().to_lower()
164+
var tmapNumber = int(baseName.to_int())
165+
var cachePath = Settings.unearthdata.plus_file(baseName + ".png")
168166

169167
if File.new().file_exists(cachePath) == true:
170168
var img = Image.new()
171169
img.load(cachePath)
172-
load_image_into_cache(img, tmapNumber, fileName)
170+
load_image_into_cache(img, tmapNumber, baseName)
173171
return OK
174172
else:
175173
print('Cache file not found: ' + cachePath)
176174
cachedTextures.clear()
177175
return FAILED
178176

179177

180-
func load_image_into_cache(img, tmapNumber, fileName):
178+
func load_image_into_cache(img, tmapNumber, baseName):
179+
181180
while cachedTextures.size() <= tmapNumber: # Fill all array positions, in case a tmapa00#.dat file inbetween is deleted
182181
cachedTextures.append([null, null, null, null])
183182

184183
var twoArrays = convert_img_to_two_texture_arrays(img)
185184

186-
if fileName.begins_with("tmapa"):
185+
if baseName.to_lower().begins_with("tmapa"):
187186
cachedTextures[tmapNumber][0] = twoArrays[0]
188187
cachedTextures[tmapNumber][1] = twoArrays[1]
189-
elif fileName.begins_with("tmapb"):
188+
elif baseName.to_lower().begins_with("tmapb"):
190189
cachedTextures[tmapNumber][2] = twoArrays[0]
191190
cachedTextures[tmapNumber][3] = twoArrays[1]
192191

Scenes/LineEditFloat.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ func _ready():
44
connect("focus_exited", self, "_on_focus_exited")
55

66
func _on_focus_exited():
7-
text = String(int(text))
7+
text = String(float(text))
88
#text = text.pad_decimals(2)

Scenes/Main.tscn

+98-107
Original file line numberDiff line numberDiff line change
@@ -5001,21 +5001,6 @@ reset_on_save = false
50015001
anims/Flash = SubResource( 17 )
50025002
anims/RESET = SubResource( 18 )
50035003

5004-
[node name="ChooseFileListFileDialog" type="FileDialog" parent="Ui/UiSystem"]
5005-
visible = true
5006-
margin_left = -2004.0
5007-
margin_top = 1631.0
5008-
margin_right = -1324.0
5009-
margin_bottom = 2191.0
5010-
rect_min_size = Vector2( 250, 87.5 )
5011-
window_title = "Open a File"
5012-
resizable = true
5013-
dialog_text = "Find and select filelist_tmapa*.txt (must have accompanying pack* folder)"
5014-
mode = 0
5015-
access = 2
5016-
filters = PoolStringArray( "*.txt" )
5017-
show_hidden_files = true
5018-
50195004
[node name="ChooseTmapaFileDialog" type="FileDialog" parent="Ui/UiSystem"]
50205005
visible = true
50215006
margin_left = -1278.0
@@ -5055,9 +5040,10 @@ show_hidden_files = true
50555040
visible = true
50565041
margin_left = -1273.0
50575042
margin_top = 954.0
5058-
margin_right = -741.0
5059-
margin_bottom = 1389.0
5060-
window_title = "Tileset editing"
5043+
margin_right = -989.0
5044+
margin_bottom = 1202.0
5045+
rect_min_size = Vector2( 284, 248 )
5046+
window_title = "Create a tileset"
50615047
resizable = true
50625048
script = ExtResource( 126 )
50635049

@@ -5069,106 +5055,111 @@ margin_top = 10.0
50695055
margin_right = -10.0
50705056
margin_bottom = -10.0
50715057

5072-
[node name="CreateFilelistButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5073-
margin_right = 512.0
5074-
margin_bottom = 27.0
5075-
text = "Convert tmapa*.dat file to filelist pack"
5076-
5077-
[node name="LoadFilelistButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5078-
margin_top = 31.0
5079-
margin_right = 512.0
5080-
margin_bottom = 58.0
5081-
text = "Load filelist pack"
5082-
5083-
[node name="ReloaderContainer" type="VBoxContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5084-
margin_top = 62.0
5085-
margin_right = 512.0
5086-
margin_bottom = 384.0
5087-
size_flags_horizontal = 3
5088-
size_flags_vertical = 3
5058+
[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5059+
margin_right = 264.0
5060+
margin_bottom = 89.0
5061+
columns = 2
50895062

5090-
[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5091-
margin_right = 512.0
5092-
margin_bottom = 21.0
5093-
scroll_vertical_enabled = false
5063+
[node name="Label" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5064+
margin_top = 3.0
5065+
margin_right = 50.0
5066+
margin_bottom = 24.0
5067+
rect_min_size = Vector2( 50, 0 )
5068+
text = "1."
5069+
align = 1
50945070

5095-
[node name="ReloaderPathLabel" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer/ScrollContainer"]
5096-
margin_right = 14.0
5097-
margin_bottom = 21.0
5098-
text = "<>"
5071+
[node name="CreateFilelistButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5072+
margin_left = 54.0
5073+
margin_right = 229.0
5074+
margin_bottom = 27.0
5075+
rect_min_size = Vector2( 175, 0 )
5076+
size_flags_horizontal = 0
5077+
text = "Load tileset"
50995078

5100-
[node name="Spacing3" type="Control" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5101-
margin_top = 25.0
5102-
margin_right = 512.0
5103-
margin_bottom = 49.0
5104-
rect_min_size = Vector2( 24, 24 )
5079+
[node name="Label2" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5080+
margin_top = 34.0
5081+
margin_right = 50.0
5082+
margin_bottom = 55.0
5083+
rect_min_size = Vector2( 50, 0 )
5084+
text = "2."
5085+
align = 1
51055086

5106-
[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5107-
margin_top = 53.0
5108-
margin_right = 512.0
5109-
margin_bottom = 84.0
5087+
[node name="ModifyTexturesButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5088+
margin_left = 54.0
5089+
margin_top = 31.0
5090+
margin_right = 229.0
5091+
margin_bottom = 58.0
5092+
rect_min_size = Vector2( 175, 0 )
5093+
size_flags_horizontal = 4
5094+
text = "Modify textures"
51105095

5111-
[node name="label" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer/HBoxContainer"]
5112-
margin_top = 5.0
5113-
margin_right = 114.0
5114-
margin_bottom = 26.0
5115-
text = "Reload every"
5116-
__meta__ = {
5117-
"_edit_use_anchors_": false
5118-
}
5096+
[node name="Label3" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5097+
margin_top = 65.0
5098+
margin_right = 50.0
5099+
margin_bottom = 86.0
5100+
rect_min_size = Vector2( 50, 0 )
5101+
text = "3."
5102+
align = 1
51195103

5120-
[node name="ReloadEveryLineEdit" type="LineEdit" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer/HBoxContainer"]
5121-
margin_left = 118.0
5122-
margin_right = 176.0
5123-
margin_bottom = 31.0
5124-
text = "0.25"
5125-
script = ExtResource( 89 )
5104+
[node name="ExportTmapaButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer"]
5105+
margin_left = 54.0
5106+
margin_top = 62.0
5107+
margin_right = 229.0
5108+
margin_bottom = 89.0
5109+
rect_min_size = Vector2( 175, 0 )
5110+
size_flags_horizontal = 0
5111+
text = "Save tileset"
51265112
__meta__ = {
51275113
"_edit_use_anchors_": false
51285114
}
51295115

5130-
[node name="Label2" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer/HBoxContainer"]
5131-
margin_left = 180.0
5132-
margin_top = 5.0
5133-
margin_right = 250.0
5134-
margin_bottom = 26.0
5135-
text = "seconds"
5136-
__meta__ = {
5137-
"_edit_use_anchors_": false
5138-
}
5116+
[node name="Spacing" type="Control" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5117+
margin_top = 93.0
5118+
margin_right = 264.0
5119+
margin_bottom = 105.0
5120+
rect_min_size = Vector2( 0, 12 )
51395121

5140-
[node name="Spacing" type="Control" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5141-
margin_top = 88.0
5142-
margin_right = 512.0
5143-
margin_bottom = 112.0
5144-
rect_min_size = Vector2( 24, 24 )
5122+
[node name="Label" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5123+
margin_top = 109.0
5124+
margin_right = 264.0
5125+
margin_bottom = 130.0
5126+
text = "Currently loaded:"
5127+
5128+
[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5129+
margin_top = 134.0
5130+
margin_right = 264.0
5131+
margin_bottom = 180.0
5132+
scroll_vertical_enabled = false
51455133

5146-
[node name="ReloaderLoopLabel" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5147-
margin_top = 116.0
5148-
margin_right = 512.0
5149-
margin_bottom = 281.0
5150-
text = "Now actively reloading files from filelist pack folder, this means as you edit and save those .PNGs, any changes you make will be shown realtime in Unearth (in the 3D view too).
5134+
[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ScrollContainer"]
5135+
margin_right = 264.0
5136+
margin_bottom = 46.0
5137+
size_flags_horizontal = 3
5138+
size_flags_vertical = 3
51515139

5152-
Your Tileset in Map settings has been set to the texture pack # you're editing."
5153-
autowrap = true
5154-
__meta__ = {
5155-
"_edit_use_anchors_": false
5156-
}
5140+
[node name="ReloaderPathLabel" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ScrollContainer/VBoxContainer"]
5141+
margin_right = 264.0
5142+
margin_bottom = 21.0
5143+
text = "<>"
51575144

5158-
[node name="Spacing2" type="Control" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ReloaderContainer"]
5159-
margin_top = 285.0
5160-
margin_right = 512.0
5161-
margin_bottom = 309.0
5162-
rect_min_size = Vector2( 24, 24 )
5145+
[node name="ReloaderPathPackLabel" type="Label" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ScrollContainer/VBoxContainer"]
5146+
margin_top = 25.0
5147+
margin_right = 264.0
5148+
margin_bottom = 46.0
5149+
text = "<>"
51635150

5164-
[node name="ExportTmapaButton" type="Button" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5165-
margin_top = 388.0
5166-
margin_right = 512.0
5167-
margin_bottom = 415.0
5168-
text = "Export as tmapa*.dat"
5169-
__meta__ = {
5170-
"_edit_use_anchors_": false
5171-
}
5151+
[node name="TextureEditingHelpButton" type="TextureButton" parent="Ui/UiSystem/TextureEditingWindow/VBoxContainer"]
5152+
margin_left = 232.0
5153+
margin_top = 184.0
5154+
margin_right = 264.0
5155+
margin_bottom = 216.0
5156+
rect_min_size = Vector2( 32, 32 )
5157+
size_flags_horizontal = 8
5158+
texture_normal = ExtResource( 156 )
5159+
texture_pressed = ExtResource( 66 )
5160+
texture_hover = ExtResource( 128 )
5161+
expand = true
5162+
stretch_mode = 4
51725163

51735164
[node name="ColumnEditor" type="WindowDialog" parent="Ui/UiSystem"]
51745165
visible = true
@@ -7489,12 +7480,12 @@ script = SubResource( 20 )
74897480
[connection signal="text_changed" from="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor/VBoxContainer/ScriptTextEdit" to="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor" method="_on_ScriptTextEdit_text_changed"]
74907481
[connection signal="visibility_changed" from="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor/VBoxContainer/ScriptTextEdit" to="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor" method="_on_ScriptTextEdit_visibility_changed"]
74917482
[connection signal="pressed" from="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor/HelpButtonPosition/UNNEEDEDScriptHelpButton" to="Ui/UiSystem/MapSettingsWindow/MapSettingsTabs/ScriptEditor" method="_on_ScriptHelpButton_pressed"]
7492-
[connection signal="file_selected" from="Ui/UiSystem/ChooseFileListFileDialog" to="Ui/UiSystem/TextureEditingWindow" method="_on_ChooseFileListFileDialog_file_selected"]
74937483
[connection signal="file_selected" from="Ui/UiSystem/ChooseTmapaFileDialog" to="Ui/UiSystem/TextureEditingWindow" method="_on_ChooseTmapaFileDialog_file_selected"]
74947484
[connection signal="file_selected" from="Ui/UiSystem/ExportTmapaDatDialog" to="Ui/UiSystem/TextureEditingWindow" method="_on_ExportTmapaDatDialog_file_selected"]
7495-
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/CreateFilelistButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_CreateFilelistButton_pressed"]
7496-
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/LoadFilelistButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_LoadFilelistButton_pressed"]
7497-
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/ExportTmapaButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_ExportTmapaButton_pressed"]
7485+
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer/CreateFilelistButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_CreateFilelistButton_pressed"]
7486+
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer/ModifyTexturesButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_ModifyTexturesButton_pressed"]
7487+
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/GridContainer/ExportTmapaButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_ExportTmapaButton_pressed"]
7488+
[connection signal="pressed" from="Ui/UiSystem/TextureEditingWindow/VBoxContainer/TextureEditingHelpButton" to="Ui/UiSystem/TextureEditingWindow" method="_on_TextureEditingHelpButton_pressed"]
74987489
[connection signal="visibility_changed" from="Ui/UiSystem/ColumnEditor" to="Ui/UiSystem/ColumnEditor" method="_on_ColumnEditor_visibility_changed"]
74997490
[connection signal="pressed" from="Ui/UiSystem/ColumnEditor/MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer2/ColumnEditorClearUnusedButton" to="Ui/UiSystem/ColumnEditor" method="_on_ColumnEditorClearUnusedButton_pressed"]
75007491
[connection signal="pressed" from="Ui/UiSystem/ColumnEditor/MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer2/ColumnEditorSortButton" to="Ui/UiSystem/ColumnEditor" method="_on_ColumnEditorSortButton_pressed"]

Scenes/Menu.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func add_edit_menu_items():
8282
edit_popup.add_item("Resize map", 3)
8383
edit_popup.add_item("Update all slabs", 4)
8484
edit_popup.add_separator()
85-
edit_popup.add_item("Make a tileset", 5)
85+
edit_popup.add_item("Create a tileset", 5)
8686
edit_popup.add_item("Slabset", 6)
8787

8888
func update_undo_availability():

Scenes/PlacingSettings.gd

+20-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var lightRange = 10
1818
var lightIntensity = 32
1919
var pointRange = 5
2020
var boxNumber = 0
21-
2221
var creatureName = ""
2322
var creatureGold = 0
2423
var creatureInitialHealth = 100
@@ -56,6 +55,26 @@ func _on_PropertiesTabs_tab_changed(tab):
5655
if tab == 1:
5756
set_placing_tab_and_update_it()
5857

58+
59+
func replicate_instance_settings(node):
60+
if node.get("effectRange"): effectRange = node.effectRange
61+
if node.get("creatureLevel"): creatureLevel = node.creatureLevel
62+
if node.get("doorLocked"): doorLocked = node.doorLocked
63+
if node.get("ownership"): ownership = node.ownership
64+
if node.get("lightRange"): lightRange = node.lightRange
65+
if node.get("lightIntensity"): lightIntensity = node.lightIntensity
66+
if node.get("pointRange"): pointRange = node.pointRange
67+
if node.get("boxNumber"): boxNumber = node.boxNumber
68+
69+
if node.get("creatureName"): creatureName = node.creatureName
70+
if node.get("creatureName") == "": creatureName = node.creatureName
71+
72+
if node.get("creatureGold"): creatureGold = node.creatureGold
73+
if node.get("creatureInitialHealth"): creatureInitialHealth = node.creatureInitialHealth
74+
if node.get("orientation"): orientation = node.orientation
75+
if node.get("goldValue"): goldValue = node.goldValue
76+
77+
5978
func set_placing_tab_and_update_it():
6079
oPropertiesTabs.current_tab = 1
6180
update_placing_tab()

Scenes/Selection.gd

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ onready var oBrushPreview = Nodelist.list["oBrushPreview"]
3131
onready var oPlaceThingsAnywhere = Nodelist.list["oPlaceThingsAnywhere"]
3232
onready var oSlabSideViewer = Nodelist.list["oSlabSideViewer"]
3333
onready var oUseSlabOwnerCheckBox = Nodelist.list["oUseSlabOwnerCheckBox"]
34+
onready var oPlacingSettings = Nodelist.list["oPlacingSettings"]
3435

3536
enum {
3637
CONSTRUCT_BRUSH
@@ -132,6 +133,7 @@ func update_paint():
132133
paintThingType = cursorOnInstancesArray[0].thingType
133134
paintSubtype = cursorOnInstancesArray[0].subtype
134135
oPickThingWindow.set_selection(paintThingType, paintSubtype)
136+
oPlacingSettings.replicate_instance_settings(cursorOnInstancesArray[0])
135137

136138

137139
func construct_shape_for_placement(constructType):

Scenes/Selector.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ func mouse_button_on_field():
205205
change_mode(MODE_SUBTILE)
206206
else:
207207
change_mode(MODE_TILE)
208-
oPlacingSettings.set_placing_tab_and_update_it()
209208
oSelection.update_paint()
209+
oPlacingSettings.set_placing_tab_and_update_it()
210210

211211
if Input.is_action_pressed("mouse_right"):
212212
if visible == true:

0 commit comments

Comments
 (0)