EditorSpatialGizmoPlugin.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorSpatialGizmoPlugin" inherits="Resource" category="Core" version="3.1">
  3. <brief_description>
  4. Used by the editor to define Spatial gizmo types.
  5. </brief_description>
  6. <description>
  7. EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html</link>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="add_material">
  16. <return type="void">
  17. </return>
  18. <argument index="0" name="name" type="String">
  19. </argument>
  20. <argument index="1" name="material" type="SpatialMaterial">
  21. </argument>
  22. <description>
  23. Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
  24. </description>
  25. </method>
  26. <method name="can_be_hidden" qualifiers="virtual">
  27. <return type="bool">
  28. </return>
  29. <description>
  30. Override this method to define whether the gizmo can be hidden or not. Defaults to true.
  31. </description>
  32. </method>
  33. <method name="commit_handle" qualifiers="virtual">
  34. <return type="void">
  35. </return>
  36. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  37. </argument>
  38. <argument index="1" name="index" type="int">
  39. </argument>
  40. <argument index="2" name="restore" type="Variant">
  41. </argument>
  42. <argument index="3" name="cancel" type="bool" default="false">
  43. </argument>
  44. <description>
  45. Override this method to commit gizmo handles. Called for this plugin's active gizmos.
  46. </description>
  47. </method>
  48. <method name="create_gizmo" qualifiers="virtual">
  49. <return type="EditorSpatialGizmo">
  50. </return>
  51. <argument index="0" name="spatial" type="Spatial">
  52. </argument>
  53. <description>
  54. Override this method to return a custom [EditorSpatialGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. (See also [method has_gizmo])
  55. </description>
  56. </method>
  57. <method name="create_handle_material">
  58. <return type="void">
  59. </return>
  60. <argument index="0" name="name" type="String">
  61. </argument>
  62. <argument index="1" name="billboard" type="bool" default="false">
  63. </argument>
  64. <description>
  65. Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_handles]. Should not be overridden.
  66. </description>
  67. </method>
  68. <method name="create_icon_material">
  69. <return type="void">
  70. </return>
  71. <argument index="0" name="name" type="String">
  72. </argument>
  73. <argument index="1" name="texture" type="Texture">
  74. </argument>
  75. <argument index="2" name="on_top" type="bool" default="false">
  76. </argument>
  77. <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
  78. </argument>
  79. <description>
  80. Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_unscaled_billboard]. Should not be overridden.
  81. </description>
  82. </method>
  83. <method name="create_material">
  84. <return type="void">
  85. </return>
  86. <argument index="0" name="name" type="String">
  87. </argument>
  88. <argument index="1" name="color" type="Color">
  89. </argument>
  90. <argument index="2" name="billboard" type="bool" default="false">
  91. </argument>
  92. <argument index="3" name="on_top" type="bool" default="false">
  93. </argument>
  94. <argument index="4" name="use_vertex_color" type="bool" default="false">
  95. </argument>
  96. <description>
  97. Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_mesh] and [method EditorSpatialGizmo.add_lines]. Should not be overridden.
  98. </description>
  99. </method>
  100. <method name="get_handle_name" qualifiers="virtual">
  101. <return type="String">
  102. </return>
  103. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  104. </argument>
  105. <argument index="1" name="index" type="int">
  106. </argument>
  107. <description>
  108. Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
  109. </description>
  110. </method>
  111. <method name="get_handle_value" qualifiers="virtual">
  112. <return type="Variant">
  113. </return>
  114. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  115. </argument>
  116. <argument index="1" name="index" type="int">
  117. </argument>
  118. <description>
  119. Get actual value of a handle from gizmo. Called for this plugin's active gizmos.
  120. </description>
  121. </method>
  122. <method name="get_material">
  123. <return type="SpatialMaterial">
  124. </return>
  125. <argument index="0" name="name" type="String">
  126. </argument>
  127. <argument index="1" name="gizmo" type="EditorSpatialGizmo">
  128. </argument>
  129. <description>
  130. Get material from the internal list of materials. If an [EditorSpatialGizmo] is provided it will try to get the corresponding variant (selected and/or editable).
  131. </description>
  132. </method>
  133. <method name="get_name" qualifiers="virtual">
  134. <return type="String">
  135. </return>
  136. <description>
  137. Override this method to provide the name that will appear in the gizmo visibility menu.
  138. </description>
  139. </method>
  140. <method name="has_gizmo" qualifiers="virtual">
  141. <return type="bool">
  142. </return>
  143. <argument index="0" name="spatial" type="Spatial">
  144. </argument>
  145. <description>
  146. Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a [Spatial] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorSpatialGizmo] assigned and is added to this plugin's list of active gizmos.
  147. </description>
  148. </method>
  149. <method name="is_handle_highlighted" qualifiers="virtual">
  150. <return type="bool">
  151. </return>
  152. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  153. </argument>
  154. <argument index="1" name="index" type="int">
  155. </argument>
  156. <description>
  157. Get whether a handle is highlighted or not. Called for this plugin's active gizmos.
  158. </description>
  159. </method>
  160. <method name="is_selectable_when_hidden" qualifiers="virtual">
  161. <return type="bool">
  162. </return>
  163. <description>
  164. Override this method to define whether Spatial with this gizmo should be selecteble even when the gizmo is hidden.
  165. </description>
  166. </method>
  167. <method name="redraw" qualifiers="virtual">
  168. <return type="void">
  169. </return>
  170. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  171. </argument>
  172. <description>
  173. Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
  174. </description>
  175. </method>
  176. <method name="set_handle" qualifiers="virtual">
  177. <return type="void">
  178. </return>
  179. <argument index="0" name="gizmo" type="EditorSpatialGizmo">
  180. </argument>
  181. <argument index="1" name="index" type="int">
  182. </argument>
  183. <argument index="2" name="camera" type="Camera">
  184. </argument>
  185. <argument index="3" name="point" type="Vector2">
  186. </argument>
  187. <description>
  188. Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
  189. </description>
  190. </method>
  191. </methods>
  192. <constants>
  193. </constants>
  194. </class>