Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- AnimatedSprite2D
- AudioListener2D
- AudioStreamPlayer2D
- BackBufferCopy
- Bone2D
- CPUParticles2D
- Camera2D
- CanvasGroup
- CanvasModulate
- CollisionObject2D (2)
- CollisionPolygon2D
- CollisionShape2D
- GPUParticles2D
- Joint2D (3)
- Light2D (2)
- LightOccluder2D
- Line2D
- Marker2D
- MeshInstance2D
- MultiMeshInstance2D
- NavigationLink2D
- NavigationObstacle2D
- NavigationRegion2D
- Parallax2D
- ParallaxLayer
- Path2D
- PathFollow2D
- Polygon2D
- RayCast2D
- RemoteTransform2D
- ShapeCast2D
- Skeleton2D
- Sprite2D
- TileMap
- TileMapLayer
- TouchScreenButton
- VisibleOnScreenNotifier2D (1)
Table of contents
-
var antialiased: bool = false -
var color: Color = Color(1, 1, 1, 1) -
var internal_vertex_count: int = 0 -
var invert_border: float = 100.0 -
var invert_enabled: bool = false -
var offset: Vector2 = Vector2(0, 0) -
var polygon: PackedVector2Array = PackedVector2Array() -
var polygons: Array = [] -
var skeleton: NodePath = NodePath("") -
var texture: Texture2D -
var texture_offset: Vector2 = Vector2(0, 0) -
var texture_rotation: float = 0.0 -
var texture_scale: Vector2 = Vector2(1, 1) -
var uv: PackedVector2Array = PackedVector2Array() -
var vertex_colors: PackedColorArray = PackedColorArray() -
func add_bone(weights: PackedFloat32Array) -> void -
func clear_bones() -> void -
func erase_bone(index: int) -> void -
const func get_bone_count() -> int -
const func get_bone_path(index: int) -> NodePath -
const func get_bone_weights(index: int) -> PackedFloat32Array -
func set_bone_path(path: NodePath) -> void -
func set_bone_weights(weights: PackedFloat32Array) -> void
Polygon2D #
is_instantiable, Node2D, Node, core, not_builtin_classes
A 2D polygon.
A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.
Members #
var antialiased: bool = false#
If true, polygon edges will be anti-aliased.
var color: Color = Color(1, 1, 1, 1)#
The polygon's fill color. If texture is set, it will be multiplied by this color. It will also be the default color for vertices not set in vertex_colors.
var internal_vertex_count: int = 0#
Number of internal vertices, used for UV mapping.
var invert_border: float = 100.0#
Added padding applied to the bounding box when invert_enabled is set to true. Setting this value too small may result in a "Bad Polygon" error.
var invert_enabled: bool = false#
If true, the polygon will be inverted, containing the area outside the defined points and extending to the invert_border.
var offset: Vector2 = Vector2(0, 0)#
The offset applied to each vertex.
var polygon: PackedVector2Array = PackedVector2Array()#
The polygon's list of vertices. The final point will be connected to the first.
var polygons: Array = []#
The list of polygons, in case more than one is being represented. Every individual polygon is stored as a PackedInt32Array where each int is an index to a point in polygon. If empty, this property will be ignored, and the resulting single polygon will be composed of all points in polygon, using the order they are stored in.
var skeleton: NodePath = NodePath("")#
Path to a Skeleton2D node used for skeleton-based deformations of this polygon. If empty or invalid, skeletal deformations will not be used.
var texture: Texture2D#
The polygon's fill texture. Use uv to set texture coordinates.
var texture_offset: Vector2 = Vector2(0, 0)#
Amount to offset the polygon's texture. If set to Vector2(0, 0), the texture's origin (its top-left corner) will be placed at the polygon's position.
var texture_rotation: float = 0.0#
The texture's rotation in radians.
var texture_scale: Vector2 = Vector2(1, 1)#
Amount to multiply the uv coordinates when using texture. Larger values make the texture smaller, and vice versa.
var uv: PackedVector2Array = PackedVector2Array()#
Texture coordinates for each vertex of the polygon. There should be one UV value per polygon vertex. If there are fewer, undefined vertices will use Vector2(0, 0).
var vertex_colors: PackedColorArray = PackedColorArray()#
Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use color.
Methods #
func add_bone(weights: PackedFloat32Array) -> void#
Adds a bone with the specified path and weights.
const func get_bone_path(index: int) -> NodePath#
Returns the path to the node associated with the specified bone.
const func get_bone_weights(index: int) -> PackedFloat32Array#
Returns the weight values of the specified bone.
func set_bone_path(path: NodePath) -> void#
Sets the path to the node associated with the specified bone.
func set_bone_weights(weights: PackedFloat32Array) -> void#
Sets the weight values for the specified bone.