class_pckpacker.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/PCKPacker.xml.
  6. .. _class_PCKPacker:
  7. PCKPacker
  8. =========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Creates packages that can be loaded into a running project.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The **PCKPacker** is used to create packages that can be loaded into a running project using :ref:`ProjectSettings.load_resource_pack<class_ProjectSettings_method_load_resource_pack>`.
  15. .. tabs::
  16. .. code-tab:: gdscript
  17. var packer = PCKPacker.new()
  18. packer.pck_start("test.pck")
  19. packer.add_file("res://text.txt", "text.txt")
  20. packer.flush()
  21. .. code-tab:: csharp
  22. var packer = new PCKPacker();
  23. packer.PckStart("test.pck");
  24. packer.AddFile("res://text.txt", "text.txt");
  25. packer.Flush();
  26. The above **PCKPacker** creates package ``test.pck``, then adds a file named ``text.txt`` at the root of the package.
  27. .. rst-class:: classref-reftable-group
  28. Methods
  29. -------
  30. .. table::
  31. :widths: auto
  32. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`add_file<class_PCKPacker_method_add_file>` **(** :ref:`String<class_String>` pck_path, :ref:`String<class_String>` source_path, :ref:`bool<class_bool>` encrypt=false **)** |
  34. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`flush<class_PCKPacker_method_flush>` **(** :ref:`bool<class_bool>` verbose=false **)** |
  36. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`pck_start<class_PCKPacker_method_pck_start>` **(** :ref:`String<class_String>` pck_name, :ref:`int<class_int>` alignment=32, :ref:`String<class_String>` key="0000000000000000000000000000000000000000000000000000000000000000", :ref:`bool<class_bool>` encrypt_directory=false **)** |
  38. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Method Descriptions
  43. -------------------
  44. .. _class_PCKPacker_method_add_file:
  45. .. rst-class:: classref-method
  46. :ref:`Error<enum_@GlobalScope_Error>` **add_file** **(** :ref:`String<class_String>` pck_path, :ref:`String<class_String>` source_path, :ref:`bool<class_bool>` encrypt=false **)**
  47. Adds the ``source_path`` file to the current PCK package at the ``pck_path`` internal path (should start with ``res://``).
  48. .. rst-class:: classref-item-separator
  49. ----
  50. .. _class_PCKPacker_method_flush:
  51. .. rst-class:: classref-method
  52. :ref:`Error<enum_@GlobalScope_Error>` **flush** **(** :ref:`bool<class_bool>` verbose=false **)**
  53. Writes the files specified using all :ref:`add_file<class_PCKPacker_method_add_file>` calls since the last flush. If ``verbose`` is ``true``, a list of files added will be printed to the console for easier debugging.
  54. .. rst-class:: classref-item-separator
  55. ----
  56. .. _class_PCKPacker_method_pck_start:
  57. .. rst-class:: classref-method
  58. :ref:`Error<enum_@GlobalScope_Error>` **pck_start** **(** :ref:`String<class_String>` pck_name, :ref:`int<class_int>` alignment=32, :ref:`String<class_String>` key="0000000000000000000000000000000000000000000000000000000000000000", :ref:`bool<class_bool>` encrypt_directory=false **)**
  59. Creates a new PCK file with the name ``pck_name``. The ``.pck`` file extension isn't added automatically, so it should be part of ``pck_name`` (even though it's not required).
  60. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  61. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  62. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  63. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  64. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  65. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`