EditorSpatialGizmoPlugin.xml 7.6 KB

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