class_pckpacker.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. Description
  12. -----------
  13. 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>`.
  14. .. tabs::
  15. .. code-tab:: gdscript
  16. var packer = PCKPacker.new()
  17. packer.pck_start("test.pck")
  18. packer.add_file("res://text.txt", "text.txt")
  19. packer.flush()
  20. .. code-tab:: csharp
  21. var packer = new PCKPacker();
  22. packer.PckStart("test.pck");
  23. packer.AddFile("res://text.txt", "text.txt");
  24. packer.Flush();
  25. The above ``PCKPacker`` creates package ``test.pck``, then adds a file named ``text.txt`` at the root of the package.
  26. Methods
  27. -------
  28. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :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 **)** |
  30. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`flush<class_PCKPacker_method_flush>` **(** :ref:`bool<class_bool>` verbose=false **)** |
  32. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :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 **)** |
  34. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. Method Descriptions
  36. -------------------
  37. .. _class_PCKPacker_method_add_file:
  38. - :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 **)**
  39. Adds the ``source_path`` file to the current PCK package at the ``pck_path`` internal path (should start with ``res://``).
  40. ----
  41. .. _class_PCKPacker_method_flush:
  42. - :ref:`Error<enum_@GlobalScope_Error>` **flush** **(** :ref:`bool<class_bool>` verbose=false **)**
  43. 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.
  44. ----
  45. .. _class_PCKPacker_method_pck_start:
  46. - :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 **)**
  47. 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).
  48. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  49. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  50. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  51. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  52. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  53. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`