EditorSpinSlider

继承: Range < Control < CanvasItem < Node < Object

Godot 编辑器用于编辑数值的控件。

描述

这个 Control 节点在编辑器的检查器面板中使用,允许编辑数值。可以与 EditorInspectorPlugin 一起使用,以重新创建相同的行为。

如果 Range.step 值为 1,则 EditorSpinSlider 将显示向上/向下箭头,类似于 SpinBox。如果 Range.step 值不是 1,则会显示一个滑块。

属性

ControlState

control_state

0

bool

editing_integer

false

bool

flat

false

FocusMode

focus_mode

2 (overrides Control)

bool

hide_slider

false

String

label

""

bool

read_only

false

BitField[SizeFlags]

size_flags_vertical

1 (overrides Control)

float

step

1.0 (overrides Range)

String

suffix

""

主题属性

Texture2D

updown

Texture2D

updown_disabled


信号

grabbed() 🔗

当微调器/滑块被抓取时发出。


ungrabbed() 🔗

当微调器/滑块取消抓取时发出。


updown_pressed() 🔗

当按下上下按钮时发出。


value_focus_entered() 🔗

值表单获得焦点时发出。


value_focus_exited() 🔗

值表单丢失焦点时发出。


枚举

enum ControlState: 🔗

ControlState CONTROL_STATE_DEFAULT = 0

The type of control used will depend on the value of editing_integer. Up-down arrows if true, a slider if false.

ControlState CONTROL_STATE_PREFER_SLIDER = 1

A slider will always be used, even if editing_integer is enabled.

ControlState CONTROL_STATE_HIDE = 2

Neither the up-down arrows nor the slider will be shown.


属性说明

ControlState control_state = 0 🔗

The state in which the control used to manipulate the value will be.


bool editing_integer = false 🔗

  • void set_editing_integer(value: bool)

  • bool is_editing_integer()

If true, the EditorSpinSlider is considered to be editing an integer value. If false, the EditorSpinSlider is considered to be editing a floating-point value. This is used to determine whether a slider should be drawn by default. The slider is only drawn for floats; integers use up-down arrows similar to SpinBox instead, unless control_state is set to CONTROL_STATE_PREFER_SLIDER. It will also use EditorSettings.interface/inspector/integer_drag_speed instead of EditorSettings.interface/inspector/float_drag_speed if the slider is available.


bool flat = false 🔗

  • void set_flat(value: bool)

  • bool is_flat()

如果为 true,则滑块不会绘制背景。


bool hide_slider = false 🔗

  • void set_hide_slider(value: bool)

  • bool is_hiding_slider()

已弃用: Use control_state instead.

如果为 true,则隐藏滑块和向上/向下箭头。


String label = "" 🔗

在值的左侧显示的文本。


bool read_only = false 🔗

  • void set_read_only(value: bool)

  • bool is_read_only()

如果为 true,则无法与滑块交互。


String suffix = "" 🔗

在值之后显示的后缀(以一种淡化的颜色显示)。这通常应该是一个复数形式的词。如果后缀太长而无法显示,可能必须使用缩写。


主题属性说明

Texture2D updown 🔗

代表上下按钮的单张纹理。


Texture2D updown_disabled 🔗

控件只读或禁用时,代表上下按钮的单张纹理。