mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
Rename Camera2D's smoothing
to position_smoothing
For Camera2D: `smoothing_enabled` -> `position_smoothing_enabled` `set_enable_follow_smoothing` -> `set_position_smoothing_enabled` `is_follow_smoothing_enabled` -> `is_position_smoothing_enabled` `smoothing_speed` -> `position_smoothing_speed` `set_follow_smoothing` -> `set_position_smoothing_speed` `get_follow_smoothing` -> `get_position_smoothing_speed`
This commit is contained in:
parent
5aadc618b6
commit
43b9cc96da
@ -52,14 +52,14 @@
|
|||||||
<return type="Vector2" />
|
<return type="Vector2" />
|
||||||
<description>
|
<description>
|
||||||
Returns this camera's target position, in global coordinates.
|
Returns this camera's target position, in global coordinates.
|
||||||
[b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]).
|
[b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member position_smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="reset_smoothing">
|
<method name="reset_smoothing">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<description>
|
<description>
|
||||||
Sets the camera's position immediately to its current smoothing destination.
|
Sets the camera's position immediately to its current smoothing destination.
|
||||||
This method has no effect if [member smoothing_enabled] is [code]false[/code].
|
This method has no effect if [member position_smoothing_enabled] is [code]false[/code].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_drag_margin">
|
<method name="set_drag_margin">
|
||||||
@ -138,7 +138,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled" default="false">
|
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled" default="false">
|
||||||
If [code]true[/code], the camera smoothly stops when reaches its limits.
|
If [code]true[/code], the camera smoothly stops when reaches its limits.
|
||||||
This property has no effect if [member smoothing_enabled] is [code]false[/code].
|
This property has no effect if [member position_smoothing_enabled] is [code]false[/code].
|
||||||
[b]Note:[/b] To immediately update the camera's position to be within limits without smoothing, even with this setting enabled, invoke [method reset_smoothing].
|
[b]Note:[/b] To immediately update the camera's position to be within limits without smoothing, even with this setting enabled, invoke [method reset_smoothing].
|
||||||
</member>
|
</member>
|
||||||
<member name="limit_top" type="int" setter="set_limit" getter="get_limit" default="-10000000">
|
<member name="limit_top" type="int" setter="set_limit" getter="get_limit" default="-10000000">
|
||||||
@ -147,6 +147,12 @@
|
|||||||
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
|
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
|
||||||
The camera's relative offset. Useful for looking around or camera shake animations. The offsetted camera can go past the limits defined in [member limit_top], [member limit_bottom], [member limit_left] and [member limit_right].
|
The camera's relative offset. Useful for looking around or camera shake animations. The offsetted camera can go past the limits defined in [member limit_top], [member limit_bottom], [member limit_left] and [member limit_right].
|
||||||
</member>
|
</member>
|
||||||
|
<member name="position_smoothing_enabled" type="bool" setter="set_position_smoothing_enabled" getter="is_position_smoothing_enabled" default="false">
|
||||||
|
If [code]true[/code], the camera's view smoothly moves towards its target position at [member position_smoothing_speed].
|
||||||
|
</member>
|
||||||
|
<member name="position_smoothing_speed" type="float" setter="set_position_smoothing_speed" getter="get_position_smoothing_speed" default="5.0">
|
||||||
|
Speed in pixels per second of the camera's smoothing effect when [member position_smoothing_enabled] is [code]true[/code].
|
||||||
|
</member>
|
||||||
<member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="Camera2D.Camera2DProcessCallback" default="1">
|
<member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="Camera2D.Camera2DProcessCallback" default="1">
|
||||||
The camera's process callback. See [enum Camera2DProcessCallback].
|
The camera's process callback. See [enum Camera2DProcessCallback].
|
||||||
</member>
|
</member>
|
||||||
@ -157,12 +163,6 @@
|
|||||||
<member name="rotation_smoothing_speed" type="float" setter="set_rotation_smoothing_speed" getter="get_rotation_smoothing_speed" default="5.0">
|
<member name="rotation_smoothing_speed" type="float" setter="set_rotation_smoothing_speed" getter="get_rotation_smoothing_speed" default="5.0">
|
||||||
The angular, asymptotic speed of the camera's rotation smoothing effect when [member rotation_smoothing_enabled] is [code]true[/code].
|
The angular, asymptotic speed of the camera's rotation smoothing effect when [member rotation_smoothing_enabled] is [code]true[/code].
|
||||||
</member>
|
</member>
|
||||||
<member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled" default="false">
|
|
||||||
If [code]true[/code], the camera smoothly moves towards the target at [member smoothing_speed].
|
|
||||||
</member>
|
|
||||||
<member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing" default="5.0">
|
|
||||||
Speed in pixels per second of the camera's smoothing effect when [member smoothing_enabled] is [code]true[/code].
|
|
||||||
</member>
|
|
||||||
<member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom" default="Vector2(1, 1)">
|
<member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom" default="Vector2(1, 1)">
|
||||||
The camera's zoom. A zoom of [code]Vector(2, 2)[/code] doubles the size seen in the viewport. A zoom of [code]Vector(0.5, 0.5)[/code] halves the size seen in the viewport.
|
The camera's zoom. A zoom of [code]Vector(2, 2)[/code] doubles the size seen in the viewport. A zoom of [code]Vector(0.5, 0.5)[/code] halves the size seen in the viewport.
|
||||||
</member>
|
</member>
|
||||||
|
@ -310,6 +310,7 @@ static const char *gdscript_function_renames[][2] = {
|
|||||||
{ "get_error_string", "get_error_message" }, // JSON
|
{ "get_error_string", "get_error_message" }, // JSON
|
||||||
{ "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
|
{ "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
|
||||||
{ "get_focus_neighbour", "get_focus_neighbor" }, // Control
|
{ "get_focus_neighbour", "get_focus_neighbor" }, // Control
|
||||||
|
{ "get_follow_smoothing", "get_position_smoothing_speed" }, // Camera2D
|
||||||
{ "get_font_types", "get_font_type_list" }, // Theme
|
{ "get_font_types", "get_font_type_list" }, // Theme
|
||||||
{ "get_frame_color", "get_color" }, // ColorRect
|
{ "get_frame_color", "get_color" }, // ColorRect
|
||||||
{ "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer
|
{ "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer
|
||||||
@ -417,6 +418,7 @@ static const char *gdscript_function_renames[][2] = {
|
|||||||
{ "is_commiting_action", "is_committing_action" }, // UndoRedo
|
{ "is_commiting_action", "is_committing_action" }, // UndoRedo
|
||||||
{ "is_doubleclick", "is_double_click" }, // InputEventMouseButton
|
{ "is_doubleclick", "is_double_click" }, // InputEventMouseButton
|
||||||
{ "is_draw_red", "is_draw_warning" }, // EditorProperty
|
{ "is_draw_red", "is_draw_warning" }, // EditorProperty
|
||||||
|
{ "is_follow_smoothing_enabled", "is_position_smoothing_enabled" }, // Camera2D
|
||||||
{ "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D
|
{ "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D
|
||||||
{ "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
|
{ "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
|
||||||
{ "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D
|
{ "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D
|
||||||
@ -497,11 +499,13 @@ static const char *gdscript_function_renames[][2] = {
|
|||||||
{ "set_d", "set_distance" }, // WorldMarginShape2D
|
{ "set_d", "set_distance" }, // WorldMarginShape2D
|
||||||
{ "set_doubleclick", "set_double_click" }, // InputEventMouseButton
|
{ "set_doubleclick", "set_double_click" }, // InputEventMouseButton
|
||||||
{ "set_draw_red", "set_draw_warning" }, // EditorProperty
|
{ "set_draw_red", "set_draw_warning" }, // EditorProperty
|
||||||
|
{ "set_enable_follow_smoothing", "set_position_smoothing_enabled" }, // Camera2D
|
||||||
{ "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton
|
{ "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton
|
||||||
{ "set_endian_swap", "set_big_endian" }, // File
|
{ "set_endian_swap", "set_big_endian" }, // File
|
||||||
{ "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit
|
{ "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit
|
||||||
{ "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
|
{ "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
|
||||||
{ "set_focus_neighbour", "set_focus_neighbor" }, // Control
|
{ "set_focus_neighbour", "set_focus_neighbor" }, // Control
|
||||||
|
{ "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D
|
||||||
{ "set_frame_color", "set_color" }, // ColorRect
|
{ "set_frame_color", "set_color" }, // ColorRect
|
||||||
{ "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer
|
{ "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer
|
||||||
{ "set_gravity_distance_scale", "set_gravity_point_distance_scale" }, // Area2D
|
{ "set_gravity_distance_scale", "set_gravity_point_distance_scale" }, // Area2D
|
||||||
@ -747,6 +751,7 @@ static const char *csharp_function_renames[][2] = {
|
|||||||
{ "GetEndianSwap", "IsBigEndian" }, // File
|
{ "GetEndianSwap", "IsBigEndian" }, // File
|
||||||
{ "GetErrorString", "GetErrorMessage" }, // JSON
|
{ "GetErrorString", "GetErrorMessage" }, // JSON
|
||||||
{ "GetFocusNeighbour", "GetFocusNeighbor" }, // Control
|
{ "GetFocusNeighbour", "GetFocusNeighbor" }, // Control
|
||||||
|
{ "GetFollowSmoothing", "GetFollowSmoothingSpeed" }, // Camera2D
|
||||||
{ "GetFontTypes", "GetFontTypeList" }, // Theme
|
{ "GetFontTypes", "GetFontTypeList" }, // Theme
|
||||||
{ "GetFrameColor", "GetColor" }, // ColorRect
|
{ "GetFrameColor", "GetColor" }, // ColorRect
|
||||||
{ "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer
|
{ "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer
|
||||||
@ -851,6 +856,7 @@ static const char *csharp_function_renames[][2] = {
|
|||||||
{ "IsAParentOf", "IsAncestorOf" }, // Node
|
{ "IsAParentOf", "IsAncestorOf" }, // Node
|
||||||
{ "IsCommitingAction", "IsCommittingAction" }, // UndoRedo
|
{ "IsCommitingAction", "IsCommittingAction" }, // UndoRedo
|
||||||
{ "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton
|
{ "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton
|
||||||
|
{ "IsFollowSmoothingEnabled", "IsPositionSmoothingEnabled" }, // Camera2D
|
||||||
{ "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D
|
{ "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D
|
||||||
{ "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
|
{ "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
|
||||||
{ "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node
|
{ "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node
|
||||||
@ -926,10 +932,12 @@ static const char *csharp_function_renames[][2] = {
|
|||||||
{ "SetCursorPosition", "SetCaretColumn" }, // LineEdit
|
{ "SetCursorPosition", "SetCaretColumn" }, // LineEdit
|
||||||
{ "SetD", "SetDistance" }, // WorldMarginShape2D
|
{ "SetD", "SetDistance" }, // WorldMarginShape2D
|
||||||
{ "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton
|
{ "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton
|
||||||
|
{ "SetEnableFollowSmoothing", "SetFollowSmoothingEnabled" }, // Camera2D
|
||||||
{ "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton
|
{ "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton
|
||||||
{ "SetEndianSwap", "SetBigEndian" }, // File
|
{ "SetEndianSwap", "SetBigEndian" }, // File
|
||||||
{ "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit
|
{ "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit
|
||||||
{ "SetFocusNeighbour", "SetFocusNeighbor" }, // Control
|
{ "SetFocusNeighbour", "SetFocusNeighbor" }, // Control
|
||||||
|
{ "SetFollowSmoothing", "SetFollowSmoothingSpeed" }, // Camera2D
|
||||||
{ "SetFrameColor", "SetColor" }, // ColorRect
|
{ "SetFrameColor", "SetColor" }, // ColorRect
|
||||||
{ "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer
|
{ "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer
|
||||||
{ "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D
|
{ "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D
|
||||||
@ -1126,6 +1134,8 @@ static const char *gdscript_properties_renames[][2] = {
|
|||||||
{ "selectedframe", "selected_frame" }, // Theme
|
{ "selectedframe", "selected_frame" }, // Theme
|
||||||
{ "size_override_stretch", "size_2d_override_stretch" }, // SubViewport
|
{ "size_override_stretch", "size_2d_override_stretch" }, // SubViewport
|
||||||
{ "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D
|
{ "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D
|
||||||
|
{ "smoothing_enabled", "follow_smoothing_enabled" }, // Camera2D
|
||||||
|
{ "smoothing_speed", "position_smoothing_speed" }, // Camera2D
|
||||||
{ "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment
|
{ "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment
|
||||||
{ "ss_reflections_enabled", "ssr_enabled" }, // Environment
|
{ "ss_reflections_enabled", "ssr_enabled" }, // Environment
|
||||||
{ "ss_reflections_fade_in", "ssr_fade_in" }, // Environment
|
{ "ss_reflections_fade_in", "ssr_fade_in" }, // Environment
|
||||||
@ -1217,6 +1227,8 @@ static const char *csharp_properties_renames[][2] = {
|
|||||||
{ "Selectedframe", "SelectedFrame" }, // Theme
|
{ "Selectedframe", "SelectedFrame" }, // Theme
|
||||||
{ "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport
|
{ "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport
|
||||||
{ "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D
|
{ "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D
|
||||||
|
{ "SmoothingEnabled", "FollowSmoothingEnabled" }, // Camera2D
|
||||||
|
{ "SmoothingSpeed", "FollowSmoothingSpeed" }, // Camera2D
|
||||||
{ "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment
|
{ "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment
|
||||||
{ "SsReflectionsEnabled", "SsrEnabled" }, // Environment
|
{ "SsReflectionsEnabled", "SsrEnabled" }, // Environment
|
||||||
{ "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment
|
{ "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment
|
||||||
|
@ -155,11 +155,11 @@ Transform2D Camera2D::get_camera_transform() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
|
if (follow_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
|
||||||
real_t c = smoothing * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
|
real_t c = position_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
|
||||||
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
|
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
|
||||||
ret_camera_pos = smoothed_camera_pos;
|
ret_camera_pos = smoothed_camera_pos;
|
||||||
//camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing;
|
//camera_pos=camera_pos*(1.0-position_smoothing_speed)+new_camera_pos*position_smoothing_speed;
|
||||||
} else {
|
} else {
|
||||||
ret_camera_pos = smoothed_camera_pos = camera_pos;
|
ret_camera_pos = smoothed_camera_pos = camera_pos;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ Transform2D Camera2D::get_camera_transform() {
|
|||||||
|
|
||||||
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
|
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
|
||||||
|
|
||||||
if (!smoothing_enabled || !limit_smoothing_enabled) {
|
if (!follow_smoothing_enabled || !limit_smoothing_enabled) {
|
||||||
if (screen_rect.position.x < limit[SIDE_LEFT]) {
|
if (screen_rect.position.x < limit[SIDE_LEFT]) {
|
||||||
screen_rect.position.x = limit[SIDE_LEFT];
|
screen_rect.position.x = limit[SIDE_LEFT];
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ void Camera2D::set_current(bool p_current) {
|
|||||||
|
|
||||||
void Camera2D::_update_process_internal_for_smoothing() {
|
void Camera2D::_update_process_internal_for_smoothing() {
|
||||||
bool is_not_in_scene_or_editor = !(is_inside_tree() && Engine::get_singleton()->is_editor_hint());
|
bool is_not_in_scene_or_editor = !(is_inside_tree() && Engine::get_singleton()->is_editor_hint());
|
||||||
bool is_any_smoothing_valid = smoothing > 0 || rotation_smoothing_speed > 0;
|
bool is_any_smoothing_valid = position_smoothing_speed > 0 || rotation_smoothing_speed > 0;
|
||||||
|
|
||||||
bool enabled = is_any_smoothing_valid && is_not_in_scene_or_editor;
|
bool enabled = is_any_smoothing_valid && is_not_in_scene_or_editor;
|
||||||
set_process_internal(enabled);
|
set_process_internal(enabled);
|
||||||
@ -525,13 +525,13 @@ void Camera2D::align() {
|
|||||||
_update_scroll();
|
_update_scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::set_follow_smoothing(real_t p_speed) {
|
void Camera2D::set_position_smoothing_speed(real_t p_speed) {
|
||||||
smoothing = p_speed;
|
position_smoothing_speed = p_speed;
|
||||||
_update_process_internal_for_smoothing();
|
_update_process_internal_for_smoothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t Camera2D::get_follow_smoothing() const {
|
real_t Camera2D::get_position_smoothing_speed() const {
|
||||||
return smoothing;
|
return position_smoothing_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::set_rotation_smoothing_speed(real_t p_speed) {
|
void Camera2D::set_rotation_smoothing_speed(real_t p_speed) {
|
||||||
@ -607,18 +607,18 @@ real_t Camera2D::get_drag_horizontal_offset() const {
|
|||||||
void Camera2D::_set_old_smoothing(real_t p_enable) {
|
void Camera2D::_set_old_smoothing(real_t p_enable) {
|
||||||
//compatibility
|
//compatibility
|
||||||
if (p_enable > 0) {
|
if (p_enable > 0) {
|
||||||
smoothing_enabled = true;
|
follow_smoothing_enabled = true;
|
||||||
set_follow_smoothing(p_enable);
|
set_position_smoothing_speed(p_enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::set_enable_follow_smoothing(bool p_enabled) {
|
void Camera2D::set_position_smoothing_enabled(bool p_enabled) {
|
||||||
smoothing_enabled = p_enabled;
|
follow_smoothing_enabled = p_enabled;
|
||||||
notify_property_list_changed();
|
notify_property_list_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Camera2D::is_follow_smoothing_enabled() const {
|
bool Camera2D::is_position_smoothing_enabled() const {
|
||||||
return smoothing_enabled;
|
return follow_smoothing_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::set_custom_viewport(Node *p_viewport) {
|
void Camera2D::set_custom_viewport(Node *p_viewport) {
|
||||||
@ -689,7 +689,7 @@ bool Camera2D::is_margin_drawing_enabled() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::_validate_property(PropertyInfo &p_property) const {
|
void Camera2D::_validate_property(PropertyInfo &p_property) const {
|
||||||
if (!smoothing_enabled && p_property.name == "smoothing_speed") {
|
if (!follow_smoothing_enabled && p_property.name == "smoothing_speed") {
|
||||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||||
}
|
}
|
||||||
if (!rotation_smoothing_enabled && p_property.name == "rotation_smoothing_speed") {
|
if (!rotation_smoothing_enabled && p_property.name == "rotation_smoothing_speed") {
|
||||||
@ -746,11 +746,11 @@ void Camera2D::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &Camera2D::set_custom_viewport);
|
ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &Camera2D::set_custom_viewport);
|
||||||
ClassDB::bind_method(D_METHOD("get_custom_viewport"), &Camera2D::get_custom_viewport);
|
ClassDB::bind_method(D_METHOD("get_custom_viewport"), &Camera2D::get_custom_viewport);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_follow_smoothing", "follow_smoothing"), &Camera2D::set_follow_smoothing);
|
ClassDB::bind_method(D_METHOD("set_position_smoothing_speed", "position_smoothing_speed"), &Camera2D::set_position_smoothing_speed);
|
||||||
ClassDB::bind_method(D_METHOD("get_follow_smoothing"), &Camera2D::get_follow_smoothing);
|
ClassDB::bind_method(D_METHOD("get_position_smoothing_speed"), &Camera2D::get_position_smoothing_speed);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_enable_follow_smoothing", "follow_smoothing"), &Camera2D::set_enable_follow_smoothing);
|
ClassDB::bind_method(D_METHOD("set_position_smoothing_enabled", "position_smoothing_speed"), &Camera2D::set_position_smoothing_enabled);
|
||||||
ClassDB::bind_method(D_METHOD("is_follow_smoothing_enabled"), &Camera2D::is_follow_smoothing_enabled);
|
ClassDB::bind_method(D_METHOD("is_position_smoothing_enabled"), &Camera2D::is_position_smoothing_enabled);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_rotation_smoothing_enabled", "enabled"), &Camera2D::set_rotation_smoothing_enabled);
|
ClassDB::bind_method(D_METHOD("set_rotation_smoothing_enabled", "enabled"), &Camera2D::set_rotation_smoothing_enabled);
|
||||||
ClassDB::bind_method(D_METHOD("is_rotation_smoothing_enabled"), &Camera2D::is_rotation_smoothing_enabled);
|
ClassDB::bind_method(D_METHOD("is_rotation_smoothing_enabled"), &Camera2D::is_rotation_smoothing_enabled);
|
||||||
@ -788,9 +788,9 @@ void Camera2D::_bind_methods() {
|
|||||||
ADD_PROPERTYI(PropertyInfo(Variant::INT, "limit_bottom", PROPERTY_HINT_NONE, "suffix:px"), "set_limit", "get_limit", SIDE_BOTTOM);
|
ADD_PROPERTYI(PropertyInfo(Variant::INT, "limit_bottom", PROPERTY_HINT_NONE, "suffix:px"), "set_limit", "get_limit", SIDE_BOTTOM);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "limit_smoothed"), "set_limit_smoothing_enabled", "is_limit_smoothing_enabled");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "limit_smoothed"), "set_limit_smoothing_enabled", "is_limit_smoothing_enabled");
|
||||||
|
|
||||||
ADD_GROUP("Smoothing", "smoothing_");
|
ADD_GROUP("Follow Smoothing", "follow_smoothing_");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smoothing_enabled"), "set_enable_follow_smoothing", "is_follow_smoothing_enabled");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "position_smoothing_enabled"), "set_position_smoothing_enabled", "is_position_smoothing_enabled");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "smoothing_speed", PROPERTY_HINT_NONE, "suffix:px/s"), "set_follow_smoothing", "get_follow_smoothing");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "position_smoothing_speed", PROPERTY_HINT_NONE, "suffix:px/s"), "set_position_smoothing_speed", "get_position_smoothing_speed");
|
||||||
|
|
||||||
ADD_GROUP("Rotation Smoothing", "rotation_smoothing_");
|
ADD_GROUP("Rotation Smoothing", "rotation_smoothing_");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotation_smoothing_enabled"), "set_rotation_smoothing_enabled", "is_rotation_smoothing_enabled");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotation_smoothing_enabled"), "set_rotation_smoothing_enabled", "is_rotation_smoothing_enabled");
|
||||||
|
@ -65,8 +65,8 @@ protected:
|
|||||||
AnchorMode anchor_mode = ANCHOR_MODE_DRAG_CENTER;
|
AnchorMode anchor_mode = ANCHOR_MODE_DRAG_CENTER;
|
||||||
bool ignore_rotation = true;
|
bool ignore_rotation = true;
|
||||||
bool current = false;
|
bool current = false;
|
||||||
real_t smoothing = 5.0;
|
real_t position_smoothing_speed = 5.0;
|
||||||
bool smoothing_enabled = false;
|
bool follow_smoothing_enabled = false;
|
||||||
|
|
||||||
real_t camera_angle = 0.0;
|
real_t camera_angle = 0.0;
|
||||||
real_t rotation_smoothing_speed = 5.0;
|
real_t rotation_smoothing_speed = 5.0;
|
||||||
@ -140,11 +140,11 @@ public:
|
|||||||
void set_drag_vertical_offset(real_t p_offset);
|
void set_drag_vertical_offset(real_t p_offset);
|
||||||
real_t get_drag_vertical_offset() const;
|
real_t get_drag_vertical_offset() const;
|
||||||
|
|
||||||
void set_enable_follow_smoothing(bool p_enabled);
|
void set_position_smoothing_enabled(bool p_enabled);
|
||||||
bool is_follow_smoothing_enabled() const;
|
bool is_position_smoothing_enabled() const;
|
||||||
|
|
||||||
void set_follow_smoothing(real_t p_speed);
|
void set_position_smoothing_speed(real_t p_speed);
|
||||||
real_t get_follow_smoothing() const;
|
real_t get_position_smoothing_speed() const;
|
||||||
|
|
||||||
void set_rotation_smoothing_speed(real_t p_speed);
|
void set_rotation_smoothing_speed(real_t p_speed);
|
||||||
real_t get_rotation_smoothing_speed() const;
|
real_t get_rotation_smoothing_speed() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user