EditorSpatialGizmoPlugin.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorSpatialGizmoPlugin" inherits="Resource" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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. To use [EditorSpatialGizmoPlugin], register it using the [method EditorPlugin.add_spatial_gizmo_plugin] method first.
  9. </description>
  10. <tutorials>
  11. <link>$DOCS_URL/tutorials/plugins/editor/spatial_gizmos.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_material">
  15. <return type="void" />
  16. <argument index="0" name="name" type="String" />
  17. <argument index="1" name="material" type="Material3D" />
  18. <description>
  19. 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.
  20. </description>
  21. </method>
  22. <method name="can_be_hidden" qualifiers="virtual">
  23. <return type="bool" />
  24. <description>
  25. Override this method to define whether the gizmo can be hidden or not. Returns [code]true[/code] if not overridden.
  26. </description>
  27. </method>
  28. <method name="commit_handle" qualifiers="virtual">
  29. <return type="void" />
  30. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  31. <argument index="1" name="index" type="int" />
  32. <argument index="2" name="restore" type="Variant" />
  33. <argument index="3" name="cancel" type="bool" default="false" />
  34. <description>
  35. Override this method to commit gizmo handles. Called for this plugin's active gizmos.
  36. </description>
  37. </method>
  38. <method name="create_gizmo" qualifiers="virtual">
  39. <return type="EditorSpatialGizmo" />
  40. <argument index="0" name="spatial" type="Spatial" />
  41. <description>
  42. 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].
  43. </description>
  44. </method>
  45. <method name="create_handle_material">
  46. <return type="void" />
  47. <argument index="0" name="name" type="String" />
  48. <argument index="1" name="billboard" type="bool" default="false" />
  49. <argument index="2" name="texture" type="Texture" default="null" />
  50. <description>
  51. 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.
  52. You can optionally provide a texture to use instead of the default icon.
  53. </description>
  54. </method>
  55. <method name="create_icon_material">
  56. <return type="void" />
  57. <argument index="0" name="name" type="String" />
  58. <argument index="1" name="texture" type="Texture" />
  59. <argument index="2" name="on_top" type="bool" default="false" />
  60. <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )" />
  61. <description>
  62. 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.
  63. </description>
  64. </method>
  65. <method name="create_material">
  66. <return type="void" />
  67. <argument index="0" name="name" type="String" />
  68. <argument index="1" name="color" type="Color" />
  69. <argument index="2" name="billboard" type="bool" default="false" />
  70. <argument index="3" name="on_top" type="bool" default="false" />
  71. <argument index="4" name="use_vertex_color" type="bool" default="false" />
  72. <description>
  73. 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.
  74. </description>
  75. </method>
  76. <method name="get_handle_name" qualifiers="virtual">
  77. <return type="String" />
  78. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  79. <argument index="1" name="index" type="int" />
  80. <description>
  81. Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
  82. </description>
  83. </method>
  84. <method name="get_handle_value" qualifiers="virtual">
  85. <return type="Variant" />
  86. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  87. <argument index="1" name="index" type="int" />
  88. <description>
  89. Gets actual value of a handle from gizmo. Called for this plugin's active gizmos.
  90. </description>
  91. </method>
  92. <method name="get_material">
  93. <return type="Material3D" />
  94. <argument index="0" name="name" type="String" />
  95. <argument index="1" name="gizmo" type="EditorSpatialGizmo" default="null" />
  96. <description>
  97. Gets material from the internal list of materials. If an [EditorSpatialGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
  98. </description>
  99. </method>
  100. <method name="get_name" qualifiers="virtual">
  101. <return type="String" />
  102. <description>
  103. Override this method to provide the name that will appear in the gizmo visibility menu.
  104. </description>
  105. </method>
  106. <method name="get_priority" qualifiers="virtual">
  107. <return type="int" />
  108. <description>
  109. Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used.
  110. All built-in editor gizmos return a priority of [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically override built-in gizmos.
  111. </description>
  112. </method>
  113. <method name="has_gizmo" qualifiers="virtual">
  114. <return type="bool" />
  115. <argument index="0" name="spatial" type="Spatial" />
  116. <description>
  117. 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.
  118. </description>
  119. </method>
  120. <method name="is_handle_highlighted" qualifiers="virtual">
  121. <return type="bool" />
  122. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  123. <argument index="1" name="index" type="int" />
  124. <description>
  125. Gets whether a handle is highlighted or not. Called for this plugin's active gizmos.
  126. </description>
  127. </method>
  128. <method name="is_selectable_when_hidden" qualifiers="virtual">
  129. <return type="bool" />
  130. <description>
  131. Override this method to define whether a Spatial with this gizmo should be selectable even when the gizmo is hidden.
  132. </description>
  133. </method>
  134. <method name="redraw" qualifiers="virtual">
  135. <return type="void" />
  136. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  137. <description>
  138. Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
  139. </description>
  140. </method>
  141. <method name="set_handle" qualifiers="virtual">
  142. <return type="void" />
  143. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  144. <argument index="1" name="index" type="int" />
  145. <argument index="2" name="camera" type="Camera" />
  146. <argument index="3" name="point" type="Vector2" />
  147. <description>
  148. Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
  149. </description>
  150. </method>
  151. </methods>
  152. <constants>
  153. </constants>
  154. </class>