class_pckpacker.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the PCKPacker.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_PCKPacker:
  6. PCKPacker
  7. =========
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Creates packages that can be loaded into a running project.
  10. Description
  11. -----------
  12. 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>`.
  13. ::
  14. var packer = PCKPacker.new()
  15. packer.pck_start("test.pck")
  16. packer.add_file("res://text.txt", "text.txt")
  17. packer.flush()
  18. The above ``PCKPacker`` creates package ``test.pck``, then adds a file named ``text.txt`` at the root of the package.
  19. Methods
  20. -------
  21. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :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 **)** |
  23. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`flush<class_PCKPacker_method_flush>` **(** :ref:`bool<class_bool>` verbose=false **)** |
  25. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`pck_start<class_PCKPacker_method_pck_start>` **(** :ref:`String<class_String>` pck_name, :ref:`int<class_int>` alignment=0 **)** |
  27. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  28. Method Descriptions
  29. -------------------
  30. .. _class_PCKPacker_method_add_file:
  31. - :ref:`Error<enum_@GlobalScope_Error>` **add_file** **(** :ref:`String<class_String>` pck_path, :ref:`String<class_String>` source_path **)**
  32. Adds the ``source_path`` file to the current PCK package at the ``pck_path`` internal path (should start with ``res://``).
  33. ----
  34. .. _class_PCKPacker_method_flush:
  35. - :ref:`Error<enum_@GlobalScope_Error>` **flush** **(** :ref:`bool<class_bool>` verbose=false **)**
  36. 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.
  37. ----
  38. .. _class_PCKPacker_method_pck_start:
  39. - :ref:`Error<enum_@GlobalScope_Error>` **pck_start** **(** :ref:`String<class_String>` pck_name, :ref:`int<class_int>` alignment=0 **)**
  40. 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).
  41. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  42. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  43. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`