class_pckpacker.rst 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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>`\ (\ target_path\: :ref:`String<class_String>`, source_path\: :ref:`String<class_String>`, encrypt\: :ref:`bool<class_bool>` = false\ ) |
  34. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`add_file_removal<class_PCKPacker_method_add_file_removal>`\ (\ target_path\: :ref:`String<class_String>`\ ) |
  36. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`flush<class_PCKPacker_method_flush>`\ (\ verbose\: :ref:`bool<class_bool>` = false\ ) |
  38. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`pck_start<class_PCKPacker_method_pck_start>`\ (\ pck_path\: :ref:`String<class_String>`, alignment\: :ref:`int<class_int>` = 32, key\: :ref:`String<class_String>` = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory\: :ref:`bool<class_bool>` = false\ ) |
  40. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. .. rst-class:: classref-section-separator
  42. ----
  43. .. rst-class:: classref-descriptions-group
  44. Method Descriptions
  45. -------------------
  46. .. _class_PCKPacker_method_add_file:
  47. .. rst-class:: classref-method
  48. :ref:`Error<enum_@GlobalScope_Error>` **add_file**\ (\ target_path\: :ref:`String<class_String>`, source_path\: :ref:`String<class_String>`, encrypt\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_PCKPacker_method_add_file>`
  49. Adds the ``source_path`` file to the current PCK package at the ``target_path`` internal path. The ``res://`` prefix for ``target_path`` is optional and stripped internally.
  50. .. rst-class:: classref-item-separator
  51. ----
  52. .. _class_PCKPacker_method_add_file_removal:
  53. .. rst-class:: classref-method
  54. :ref:`Error<enum_@GlobalScope_Error>` **add_file_removal**\ (\ target_path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_PCKPacker_method_add_file_removal>`
  55. Registers a file removal of the ``target_path`` internal path to the PCK. This is mainly used for patches. If the file at this path has been loaded from a previous PCK, it will be removed. The ``res://`` prefix for ``target_path`` is optional and stripped internally.
  56. .. rst-class:: classref-item-separator
  57. ----
  58. .. _class_PCKPacker_method_flush:
  59. .. rst-class:: classref-method
  60. :ref:`Error<enum_@GlobalScope_Error>` **flush**\ (\ verbose\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_PCKPacker_method_flush>`
  61. 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.
  62. .. rst-class:: classref-item-separator
  63. ----
  64. .. _class_PCKPacker_method_pck_start:
  65. .. rst-class:: classref-method
  66. :ref:`Error<enum_@GlobalScope_Error>` **pck_start**\ (\ pck_path\: :ref:`String<class_String>`, alignment\: :ref:`int<class_int>` = 32, key\: :ref:`String<class_String>` = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_PCKPacker_method_pck_start>`
  67. Creates a new PCK file at the file path ``pck_path``. The ``.pck`` file extension isn't added automatically, so it should be part of ``pck_path`` (even though it's not required).
  68. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  69. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  70. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  71. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  72. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  73. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  74. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  75. .. |void| replace:: :abbr:`void (No return value.)`