class_projectsettings.rst 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the ProjectSettings.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_ProjectSettings:
  5. ProjectSettings
  6. ===============
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Contains global variables accessible from everywhere.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_property_info<class_ProjectSettings_add_property_info>` **(** :ref:`Dictionary<class_dictionary>` hint **)** |
  16. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`clear<class_ProjectSettings_clear>` **(** :ref:`String<class_string>` name **)** |
  18. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`get_order<class_ProjectSettings_get_order>` **(** :ref:`String<class_string>` name **)** const |
  20. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Variant<class_variant>` | :ref:`get_setting<class_ProjectSettings_get_setting>` **(** :ref:`String<class_string>` name **)** const |
  22. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_string>` | :ref:`globalize_path<class_ProjectSettings_globalize_path>` **(** :ref:`String<class_string>` path **)** const |
  24. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`has_setting<class_ProjectSettings_has_setting>` **(** :ref:`String<class_string>` name **)** const |
  26. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`load_resource_pack<class_ProjectSettings_load_resource_pack>` **(** :ref:`String<class_string>` pack **)** |
  28. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_string>` | :ref:`localize_path<class_ProjectSettings_localize_path>` **(** :ref:`String<class_string>` path **)** const |
  30. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`property_can_revert<class_ProjectSettings_property_can_revert>` **(** :ref:`String<class_string>` name **)** |
  32. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Variant<class_variant>` | :ref:`property_get_revert<class_ProjectSettings_property_get_revert>` **(** :ref:`String<class_string>` name **)** |
  34. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`save<class_ProjectSettings_save>` **(** **)** |
  36. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`save_custom<class_ProjectSettings_save_custom>` **(** :ref:`String<class_string>` file **)** |
  38. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_initial_value<class_ProjectSettings_set_initial_value>` **(** :ref:`String<class_string>` name, :ref:`Variant<class_variant>` value **)** |
  40. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_order<class_ProjectSettings_set_order>` **(** :ref:`String<class_string>` name, :ref:`int<class_int>` position **)** |
  42. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_setting<class_ProjectSettings_set_setting>` **(** :ref:`String<class_string>` name, :ref:`Variant<class_variant>` value **)** |
  44. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  45. Description
  46. -----------
  47. Contains global variables accessible from everywhere. Use "ProjectSettings.get_setting(variable)", "ProjectSettings.set_setting(variable,value)" or "ProjectSettings.has_setting(variable)" to access them. Variables stored in project.godot are also loaded into ProjectSettings, making this object very useful for reading custom game configuration options.
  48. Member Function Description
  49. ---------------------------
  50. .. _class_ProjectSettings_add_property_info:
  51. - void **add_property_info** **(** :ref:`Dictionary<class_dictionary>` hint **)**
  52. Add a custom property info to a property. The dictionary must contain: name::ref:`String<class_string>`(the name of the property) and type::ref:`int<class_int>`(see TYPE\_\* in :ref:`@GlobalScope<class_@globalscope>`), and optionally hint::ref:`int<class_int>`(see PROPERTY_HINT\_\* in :ref:`@GlobalScope<class_@globalscope>`), hint_string::ref:`String<class_string>`.
  53. Example:
  54. ::
  55. ProjectSettings.set("category/property_name", 0)
  56. var property_info = {
  57. "name": "category/property_name",
  58. "type": TYPE_INT,
  59. "hint": PROPERTY_HINT_ENUM,
  60. "hint_string": "one,two,three"
  61. }
  62. ProjectSettings.add_property_info(property_info)
  63. .. _class_ProjectSettings_clear:
  64. - void **clear** **(** :ref:`String<class_string>` name **)**
  65. Clear the whole configuration (not recommended, may break things).
  66. .. _class_ProjectSettings_get_order:
  67. - :ref:`int<class_int>` **get_order** **(** :ref:`String<class_string>` name **)** const
  68. Return the order of a configuration value (influences when saved to the config file).
  69. .. _class_ProjectSettings_get_setting:
  70. - :ref:`Variant<class_variant>` **get_setting** **(** :ref:`String<class_string>` name **)** const
  71. .. _class_ProjectSettings_globalize_path:
  72. - :ref:`String<class_string>` **globalize_path** **(** :ref:`String<class_string>` path **)** const
  73. Convert a localized path (res://) to a full native OS path.
  74. .. _class_ProjectSettings_has_setting:
  75. - :ref:`bool<class_bool>` **has_setting** **(** :ref:`String<class_string>` name **)** const
  76. Return true if a configuration value is present.
  77. .. _class_ProjectSettings_load_resource_pack:
  78. - :ref:`bool<class_bool>` **load_resource_pack** **(** :ref:`String<class_string>` pack **)**
  79. .. _class_ProjectSettings_localize_path:
  80. - :ref:`String<class_string>` **localize_path** **(** :ref:`String<class_string>` path **)** const
  81. Convert a path to a localized path (res:// path).
  82. .. _class_ProjectSettings_property_can_revert:
  83. - :ref:`bool<class_bool>` **property_can_revert** **(** :ref:`String<class_string>` name **)**
  84. .. _class_ProjectSettings_property_get_revert:
  85. - :ref:`Variant<class_variant>` **property_get_revert** **(** :ref:`String<class_string>` name **)**
  86. .. _class_ProjectSettings_save:
  87. - :ref:`int<class_int>` **save** **(** **)**
  88. .. _class_ProjectSettings_save_custom:
  89. - :ref:`int<class_int>` **save_custom** **(** :ref:`String<class_string>` file **)**
  90. .. _class_ProjectSettings_set_initial_value:
  91. - void **set_initial_value** **(** :ref:`String<class_string>` name, :ref:`Variant<class_variant>` value **)**
  92. .. _class_ProjectSettings_set_order:
  93. - void **set_order** **(** :ref:`String<class_string>` name, :ref:`int<class_int>` position **)**
  94. Set the order of a configuration value (influences when saved to the config file).
  95. .. _class_ProjectSettings_set_setting:
  96. - void **set_setting** **(** :ref:`String<class_string>` name, :ref:`Variant<class_variant>` value **)**