class_gltfdocumentextension.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/gltf/doc_classes/GLTFDocumentExtension.xml.
  6. .. _class_GLTFDocumentExtension:
  7. GLTFDocumentExtension
  8. =====================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. :ref:`GLTFDocument<class_GLTFDocument>` extension class.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Extends the functionality of the :ref:`GLTFDocument<class_GLTFDocument>` class by allowing you to run arbitrary code at various stages of GLTF import or export.
  15. \ **Note:** Like GLTFDocument itself, all GLTFDocumentExtension classes must be stateless in order to function properly. If you need to store data, use the ``set_additional_data`` and ``get_additional_data`` methods in :ref:`GLTFState<class_GLTFState>` or :ref:`GLTFNode<class_GLTFNode>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`_convert_scene_node<class_GLTFDocumentExtension_method__convert_scene_node>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Node<class_Node>` scene_node **)** |virtual| |
  23. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`_export_node<class_GLTFDocumentExtension_method__export_node>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` json, :ref:`Node<class_Node>` node **)** |virtual| |
  25. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`_export_post<class_GLTFDocumentExtension_method__export_post>` **(** :ref:`GLTFState<class_GLTFState>` state **)** |virtual| |
  27. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`_export_preflight<class_GLTFDocumentExtension_method__export_preflight>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`Node<class_Node>` root **)** |virtual| |
  29. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Object<class_Object>` | :ref:`_generate_scene_node<class_GLTFDocumentExtension_method__generate_scene_node>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Node<class_Node>` scene_parent **)** |virtual| |
  31. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Array<class_Array>` | :ref:`_get_supported_extensions<class_GLTFDocumentExtension_method__get_supported_extensions>` **(** **)** |virtual| |
  33. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`_import_node<class_GLTFDocumentExtension_method__import_node>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` json, :ref:`Node<class_Node>` node **)** |virtual| |
  35. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`_import_post<class_GLTFDocumentExtension_method__import_post>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`Node<class_Node>` root **)** |virtual| |
  37. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`_import_post_parse<class_GLTFDocumentExtension_method__import_post_parse>` **(** :ref:`GLTFState<class_GLTFState>` state **)** |virtual| |
  39. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`_import_preflight<class_GLTFDocumentExtension_method__import_preflight>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`PoolStringArray<class_PoolStringArray>` extensions **)** |virtual| |
  41. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`_parse_node_extensions<class_GLTFDocumentExtension_method__parse_node_extensions>` **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` extensions **)** |virtual| |
  43. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Method Descriptions
  48. -------------------
  49. .. _class_GLTFDocumentExtension_method__convert_scene_node:
  50. .. rst-class:: classref-method
  51. void **_convert_scene_node** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Node<class_Node>` scene_node **)** |virtual|
  52. Part of the export process. This method is run after :ref:`_export_preflight<class_GLTFDocumentExtension_method__export_preflight>` and before :ref:`_export_node<class_GLTFDocumentExtension_method__export_node>`.
  53. Runs when converting the data from a Godot scene node. This method can be used to process the Godot scene node data into a format that can be used by :ref:`_export_node<class_GLTFDocumentExtension_method__export_node>`.
  54. .. rst-class:: classref-item-separator
  55. ----
  56. .. _class_GLTFDocumentExtension_method__export_node:
  57. .. rst-class:: classref-method
  58. :ref:`int<class_int>` **_export_node** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` json, :ref:`Node<class_Node>` node **)** |virtual|
  59. Part of the export process. This method is run after :ref:`_convert_scene_node<class_GLTFDocumentExtension_method__convert_scene_node>` and before :ref:`_export_post<class_GLTFDocumentExtension_method__export_post>`.
  60. This method can be used to modify the final JSON of each node.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_GLTFDocumentExtension_method__export_post:
  64. .. rst-class:: classref-method
  65. :ref:`int<class_int>` **_export_post** **(** :ref:`GLTFState<class_GLTFState>` state **)** |virtual|
  66. Part of the export process. This method is run last, after all other parts of the export process.
  67. This method can be used to modify the final JSON of the generated GLTF file.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_GLTFDocumentExtension_method__export_preflight:
  71. .. rst-class:: classref-method
  72. :ref:`int<class_int>` **_export_preflight** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`Node<class_Node>` root **)** |virtual|
  73. Part of the export process. This method is run first, before all other parts of the export process.
  74. The return value is used to determine if this **GLTFDocumentExtension** instance should be used for exporting a given GLTF file. If :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`, the export will use this **GLTFDocumentExtension** instance. If not overridden, :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` is returned.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_GLTFDocumentExtension_method__generate_scene_node:
  78. .. rst-class:: classref-method
  79. :ref:`Object<class_Object>` **_generate_scene_node** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Node<class_Node>` scene_parent **)** |virtual|
  80. Part of the import process. This method is run after :ref:`_parse_node_extensions<class_GLTFDocumentExtension_method__parse_node_extensions>` and before :ref:`_import_post_parse<class_GLTFDocumentExtension_method__import_post_parse>`.
  81. Runs when generating a Godot scene node from a GLTFNode. The returned node will be added to the scene tree. Multiple nodes can be generated in this step if they are added as a child of the returned node.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_GLTFDocumentExtension_method__get_supported_extensions:
  85. .. rst-class:: classref-method
  86. :ref:`Array<class_Array>` **_get_supported_extensions** **(** **)** |virtual|
  87. Part of the import process. This method is run after :ref:`_import_preflight<class_GLTFDocumentExtension_method__import_preflight>` and before :ref:`_parse_node_extensions<class_GLTFDocumentExtension_method__parse_node_extensions>`.
  88. Returns an array of the GLTF extensions supported by this GLTFDocumentExtension class. This is used to validate if a GLTF file with required extensions can be loaded.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_GLTFDocumentExtension_method__import_node:
  92. .. rst-class:: classref-method
  93. :ref:`int<class_int>` **_import_node** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` json, :ref:`Node<class_Node>` node **)** |virtual|
  94. Part of the import process. This method is run after :ref:`_import_post_parse<class_GLTFDocumentExtension_method__import_post_parse>` and before :ref:`_import_post<class_GLTFDocumentExtension_method__import_post>`.
  95. This method can be used to make modifications to each of the generated Godot scene nodes.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_GLTFDocumentExtension_method__import_post:
  99. .. rst-class:: classref-method
  100. :ref:`int<class_int>` **_import_post** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`Node<class_Node>` root **)** |virtual|
  101. Part of the import process. This method is run last, after all other parts of the import process.
  102. This method can be used to modify the final Godot scene generated by the import process.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_GLTFDocumentExtension_method__import_post_parse:
  106. .. rst-class:: classref-method
  107. :ref:`int<class_int>` **_import_post_parse** **(** :ref:`GLTFState<class_GLTFState>` state **)** |virtual|
  108. Part of the import process. This method is run after :ref:`_generate_scene_node<class_GLTFDocumentExtension_method__generate_scene_node>` and before :ref:`_import_node<class_GLTFDocumentExtension_method__import_node>`.
  109. This method can be used to modify any of the data imported so far, including any scene nodes, before running the final per-node import step.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_GLTFDocumentExtension_method__import_preflight:
  113. .. rst-class:: classref-method
  114. :ref:`int<class_int>` **_import_preflight** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`PoolStringArray<class_PoolStringArray>` extensions **)** |virtual|
  115. Part of the import process. This method is run first, before all other parts of the import process.
  116. The return value is used to determine if this **GLTFDocumentExtension** instance should be used for importing a given GLTF file. If :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`, the import will use this **GLTFDocumentExtension** instance. If not overridden, :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` is returned.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_GLTFDocumentExtension_method__parse_node_extensions:
  120. .. rst-class:: classref-method
  121. :ref:`int<class_int>` **_parse_node_extensions** **(** :ref:`GLTFState<class_GLTFState>` state, :ref:`GLTFNode<class_GLTFNode>` gltf_node, :ref:`Dictionary<class_Dictionary>` extensions **)** |virtual|
  122. Part of the import process. This method is run after :ref:`_get_supported_extensions<class_GLTFDocumentExtension_method__get_supported_extensions>` and before :ref:`_generate_scene_node<class_GLTFDocumentExtension_method__generate_scene_node>`.
  123. Runs when parsing the node extensions of a GLTFNode. This method can be used to process the extension JSON data into a format that can be used by :ref:`_generate_scene_node<class_GLTFDocumentExtension_method__generate_scene_node>`. The return value should be a member of the :ref:`Error<enum_@GlobalScope_Error>` enum.
  124. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  125. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  126. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  127. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`