runtime_save_load.tscn 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. [gd_scene load_steps=2 format=3 uid="uid://ca0d8q5aicxfr"]
  2. [ext_resource type="Script" path="res://runtime_save_load.gd" id="1_2gu2h"]
  3. [node name="RuntimeLoadSave" type="Control"]
  4. layout_mode = 3
  5. anchors_preset = 15
  6. anchor_right = 1.0
  7. anchor_bottom = 1.0
  8. grow_horizontal = 2
  9. grow_vertical = 2
  10. script = ExtResource("1_2gu2h")
  11. [node name="MarginContainer" type="MarginContainer" parent="."]
  12. layout_mode = 1
  13. anchors_preset = 15
  14. anchor_right = 1.0
  15. anchor_bottom = 1.0
  16. grow_horizontal = 2
  17. grow_vertical = 2
  18. theme_override_constants/margin_left = 20
  19. theme_override_constants/margin_top = 20
  20. theme_override_constants/margin_right = 20
  21. theme_override_constants/margin_bottom = 20
  22. [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
  23. layout_mode = 2
  24. theme_override_constants/separation = 10
  25. [node name="Help" type="Label" parent="MarginContainer/VBoxContainer"]
  26. layout_mode = 2
  27. theme_override_colors/font_color = Color(1, 1, 1, 0.752941)
  28. text = "This project showcases how to load and save various file types without going through Godot's resource importing system.
  29. This is useful to load/save images, sounds, 3D scenes and ZIP archives at run-time such as user-generated content,
  30. without requiring users to generate a PCK file through Godot."
  31. autowrap_mode = 2
  32. [node name="Instructions" type="Label" parent="MarginContainer/VBoxContainer"]
  33. layout_mode = 2
  34. text = "Select a file to load (look in the \"examples\" folder):"
  35. autowrap_mode = 2
  36. [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
  37. layout_mode = 2
  38. [node name="FilePath" type="LineEdit" parent="MarginContainer/VBoxContainer/HBoxContainer"]
  39. layout_mode = 2
  40. size_flags_horizontal = 3
  41. placeholder_text = "Click \"Browse\" on the right or enter path to file"
  42. [node name="Browse" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
  43. custom_minimum_size = Vector2(100, 0)
  44. layout_mode = 2
  45. text = "Browse"
  46. [node name="FileDialog" type="FileDialog" parent="MarginContainer/VBoxContainer/HBoxContainer"]
  47. title = "Open a File"
  48. size = Vector2i(392, 159)
  49. ok_button_text = "Open"
  50. file_mode = 0
  51. access = 2
  52. [node name="Result" type="CenterContainer" parent="MarginContainer/VBoxContainer"]
  53. custom_minimum_size = Vector2(0, 400)
  54. layout_mode = 2
  55. [node name="PlainTextViewer" type="ScrollContainer" parent="MarginContainer/VBoxContainer/Result"]
  56. visible = false
  57. custom_minimum_size = Vector2(1050, 400)
  58. layout_mode = 2
  59. horizontal_scroll_mode = 0
  60. [node name="Label" type="Label" parent="MarginContainer/VBoxContainer/Result/PlainTextViewer"]
  61. custom_minimum_size = Vector2(1050, 400)
  62. layout_mode = 2
  63. theme_override_colors/font_color = Color(1, 0.941176, 0.627451, 1)
  64. autowrap_mode = 2
  65. [node name="TextureViewer" type="TextureRect" parent="MarginContainer/VBoxContainer/Result"]
  66. visible = false
  67. custom_minimum_size = Vector2(0, 400)
  68. layout_mode = 2
  69. expand_mode = 3
  70. [node name="AudioPlayer" type="Button" parent="MarginContainer/VBoxContainer/Result"]
  71. visible = false
  72. layout_mode = 2
  73. theme_override_font_sizes/font_size = 24
  74. text = "Play Audio"
  75. [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="MarginContainer/VBoxContainer/Result/AudioPlayer"]
  76. volume_db = -10.0
  77. [node name="SceneViewer" type="SubViewportContainer" parent="MarginContainer/VBoxContainer/Result"]
  78. visible = false
  79. custom_minimum_size = Vector2(1050, 400)
  80. layout_mode = 2
  81. stretch = true
  82. [node name="SubViewport" type="SubViewport" parent="MarginContainer/VBoxContainer/Result/SceneViewer"]
  83. handle_input_locally = false
  84. msaa_3d = 2
  85. size = Vector2i(1050, 400)
  86. render_target_update_mode = 0
  87. [node name="Camera3D" type="Camera3D" parent="MarginContainer/VBoxContainer/Result/SceneViewer/SubViewport"]
  88. transform = Transform3D(0.877582, -0.229849, 0.420736, 0, 0.877582, 0.479426, -0.479426, -0.420736, 0.770151, 26.1772, 30.2846, 47.917)
  89. projection = 1
  90. size = 1.2
  91. near = 0.001
  92. far = 100.0
  93. [node name="KeyLight" type="DirectionalLight3D" parent="MarginContainer/VBoxContainer/Result/SceneViewer/SubViewport"]
  94. transform = Transform3D(0.775472, 0.453626, -0.439166, 0, 0.695563, 0.718465, 0.631382, -0.557149, 0.53939, -2.78761, 4.56046, 3.42378)
  95. shadow_enabled = true
  96. directional_shadow_mode = 0
  97. directional_shadow_fade_start = 1.0
  98. directional_shadow_max_distance = 20.0
  99. [node name="FillLight" type="DirectionalLight3D" parent="MarginContainer/VBoxContainer/Result/SceneViewer/SubViewport"]
  100. transform = Transform3D(-0.775472, -0.453626, 0.439166, 4.2942e-09, 0.695563, 0.718465, -0.631382, 0.557149, -0.53939, -2.78761, 2.56046, 3.42378)
  101. light_energy = 0.3
  102. shadow_bias = 0.04
  103. directional_shadow_mode = 0
  104. directional_shadow_max_distance = 30.0
  105. [node name="BackLight" type="DirectionalLight3D" parent="MarginContainer/VBoxContainer/Result/SceneViewer/SubViewport"]
  106. transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -2.78761, 0.56046, 3.42378)
  107. light_energy = 0.1
  108. shadow_bias = 0.04
  109. directional_shadow_mode = 0
  110. directional_shadow_max_distance = 30.0
  111. [node name="Zoom" type="HSlider" parent="MarginContainer/VBoxContainer/Result/SceneViewer"]
  112. custom_minimum_size = Vector2(1050, 0)
  113. layout_mode = 2
  114. min_value = -100.0
  115. max_value = -0.1
  116. step = 0.0
  117. value = -1.2
  118. [node name="FontViewer" type="Label" parent="MarginContainer/VBoxContainer/Result"]
  119. visible = false
  120. custom_minimum_size = Vector2(1050, 400)
  121. layout_mode = 2
  122. theme_override_font_sizes/font_size = 48
  123. text = "abcdefghijklmnopqrstuvwxyz
  124. ABCDEFGHIJKLM
  125. NOPQRSTUVWXYZ
  126. 1234567890
  127. ()[]{}<> -+:!?$&#@ éàç ×÷±≠ø ↔"
  128. horizontal_alignment = 1
  129. vertical_alignment = 1
  130. [node name="ZIPViewer" type="HSplitContainer" parent="MarginContainer/VBoxContainer/Result"]
  131. visible = false
  132. custom_minimum_size = Vector2(1050, 400)
  133. layout_mode = 2
  134. split_offset = 525
  135. [node name="FileList" type="ItemList" parent="MarginContainer/VBoxContainer/Result/ZIPViewer"]
  136. custom_minimum_size = Vector2(150, 0)
  137. layout_mode = 2
  138. [node name="FilePreview" type="Label" parent="MarginContainer/VBoxContainer/Result/ZIPViewer"]
  139. custom_minimum_size = Vector2(150, 0)
  140. layout_mode = 2
  141. size_flags_horizontal = 3
  142. size_flags_vertical = 1
  143. theme_override_colors/font_color = Color(0.631373, 0.862745, 1, 1)
  144. autowrap_mode = 2
  145. text_overrun_behavior = 3
  146. [node name="ErrorLabel" type="Label" parent="MarginContainer/VBoxContainer/Result"]
  147. visible = false
  148. layout_mode = 2
  149. theme_override_colors/font_color = Color(1, 0.501961, 0.501961, 1)
  150. theme_override_font_sizes/font_size = 24
  151. [node name="Export" type="Button" parent="MarginContainer/VBoxContainer"]
  152. layout_mode = 2
  153. text = "Export"
  154. [node name="FileDialog" type="FileDialog" parent="MarginContainer/VBoxContainer/Export"]
  155. title = "Export File"
  156. access = 2
  157. [connection signal="text_submitted" from="MarginContainer/VBoxContainer/HBoxContainer/FilePath" to="." method="_on_file_path_text_submitted"]
  158. [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Browse" to="." method="_on_browse_pressed"]
  159. [connection signal="file_selected" from="MarginContainer/VBoxContainer/HBoxContainer/FileDialog" to="." method="_on_file_dialog_file_selected"]
  160. [connection signal="pressed" from="MarginContainer/VBoxContainer/Result/AudioPlayer" to="." method="_on_audio_player_pressed"]
  161. [connection signal="value_changed" from="MarginContainer/VBoxContainer/Result/SceneViewer/Zoom" to="." method="_on_scene_viewer_zoom_value_changed"]
  162. [connection signal="item_selected" from="MarginContainer/VBoxContainer/Result/ZIPViewer/FileList" to="." method="_on_zip_viewer_item_selected"]
  163. [connection signal="pressed" from="MarginContainer/VBoxContainer/Export" to="." method="_on_export_pressed"]
  164. [connection signal="file_selected" from="MarginContainer/VBoxContainer/Export/FileDialog" to="." method="_on_export_file_dialog_file_selected"]