mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Rename Project.directory_path
to Project.export_directory_path
This commit is contained in:
parent
64983b0404
commit
6c8b2ae36b
|
@ -280,15 +280,18 @@ func export_processed_images(
|
||||||
ignore_overwrites: bool, export_dialog: ConfirmationDialog, project := Global.current_project
|
ignore_overwrites: bool, export_dialog: ConfirmationDialog, project := Global.current_project
|
||||||
) -> bool:
|
) -> bool:
|
||||||
# Stop export if directory path or file name are not valid
|
# Stop export if directory path or file name are not valid
|
||||||
var dir := DirAccess.open(project.directory_path)
|
var dir := DirAccess.open(project.export_directory_path)
|
||||||
if not dir.dir_exists(project.directory_path) or not project.file_name.is_valid_filename():
|
var dir_exists := dir.dir_exists(project.export_directory_path)
|
||||||
if not dir.dir_exists(project.directory_path) and project.file_name.is_valid_filename():
|
var is_valid_filename := project.file_name.is_valid_filename()
|
||||||
|
if not dir_exists:
|
||||||
|
if is_valid_filename: # Directory path not valid, file name is valid
|
||||||
export_dialog.open_path_validation_alert_popup(0)
|
export_dialog.open_path_validation_alert_popup(0)
|
||||||
elif not project.file_name.is_valid_filename() and dir.dir_exists(project.directory_path):
|
else: # Both directory path and file name are invalid
|
||||||
export_dialog.open_path_validation_alert_popup(1)
|
|
||||||
else:
|
|
||||||
export_dialog.open_path_validation_alert_popup()
|
export_dialog.open_path_validation_alert_popup()
|
||||||
return false
|
return false
|
||||||
|
if not is_valid_filename: # Directory path is valid, file name is invalid
|
||||||
|
export_dialog.open_path_validation_alert_popup(1)
|
||||||
|
return false
|
||||||
|
|
||||||
var multiple_files := false
|
var multiple_files := false
|
||||||
if current_tab == ExportTab.IMAGE and not is_single_file_format(project):
|
if current_tab == ExportTab.IMAGE and not is_single_file_format(project):
|
||||||
|
@ -309,7 +312,7 @@ func export_processed_images(
|
||||||
if multiple_files and new_dir_for_each_frame_tag:
|
if multiple_files and new_dir_for_each_frame_tag:
|
||||||
var frame_tag_directory := DirAccess.open(export_path.get_base_dir())
|
var frame_tag_directory := DirAccess.open(export_path.get_base_dir())
|
||||||
if not frame_tag_directory.dir_exists(export_path.get_base_dir()):
|
if not frame_tag_directory.dir_exists(export_path.get_base_dir()):
|
||||||
frame_tag_directory = DirAccess.open(project.directory_path)
|
frame_tag_directory = DirAccess.open(project.export_directory_path)
|
||||||
frame_tag_directory.make_dir(export_path.get_base_dir().get_file())
|
frame_tag_directory.make_dir(export_path.get_base_dir().get_file())
|
||||||
|
|
||||||
if not ignore_overwrites: # Check if the files already exist
|
if not ignore_overwrites: # Check if the files already exist
|
||||||
|
@ -430,8 +433,8 @@ func export_processed_images(
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
Global.top_menu_container.file_menu.set_item_text(
|
||||||
Global.FileMenu.EXPORT, tr("Export") + " %s" % file_name_with_ext
|
Global.FileMenu.EXPORT, tr("Export") + " %s" % file_name_with_ext
|
||||||
)
|
)
|
||||||
project.directory_path = export_paths[0].get_base_dir()
|
project.export_directory_path = export_paths[0].get_base_dir()
|
||||||
Global.config_cache.set_value("data", "current_dir", project.directory_path)
|
Global.config_cache.set_value("data", "current_dir", project.export_directory_path)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
@ -624,12 +627,12 @@ func _create_export_path(multifile: bool, project: Project, frame := 0, layer :=
|
||||||
)
|
)
|
||||||
if new_dir_for_each_frame_tag:
|
if new_dir_for_each_frame_tag:
|
||||||
path += path_extras
|
path += path_extras
|
||||||
return project.directory_path.path_join(frame_tag_dir).path_join(
|
return project.export_directory_path.path_join(frame_tag_dir).path_join(
|
||||||
path + file_format_string(project.file_format)
|
path + file_format_string(project.file_format)
|
||||||
)
|
)
|
||||||
path += path_extras
|
path += path_extras
|
||||||
|
|
||||||
return project.directory_path.path_join(path + file_format_string(project.file_format))
|
return project.export_directory_path.path_join(path + file_format_string(project.file_format))
|
||||||
|
|
||||||
|
|
||||||
func _get_proccessed_image_animation_tag_and_start_id(
|
func _get_proccessed_image_animation_tag_and_start_id(
|
||||||
|
|
|
@ -260,7 +260,7 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true
|
||||||
# Set last opened project path and save
|
# Set last opened project path and save
|
||||||
Global.config_cache.set_value("data", "last_project_path", path)
|
Global.config_cache.set_value("data", "last_project_path", path)
|
||||||
Global.config_cache.save("user://cache.ini")
|
Global.config_cache.save("user://cache.ini")
|
||||||
new_project.directory_path = path.get_base_dir()
|
new_project.export_directory_path = path.get_base_dir()
|
||||||
new_project.file_name = path.get_file().trim_suffix(".pxo")
|
new_project.file_name = path.get_file().trim_suffix(".pxo")
|
||||||
new_project.was_exported = false
|
new_project.was_exported = false
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
Global.top_menu_container.file_menu.set_item_text(
|
||||||
|
@ -424,7 +424,7 @@ func save_pxo_file(
|
||||||
Global.config_cache.save("user://cache.ini")
|
Global.config_cache.save("user://cache.ini")
|
||||||
if !project.was_exported:
|
if !project.was_exported:
|
||||||
project.file_name = path.get_file().trim_suffix(".pxo")
|
project.file_name = path.get_file().trim_suffix(".pxo")
|
||||||
project.directory_path = path.get_base_dir()
|
project.export_directory_path = path.get_base_dir()
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
Global.top_menu_container.file_menu.set_item_text(
|
||||||
Global.FileMenu.SAVE, tr("Save") + " %s" % path.get_file()
|
Global.FileMenu.SAVE, tr("Save") + " %s" % path.get_file()
|
||||||
)
|
)
|
||||||
|
@ -783,8 +783,8 @@ func set_new_imported_tab(project: Project, path: String) -> void:
|
||||||
if project.has_changed:
|
if project.has_changed:
|
||||||
Global.main_window.title = Global.main_window.title + "(*)"
|
Global.main_window.title = Global.main_window.title + "(*)"
|
||||||
var file_name := path.get_basename().get_file()
|
var file_name := path.get_basename().get_file()
|
||||||
var directory_path := path.get_base_dir()
|
var export_directory_path := path.get_base_dir()
|
||||||
project.directory_path = directory_path
|
project.export_directory_path = export_directory_path
|
||||||
project.file_name = file_name
|
project.file_name = file_name
|
||||||
project.was_exported = true
|
project.was_exported = true
|
||||||
if path.get_extension().to_lower() == "png":
|
if path.get_extension().to_lower() == "png":
|
||||||
|
|
|
@ -73,7 +73,7 @@ var cameras_zoom: PackedVector2Array = [
|
||||||
var cameras_offset: PackedVector2Array = [Vector2.ZERO, Vector2.ZERO, Vector2.ZERO]
|
var cameras_offset: PackedVector2Array = [Vector2.ZERO, Vector2.ZERO, Vector2.ZERO]
|
||||||
|
|
||||||
# Export directory path and export file name
|
# Export directory path and export file name
|
||||||
var directory_path := ""
|
var export_directory_path := ""
|
||||||
var file_name := "untitled"
|
var file_name := "untitled"
|
||||||
var file_format := Export.FileFormat.PNG
|
var file_format := Export.FileFormat.PNG
|
||||||
var was_exported := false
|
var was_exported := false
|
||||||
|
@ -109,9 +109,9 @@ func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2
|
||||||
Global.canvas.add_child(y_symmetry_axis)
|
Global.canvas.add_child(y_symmetry_axis)
|
||||||
|
|
||||||
if OS.get_name() == "Web":
|
if OS.get_name() == "Web":
|
||||||
directory_path = "user://"
|
export_directory_path = "user://"
|
||||||
else:
|
else:
|
||||||
directory_path = Global.config_cache.get_value(
|
export_directory_path = Global.config_cache.get_value(
|
||||||
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
||||||
)
|
)
|
||||||
Global.project_created.emit(self)
|
Global.project_created.emit(self)
|
||||||
|
@ -347,7 +347,7 @@ func serialize() -> Dictionary:
|
||||||
"brushes": brush_data,
|
"brushes": brush_data,
|
||||||
"reference_images": reference_image_data,
|
"reference_images": reference_image_data,
|
||||||
"vanishing_points": vanishing_points,
|
"vanishing_points": vanishing_points,
|
||||||
"export_directory_path": directory_path,
|
"export_directory_path": export_directory_path,
|
||||||
"export_file_name": file_name,
|
"export_file_name": file_name,
|
||||||
"export_file_format": file_format,
|
"export_file_format": file_format,
|
||||||
"fps": fps,
|
"fps": fps,
|
||||||
|
@ -467,7 +467,7 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
|
||||||
for point in y_symmetry_axis.points.size():
|
for point in y_symmetry_axis.points.size():
|
||||||
y_symmetry_axis.points[point].x = floorf(x_symmetry_point / 2 + 1)
|
y_symmetry_axis.points[point].x = floorf(x_symmetry_point / 2 + 1)
|
||||||
if dict.has("export_directory_path"):
|
if dict.has("export_directory_path"):
|
||||||
directory_path = dict.export_directory_path
|
export_directory_path = dict.export_directory_path
|
||||||
if dict.has("export_file_name"):
|
if dict.has("export_file_name"):
|
||||||
file_name = dict.export_file_name
|
file_name = dict.export_file_name
|
||||||
if dict.has("export_file_format"):
|
if dict.has("export_file_format"):
|
||||||
|
|
|
@ -396,7 +396,7 @@ func _quit() -> void:
|
||||||
func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array) -> void:
|
func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array) -> void:
|
||||||
OpenSave.reload_backup_file(project_paths, backup_paths)
|
OpenSave.reload_backup_file(project_paths, backup_paths)
|
||||||
Global.current_project.file_name = OpenSave.current_save_paths[0].get_file().trim_suffix(".pxo")
|
Global.current_project.file_name = OpenSave.current_save_paths[0].get_file().trim_suffix(".pxo")
|
||||||
Global.current_project.directory_path = OpenSave.current_save_paths[0].get_base_dir()
|
Global.current_project.export_directory_path = OpenSave.current_save_paths[0].get_base_dir()
|
||||||
Global.current_project.was_exported = false
|
Global.current_project.was_exported = false
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
Global.top_menu_container.file_menu.set_item_text(
|
||||||
Global.FileMenu.SAVE, tr("Save") + " %s" % OpenSave.current_save_paths[0].get_file()
|
Global.FileMenu.SAVE, tr("Save") + " %s" % OpenSave.current_save_paths[0].get_file()
|
||||||
|
|
|
@ -276,18 +276,18 @@ func _on_ExportDialog_about_to_show() -> void:
|
||||||
# If we're on Web, don't let the user change the directory path
|
# If we're on Web, don't let the user change the directory path
|
||||||
if OS.get_name() == "Web":
|
if OS.get_name() == "Web":
|
||||||
get_tree().call_group("NotHTML5", "hide")
|
get_tree().call_group("NotHTML5", "hide")
|
||||||
project.directory_path = "user://"
|
project.export_directory_path = "user://"
|
||||||
|
|
||||||
if project.directory_path.is_empty():
|
if project.export_directory_path.is_empty():
|
||||||
project.directory_path = Global.config_cache.get_value(
|
project.export_directory_path = Global.config_cache.get_value(
|
||||||
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
||||||
)
|
)
|
||||||
|
|
||||||
# If export already occurred - sets GUI to show previous settings
|
# If export already occurred - sets GUI to show previous settings
|
||||||
options_resize.value = Export.resize
|
options_resize.value = Export.resize
|
||||||
options_interpolation.selected = Export.interpolation
|
options_interpolation.selected = Export.interpolation
|
||||||
path_line_edit.text = project.directory_path
|
path_line_edit.text = project.export_directory_path
|
||||||
path_dialog_popup.current_dir = project.directory_path
|
path_dialog_popup.current_dir = project.export_directory_path
|
||||||
file_line_edit.text = project.file_name
|
file_line_edit.text = project.file_name
|
||||||
file_format_options.selected = project.file_format
|
file_format_options.selected = project.file_format
|
||||||
show_tab()
|
show_tab()
|
||||||
|
@ -359,7 +359,7 @@ func _on_PathButton_pressed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_PathLineEdit_text_changed(new_text: String) -> void:
|
func _on_PathLineEdit_text_changed(new_text: String) -> void:
|
||||||
Global.current_project.directory_path = new_text
|
Global.current_project.export_directory_path = new_text
|
||||||
|
|
||||||
|
|
||||||
func _on_FileLineEdit_text_changed(new_text: String) -> void:
|
func _on_FileLineEdit_text_changed(new_text: String) -> void:
|
||||||
|
@ -368,7 +368,7 @@ func _on_FileLineEdit_text_changed(new_text: String) -> void:
|
||||||
|
|
||||||
func _on_FileDialog_dir_selected(dir: String) -> void:
|
func _on_FileDialog_dir_selected(dir: String) -> void:
|
||||||
path_line_edit.text = dir
|
path_line_edit.text = dir
|
||||||
Global.current_project.directory_path = dir
|
Global.current_project.export_directory_path = dir
|
||||||
|
|
||||||
|
|
||||||
func _on_FileFormat_item_selected(idx: int) -> void:
|
func _on_FileFormat_item_selected(idx: int) -> void:
|
||||||
|
|
Loading…
Reference in a new issue