Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion material_maker/globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func propagate_shortcuts(control : Control, event : InputEvent):
do_propagate_shortcuts(control, event)


func interpret_file_name(file_name: String, path:="", file_extension:="",additional_identifiers:={}) -> String:
func interpret_file_name(file_name: String, path:="", file_extension:="",additional_identifiers:={}, resolution="") -> String:
for i in additional_identifiers:
file_name = file_name.replace(i, additional_identifiers[i])

Expand All @@ -194,6 +194,9 @@ func interpret_file_name(file_name: String, path:="", file_extension:="",additio
if file_extension != "" and not file_name.ends_with(file_extension):
file_name += file_extension

if resolution:
file_name = file_name.replace("$resolution", resolution)

if "$idx" in file_name:
if path:
var idx := 1
Expand Down
17 changes: 16 additions & 1 deletion material_maker/panels/preview_2d/export_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func _on_resolution_item_selected(index: int) -> void:
if index != RESOLUTION_CUSTOM:
%CustomResolutionX.set_value(64 << index)
%CustomResolutionY.set_value(64 << index)
update()


func get_export_resolution() -> Vector2i:
Expand Down Expand Up @@ -177,5 +178,19 @@ func interpret_file_name(file_name: String, path:="") -> String:
match %FileType.selected:
0: extension += ".png"
1: extension += ".exr"

var resolution : String
if %CustomResolutionSection.visible:
resolution = "%sx%s" % [ int(%CustomResolutionX.value), int(%CustomResolutionY.value) ]
else:
resolution = str(64 << %Resolution.selected)

return mm_globals.interpret_file_name(file_name, path, extension, additional_ids, resolution)

return mm_globals.interpret_file_name(file_name, path, extension, additional_ids)

func _on_custom_resolution_x_value_changed(value: Variant) -> void:
update()


func _on_custom_resolution_y_value_changed(value: Variant) -> void:
update()
4 changes: 3 additions & 1 deletion material_maker/panels/preview_2d/preview_2d_panel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "The file-name to use.

You can use $project, $node and $idx to make the file-name auto-adjust."
You can use $project, $node, $idx and $resolution to make the file-name auto-adjust."
theme_override_font_sizes/font_size = 15
text = "$project_$node"

Expand Down Expand Up @@ -755,6 +755,8 @@ layout_mode = 2
[connection signal="text_changed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/ExportFile/BoxContainer/ExportFile" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_export_file_text_changed"]
[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/ExportFile/BoxContainer/FileType" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_file_type_item_selected"]
[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/ResolutionSection/Resolution" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_resolution_item_selected"]
[connection signal="value_changed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/ResolutionSection/CustomResolutionSection/CustomResolutionX" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_custom_resolution_x_value_changed"]
[connection signal="value_changed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/ResolutionSection/CustomResolutionSection/CustomResolutionY" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_custom_resolution_y_value_changed"]
[connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/BoxContainer/Image" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_image_pressed"]
[connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/BoxContainer/Reference" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_reference_pressed"]
[connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/Grid/BoxContainer/Animation" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_animation_pressed"]
Expand Down
6 changes: 4 additions & 2 deletions material_maker/panels/preview_3d/export_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func _on_map_export_file_text_changed(new_text: String) -> void:

func _on_map_resolution_item_selected(index: int) -> void:
mm_globals.set_config(SETTING_GENERATE_MAP_RESOLUTION, index)
update_generate_map_file_label()


func update_generate_map_file_label() -> void:
Expand All @@ -91,9 +92,10 @@ func interpret_map_file_name(file_name: String, path:="") -> String:
match MapFileType.selected:
0: extension += ".png"
1: extension += ".exr"

var resolution := str(256 << MapResolution.selected)

return mm_globals.interpret_file_name(file_name, path, extension, additional_ids)

return mm_globals.interpret_file_name(file_name, path, extension, additional_ids, resolution)

func _on_map_file_type_item_selected(_index: int) -> void:
update_generate_map_file_label()
2 changes: 1 addition & 1 deletion material_maker/panels/preview_3d/preview_3d.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "The file-name to use.
Use $project, $type and $idx to make it auto-adjust."
Use $project, $type, $idx and $resolution to make it auto-adjust."
theme_override_font_sizes/font_size = 15
text = "$project_$type_map"

Expand Down