NodePath.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="NodePath" category="Built-In Types" version="3.1">
  3. <brief_description>
  4. Pre-parsed scene tree path.
  5. </brief_description>
  6. <description>
  7. A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite:texture:size"[/code] would refer to the size property of the texture resource on the node named "Sprite" which is a child of the other named nodes in the path. Note that if you want to get a resource, you must end the path with a colon, otherwise the last element will be used as a property name.
  8. You will usually just pass a string to [method Node.get_node] and it will be automatically converted, but you may occasionally want to parse a path ahead of time with [code]NodePath[/code] or the literal syntax [code]@"path"[/code]. Exporting a [code]NodePath[/code] variable will give you a node selection widget in the properties panel of the editor, which can often be useful.
  9. A [code]NodePath[/code] is made up of a list of node names, a list of "subnode" (resource) names, and the name of a property in the final node or resource.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <demos>
  14. </demos>
  15. <methods>
  16. <method name="NodePath">
  17. <return type="NodePath">
  18. </return>
  19. <argument index="0" name="from" type="String">
  20. </argument>
  21. <description>
  22. Create a NodePath from a string, e.g. "Path2D/PathFollow2D/Sprite:texture:size". A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, [code]"."[/code] and [code]".."[/code] indicate the current node and its parent.
  23. </description>
  24. </method>
  25. <method name="get_as_property_path">
  26. <return type="NodePath">
  27. </return>
  28. <description>
  29. </description>
  30. </method>
  31. <method name="get_concatenated_subnames">
  32. <return type="String">
  33. </return>
  34. <description>
  35. </description>
  36. </method>
  37. <method name="get_name">
  38. <return type="String">
  39. </return>
  40. <argument index="0" name="idx" type="int">
  41. </argument>
  42. <description>
  43. Get the node name indicated by [code]idx[/code] (0 to [method get_name_count])
  44. </description>
  45. </method>
  46. <method name="get_name_count">
  47. <return type="int">
  48. </return>
  49. <description>
  50. Get the number of node names which make up the path.
  51. </description>
  52. </method>
  53. <method name="get_subname">
  54. <return type="String">
  55. </return>
  56. <argument index="0" name="idx" type="int">
  57. </argument>
  58. <description>
  59. Get the resource name indicated by [code]idx[/code] (0 to [method get_subname_count])
  60. </description>
  61. </method>
  62. <method name="get_subname_count">
  63. <return type="int">
  64. </return>
  65. <description>
  66. Get the number of resource names in the path.
  67. </description>
  68. </method>
  69. <method name="is_absolute">
  70. <return type="bool">
  71. </return>
  72. <description>
  73. Return true if the node path is absolute (not relative).
  74. </description>
  75. </method>
  76. <method name="is_empty">
  77. <return type="bool">
  78. </return>
  79. <description>
  80. Return true if the node path is empty.
  81. </description>
  82. </method>
  83. </methods>
  84. <constants>
  85. </constants>
  86. </class>