EditorSpatialGizmoPlugin.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorSpatialGizmoPlugin" inherits="Resource" version="3.3">
  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.3/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. <description>
  49. 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.
  50. </description>
  51. </method>
  52. <method name="create_icon_material">
  53. <return type="void" />
  54. <argument index="0" name="name" type="String" />
  55. <argument index="1" name="texture" type="Texture" />
  56. <argument index="2" name="on_top" type="bool" default="false" />
  57. <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )" />
  58. <description>
  59. 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.
  60. </description>
  61. </method>
  62. <method name="create_material">
  63. <return type="void" />
  64. <argument index="0" name="name" type="String" />
  65. <argument index="1" name="color" type="Color" />
  66. <argument index="2" name="billboard" type="bool" default="false" />
  67. <argument index="3" name="on_top" type="bool" default="false" />
  68. <argument index="4" name="use_vertex_color" type="bool" default="false" />
  69. <description>
  70. 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.
  71. </description>
  72. </method>
  73. <method name="get_handle_name" qualifiers="virtual">
  74. <return type="String" />
  75. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  76. <argument index="1" name="index" type="int" />
  77. <description>
  78. Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
  79. </description>
  80. </method>
  81. <method name="get_handle_value" qualifiers="virtual">
  82. <return type="Variant" />
  83. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  84. <argument index="1" name="index" type="int" />
  85. <description>
  86. Gets actual value of a handle from gizmo. Called for this plugin's active gizmos.
  87. </description>
  88. </method>
  89. <method name="get_material">
  90. <return type="SpatialMaterial" />
  91. <argument index="0" name="name" type="String" />
  92. <argument index="1" name="gizmo" type="EditorSpatialGizmo" default="null" />
  93. <description>
  94. 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).
  95. </description>
  96. </method>
  97. <method name="get_name" qualifiers="virtual">
  98. <return type="String" />
  99. <description>
  100. Override this method to provide the name that will appear in the gizmo visibility menu.
  101. </description>
  102. </method>
  103. <method name="get_priority" qualifiers="virtual">
  104. <return type="int" />
  105. <description>
  106. 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.
  107. 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.
  108. </description>
  109. </method>
  110. <method name="has_gizmo" qualifiers="virtual">
  111. <return type="bool" />
  112. <argument index="0" name="spatial" type="Spatial" />
  113. <description>
  114. 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.
  115. </description>
  116. </method>
  117. <method name="is_handle_highlighted" qualifiers="virtual">
  118. <return type="bool" />
  119. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  120. <argument index="1" name="index" type="int" />
  121. <description>
  122. Gets whether a handle is highlighted or not. Called for this plugin's active gizmos.
  123. </description>
  124. </method>
  125. <method name="is_selectable_when_hidden" qualifiers="virtual">
  126. <return type="bool" />
  127. <description>
  128. Override this method to define whether a Spatial with this gizmo should be selectable even when the gizmo is hidden.
  129. </description>
  130. </method>
  131. <method name="redraw" qualifiers="virtual">
  132. <return type="void" />
  133. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  134. <description>
  135. Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
  136. </description>
  137. </method>
  138. <method name="set_handle" qualifiers="virtual">
  139. <return type="void" />
  140. <argument index="0" name="gizmo" type="EditorSpatialGizmo" />
  141. <argument index="1" name="index" type="int" />
  142. <argument index="2" name="camera" type="Camera" />
  143. <argument index="3" name="point" type="Vector2" />
  144. <description>
  145. Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
  146. </description>
  147. </method>
  148. </methods>
  149. <constants>
  150. </constants>
  151. </class>