summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/area_2d.cpp8
-rw-r--r--scene/2d/audio_stream_player_2d.cpp71
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/camera_2d.cpp4
-rw-r--r--scene/2d/camera_2d.h2
-rw-r--r--scene/2d/canvas_item.cpp21
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/collision_polygon_2d.cpp3
-rw-r--r--scene/2d/light_2d.cpp7
-rw-r--r--scene/2d/line_2d.cpp25
-rw-r--r--scene/2d/line_2d.h23
-rw-r--r--scene/2d/line_builder.cpp107
-rw-r--r--scene/2d/line_builder.h27
-rw-r--r--scene/2d/node_2d.cpp4
-rw-r--r--scene/2d/path_2d.cpp5
-rw-r--r--scene/2d/physics_body_2d.cpp224
-rw-r--r--scene/2d/physics_body_2d.h52
-rw-r--r--scene/2d/screen_button.cpp3
-rw-r--r--scene/2d/tile_map.cpp8
-rw-r--r--scene/3d/area.cpp6
-rw-r--r--scene/3d/arvr_nodes.cpp19
-rw-r--r--scene/3d/arvr_nodes.h2
-rw-r--r--scene/3d/audio_stream_player_3d.cpp166
-rw-r--r--scene/3d/audio_stream_player_3d.h6
-rw-r--r--scene/3d/bone_attachment.cpp6
-rw-r--r--scene/3d/collision_object.cpp4
-rw-r--r--scene/3d/collision_shape.cpp3
-rw-r--r--scene/3d/gi_probe.cpp19
-rw-r--r--scene/3d/immediate_geometry.cpp2
-rw-r--r--scene/3d/interpolated_camera.cpp4
-rw-r--r--scene/3d/light.cpp15
-rw-r--r--scene/3d/light.h2
-rw-r--r--scene/3d/navigation_mesh.cpp230
-rw-r--r--scene/3d/navigation_mesh.h81
-rw-r--r--scene/3d/path.cpp4
-rw-r--r--scene/3d/physics_body.cpp9
-rw-r--r--scene/3d/spatial.cpp6
-rw-r--r--scene/3d/spatial.h2
-rw-r--r--scene/3d/vehicle_body.cpp8
-rw-r--r--scene/3d/vehicle_body.h2
-rw-r--r--scene/3d/visual_instance.cpp11
-rw-r--r--scene/animation/animation_player.cpp8
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/animation/animation_tree_player.cpp20
-rw-r--r--scene/animation/animation_tree_player.h4
-rw-r--r--scene/audio/audio_player.cpp32
-rw-r--r--scene/audio/audio_player.h2
-rw-r--r--scene/gui/control.cpp38
-rw-r--r--scene/gui/dialogs.cpp2
-rw-r--r--scene/gui/file_dialog.cpp4
-rw-r--r--scene/gui/graph_edit.cpp36
-rw-r--r--scene/gui/graph_node.cpp17
-rw-r--r--scene/gui/graph_node.h4
-rw-r--r--scene/gui/item_list.cpp8
-rw-r--r--scene/gui/item_list.h2
-rw-r--r--scene/gui/line_edit.cpp48
-rw-r--r--scene/gui/line_edit.h4
-rw-r--r--scene/gui/rich_text_label.cpp8
-rw-r--r--scene/gui/scroll_bar.cpp8
-rw-r--r--scene/gui/scroll_container.cpp6
-rw-r--r--scene/gui/scroll_container.h2
-rw-r--r--scene/gui/slider.cpp10
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/tab_container.cpp10
-rw-r--r--scene/gui/text_edit.cpp35
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/tree.cpp152
-rw-r--r--scene/gui/tree.h10
-rw-r--r--scene/gui/video_player.cpp6
-rw-r--r--scene/gui/video_player.h2
-rwxr-xr-xscene/main/node.cpp30
-rw-r--r--scene/main/scene_tree.cpp1
-rw-r--r--scene/main/viewport.cpp16
-rw-r--r--scene/register_scene_types.cpp1
-rw-r--r--scene/resources/animation.cpp28
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/audio_stream_sample.cpp10
-rw-r--r--scene/resources/audio_stream_sample.h2
-rw-r--r--scene/resources/bit_mask.cpp4
-rw-r--r--scene/resources/curve.cpp79
-rw-r--r--scene/resources/curve.h10
-rw-r--r--scene/resources/default_theme/default_theme.cpp4
-rw-r--r--scene/resources/default_theme/icon_snap_grid.png (renamed from scene/resources/default_theme/icon_snap.png)bin269 -> 325 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/font.cpp4
-rw-r--r--scene/resources/material.cpp8
-rw-r--r--scene/resources/mesh.cpp44
-rw-r--r--scene/resources/mesh.h3
-rw-r--r--scene/resources/packed_scene.cpp8
-rw-r--r--scene/resources/primitive_meshes.cpp19
-rw-r--r--scene/resources/primitive_meshes.h3
-rw-r--r--scene/resources/scene_format_text.cpp4
-rw-r--r--scene/resources/shader_graph.cpp14
-rw-r--r--scene/resources/shader_graph.h4
-rw-r--r--scene/resources/sky_box.cpp6
-rw-r--r--scene/resources/style_box.h4
-rw-r--r--scene/resources/texture.cpp6
-rw-r--r--scene/resources/video_stream.h2
100 files changed, 1286 insertions, 729 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 26241df660..c2edb173d7 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -223,7 +223,7 @@ void SpriteFrames::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_loop", "anim", "loop"), &SpriteFrames::set_animation_loop);
ClassDB::bind_method(D_METHOD("get_animation_loop", "anim"), &SpriteFrames::get_animation_loop);
- ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "at_position"), &SpriteFrames::add_frame, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_frame_count", "anim"), &SpriteFrames::get_frame_count);
ClassDB::bind_method(D_METHOD("get_frame", "anim", "idx"), &SpriteFrames::get_frame);
ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt"), &SpriteFrames::set_frame);
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 1124904963..9fc6c8d23a 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -596,7 +596,7 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_area_enter_tree", "id"), &Area2D::_area_enter_tree);
ClassDB::bind_method(D_METHOD("_area_exit_tree", "id"), &Area2D::_area_exit_tree);
- ClassDB::bind_method(D_METHOD("set_space_override_mode", "enable"), &Area2D::set_space_override_mode);
+ ClassDB::bind_method(D_METHOD("set_space_override_mode", "space_override_mode"), &Area2D::set_space_override_mode);
ClassDB::bind_method(D_METHOD("get_space_override_mode"), &Area2D::get_space_override_mode);
ClassDB::bind_method(D_METHOD("set_gravity_is_point", "enable"), &Area2D::set_gravity_is_point);
@@ -680,6 +680,12 @@ void Area2D::_bind_methods() {
ADD_GROUP("Audio Bus", "audio_bus_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_bus_override"), "set_audio_bus_override", "is_overriding_audio_bus");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus", "get_audio_bus");
+
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE_REPLACE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE_COMBINE);
}
Area2D::Area2D()
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index ea2e77fc47..4b108996f0 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -57,52 +57,32 @@ void AudioStreamPlayer2D::_mix_audio() {
AudioFrame vol_inc = (current.vol - prev_outputs[i].vol) / float(buffer_size);
AudioFrame vol = current.vol;
- switch (AudioServer::get_singleton()->get_speaker_mode()) {
+ int cc = AudioServer::get_singleton()->get_channel_count();
- case AudioServer::SPEAKER_MODE_STEREO: {
- AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 0);
+ if (cc == 1) {
+ AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 0);
- for (int j = 0; j < buffer_size; j++) {
+ for (int j = 0; j < buffer_size; j++) {
- target[j] += buffer[j] * vol;
- vol += vol_inc;
- }
-
- } break;
- case AudioServer::SPEAKER_SURROUND_51: {
-
- AudioFrame *targets[2] = {
- AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 1),
- AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 2),
- };
-
- for (int j = 0; j < buffer_size; j++) {
-
- AudioFrame frame = buffer[j] * vol;
- targets[0][j] += frame;
- targets[1][j] += frame;
- vol += vol_inc;
- }
+ target[j] += buffer[j] * vol;
+ vol += vol_inc;
+ }
- } break;
- case AudioServer::SPEAKER_SURROUND_71: {
+ } else {
+ AudioFrame *targets[4];
- AudioFrame *targets[3] = {
- AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 1),
- AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 2),
- AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 3)
- };
+ for (int k = 0; k < cc; k++) {
+ targets[k] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, k);
+ }
- for (int j = 0; j < buffer_size; j++) {
+ for (int j = 0; j < buffer_size; j++) {
- AudioFrame frame = buffer[j] * vol;
- targets[0][j] += frame;
- targets[1][j] += frame;
- targets[2][j] += frame;
- vol += vol_inc;
+ AudioFrame frame = buffer[j] * vol;
+ for (int k = 0; k < cc; k++) {
+ targets[k][j] += frame;
}
-
- } break;
+ vol += vol_inc;
+ }
}
prev_outputs[i] = current;
@@ -254,8 +234,6 @@ void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
stream.unref();
ERR_FAIL_COND(stream_playback.is_null());
}
-
-
}
Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
@@ -306,10 +284,10 @@ bool AudioStreamPlayer2D::is_playing() const {
return false;
}
-float AudioStreamPlayer2D::get_pos() {
+float AudioStreamPlayer2D::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -412,12 +390,12 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer2D::get_volume_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer2D::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer2D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer2D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer2D::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer2D::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer2D::get_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer2D::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer2D::get_bus);
@@ -441,7 +419,7 @@ void AudioStreamPlayer2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "play", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "_is_active");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "1,65536,1"), "set_max_distance", "get_max_distance");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "attenuation", PROPERTY_HINT_EXP_EASING), "set_attenuation", "get_attenuation");
@@ -449,7 +427,6 @@ void AudioStreamPlayer2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "area_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_area_mask", "get_area_mask");
ADD_SIGNAL(MethodInfo("finished"));
-
}
AudioStreamPlayer2D::AudioStreamPlayer2D() {
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index 25eff61b76..112d05856b 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -72,7 +72,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_pos();
+ float get_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index e39e6fc6da..0d04967f1c 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -452,7 +452,7 @@ float Camera2D::get_drag_margin(Margin p_margin) const {
return drag_margin[p_margin];
}
-Vector2 Camera2D::get_camera_pos() const {
+Vector2 Camera2D::get_camera_position() const {
return camera_pos;
}
@@ -673,7 +673,7 @@ void Camera2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_margin", "margin", "drag_margin"), &Camera2D::set_drag_margin);
ClassDB::bind_method(D_METHOD("get_drag_margin", "margin"), &Camera2D::get_drag_margin);
- ClassDB::bind_method(D_METHOD("get_camera_pos"), &Camera2D::get_camera_pos);
+ ClassDB::bind_method(D_METHOD("get_camera_position"), &Camera2D::get_camera_position);
ClassDB::bind_method(D_METHOD("get_camera_screen_center"), &Camera2D::get_camera_screen_center);
ClassDB::bind_method(D_METHOD("set_zoom", "zoom"), &Camera2D::set_zoom);
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index dfcadf65a6..13b6be3978 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -137,7 +137,7 @@ public:
void set_custom_viewport(Node *p_viewport);
Node *get_custom_viewport() const;
- Vector2 get_camera_pos() const;
+ Vector2 get_camera_position() const;
void force_update_scroll();
void reset_smoothing();
void align();
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index a7c5d1adbb..d9bb6576d9 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -338,7 +338,6 @@ void CanvasItem::_update_callback() {
notification(NOTIFICATION_DRAW);
emit_signal(SceneStringNames::get_singleton()->draw);
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0);
}
drawing = false;
@@ -903,7 +902,7 @@ Ref<Material> CanvasItem::get_material() const {
return material;
}
-Vector2 CanvasItem::make_canvas_pos_local(const Vector2 &screen_point) const {
+Vector2 CanvasItem::make_canvas_position_local(const Vector2 &screen_point) const {
ERR_FAIL_COND_V(!is_inside_tree(), screen_point);
@@ -924,7 +923,8 @@ Vector2 CanvasItem::get_global_mouse_position() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_position());
}
-Vector2 CanvasItem::get_local_mouse_pos() const {
+
+Vector2 CanvasItem::get_local_mouse_position() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
@@ -977,18 +977,18 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled"), &CanvasItem::draw_rect, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("draw_circle", "pos", "radius", "color"), &CanvasItem::draw_circle);
- ClassDB::bind_method(D_METHOD("draw_texture", "texture", "pos", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw_circle", "position", "radius", "color"), &CanvasItem::draw_circle);
+ ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box);
ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_string", "font", "position", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("draw_char", "font", "position", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
- ClassDB::bind_method(D_METHOD("draw_set_transform", "pos", "rot", "scale"), &CanvasItem::draw_set_transform);
+ ClassDB::bind_method(D_METHOD("draw_set_transform", "position", "rotation", "scale"), &CanvasItem::draw_set_transform);
ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix);
ClassDB::bind_method(D_METHOD("get_transform"), &CanvasItem::get_transform);
ClassDB::bind_method(D_METHOD("get_global_transform"), &CanvasItem::get_global_transform);
@@ -996,7 +996,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_viewport_transform"), &CanvasItem::get_viewport_transform);
ClassDB::bind_method(D_METHOD("get_viewport_rect"), &CanvasItem::get_viewport_rect);
ClassDB::bind_method(D_METHOD("get_canvas_transform"), &CanvasItem::get_canvas_transform);
- ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos);
+ ClassDB::bind_method(D_METHOD("get_local_mouse_position"), &CanvasItem::get_local_mouse_position);
ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position);
ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas);
ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d);
@@ -1014,8 +1014,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_notify_transform", "enable"), &CanvasItem::set_notify_transform);
ClassDB::bind_method(D_METHOD("is_transform_notification_enabled"), &CanvasItem::is_transform_notification_enabled);
- ClassDB::bind_method(D_METHOD("make_canvas_pos_local", "screen_point"),
- &CanvasItem::make_canvas_pos_local);
+ ClassDB::bind_method(D_METHOD("make_canvas_position_local", "screen_point"), &CanvasItem::make_canvas_position_local);
ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local);
BIND_VMETHOD(MethodInfo("_draw"));
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 5a0a9c6e6a..1afbd150a2 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -298,10 +298,10 @@ public:
bool get_use_parent_material() const;
Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const;
- Vector2 make_canvas_pos_local(const Vector2 &screen_point) const;
+ Vector2 make_canvas_position_local(const Vector2 &screen_point) const;
Vector2 get_global_mouse_position() const;
- Vector2 get_local_mouse_pos() const;
+ Vector2 get_local_mouse_position() const;
void set_notify_local_transform(bool p_enable);
bool is_local_transform_notification_enabled() const;
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index e2764a6e8d..a840744c78 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -302,6 +302,9 @@ void CollisionPolygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "one_way_collision"), "set_one_way_collision", "is_one_way_collision_enabled");
+
+ BIND_ENUM_CONSTANT(BUILD_SOLIDS);
+ BIND_ENUM_CONSTANT(BUILD_SEGMENTS);
}
CollisionPolygon2D::CollisionPolygon2D() {
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 1bca2c6f37..516acefe2a 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -443,6 +443,13 @@ void Light2D::_bind_methods() {
BIND_ENUM_CONSTANT(MODE_SUB);
BIND_ENUM_CONSTANT(MODE_MIX);
BIND_ENUM_CONSTANT(MODE_MASK);
+
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_NONE);
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF3);
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF5);
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF7);
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF9);
+ BIND_ENUM_CONSTANT(SHADOW_FILTER_PCF13);
}
Light2D::Light2D() {
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index c87a9a5b1e..9131223ff3 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -28,13 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "line_2d.h"
+#include "line_builder.h"
#include "core_string_names.h"
// Needed so we can bind functions
-VARIANT_ENUM_CAST(LineJointMode)
-VARIANT_ENUM_CAST(LineCapMode)
-VARIANT_ENUM_CAST(LineTextureMode)
+VARIANT_ENUM_CAST(Line2D::LineJointMode)
+VARIANT_ENUM_CAST(Line2D::LineCapMode)
+VARIANT_ENUM_CAST(Line2D::LineTextureMode)
Line2D::Line2D()
: Node2D() {
@@ -67,12 +68,12 @@ PoolVector<Vector2> Line2D::get_points() const {
return _points;
}
-void Line2D::set_point_pos(int i, Vector2 pos) {
+void Line2D::set_point_position(int i, Vector2 pos) {
_points.set(i, pos);
update();
}
-Vector2 Line2D::get_point_pos(int i) const {
+Vector2 Line2D::get_point_position(int i) const {
return _points.get(i);
}
@@ -134,7 +135,7 @@ void Line2D::set_texture_mode(const LineTextureMode mode) {
update();
}
-LineTextureMode Line2D::get_texture_mode() const {
+Line2D::LineTextureMode Line2D::get_texture_mode() const {
return _texture_mode;
}
@@ -143,7 +144,7 @@ void Line2D::set_joint_mode(LineJointMode mode) {
update();
}
-LineJointMode Line2D::get_joint_mode() const {
+Line2D::LineJointMode Line2D::get_joint_mode() const {
return _joint_mode;
}
@@ -152,7 +153,7 @@ void Line2D::set_begin_cap_mode(LineCapMode mode) {
update();
}
-LineCapMode Line2D::get_begin_cap_mode() const {
+Line2D::LineCapMode Line2D::get_begin_cap_mode() const {
return _begin_cap_mode;
}
@@ -161,7 +162,7 @@ void Line2D::set_end_cap_mode(LineCapMode mode) {
update();
}
-LineCapMode Line2D::get_end_cap_mode() const {
+Line2D::LineCapMode Line2D::get_end_cap_mode() const {
return _end_cap_mode;
}
@@ -269,12 +270,12 @@ void Line2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_points", "points"), &Line2D::set_points);
ClassDB::bind_method(D_METHOD("get_points"), &Line2D::get_points);
- ClassDB::bind_method(D_METHOD("set_point_pos", "i", "pos"), &Line2D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "i"), &Line2D::get_point_pos);
+ ClassDB::bind_method(D_METHOD("set_point_position", "i", "position"), &Line2D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "i"), &Line2D::get_point_position);
ClassDB::bind_method(D_METHOD("get_point_count"), &Line2D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos"), &Line2D::add_point);
+ ClassDB::bind_method(D_METHOD("add_point", "position"), &Line2D::add_point);
ClassDB::bind_method(D_METHOD("remove_point", "i"), &Line2D::remove_point);
ClassDB::bind_method(D_METHOD("set_width", "width"), &Line2D::set_width);
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 017ccf13ff..6426484f02 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -30,7 +30,6 @@
#ifndef LINE2D_H
#define LINE2D_H
-#include "line_builder.h"
#include "node_2d.h"
class Line2D : public Node2D {
@@ -38,13 +37,31 @@ class Line2D : public Node2D {
GDCLASS(Line2D, Node2D)
public:
+ enum LineJointMode {
+ LINE_JOINT_SHARP = 0,
+ LINE_JOINT_BEVEL,
+ LINE_JOINT_ROUND
+ };
+
+ enum LineCapMode {
+ LINE_CAP_NONE = 0,
+ LINE_CAP_BOX,
+ LINE_CAP_ROUND
+ };
+
+ enum LineTextureMode {
+ LINE_TEXTURE_NONE = 0,
+ LINE_TEXTURE_TILE
+ // TODO STRETCH mode
+ };
+
Line2D();
void set_points(const PoolVector<Vector2> &p_points);
PoolVector<Vector2> get_points() const;
- void set_point_pos(int i, Vector2 pos);
- Vector2 get_point_pos(int i) const;
+ void set_point_position(int i, Vector2 pos);
+ Vector2 get_point_position(int i) const;
int get_point_count() const;
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index 1235013af4..4873c47827 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -92,14 +92,14 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) {
//----------------------------------------------------------------------------
LineBuilder::LineBuilder() {
- joint_mode = LINE_JOINT_SHARP;
+ joint_mode = Line2D::LINE_JOINT_SHARP;
width = 10;
default_color = Color(0.4, 0.5, 1);
gradient = NULL;
sharp_limit = 2.f;
round_precision = 8;
- begin_cap_mode = LINE_CAP_NONE;
- end_cap_mode = LINE_CAP_NONE;
+ begin_cap_mode = Line2D::LINE_CAP_NONE;
+ end_cap_mode = Line2D::LINE_CAP_NONE;
_interpolate_color = false;
_last_index[0] = 0;
@@ -141,7 +141,7 @@ void LineBuilder::build() {
float current_distance1 = 0.f;
float total_distance = 0.f;
_interpolate_color = gradient != NULL;
- bool distance_required = _interpolate_color || texture_mode == LINE_TEXTURE_TILE;
+ bool distance_required = _interpolate_color || texture_mode == Line2D::LINE_TEXTURE_TILE;
if (distance_required)
total_distance = calculate_total_distance(points);
if (_interpolate_color)
@@ -153,7 +153,7 @@ void LineBuilder::build() {
float uvx1 = 0.f;
// Begin cap
- if (begin_cap_mode == LINE_CAP_BOX) {
+ if (begin_cap_mode == Line2D::LINE_CAP_BOX) {
// Push back first vertices a little bit
pos_up0 -= f0 * hw;
pos_down0 -= f0 * hw;
@@ -161,8 +161,8 @@ void LineBuilder::build() {
total_distance += width;
current_distance0 += hw;
current_distance1 = current_distance0;
- } else if (begin_cap_mode == LINE_CAP_ROUND) {
- if (texture_mode == LINE_TEXTURE_TILE) {
+ } else if (begin_cap_mode == Line2D::LINE_CAP_ROUND) {
+ if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx0 = 0.5f;
}
new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f));
@@ -173,13 +173,15 @@ void LineBuilder::build() {
strip_begin(pos_up0, pos_down0, color0, uvx0);
- // pos_up0 ------------- pos_up1 --------------------
- // | |
- // pos0 - - - - - - - - - pos1 - - - - - - - - - pos2
- // | |
- // pos_down0 ------------ pos_down1 ------------------
- //
- // i-1 i i+1
+ /*
+ * pos_up0 ------------- pos_up1 --------------------
+ * | |
+ * pos0 - - - - - - - - - pos1 - - - - - - - - - pos2
+ * | |
+ * pos_down0 ------------ pos_down1 ------------------
+ *
+ * i-1 i i+1
+ */
// http://labs.hyperandroid.com/tag/opengl-lines
// (not the same implementation but visuals help a lot)
@@ -206,17 +208,19 @@ void LineBuilder::build() {
inner_normal1 = -u1 * hw;
}
- // ---------------------------
- // /
- // 0 / 1
- // / /
- // --------------------x------ /
- // / / (here shown with orientation == DOWN)
- // / /
- // / /
- // / /
- // 2 /
- // /
+ /*
+ * ---------------------------
+ * /
+ * 0 / 1
+ * / /
+ * --------------------x------ /
+ * / / (here shown with orientation == DOWN)
+ * / /
+ * / /
+ * / /
+ * 2 /
+ * /
+ */
// Find inner intersection at the joint
Vector2 corner_pos_in, corner_pos_out;
@@ -243,15 +247,15 @@ void LineBuilder::build() {
corner_pos_down = corner_pos_in;
}
- LineJointMode current_joint_mode = joint_mode;
+ Line2D::LineJointMode current_joint_mode = joint_mode;
Vector2 pos_up1, pos_down1;
if (intersection_result == SEGMENT_INTERSECT) {
// Fallback on bevel if sharp angle is too high (because it would produce very long miters)
- if (current_joint_mode == LINE_JOINT_SHARP && corner_pos_out.distance_squared_to(pos1) / hw_sq > sharp_limit_sq) {
- current_joint_mode = LINE_JOINT_BEVEL;
+ if (current_joint_mode == Line2D::LINE_JOINT_SHARP && corner_pos_out.distance_squared_to(pos1) / hw_sq > sharp_limit_sq) {
+ current_joint_mode = Line2D::LINE_JOINT_BEVEL;
}
- if (current_joint_mode == LINE_JOINT_SHARP) {
+ if (current_joint_mode == Line2D::LINE_JOINT_SHARP) {
// In this case, we won't create joint geometry,
// The previous and next line quads will directly share an edge.
pos_up1 = corner_pos_up;
@@ -280,7 +284,7 @@ void LineBuilder::build() {
if (_interpolate_color) {
color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
}
- if (texture_mode == LINE_TEXTURE_TILE) {
+ if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx0 = current_distance0 / width;
uvx1 = current_distance1 / width;
}
@@ -294,7 +298,7 @@ void LineBuilder::build() {
pos0 = pos1;
current_distance0 = current_distance1;
if (intersection_result == SEGMENT_INTERSECT) {
- if (current_joint_mode == LINE_JOINT_SHARP) {
+ if (current_joint_mode == Line2D::LINE_JOINT_SHARP) {
pos_up0 = pos_up1;
pos_down0 = pos_down1;
} else {
@@ -313,15 +317,16 @@ void LineBuilder::build() {
// From this point, bu0 and bd0 concern the next segment
// Add joint geometry
- if (current_joint_mode != LINE_JOINT_SHARP) {
+ if (current_joint_mode != Line2D::LINE_JOINT_SHARP) {
- // ________________ cbegin
- // / \
- // / \
- // ____________/_ _ _\ cend
- // | |
- // | |
- // | |
+ /* ________________ cbegin
+ * / \
+ * / \
+ * ____________/_ _ _\ cend
+ * | |
+ * | |
+ * | |
+ */
Vector2 cbegin, cend;
if (orientation == UP) {
@@ -332,9 +337,9 @@ void LineBuilder::build() {
cend = pos_up0;
}
- if (current_joint_mode == LINE_JOINT_BEVEL) {
+ if (current_joint_mode == Line2D::LINE_JOINT_BEVEL) {
strip_add_tri(cend, orientation);
- } else if (current_joint_mode == LINE_JOINT_ROUND) {
+ } else if (current_joint_mode == Line2D::LINE_JOINT_ROUND) {
Vector2 vbegin = cbegin - pos1;
Vector2 vend = cend - pos1;
strip_add_arc(pos1, vbegin.angle_to(vend), orientation);
@@ -355,7 +360,7 @@ void LineBuilder::build() {
Vector2 pos_down1 = pos1 - u0 * hw;
// End cap (box)
- if (end_cap_mode == LINE_CAP_BOX) {
+ if (end_cap_mode == Line2D::LINE_CAP_BOX) {
pos_up1 += f0 * hw;
pos_down1 += f0 * hw;
}
@@ -366,14 +371,14 @@ void LineBuilder::build() {
if (_interpolate_color) {
color1 = gradient->get_color(gradient->get_points_count() - 1);
}
- if (texture_mode == LINE_TEXTURE_TILE) {
+ if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
uvx1 = current_distance1 / width;
}
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
// End cap (round)
- if (end_cap_mode == LINE_CAP_ROUND) {
+ if (end_cap_mode == Line2D::LINE_CAP_ROUND) {
// Note: color is not used in case we don't interpolate...
Color color = _interpolate_color ? gradient->get_color(gradient->get_points_count() - 1) : Color(0, 0, 0);
new_arc(pos1, pos_up1 - pos1, Math_PI, color, Rect2(uvx1 - 0.5f, 0.f, 1.f, 1.f));
@@ -391,7 +396,7 @@ void LineBuilder::strip_begin(Vector2 up, Vector2 down, Color color, float uvx)
colors.push_back(color);
}
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(Vector2(uvx, 0.f));
uvs.push_back(Vector2(uvx, 1.f));
}
@@ -415,7 +420,7 @@ void LineBuilder::strip_new_quad(Vector2 up, Vector2 down, Color color, float uv
colors.push_back(color);
}
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(uvs[_last_index[UP]]);
uvs.push_back(uvs[_last_index[DOWN]]);
uvs.push_back(Vector2(uvx, UP));
@@ -444,7 +449,7 @@ void LineBuilder::strip_add_quad(Vector2 up, Vector2 down, Color color, float uv
colors.push_back(color);
}
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
uvs.push_back(Vector2(uvx, 0.f));
uvs.push_back(Vector2(uvx, 1.f));
}
@@ -471,7 +476,7 @@ void LineBuilder::strip_add_tri(Vector2 up, Orientation orientation) {
Orientation opposite_orientation = orientation == UP ? DOWN : UP;
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
// UVs are just one slice of the texture all along
// (otherwise we can't share the bottom vertice)
uvs.push_back(uvs[_last_index[opposite_orientation]]);
@@ -536,7 +541,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(center);
if (_interpolate_color)
colors.push_back(color);
- if (texture_mode != LINE_TEXTURE_NONE)
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE)
uvs.push_back(interpolate(uv_rect, Vector2(0.5f, 0.5f)));
// Arc vertices
@@ -547,7 +552,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(rpos);
if (_interpolate_color)
colors.push_back(color);
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt));
uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f))));
tt += angle_step;
@@ -560,7 +565,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col
vertices.push_back(rpos);
if (_interpolate_color)
colors.push_back(color);
- if (texture_mode != LINE_TEXTURE_NONE) {
+ if (texture_mode != Line2D::LINE_TEXTURE_NONE) {
tt = tt_begin + angle_delta;
Vector2 tsc = Vector2(Math::cos(tt), Math::sin(tt));
uvs.push_back(interpolate(uv_rect, 0.5f * (tsc + Vector2(1.f, 1.f))));
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index 227e0abd08..f12fbf6f82 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -31,39 +31,22 @@
#define LINE_BUILDER_H
#include "color.h"
+#include "line_2d.h"
#include "math_2d.h"
#include "scene/resources/color_ramp.h"
-enum LineJointMode {
- LINE_JOINT_SHARP = 0,
- LINE_JOINT_BEVEL,
- LINE_JOINT_ROUND
-};
-
-enum LineCapMode {
- LINE_CAP_NONE = 0,
- LINE_CAP_BOX,
- LINE_CAP_ROUND
-};
-
-enum LineTextureMode {
- LINE_TEXTURE_NONE = 0,
- LINE_TEXTURE_TILE
- // TODO STRETCH mode
-};
-
class LineBuilder {
public:
// TODO Move in a struct and reference it
// Input
Vector<Vector2> points;
- LineJointMode joint_mode;
- LineCapMode begin_cap_mode;
- LineCapMode end_cap_mode;
+ Line2D::LineJointMode joint_mode;
+ Line2D::LineCapMode begin_cap_mode;
+ Line2D::LineCapMode end_cap_mode;
float width;
Color default_color;
Gradient *gradient;
- LineTextureMode texture_mode;
+ Line2D::LineTextureMode texture_mode;
float sharp_limit;
int round_precision;
// TODO offset_joints option (offers alternative implementation of round joints)
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 0c7685a858..e62b59dd4d 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -414,7 +414,7 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_rotd"), &Node2D::_get_rotd);
ClassDB::bind_method(D_METHOD("_set_rotd", "degrees"), &Node2D::_set_rotd);
- ClassDB::bind_method(D_METHOD("set_position", "pos"), &Node2D::set_position);
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_in_degrees", "degrees"), &Node2D::set_rotation_in_degrees);
ClassDB::bind_method(D_METHOD("set_scale", "scale"), &Node2D::set_scale);
@@ -431,7 +431,7 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("global_translate", "offset"), &Node2D::global_translate);
ClassDB::bind_method(D_METHOD("apply_scale", "ratio"), &Node2D::apply_scale);
- ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Node2D::set_global_position);
+ ClassDB::bind_method(D_METHOD("set_global_position", "position"), &Node2D::set_global_position);
ClassDB::bind_method(D_METHOD("get_global_position"), &Node2D::get_global_position);
ClassDB::bind_method(D_METHOD("set_global_rotation", "radians"), &Node2D::set_global_rotation);
ClassDB::bind_method(D_METHOD("get_global_rotation"), &Node2D::get_global_rotation);
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 1d7bd8fc2a..8413be1ca9 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -43,7 +43,7 @@ void Path2D::_notification(int p_what) {
for (int i = 0; i < curve->get_point_count(); i++) {
- Vector2 prev_p = curve->get_point_pos(i);
+ Vector2 prev_p = curve->get_point_position(i);
for (int j = 1; j <= 8; j++) {
@@ -137,7 +137,8 @@ void PathFollow2D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- if ((path = Object::cast_to<Path2D>(get_parent()))) {
+ path = Object::cast_to<Path2D>(get_parent());
+ if (path) {
_update_transform();
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index b1eb2ba267..c6cd3677cd 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -955,35 +955,25 @@ RigidBody2D::~RigidBody2D() {
//////////////////////////
-Dictionary KinematicBody2D::_move(const Vector2 &p_motion) {
+Ref<KinematicCollision2D> KinematicBody2D::_move(const Vector2 &p_motion) {
Collision col;
- if (move(p_motion, col)) {
- Dictionary d;
- d["position"] = col.collision;
- d["normal"] = col.normal;
- d["local_shape"] = col.local_shape;
- d["travel"] = col.travel;
- d["remainder"] = col.remainder;
- d["collider_id"] = col.collider;
- d["collider_velocity"] = col.collider_vel;
- if (col.collider) {
- d["collider"] = ObjectDB::get_instance(col.collider);
- } else {
- d["collider"] = Variant();
- }
- d["collider_shape_index"] = col.collider_shape;
- d["collider_metadata"] = col.collider_metadata;
+ if (move_and_collide(p_motion, col)) {
+ if (motion_cache.is_null()) {
+ motion_cache.instance();
+ motion_cache->owner = this;
+ }
- return d;
+ motion_cache->collision = col;
- } else {
- return Dictionary();
+ return motion_cache;
}
+
+ return Ref<KinematicCollision2D>();
}
-bool KinematicBody2D::move(const Vector2 &p_motion, Collision &r_collision) {
+bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, Collision &r_collision) {
Transform2D gt = get_global_transform();
Physics2DServer::MotionResult result;
@@ -1007,7 +997,7 @@ bool KinematicBody2D::move(const Vector2 &p_motion, Collision &r_collision) {
return colliding;
}
-Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_bounces, float p_floor_max_angle) {
+Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) {
Vector2 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time();
Vector2 lv = p_linear_velocity;
@@ -1018,11 +1008,11 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
colliders.clear();
floor_velocity = Vector2();
- while (p_max_bounces) {
+ while (p_max_slides) {
Collision collision;
- bool collided = move(motion, collision);
+ bool collided = move_and_collide(motion, collision);
if (collided) {
@@ -1060,7 +1050,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
break;
}
- p_max_bounces--;
+ p_max_slides--;
if (motion == Vector2())
break;
}
@@ -1103,75 +1093,35 @@ float KinematicBody2D::get_safe_margin() const {
return margin;
}
-int KinematicBody2D::get_collision_count() const {
+int KinematicBody2D::get_slide_count() const {
return colliders.size();
}
-Vector2 KinematicBody2D::get_collision_position(int p_collision) const {
-
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Vector2());
- return colliders[p_collision].collision;
-}
-Vector2 KinematicBody2D::get_collision_normal(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Vector2());
- return colliders[p_collision].normal;
+KinematicBody2D::Collision KinematicBody2D::get_slide_collision(int p_bounce) const {
+ ERR_FAIL_INDEX_V(p_bounce, colliders.size(), Collision());
+ return colliders[p_bounce];
}
-Vector2 KinematicBody2D::get_collision_travel(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Vector2());
- return colliders[p_collision].travel;
-}
-Vector2 KinematicBody2D::get_collision_remainder(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Vector2());
- return colliders[p_collision].remainder;
-}
-Object *KinematicBody2D::get_collision_local_shape(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), NULL);
- uint32_t owner = shape_find_owner(colliders[p_collision].local_shape);
- return shape_owner_get_owner(owner);
-}
-Object *KinematicBody2D::get_collision_collider(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), NULL);
+Ref<KinematicCollision2D> KinematicBody2D::_get_slide_collision(int p_bounce) {
- if (colliders[p_collision].collider) {
- return ObjectDB::get_instance(colliders[p_collision].collider);
+ ERR_FAIL_INDEX_V(p_bounce, colliders.size(), Ref<KinematicCollision2D>());
+ if (p_bounce >= slide_colliders.size()) {
+ slide_colliders.resize(p_bounce + 1);
}
- return NULL;
-}
-ObjectID KinematicBody2D::get_collision_collider_id(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), 0);
-
- return colliders[p_collision].collider;
-}
-Object *KinematicBody2D::get_collision_collider_shape(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), NULL);
- Object *collider = get_collision_collider(p_collision);
- CollisionObject2D *obj2d = Object::cast_to<CollisionObject2D>(collider);
- if (obj2d) {
- uint32_t owner = shape_find_owner(colliders[p_collision].collider_shape);
- return obj2d->shape_owner_get_owner(owner);
+ if (slide_colliders[p_bounce].is_null()) {
+ slide_colliders[p_bounce].instance();
+ slide_colliders[p_bounce]->owner = this;
}
- return NULL;
-}
-int KinematicBody2D::get_collision_collider_shape_index(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), -1);
- return colliders[p_collision].collider_shape;
-}
-Vector2 KinematicBody2D::get_collision_collider_velocity(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Vector2());
- return colliders[p_collision].collider_vel;
-}
-Variant KinematicBody2D::get_collision_collider_metadata(int p_collision) const {
- ERR_FAIL_INDEX_V(p_collision, colliders.size(), Variant());
- return colliders[p_collision].collider_metadata;
+ slide_colliders[p_bounce]->collision = colliders[p_bounce];
+ return slide_colliders[p_bounce];
}
void KinematicBody2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("move", "rel_vec"), &KinematicBody2D::_move);
+ ClassDB::bind_method(D_METHOD("move_and_collide", "rel_vec"), &KinematicBody2D::_move);
ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_bounces", "floor_max_angle"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(5), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)));
ClassDB::bind_method(D_METHOD("test_move", "from", "rel_vec"), &KinematicBody2D::test_move);
@@ -1184,18 +1134,8 @@ void KinematicBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_safe_margin", "pixels"), &KinematicBody2D::set_safe_margin);
ClassDB::bind_method(D_METHOD("get_safe_margin"), &KinematicBody2D::get_safe_margin);
- ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicBody2D::get_collision_count);
- ClassDB::bind_method(D_METHOD("get_collision_position", "collision"), &KinematicBody2D::get_collision_position);
- ClassDB::bind_method(D_METHOD("get_collision_normal", "collision"), &KinematicBody2D::get_collision_normal);
- ClassDB::bind_method(D_METHOD("get_collision_travel", "collision"), &KinematicBody2D::get_collision_travel);
- ClassDB::bind_method(D_METHOD("get_collision_remainder", "collision"), &KinematicBody2D::get_collision_remainder);
- ClassDB::bind_method(D_METHOD("get_collision_local_shape", "collision"), &KinematicBody2D::get_collision_local_shape);
- ClassDB::bind_method(D_METHOD("get_collision_collider", "collision"), &KinematicBody2D::get_collision_collider);
- ClassDB::bind_method(D_METHOD("get_collision_collider_id", "collision"), &KinematicBody2D::get_collision_collider_id);
- ClassDB::bind_method(D_METHOD("get_collision_collider_shape", "collision"), &KinematicBody2D::get_collision_collider_shape);
- ClassDB::bind_method(D_METHOD("get_collision_collider_shape_index", "collision"), &KinematicBody2D::get_collision_collider_shape_index);
- ClassDB::bind_method(D_METHOD("get_collision_collider_velocity", "collision"), &KinematicBody2D::get_collision_collider_velocity);
- ClassDB::bind_method(D_METHOD("get_collision_collider_metadata", "collision"), &KinematicBody2D::get_collision_collider_metadata);
+ ClassDB::bind_method(D_METHOD("get_slide_count"), &KinematicBody2D::get_slide_count);
+ ClassDB::bind_method(D_METHOD("get_slide_collision", "slide_idx"), &KinematicBody2D::_get_slide_collision);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin");
}
@@ -1210,4 +1150,106 @@ KinematicBody2D::KinematicBody2D()
on_wall = false;
}
KinematicBody2D::~KinematicBody2D() {
+ if (motion_cache.is_valid()) {
+ motion_cache->owner = NULL;
+ }
+
+ for (int i = 0; i < slide_colliders.size(); i++) {
+ if (slide_colliders[i].is_valid()) {
+ slide_colliders[i]->owner = NULL;
+ }
+ }
+}
+
+////////////////////////
+
+Vector2 KinematicCollision2D::get_position() const {
+
+ return collision.collision;
+}
+Vector2 KinematicCollision2D::get_normal() const {
+ return collision.normal;
+}
+Vector2 KinematicCollision2D::get_travel() const {
+ return collision.travel;
+}
+Vector2 KinematicCollision2D::get_remainder() const {
+ return collision.remainder;
+}
+Object *KinematicCollision2D::get_local_shape() const {
+ ERR_FAIL_COND_V(!owner, NULL);
+ uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
+ return owner->shape_owner_get_owner(ownerid);
+}
+
+Object *KinematicCollision2D::get_collider() const {
+
+ if (collision.collider) {
+ return ObjectDB::get_instance(collision.collider);
+ }
+
+ return NULL;
+}
+ObjectID KinematicCollision2D::get_collider_id() const {
+
+ return collision.collider;
+}
+Object *KinematicCollision2D::get_collider_shape() const {
+
+ Object *collider = get_collider();
+ if (collider) {
+ CollisionObject2D *obj2d = Object::cast_to<CollisionObject2D>(collider);
+ if (obj2d) {
+ uint32_t ownerid = obj2d->shape_find_owner(collision.collider_shape);
+ return obj2d->shape_owner_get_owner(ownerid);
+ }
+ }
+
+ return NULL;
+}
+int KinematicCollision2D::get_collider_shape_index() const {
+
+ return collision.collider_shape;
+}
+Vector2 KinematicCollision2D::get_collider_velocity() const {
+
+ return collision.collider_vel;
+}
+Variant KinematicCollision2D::get_collider_metadata() const {
+
+ return Variant();
+}
+
+void KinematicCollision2D::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("get_position"), &KinematicCollision2D::get_position);
+ ClassDB::bind_method(D_METHOD("get_normal"), &KinematicCollision2D::get_normal);
+ ClassDB::bind_method(D_METHOD("get_travel"), &KinematicCollision2D::get_travel);
+ ClassDB::bind_method(D_METHOD("get_remainder"), &KinematicCollision2D::get_remainder);
+ ClassDB::bind_method(D_METHOD("get_local_shape"), &KinematicCollision2D::get_local_shape);
+ ClassDB::bind_method(D_METHOD("get_collider"), &KinematicCollision2D::get_collider);
+ ClassDB::bind_method(D_METHOD("get_collider_id"), &KinematicCollision2D::get_collider_id);
+ ClassDB::bind_method(D_METHOD("get_collider_shape"), &KinematicCollision2D::get_collider_shape);
+ ClassDB::bind_method(D_METHOD("get_collider_shape_index"), &KinematicCollision2D::get_collider_shape_index);
+ ClassDB::bind_method(D_METHOD("get_collider_velocity"), &KinematicCollision2D::get_collider_velocity);
+ ClassDB::bind_method(D_METHOD("get_collider_metadata"), &KinematicCollision2D::get_collider_metadata);
+
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position"), "", "get_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "normal"), "", "get_normal");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "travel"), "", "get_travel");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "remainder"), "", "get_remainder");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "local_shape"), "", "get_local_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id"), "", "get_collider_id");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider_shape"), "", "get_collider_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape_index"), "", "get_collider_shape_index");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity");
+ ADD_PROPERTY(PropertyInfo(Variant::NIL, "collider_metadata", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "", "get_collider_metadata");
+}
+
+KinematicCollision2D::KinematicCollision2D() {
+ collision.collider = 0;
+ collision.collider_shape = 0;
+ collision.local_shape = 0;
+ owner = NULL;
}
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index 1a4b0c0f5c..b82771a8f4 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -34,6 +34,8 @@
#include "servers/physics_2d_server.h"
#include "vset.h"
+class KinematicCollision2D;
+
class PhysicsBody2D : public CollisionObject2D {
GDCLASS(PhysicsBody2D, CollisionObject2D);
@@ -288,42 +290,62 @@ private:
bool on_ceiling;
bool on_wall;
Vector<Collision> colliders;
+ Vector<Ref<KinematicCollision2D> > slide_colliders;
+ Ref<KinematicCollision2D> motion_cache;
_FORCE_INLINE_ bool _ignores_mode(Physics2DServer::BodyMode) const;
- Dictionary _move(const Vector2 &p_motion);
+ Ref<KinematicCollision2D> _move(const Vector2 &p_motion);
+ Ref<KinematicCollision2D> _get_slide_collision(int p_bounce);
protected:
static void _bind_methods();
public:
- bool move(const Vector2 &p_motion, Collision &r_collision);
+ bool move_and_collide(const Vector2 &p_motion, Collision &r_collision);
bool test_move(const Transform2D &p_from, const Vector2 &p_motion);
void set_safe_margin(float p_margin);
float get_safe_margin() const;
- Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_bounces = 4, float p_floor_max_angle = Math::deg2rad((float)45));
+ Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_slides = 4, float p_floor_max_angle = Math::deg2rad((float)45));
bool is_on_floor() const;
bool is_on_wall() const;
bool is_on_ceiling() const;
Vector2 get_floor_velocity() const;
- int get_collision_count() const;
- Vector2 get_collision_position(int p_collision) const;
- Vector2 get_collision_normal(int p_collision) const;
- Vector2 get_collision_travel(int p_collision) const;
- Vector2 get_collision_remainder(int p_collision) const;
- Object *get_collision_local_shape(int p_collision) const;
- Object *get_collision_collider(int p_collision) const;
- ObjectID get_collision_collider_id(int p_collision) const;
- Object *get_collision_collider_shape(int p_collision) const;
- int get_collision_collider_shape_index(int p_collision) const;
- Vector2 get_collision_collider_velocity(int p_collision) const;
- Variant get_collision_collider_metadata(int p_collision) const;
+ int get_slide_count() const;
+ Collision get_slide_collision(int p_bounce) const;
KinematicBody2D();
~KinematicBody2D();
};
+class KinematicCollision2D : public Reference {
+
+ GDCLASS(KinematicCollision2D, Reference);
+
+ KinematicBody2D *owner;
+ friend class KinematicBody2D;
+ KinematicBody2D::Collision collision;
+
+protected:
+ static void _bind_methods();
+
+public:
+ Vector2 get_position() const;
+ Vector2 get_normal() const;
+ Vector2 get_travel() const;
+ Vector2 get_remainder() const;
+ Object *get_local_shape() const;
+ Object *get_collider() const;
+ ObjectID get_collider_id() const;
+ Object *get_collider_shape() const;
+ int get_collider_shape_index() const;
+ Vector2 get_collider_velocity() const;
+ Variant get_collider_metadata() const;
+
+ KinematicCollision2D();
+};
+
#endif // PHYSICS_BODY_2D_H
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index c9bf6675d2..bf7c5a3ba4 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -399,6 +399,9 @@ void TouchScreenButton::_bind_methods() {
ADD_SIGNAL(MethodInfo("pressed"));
ADD_SIGNAL(MethodInfo("released"));
+
+ BIND_ENUM_CONSTANT(VISIBILITY_ALWAYS);
+ BIND_ENUM_CONSTANT(VISIBILITY_TOUCHSCREEN_ONLY);
}
TouchScreenButton::TouchScreenButton() {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index b1cc8c226a..4286d88ab1 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1294,9 +1294,9 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &TileMap::get_occluder_light_mask);
ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("set_cellv", "pos", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell);
- ClassDB::bind_method(D_METHOD("get_cellv", "pos"), &TileMap::get_cellv);
+ ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv);
ClassDB::bind_method(D_METHOD("is_cell_x_flipped", "x", "y"), &TileMap::is_cell_x_flipped);
ClassDB::bind_method(D_METHOD("is_cell_y_flipped", "x", "y"), &TileMap::is_cell_y_flipped);
ClassDB::bind_method(D_METHOD("is_cell_transposed", "x", "y"), &TileMap::is_cell_transposed);
@@ -1307,8 +1307,8 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_used_cells_by_id", "id"), &TileMap::get_used_cells_by_id);
ClassDB::bind_method(D_METHOD("get_used_rect"), &TileMap::get_used_rect);
- ClassDB::bind_method(D_METHOD("map_to_world", "mappos", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("world_to_map", "worldpos"), &TileMap::world_to_map);
+ ClassDB::bind_method(D_METHOD("map_to_world", "map_position", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &TileMap::world_to_map);
ClassDB::bind_method(D_METHOD("_clear_quadrants"), &TileMap::_clear_quadrants);
ClassDB::bind_method(D_METHOD("_recreate_quadrants"), &TileMap::_recreate_quadrants);
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 217cb71230..266bc5e381 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -729,6 +729,12 @@ void Area::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "reverb_bus_name", PROPERTY_HINT_ENUM, ""), "set_reverb_bus", "get_reverb_bus");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_amount", "get_reverb_amount");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_uniformity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_uniformity", "get_reverb_uniformity");
+
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE_REPLACE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE);
+ BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE_COMBINE);
}
Area::Area()
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index caf313190b..147d3bf115 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -31,7 +31,6 @@
#include "arvr_nodes.h"
#include "core/os/input.h"
#include "servers/arvr/arvr_interface.h"
-#include "servers/arvr/arvr_positional_tracker.h"
#include "servers/arvr_server.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -142,6 +141,7 @@ void ARVRController::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_joystick_axis", "axis"), &ARVRController::get_joystick_axis);
ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRController::get_is_active);
+ ClassDB::bind_method(D_METHOD("get_hand"), &ARVRController::get_hand);
ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::INT, "button")));
ADD_SIGNAL(MethodInfo("button_release", PropertyInfo(Variant::INT, "button")));
@@ -184,7 +184,7 @@ int ARVRController::get_joystick_id() const {
int ARVRController::is_button_pressed(int p_button) const {
int joy_id = get_joystick_id();
- if (joy_id == 0) {
+ if (joy_id == -1) {
return false;
};
@@ -193,7 +193,7 @@ int ARVRController::is_button_pressed(int p_button) const {
float ARVRController::get_joystick_axis(int p_axis) const {
int joy_id = get_joystick_id();
- if (joy_id == 0) {
+ if (joy_id == -1) {
return 0.0;
};
@@ -204,6 +204,19 @@ bool ARVRController::get_is_active() const {
return is_active;
};
+ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN);
+
+ ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ if (tracker == NULL) {
+ return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN;
+ };
+
+ return tracker->get_hand();
+};
+
String ARVRController::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h
index 4c14be71b5..5269ec0248 100644
--- a/scene/3d/arvr_nodes.h
+++ b/scene/3d/arvr_nodes.h
@@ -33,6 +33,7 @@
#include "scene/3d/camera.h"
#include "scene/3d/spatial.h"
+#include "servers/arvr/arvr_positional_tracker.h"
/**
@author Bastiaan Olij <mux213@gmail.com>
@@ -84,6 +85,7 @@ public:
float get_joystick_axis(int p_axis) const;
bool get_is_active() const;
+ ARVRPositionalTracker::TrackerHand get_hand() const;
String get_configuration_warning() const;
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 2073ebf94e..c8c478ae18 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -72,34 +72,13 @@ void AudioStreamPlayer3D::_mix_audio() {
//mix!
- int buffers = 0;
- int first = 0;
-
- switch (AudioServer::get_singleton()->get_speaker_mode()) {
-
- case AudioServer::SPEAKER_MODE_STEREO: {
- buffers = 1;
- first = 0;
-
- } break;
- case AudioServer::SPEAKER_SURROUND_51: {
- buffers = 2;
- first = 1;
-
- } break;
- case AudioServer::SPEAKER_SURROUND_71: {
-
- buffers = 3;
- first = 1;
-
- } break;
- }
+ int buffers = AudioServer::get_singleton()->get_channel_count();
for (int k = 0; k < buffers; k++) {
AudioFrame vol_inc = (current.vol[k] - prev_outputs[i].vol[k]) / float(buffer_size);
AudioFrame vol = current.vol[k];
- AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, first + k);
+ AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, k);
current.filter.set_mode(AudioFilterSW::HIGHSHELF);
current.filter.set_sampling_rate(AudioServer::get_singleton()->get_mix_rate());
@@ -146,7 +125,7 @@ void AudioStreamPlayer3D::_mix_audio() {
if (current.reverb_bus_index >= 0) {
- AudioFrame *rtarget = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.reverb_bus_index, first + k);
+ AudioFrame *rtarget = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.reverb_bus_index, k);
if (current.reverb_bus_index == prev_outputs[i].reverb_bus_index) {
AudioFrame rvol_inc = (current.reverb_vol[k] - prev_outputs[i].reverb_vol[k]) / float(buffer_size);
@@ -341,49 +320,57 @@ void AudioStreamPlayer3D::_notification(int p_what) {
flat_pos.y = 0;
flat_pos.normalize();
- switch (AudioServer::get_singleton()->get_speaker_mode()) {
+ unsigned int cc = AudioServer::get_singleton()->get_channel_count();
+ if (cc == 1) {
+ // Stereo pair
+ float c = flat_pos.x * 0.5 + 0.5;
- case AudioServer::SPEAKER_MODE_STEREO: {
-
- float c = flat_pos.x * 0.5 + 0.5;
- output.vol[0].l = 1.0 - c;
- output.vol[0].r = c;
-
- output.vol[0] *= multiplier;
+ output.vol[0].l = 1.0 - c;
+ output.vol[0].r = c;
+ } else {
+ Vector3 camtopos = global_pos - camera->get_global_transform().origin;
+ float c = camtopos.normalized().dot(get_global_transform().basis.get_axis(2).normalized()); //it's z negative
+ float angle = Math::rad2deg(Math::acos(c));
+ float av = angle * (flat_pos.x < 0 ? -1 : 1) / 180.0;
- } break;
- case AudioServer::SPEAKER_SURROUND_51: {
+ if (cc >= 1) {
+ // Stereo pair
+ float fl = Math::abs(1.0 - Math::abs(-0.8 - av));
+ float fr = Math::abs(1.0 - Math::abs(0.8 - av));
- float xl = Vector3(-1, 0, -1).normalized().dot(flat_pos) * 0.5 + 0.5;
- float xr = Vector3(1, 0, -1).normalized().dot(flat_pos) * 0.5 + 0.5;
+ output.vol[0].l = fl;
+ output.vol[0].r = fr;
+ }
- output.vol[0].l = xl;
- output.vol[1].r = 1.0 - xl;
- output.vol[0].r = xr;
- output.vol[1].l = 1.0 - xr;
+ if (cc >= 2) {
+ // Center pair
+ float center = 1.0 - Math::sin(Math::acos(c));
- output.vol[0] *= multiplier;
- output.vol[1] *= multiplier;
- } break;
- case AudioServer::SPEAKER_SURROUND_71: {
+ output.vol[1].l = center;
+ output.vol[1].r = center;
+ }
- float xl = Vector3(-1, 0, -1).normalized().dot(flat_pos) * 0.5 + 0.5;
- float xr = Vector3(1, 0, -1).normalized().dot(flat_pos) * 0.5 + 0.5;
+ if (cc >= 3) {
+ // Side pair
+ float sl = Math::abs(1.0 - Math::abs(-0.4 - av));
+ float sr = Math::abs(1.0 - Math::abs(0.4 - av));
- output.vol[0].l = xl;
- output.vol[1].r = 1.0 - xl;
- output.vol[0].r = xr;
- output.vol[1].l = 1.0 - xr;
+ output.vol[2].l = sl;
+ output.vol[2].r = sr;
+ }
- float c = flat_pos.x * 0.5 + 0.5;
- output.vol[2].l = 1.0 - c;
- output.vol[2].r = c;
+ if (cc >= 4) {
+ // Rear pair
+ float rl = Math::abs(1.0 - Math::abs(-0.2 - av));
+ float rr = Math::abs(1.0 - Math::abs(0.2 - av));
- output.vol[0] *= multiplier;
- output.vol[1] *= multiplier;
- output.vol[2] *= multiplier;
+ output.vol[3].l = rl;
+ output.vol[3].r = rr;
+ }
+ }
- } break;
+ for (int k = 0; k < cc; k++) {
+ output.vol[k] *= multiplier;
}
bool filled_reverb = false;
@@ -422,41 +409,30 @@ void AudioStreamPlayer3D::_notification(int p_what) {
rev_pos.y = 0;
rev_pos.normalize();
- switch (AudioServer::get_singleton()->get_speaker_mode()) {
-
- case AudioServer::SPEAKER_MODE_STEREO: {
-
- float c = rev_pos.x * 0.5 + 0.5;
- output.reverb_vol[0].l = 1.0 - c;
- output.reverb_vol[0].r = c;
-
- } break;
- case AudioServer::SPEAKER_SURROUND_51: {
-
- float xl = Vector3(-1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
- float xr = Vector3(1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
-
- output.reverb_vol[0].l = xl;
- output.reverb_vol[1].r = 1.0 - xl;
- output.reverb_vol[0].r = xr;
- output.reverb_vol[1].l = 1.0 - xr;
-
- } break;
- case AudioServer::SPEAKER_SURROUND_71: {
-
- float xl = Vector3(-1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
- float xr = Vector3(1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
+ if (cc >= 1) {
+ // Stereo pair
+ float c = rev_pos.x * 0.5 + 0.5;
+ output.reverb_vol[0].l = 1.0 - c;
+ output.reverb_vol[0].r = c;
+ }
- output.reverb_vol[0].l = xl;
- output.reverb_vol[1].r = 1.0 - xl;
- output.reverb_vol[0].r = xr;
- output.reverb_vol[1].l = 1.0 - xr;
+ if (cc >= 3) {
+ // Center pair + Side pair
+ float xl = Vector3(-1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
+ float xr = Vector3(1, 0, -1).normalized().dot(rev_pos) * 0.5 + 0.5;
- float c = rev_pos.x * 0.5 + 0.5;
- output.reverb_vol[2].l = 1.0 - c;
- output.reverb_vol[2].r = c;
+ output.reverb_vol[1].l = xl;
+ output.reverb_vol[1].r = xr;
+ output.reverb_vol[2].l = 1.0 - xr;
+ output.reverb_vol[2].r = 1.0 - xl;
+ }
- } break;
+ if (cc >= 4) {
+ // Rear pair
+ // FIXME: Not sure what math should be done here
+ float c = rev_pos.x * 0.5 + 0.5;
+ output.reverb_vol[3].l = 1.0 - c;
+ output.reverb_vol[3].r = c;
}
for (int i = 0; i < vol_index_max; i++) {
@@ -635,10 +611,10 @@ bool AudioStreamPlayer3D::is_playing() const {
return false;
}
-float AudioStreamPlayer3D::get_pos() {
+float AudioStreamPlayer3D::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -826,12 +802,12 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_max_db", "max_db"), &AudioStreamPlayer3D::set_max_db);
ClassDB::bind_method(D_METHOD("get_max_db"), &AudioStreamPlayer3D::get_max_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer3D::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer3D::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer3D::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer3D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer3D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer3D::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer3D::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer3D::get_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer3D::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer3D::get_bus);
@@ -879,7 +855,7 @@ void AudioStreamPlayer3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_db", PROPERTY_HINT_RANGE, "-80,80"), "set_unit_db", "get_unit_db");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.1"), "set_unit_size", "get_unit_size");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_db", PROPERTY_HINT_RANGE, "-24,6"), "set_max_db", "get_max_db");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "play", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "_is_active");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "0,65536,1"), "set_max_distance", "get_max_distance");
ADD_PROPERTY(PropertyInfo(Variant::INT, "out_of_range_mode", PROPERTY_HINT_ENUM, "Mix,Pause"), "set_out_of_range_mode", "get_out_of_range_mode");
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 8603cab5a4..a6ce123790 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -40,12 +40,12 @@ private:
AudioFilterSW filter;
AudioFilterSW::Processor filter_process[6];
- AudioFrame vol[3];
+ AudioFrame vol[4];
float filter_gain;
float pitch_scale;
int bus_index;
int reverb_bus_index;
- AudioFrame reverb_vol[3];
+ AudioFrame reverb_vol[4];
Viewport *viewport; //pointer only used for reference to previous mix
Output() {
@@ -127,7 +127,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_pos();
+ float get_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp
index e1a5329fb0..2580b645e2 100644
--- a/scene/3d/bone_attachment.cpp
+++ b/scene/3d/bone_attachment.cpp
@@ -71,7 +71,8 @@ void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const {
void BoneAttachment::_check_bind() {
- if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) {
+ Skeleton *sk = Object::cast_to<Skeleton>(get_parent());
+ if (sk) {
int idx = sk->find_bone(bone_name);
if (idx != -1) {
@@ -86,7 +87,8 @@ void BoneAttachment::_check_unbind() {
if (bound) {
- if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) {
+ Skeleton *sk = Object::cast_to<Skeleton>(get_parent());
+ if (sk) {
int idx = sk->find_bone(bone_name);
if (idx != -1) {
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index c121ef4566..1c0633fba7 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -145,9 +145,9 @@ void CollisionObject::_bind_methods() {
ClassDB::bind_method(D_METHOD("shape_owner_clear_shapes", "owner_id"), &CollisionObject::shape_owner_clear_shapes);
ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject::shape_find_owner);
- BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_pos"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
- ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_pos"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 5f1151f8e9..f49d89122d 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -50,7 +50,8 @@ void CollisionShape::make_convex_from_brothers() {
for (int i = 0; i < p->get_child_count(); i++) {
Node *n = p->get_child(i);
- if (MeshInstance *mi = Object::cast_to<MeshInstance>(n)) {
+ MeshInstance *mi = Object::cast_to<MeshInstance>(n);
+ if (mi) {
Ref<Mesh> m = mi->get_mesh();
if (m.is_valid()) {
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 7792a86b4a..66364d40f9 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -696,22 +696,6 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
p_baker->bake_cells[p_idx].normal[2] += normal_accum.z;
p_baker->bake_cells[p_idx].alpha += alpha;
- static const Vector3 side_normals[6] = {
- Vector3(-1, 0, 0),
- Vector3(1, 0, 0),
- Vector3(0, -1, 0),
- Vector3(0, 1, 0),
- Vector3(0, 0, -1),
- Vector3(0, 0, 1),
- };
-
- /*
- for(int i=0;i<6;i++) {
- if (normal.dot(side_normals[i])>CMP_EPSILON) {
- p_baker->bake_cells[p_idx].used_sides|=(1<<i);
- }
- }*/
-
} else {
//go down
@@ -1113,7 +1097,8 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
}
}
- if (Spatial *s = Object::cast_to<Spatial>(p_at_node)) {
+ Spatial *s = Object::cast_to<Spatial>(p_at_node);
+ if (s) {
if (s->is_visible_in_tree()) {
diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp
index 64d3f4fcab..11f7efe066 100644
--- a/scene/3d/immediate_geometry.cpp
+++ b/scene/3d/immediate_geometry.cpp
@@ -149,7 +149,7 @@ void ImmediateGeometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &ImmediateGeometry::set_color);
ClassDB::bind_method(D_METHOD("set_uv", "uv"), &ImmediateGeometry::set_uv);
ClassDB::bind_method(D_METHOD("set_uv2", "uv"), &ImmediateGeometry::set_uv2);
- ClassDB::bind_method(D_METHOD("add_vertex", "pos"), &ImmediateGeometry::add_vertex);
+ ClassDB::bind_method(D_METHOD("add_vertex", "position"), &ImmediateGeometry::add_vertex);
ClassDB::bind_method(D_METHOD("add_sphere", "lats", "lons", "radius", "add_uv"), &ImmediateGeometry::add_sphere, DEFVAL(true));
ClassDB::bind_method(D_METHOD("end"), &ImmediateGeometry::end);
ClassDB::bind_method(D_METHOD("clear"), &ImmediateGeometry::clear);
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 157ae42571..0f281b694d 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -55,8 +55,8 @@ void InterpolatedCamera::_notification(int p_what) {
Transform local_transform = get_global_transform();
local_transform = local_transform.interpolate_with(target_xform, delta);
set_global_transform(local_transform);
-
- if (Camera *cam = Object::cast_to<Camera>(node)) {
+ Camera *cam = Object::cast_to<Camera>(node);
+ if (cam) {
if (cam->get_projection() == get_projection()) {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index d410ba1e2a..7402e664d9 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -308,9 +308,8 @@ DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const {
}
void DirectionalLight::set_shadow_depth_range(ShadowDepthRange p_range) {
- shadow_depth_range=p_range;
+ shadow_depth_range = p_range;
VS::get_singleton()->light_directional_set_shadow_depth_range_mode(light, VS::LightDirectionalShadowDepthRangeMode(p_range));
-
}
DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() const {
@@ -318,7 +317,6 @@ DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() co
return shadow_depth_range;
}
-
void DirectionalLight::set_blend_splits(bool p_enable) {
blend_splits = p_enable;
@@ -356,8 +354,8 @@ void DirectionalLight::_bind_methods() {
BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS);
- BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_STABLE );
- BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_OPTIMIZED );
+ BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_STABLE);
+ BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_OPTIMIZED);
}
DirectionalLight::DirectionalLight()
@@ -370,7 +368,6 @@ DirectionalLight::DirectionalLight()
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE);
-
blend_splits = false;
}
@@ -408,6 +405,12 @@ void OmniLight::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION);
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_mode", PROPERTY_HINT_ENUM, "Dual Paraboloid,Cube"), "set_shadow_mode", "get_shadow_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_detail", PROPERTY_HINT_ENUM, "Vertical,Horizontal"), "set_shadow_detail", "get_shadow_detail");
+
+ BIND_ENUM_CONSTANT(SHADOW_DUAL_PARABOLOID);
+ BIND_ENUM_CONSTANT(SHADOW_CUBE);
+
+ BIND_ENUM_CONSTANT(SHADOW_DETAIL_VERTICAL);
+ BIND_ENUM_CONSTANT(SHADOW_DETAIL_HORIZONTAL);
}
OmniLight::OmniLight()
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 6aa0220265..2f3ac8a5e7 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -150,7 +150,7 @@ public:
void set_shadow_mode(ShadowMode p_mode);
ShadowMode get_shadow_mode() const;
- void set_shadow_depth_range(ShadowDepthRange p_mode);
+ void set_shadow_depth_range(ShadowDepthRange p_range);
ShadowDepthRange get_shadow_depth_range() const;
void set_blend_splits(bool p_enable);
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 7a55f956e0..40750cdfe8 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -63,6 +63,143 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) {
}
}
+void NavigationMesh::set_sample_partition_type(int p_value) {
+ ERR_FAIL_COND(p_value >= SAMPLE_PARTITION_MAX);
+ partition_type = static_cast<SamplePartitionType>(p_value);
+}
+
+int NavigationMesh::get_sample_partition_type() const {
+ return static_cast<int>(partition_type);
+}
+
+void NavigationMesh::set_cell_size(float p_value) {
+ cell_size = p_value;
+}
+
+float NavigationMesh::get_cell_size() const {
+ return cell_size;
+}
+
+void NavigationMesh::set_cell_height(float p_value) {
+ cell_height = p_value;
+}
+
+float NavigationMesh::get_cell_height() const {
+ return cell_height;
+}
+
+void NavigationMesh::set_agent_height(float p_value) {
+ agent_height = p_value;
+}
+
+float NavigationMesh::get_agent_height() const {
+ return agent_height;
+}
+
+void NavigationMesh::set_agent_radius(float p_value) {
+ agent_radius = p_value;
+}
+
+float NavigationMesh::get_agent_radius() {
+ return agent_radius;
+}
+
+void NavigationMesh::set_agent_max_climb(float p_value) {
+ agent_max_climb = p_value;
+}
+
+float NavigationMesh::get_agent_max_climb() const {
+ return agent_max_climb;
+}
+
+void NavigationMesh::set_agent_max_slope(float p_value) {
+ agent_max_slope = p_value;
+}
+
+float NavigationMesh::get_agent_max_slope() const {
+ return agent_max_slope;
+}
+
+void NavigationMesh::set_region_min_size(float p_value) {
+ region_min_size = p_value;
+}
+
+float NavigationMesh::get_region_min_size() const {
+ return region_min_size;
+}
+
+void NavigationMesh::set_region_merge_size(float p_value) {
+ region_merge_size = p_value;
+}
+
+float NavigationMesh::get_region_merge_size() const {
+ return region_merge_size;
+}
+
+void NavigationMesh::set_edge_max_length(float p_value) {
+ edge_max_length = p_value;
+}
+
+float NavigationMesh::get_edge_max_length() const {
+ return edge_max_length;
+}
+
+void NavigationMesh::set_edge_max_error(float p_value) {
+ edge_max_error = p_value;
+}
+
+float NavigationMesh::get_edge_max_error() const {
+ return edge_max_error;
+}
+
+void NavigationMesh::set_verts_per_poly(float p_value) {
+ verts_per_poly = p_value;
+}
+
+float NavigationMesh::get_verts_per_poly() const {
+ return verts_per_poly;
+}
+
+void NavigationMesh::set_detail_sample_distance(float p_value) {
+ detail_sample_distance = p_value;
+}
+
+float NavigationMesh::get_detail_sample_distance() const {
+ return detail_sample_distance;
+}
+
+void NavigationMesh::set_detail_sample_max_error(float p_value) {
+ detail_sample_max_error = p_value;
+}
+
+float NavigationMesh::get_detail_sample_max_error() const {
+ return detail_sample_max_error;
+}
+
+void NavigationMesh::set_filter_low_hanging_obstacles(bool p_value) {
+ filter_low_hanging_obstacles = p_value;
+}
+
+bool NavigationMesh::get_filter_low_hanging_obstacles() const {
+ return filter_low_hanging_obstacles;
+}
+
+void NavigationMesh::set_filter_ledge_spans(bool p_value) {
+ filter_ledge_spans = p_value;
+}
+
+bool NavigationMesh::get_filter_ledge_spans() const {
+ return filter_ledge_spans;
+}
+
+void NavigationMesh::set_filter_walkable_low_height_spans(bool p_value) {
+ filter_walkable_low_height_spans = p_value;
+}
+
+bool NavigationMesh::get_filter_walkable_low_height_spans() const {
+ return filter_walkable_low_height_spans;
+}
+
void NavigationMesh::set_vertices(const PoolVector<Vector3> &p_vertices) {
vertices = p_vertices;
@@ -199,6 +336,56 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
}
void NavigationMesh::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_sample_partition_type", "sample_partition_type"), &NavigationMesh::set_sample_partition_type);
+ ClassDB::bind_method(D_METHOD("get_sample_partition_type"), &NavigationMesh::get_sample_partition_type);
+
+ ClassDB::bind_method(D_METHOD("set_cell_size", "cell_size"), &NavigationMesh::set_cell_size);
+ ClassDB::bind_method(D_METHOD("get_cell_size"), &NavigationMesh::get_cell_size);
+
+ ClassDB::bind_method(D_METHOD("set_cell_height", "cell_height"), &NavigationMesh::set_cell_height);
+ ClassDB::bind_method(D_METHOD("get_cell_height"), &NavigationMesh::get_cell_height);
+
+ ClassDB::bind_method(D_METHOD("set_agent_height", "agent_height"), &NavigationMesh::set_agent_height);
+ ClassDB::bind_method(D_METHOD("get_agent_height"), &NavigationMesh::get_agent_height);
+
+ ClassDB::bind_method(D_METHOD("set_agent_radius", "agent_radius"), &NavigationMesh::set_agent_radius);
+ ClassDB::bind_method(D_METHOD("get_agent_radius"), &NavigationMesh::get_agent_radius);
+
+ ClassDB::bind_method(D_METHOD("set_agent_max_climb", "agent_max_climb"), &NavigationMesh::set_agent_max_climb);
+ ClassDB::bind_method(D_METHOD("get_agent_max_climb"), &NavigationMesh::get_agent_max_climb);
+
+ ClassDB::bind_method(D_METHOD("set_agent_max_slope", "agent_max_slope"), &NavigationMesh::set_agent_max_slope);
+ ClassDB::bind_method(D_METHOD("get_agent_max_slope"), &NavigationMesh::get_agent_max_slope);
+
+ ClassDB::bind_method(D_METHOD("set_region_min_size", "region_min_size"), &NavigationMesh::set_region_min_size);
+ ClassDB::bind_method(D_METHOD("get_region_min_size"), &NavigationMesh::get_region_min_size);
+
+ ClassDB::bind_method(D_METHOD("set_region_merge_size", "region_merge_size"), &NavigationMesh::set_region_merge_size);
+ ClassDB::bind_method(D_METHOD("get_region_merge_size"), &NavigationMesh::get_region_merge_size);
+
+ ClassDB::bind_method(D_METHOD("set_edge_max_length", "edge_max_length"), &NavigationMesh::set_edge_max_length);
+ ClassDB::bind_method(D_METHOD("get_edge_max_length"), &NavigationMesh::get_edge_max_length);
+
+ ClassDB::bind_method(D_METHOD("set_edge_max_error", "edge_max_error"), &NavigationMesh::set_edge_max_error);
+ ClassDB::bind_method(D_METHOD("get_edge_max_error"), &NavigationMesh::get_edge_max_error);
+
+ ClassDB::bind_method(D_METHOD("set_verts_per_poly", "verts_per_poly"), &NavigationMesh::set_verts_per_poly);
+ ClassDB::bind_method(D_METHOD("get_verts_per_poly"), &NavigationMesh::get_verts_per_poly);
+
+ ClassDB::bind_method(D_METHOD("set_detail_sample_distance", "detail_sample_dist"), &NavigationMesh::set_detail_sample_distance);
+ ClassDB::bind_method(D_METHOD("get_detail_sample_distance"), &NavigationMesh::get_detail_sample_distance);
+
+ ClassDB::bind_method(D_METHOD("set_detail_sample_max_error", "detail_sample_max_error"), &NavigationMesh::set_detail_sample_max_error);
+ ClassDB::bind_method(D_METHOD("get_detail_sample_max_error"), &NavigationMesh::get_detail_sample_max_error);
+
+ ClassDB::bind_method(D_METHOD("set_filter_low_hanging_obstacles", "filter_low_hanging_obstacles"), &NavigationMesh::set_filter_low_hanging_obstacles);
+ ClassDB::bind_method(D_METHOD("get_filter_low_hanging_obstacles"), &NavigationMesh::get_filter_low_hanging_obstacles);
+
+ ClassDB::bind_method(D_METHOD("set_filter_ledge_spans", "filter_ledge_spans"), &NavigationMesh::set_filter_ledge_spans);
+ ClassDB::bind_method(D_METHOD("get_filter_ledge_spans"), &NavigationMesh::get_filter_ledge_spans);
+
+ ClassDB::bind_method(D_METHOD("set_filter_walkable_low_height_spans", "filter_walkable_low_height_spans"), &NavigationMesh::set_filter_walkable_low_height_spans);
+ ClassDB::bind_method(D_METHOD("get_filter_walkable_low_height_spans"), &NavigationMesh::get_filter_walkable_low_height_spans);
ClassDB::bind_method(D_METHOD("set_vertices", "vertices"), &NavigationMesh::set_vertices);
ClassDB::bind_method(D_METHOD("get_vertices"), &NavigationMesh::get_vertices);
@@ -213,11 +400,54 @@ void NavigationMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons);
ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons);
+ BIND_CONSTANT(SAMPLE_PARTITION_WATERSHED);
+ BIND_CONSTANT(SAMPLE_PARTITION_MONOTONE);
+ BIND_CONSTANT(SAMPLE_PARTITION_LAYERS);
+
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_vertices", "get_vertices");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_polygons", "_get_polygons");
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type");
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_size", "get_cell_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_height", "get_cell_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_height", "get_agent_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_radius", "get_agent_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_max_climb", "get_agent_max_climb");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_slope", PROPERTY_HINT_RANGE, "0.0,90.0,0.1"), "set_agent_max_slope", "get_agent_max_slope");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_min_size", "get_region_min_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_merge_size", "get_region_merge_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01"), "set_edge_max_length", "get_edge_max_length");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01"), "set_edge_max_error", "get_edge_max_error");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0"), "set_verts_per_poly", "get_verts_per_poly");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_distance", "get_detail_sample_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_max_error", "get_detail_sample_max_error");
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans");
}
NavigationMesh::NavigationMesh() {
+ cell_size = 0.3f;
+ cell_height = 0.2f;
+ agent_height = 2.0f;
+ agent_radius = 0.6f;
+ agent_max_climb = 0.9f;
+ agent_max_slope = 45.0f;
+ region_min_size = 8.0f;
+ region_merge_size = 20.0f;
+ edge_max_length = 12.0f;
+ edge_max_error = 1.3f;
+ verts_per_poly = 6.0f;
+ detail_sample_distance = 6.0f;
+ detail_sample_max_error = 1.0f;
+
+ partition_type = SAMPLE_PARTITION_WATERSHED;
+
+ filter_low_hanging_obstacles = false;
+ filter_ledge_spans = false;
+ filter_walkable_low_height_spans = false;
}
void NavigationMeshInstance::set_enabled(bool p_enabled) {
diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h
index 36fe3ee34b..dd5ed79500 100644
--- a/scene/3d/navigation_mesh.h
+++ b/scene/3d/navigation_mesh.h
@@ -61,6 +61,87 @@ protected:
Array _get_polygons() const;
public:
+ enum SamplePartitionType {
+ SAMPLE_PARTITION_WATERSHED = 0,
+ SAMPLE_PARTITION_MONOTONE,
+ SAMPLE_PARTITION_LAYERS,
+ SAMPLE_PARTITION_MAX
+ };
+
+protected:
+ float cell_size;
+ float cell_height;
+ float agent_height;
+ float agent_radius;
+ float agent_max_climb;
+ float agent_max_slope;
+ float region_min_size;
+ float region_merge_size;
+ float edge_max_length;
+ float edge_max_error;
+ float verts_per_poly;
+ float detail_sample_distance;
+ float detail_sample_max_error;
+
+ SamplePartitionType partition_type;
+
+ bool filter_low_hanging_obstacles;
+ bool filter_ledge_spans;
+ bool filter_walkable_low_height_spans;
+
+public:
+ // Recast settings
+ void set_sample_partition_type(int p_value);
+ int get_sample_partition_type() const;
+
+ void set_cell_size(float p_value);
+ float get_cell_size() const;
+
+ void set_cell_height(float p_value);
+ float get_cell_height() const;
+
+ void set_agent_height(float p_value);
+ float get_agent_height() const;
+
+ void set_agent_radius(float p_value);
+ float get_agent_radius();
+
+ void set_agent_max_climb(float p_value);
+ float get_agent_max_climb() const;
+
+ void set_agent_max_slope(float p_value);
+ float get_agent_max_slope() const;
+
+ void set_region_min_size(float p_value);
+ float get_region_min_size() const;
+
+ void set_region_merge_size(float p_value);
+ float get_region_merge_size() const;
+
+ void set_edge_max_length(float p_value);
+ float get_edge_max_length() const;
+
+ void set_edge_max_error(float p_value);
+ float get_edge_max_error() const;
+
+ void set_verts_per_poly(float p_value);
+ float get_verts_per_poly() const;
+
+ void set_detail_sample_distance(float p_value);
+ float get_detail_sample_distance() const;
+
+ void set_detail_sample_max_error(float p_value);
+ float get_detail_sample_max_error() const;
+
+ void set_filter_low_hanging_obstacles(bool p_value);
+ bool get_filter_low_hanging_obstacles() const;
+
+ void set_filter_ledge_spans(bool p_value);
+ bool get_filter_ledge_spans() const;
+
+ void set_filter_walkable_low_height_spans(bool p_value);
+ bool get_filter_walkable_low_height_spans() const;
+
void create_from_mesh(const Ref<Mesh> &p_mesh);
void set_vertices(const PoolVector<Vector3> &p_vertices);
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index ed4d88417c..60245fe6ce 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -155,8 +155,8 @@ void PathFollow::_notification(int p_what) {
Node *parent = get_parent();
if (parent) {
-
- if ((path = Object::cast_to<Path>(parent))) {
+ path = Object::cast_to<Path>(parent);
+ if (path) {
_update_transform();
}
}
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 6a8226c0e1..005ea1f8d1 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -825,7 +825,7 @@ void RigidBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_using_continuous_collision_detection"), &RigidBody::is_using_continuous_collision_detection);
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody::set_axis_velocity);
- ClassDB::bind_method(D_METHOD("apply_impulse", "pos", "impulse"), &RigidBody::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &RigidBody::apply_impulse);
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody::set_sleeping);
ClassDB::bind_method(D_METHOD("is_sleeping"), &RigidBody::is_sleeping);
@@ -874,6 +874,11 @@ void RigidBody::_bind_methods() {
BIND_ENUM_CONSTANT(MODE_KINEMATIC);
BIND_ENUM_CONSTANT(MODE_RIGID);
BIND_ENUM_CONSTANT(MODE_CHARACTER);
+
+ BIND_ENUM_CONSTANT(AXIS_LOCK_DISABLED);
+ BIND_ENUM_CONSTANT(AXIS_LOCK_X);
+ BIND_ENUM_CONSTANT(AXIS_LOCK_Y);
+ BIND_ENUM_CONSTANT(AXIS_LOCK_Z);
}
RigidBody::RigidBody()
@@ -1061,7 +1066,7 @@ KinematicBody::Collision KinematicBody::get_slide_collision(int p_bounce) const
Ref<KinematicCollision> KinematicBody::_get_slide_collision(int p_bounce) {
ERR_FAIL_INDEX_V(p_bounce, colliders.size(), Ref<KinematicCollision>());
- if (p_bounce > slide_colliders.size()) {
+ if (p_bounce >= slide_colliders.size()) {
slide_colliders.resize(p_bounce + 1);
}
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 7db3bb18bd..0dfd80ca90 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -175,7 +175,6 @@ void Spatial::_notification(int p_what) {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
}
#ifdef TOOLS_ENABLED
@@ -207,7 +206,6 @@ void Spatial::_notification(int p_what) {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, NULL, 0);
}
@@ -653,7 +651,7 @@ void Spatial::look_at(const Vector3 &p_target, const Vector3 &p_up_normal) {
set_global_transform(lookat);
}
-void Spatial::look_at_from_pos(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal) {
+void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal) {
Transform lookat;
lookat.origin = p_pos;
@@ -751,7 +749,7 @@ void Spatial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_identity"), &Spatial::set_identity);
ClassDB::bind_method(D_METHOD("look_at", "target", "up"), &Spatial::look_at);
- ClassDB::bind_method(D_METHOD("look_at_from_pos", "pos", "target", "up"), &Spatial::look_at_from_pos);
+ ClassDB::bind_method(D_METHOD("look_at_from_position", "position", "target", "up"), &Spatial::look_at_from_position);
ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Spatial::to_local);
ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Spatial::to_global);
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 3f205ea86b..b912d1f906 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -172,7 +172,7 @@ public:
void global_translate(const Vector3 &p_offset);
void look_at(const Vector3 &p_target, const Vector3 &p_up_normal);
- void look_at_from_pos(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal);
+ void look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal);
Vector3 to_local(Vector3 p_global) const;
Vector3 to_global(Vector3 p_local) const;
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index d6b3206fbf..3518113130 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -102,6 +102,14 @@ void VehicleWheel::_notification(int p_what) {
}
}
+String VehicleWheel::get_configuration_warning() const {
+ if (!Object::cast_to<VehicleBody>(get_parent())) {
+ return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
+ }
+
+ return String();
+}
+
void VehicleWheel::_update(PhysicsDirectBodyState *s) {
if (m_raycastInfo.m_isInContact)
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index d67209c58f..eb661adb90 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -131,6 +131,8 @@ public:
void set_roll_influence(float p_value);
float get_roll_influence() const;
+ String get_configuration_warning() const;
+
VehicleWheel();
};
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 0464a82f65..fa35d982eb 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -288,12 +288,13 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed"));
- BIND_CONSTANT(FLAG_MAX);
+ BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_OFF);
+ BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_ON);
+ BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
+ BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
- BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF);
- BIND_CONSTANT(SHADOW_CASTING_SETTING_ON);
- BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
- BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
+ BIND_ENUM_CONSTANT(FLAG_USE_BAKED_LIGHT);
+ BIND_ENUM_CONSTANT(FLAG_MAX);
}
GeometryInstance::GeometryInstance() {
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index be0b652276..cadbd086bc 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1045,7 +1045,7 @@ bool AnimationPlayer::is_valid() const {
return (playback.current.from);
}
-float AnimationPlayer::get_current_animation_pos() const {
+float AnimationPlayer::get_current_animation_position() const {
ERR_FAIL_COND_V(!playback.current.from, 0);
return playback.current.pos;
@@ -1238,8 +1238,8 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::set_root);
ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::get_root);
- ClassDB::bind_method(D_METHOD("seek", "pos_sec", "update"), &AnimationPlayer::seek, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_pos"), &AnimationPlayer::get_current_animation_pos);
+ ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
@@ -1248,7 +1248,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode);
ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode);
- ClassDB::bind_method(D_METHOD("get_current_animation_pos"), &AnimationPlayer::get_current_animation_pos);
+ ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index c6e52145a8..bface7aabb 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -279,7 +279,7 @@ public:
void seek(float p_time, bool p_update = false);
void seek_delta(float p_time, float p_delta);
- float get_current_animation_pos() const;
+ float get_current_animation_position() const;
float get_current_animation_length() const;
void advance(float p_time);
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index e2330eb0d4..a2a8adb653 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -92,7 +92,7 @@ bool AnimationTreePlayer::_set(const StringName &p_name, const Variant &p_value)
Dictionary node = nodes[i];
StringName id = node.get_valid("id");
- Point2 pos = node.get_valid("pos");
+ Point2 pos = node.get_valid("position");
NodeType nt = NODE_MAX;
String type = node.get_valid("type");
@@ -122,7 +122,7 @@ bool AnimationTreePlayer::_set(const StringName &p_name, const Variant &p_value)
if (nt != NODE_OUTPUT)
add_node(nt, id);
- node_set_pos(id, pos);
+ node_set_position(id, pos);
switch (nt) {
case NODE_OUTPUT: {
@@ -245,7 +245,7 @@ bool AnimationTreePlayer::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary node;
node["id"] = E->key();
- node["pos"] = n->pos;
+ node["position"] = n->pos;
switch (n->type) {
case NODE_OUTPUT: node["type"] = "output"; break;
@@ -1156,6 +1156,7 @@ void AnimationTreePlayer::transition_node_set_xfade_time(const StringName &p_nod
}
void AnimationTreePlayer::TransitionNode::set_current(int p_current) {
+
ERR_FAIL_INDEX(p_current, inputs.size());
if (current == p_current)
@@ -1175,7 +1176,7 @@ void AnimationTreePlayer::transition_node_set_current(const StringName &p_node,
n->set_current(p_current);
}
-void AnimationTreePlayer::node_set_pos(const StringName &p_node, const Vector2 &p_pos) {
+void AnimationTreePlayer::node_set_position(const StringName &p_node, const Vector2 &p_pos) {
ERR_FAIL_COND(!node_map.has(p_node));
node_map[p_node]->pos = p_pos;
@@ -1186,7 +1187,7 @@ AnimationTreePlayer::NodeType AnimationTreePlayer::node_get_type(const StringNam
ERR_FAIL_COND_V(!node_map.has(p_node), NODE_OUTPUT);
return node_map[p_node]->type;
}
-Point2 AnimationTreePlayer::node_get_pos(const StringName &p_node) const {
+Point2 AnimationTreePlayer::node_get_position(const StringName &p_node) const {
ERR_FAIL_COND_V(!node_map.has(p_node), Point2());
return node_map[p_node]->pos;
@@ -1751,7 +1752,7 @@ void AnimationTreePlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("timescale_node_set_scale", "id", "scale"), &AnimationTreePlayer::timescale_node_set_scale);
ClassDB::bind_method(D_METHOD("timescale_node_get_scale", "id"), &AnimationTreePlayer::timescale_node_get_scale);
- ClassDB::bind_method(D_METHOD("timeseek_node_seek", "id", "pos_sec"), &AnimationTreePlayer::timeseek_node_seek);
+ ClassDB::bind_method(D_METHOD("timeseek_node_seek", "id", "seconds"), &AnimationTreePlayer::timeseek_node_seek);
ClassDB::bind_method(D_METHOD("transition_node_set_input_count", "id", "count"), &AnimationTreePlayer::transition_node_set_input_count);
ClassDB::bind_method(D_METHOD("transition_node_get_input_count", "id"), &AnimationTreePlayer::transition_node_get_input_count);
@@ -1766,8 +1767,8 @@ void AnimationTreePlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("transition_node_set_current", "id", "input_idx"), &AnimationTreePlayer::transition_node_set_current);
ClassDB::bind_method(D_METHOD("transition_node_get_current", "id"), &AnimationTreePlayer::transition_node_get_current);
- ClassDB::bind_method(D_METHOD("node_set_pos", "id", "screen_pos"), &AnimationTreePlayer::node_set_pos);
- ClassDB::bind_method(D_METHOD("node_get_pos", "id"), &AnimationTreePlayer::node_get_pos);
+ ClassDB::bind_method(D_METHOD("node_set_position", "id", "screen_position"), &AnimationTreePlayer::node_set_position);
+ ClassDB::bind_method(D_METHOD("node_get_position", "id"), &AnimationTreePlayer::node_get_position);
ClassDB::bind_method(D_METHOD("remove_node", "id"), &AnimationTreePlayer::remove_node);
ClassDB::bind_method(D_METHOD("connect_nodes", "id", "dst_id", "dst_input_idx"), &AnimationTreePlayer::connect_nodes);
@@ -1807,6 +1808,9 @@ void AnimationTreePlayer::_bind_methods() {
BIND_ENUM_CONSTANT(NODE_TIMESCALE);
BIND_ENUM_CONSTANT(NODE_TIMESEEK);
BIND_ENUM_CONSTANT(NODE_TRANSITION);
+
+ BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED);
+ BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
}
AnimationTreePlayer::AnimationTreePlayer() {
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 609430340b..806a4f6604 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -417,10 +417,10 @@ public:
void transition_node_set_current(const StringName &p_node, int p_current);
int transition_node_get_current(const StringName &p_node) const;
- void node_set_pos(const StringName &p_node, const Vector2 &p_pos); //for display
+ void node_set_position(const StringName &p_node, const Vector2 &p_pos); //for display
/* GETS */
- Point2 node_get_pos(const StringName &p_node) const; //for display
+ Point2 node_get_position(const StringName &p_node) const; //for display
NodeType node_get_type(const StringName &p_node) const;
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 341ae45ce8..11e6c1b2e1 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -66,29 +66,27 @@ void AudioStreamPlayer::_mix_audio() {
//set volume for next mix
mix_volume_db = volume_db;
- AudioFrame *targets[3] = { NULL, NULL, NULL };
+ AudioFrame *targets[4] = { NULL, NULL, NULL, NULL };
if (AudioServer::get_singleton()->get_speaker_mode() == AudioServer::SPEAKER_MODE_STEREO) {
targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
} else {
switch (mix_target) {
case MIX_TARGET_STEREO: {
- targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 1);
+ targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
} break;
case MIX_TARGET_SURROUND: {
- targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 1);
- targets[1] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 2);
- if (AudioServer::get_singleton()->get_speaker_mode() == AudioServer::SPEAKER_SURROUND_71) {
- targets[2] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 3);
+ for (int i = 0; i < AudioServer::get_singleton()->get_channel_count(); i++) {
+ targets[i] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, i);
}
} break;
case MIX_TARGET_CENTER: {
- targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
+ targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 1);
} break;
}
}
- for (int c = 0; c < 3; c++) {
+ for (int c = 0; c < 4; c++) {
if (!targets[c])
break;
for (int i = 0; i < buffer_size; i++) {
@@ -189,16 +187,16 @@ void AudioStreamPlayer::stop() {
bool AudioStreamPlayer::is_playing() const {
if (stream_playback.is_valid()) {
- return active && stream_playback->is_playing();
+ return active; //&& stream_playback->is_playing();
}
return false;
}
-float AudioStreamPlayer::get_pos() {
+float AudioStreamPlayer::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -281,12 +279,12 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer::get_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer::get_bus);
@@ -304,12 +302,16 @@ void AudioStreamPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "play", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "_is_active");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_target", PROPERTY_HINT_ENUM, "Stereo,Surround,Center"), "set_mix_target", "get_mix_target");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
ADD_SIGNAL(MethodInfo("finished"));
+
+ BIND_ENUM_CONSTANT(MIX_TARGET_STEREO);
+ BIND_ENUM_CONSTANT(MIX_TARGET_SURROUND);
+ BIND_ENUM_CONSTANT(MIX_TARGET_CENTER);
}
AudioStreamPlayer::AudioStreamPlayer() {
diff --git a/scene/audio/audio_player.h b/scene/audio/audio_player.h
index 4bfa84f766..19b61ea5d8 100644
--- a/scene/audio/audio_player.h
+++ b/scene/audio/audio_player.h
@@ -83,7 +83,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_pos();
+ float get_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 7bf11e6712..2c01a0e2d1 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -49,7 +49,7 @@ Variant Control::edit_get_state() const {
Dictionary s;
s["rect"] = get_rect();
- s["rot"] = get_rotation();
+ s["rotation"] = get_rotation();
s["scale"] = get_scale();
Array anchors;
anchors.push_back(get_anchor(MARGIN_LEFT));
@@ -66,7 +66,7 @@ void Control::edit_set_state(const Variant &p_state) {
Rect2 state = s["rect"];
set_position(state.position);
set_size(state.size);
- set_rotation(s["rot"]);
+ set_rotation(s["rotation"]);
set_scale(s["scale"]);
Array anchors = s["anchors"];
set_anchor(MARGIN_LEFT, anchors[0]);
@@ -809,9 +809,9 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
// try with custom themes
Control *theme_owner = data.theme_owner;
- while (theme_owner) {
+ StringName class_name = type;
- StringName class_name = type;
+ while (theme_owner) {
while (class_name != StringName()) {
if (theme_owner->data.theme->has_stylebox(p_name, class_name)) {
@@ -829,6 +829,14 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
theme_owner = NULL;
}
+ class_name = type;
+
+ while (class_name != StringName()) {
+ if (Theme::get_default()->has_stylebox(p_name, class_name))
+ return Theme::get_default()->get_stylebox(p_name, class_name);
+
+ class_name = ClassDB::get_parent_class_nocheck(class_name);
+ }
return Theme::get_default()->get_stylebox(p_name, type);
}
Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type) const {
@@ -1250,7 +1258,7 @@ void Control::_size_changed() {
}
if (get_viewport()->is_snap_controls_to_pixels_enabled()) {
- new_size_cache =new_size_cache.floor();
+ new_size_cache = new_size_cache.floor();
new_pos_cache = new_pos_cache.floor();
}
bool pos_changed = new_pos_cache != data.pos_cache;
@@ -2469,12 +2477,12 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor);
ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin);
ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
- ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
- ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
+ ClassDB::bind_method(D_METHOD("set_begin", "position"), &Control::set_begin);
+ ClassDB::bind_method(D_METHOD("set_end", "position"), &Control::set_end);
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &Control::set_position);
ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
- ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position);
+ ClassDB::bind_method(D_METHOD("set_global_position", "position"), &Control::set_global_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg);
// TODO: Obsolete this method (old name) properly (GH-4397)
@@ -2552,12 +2560,12 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_v_grow_direction"), &Control::get_v_grow_direction);
ClassDB::bind_method(D_METHOD("set_tooltip", "tooltip"), &Control::set_tooltip);
- ClassDB::bind_method(D_METHOD("get_tooltip", "atpos"), &Control::get_tooltip, DEFVAL(Point2()));
+ ClassDB::bind_method(D_METHOD("get_tooltip", "at_position"), &Control::get_tooltip, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("_get_tooltip"), &Control::_get_tooltip);
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Control::set_default_cursor_shape);
ClassDB::bind_method(D_METHOD("get_default_cursor_shape"), &Control::get_default_cursor_shape);
- ClassDB::bind_method(D_METHOD("get_cursor_shape", "pos"), &Control::get_cursor_shape, DEFVAL(Point2()));
+ ClassDB::bind_method(D_METHOD("get_cursor_shape", "position"), &Control::get_cursor_shape, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour);
ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour);
@@ -2575,7 +2583,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target"), &Control::set_drag_forwarding);
ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Control::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse);
ClassDB::bind_method(D_METHOD("minimum_size_changed"), &Control::minimum_size_changed);
@@ -2585,9 +2593,9 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size"));
- BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "pos")));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
- BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "position")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
ADD_GROUP("Anchor", "anchor_");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT);
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 140d002387..d4912339da 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -195,7 +195,7 @@ void WindowDialog::_notification(int p_what) {
RID canvas = get_canvas_item();
// Draw the background.
- Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
+ Ref<StyleBox> panel = get_stylebox("panel");
Size2 size = get_size();
panel->draw(canvas, Rect2(0, 0, size.x, size.y));
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 990c0f3d96..87a232e766 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -183,8 +183,8 @@ void FileDialog::_action_pressed() {
String path = dir_access->get_current_dir();
path = path.replace("\\", "/");
-
- if (TreeItem *item = tree->get_selected()) {
+ TreeItem *item = tree->get_selected();
+ if (item) {
Dictionary d = item->get_metadata(0);
if (d["dir"]) {
path = path.plus_file(d["name"]);
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 5b00aab2ef..ff31aa88ab 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -283,7 +283,7 @@ void GraphEdit::_notification(int p_what) {
zoom_minus->set_icon(get_icon("minus"));
zoom_reset->set_icon(get_icon("reset"));
zoom_plus->set_icon(get_icon("more"));
- snap_button->set_icon(get_icon("snap"));
+ snap_button->set_icon(get_icon("SnapGrid"));
//zoom_icon->set_texture( get_icon("Zoom", "EditorIcons"));
}
if (p_what == NOTIFICATION_DRAW) {
@@ -352,14 +352,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r)
return true;
}
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r) {
return true;
}
@@ -386,7 +386,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
@@ -433,7 +433,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
@@ -501,7 +501,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (!connecting_out) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
int type = gn->get_connection_output_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
@@ -516,7 +516,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
int type = gn->get_connection_input_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
connecting_target = true;
@@ -657,9 +657,9 @@ void GraphEdit::_connections_layer_draw() {
continue;
}
- Vector2 frompos = gfrom->get_connection_output_pos(E->get().from_port) + gfrom->get_offset() * zoom;
+ Vector2 frompos = gfrom->get_connection_output_position(E->get().from_port) + gfrom->get_offset() * zoom;
Color color = gfrom->get_connection_output_color(E->get().from_port);
- Vector2 topos = gto->get_connection_input_pos(E->get().to_port) + gto->get_offset() * zoom;
+ Vector2 topos = gto->get_connection_input_position(E->get().to_port) + gto->get_offset() * zoom;
Color tocolor = gto->get_connection_input_color(E->get().to_port);
_draw_cos_line(connections_layer, frompos, topos, color, tocolor);
}
@@ -682,9 +682,9 @@ void GraphEdit::_top_layer_draw() {
ERR_FAIL_COND(!from);
Vector2 pos;
if (connecting_out)
- pos = from->get_connection_output_pos(connecting_index);
+ pos = from->get_connection_output_position(connecting_index);
else
- pos = from->get_connection_input_pos(connecting_index);
+ pos = from->get_connection_input_position(connecting_index);
pos += from->get_position();
Vector2 topos;
@@ -733,7 +733,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
just_selected = true;
// TODO: Remove local mouse pos hack if/when InputEventMouseMotion is fixed to support floats
//drag_accum+=Vector2(mm->get_relative().x,mm->get_relative().y);
- drag_accum = get_local_mouse_pos() - drag_origin;
+ drag_accum = get_local_mouse_position() - drag_origin;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
if (gn && gn->is_selected()) {
@@ -750,7 +750,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (mm.is_valid() && box_selecting) {
- box_selecting_to = get_local_mouse_pos();
+ box_selecting_to = get_local_mouse_position();
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
MIN(box_selecting_from.y, box_selecting_to.y),
@@ -810,7 +810,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn) {
Rect2 r = gn->get_rect();
r.size *= zoom;
- if (r.has_point(get_local_mouse_pos()))
+ if (r.has_point(get_local_mouse_position()))
gn->set_selected(false);
}
}
@@ -848,7 +848,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn_selected->is_resizing())
continue;
- if (gn_selected->has_point(gn_selected->get_local_mouse_pos())) {
+ if (gn_selected->has_point(gn_selected->get_local_mouse_position())) {
gn = gn_selected;
break;
}
@@ -862,7 +862,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
dragging = true;
drag_accum = Vector2();
- drag_origin = get_local_mouse_pos();
+ drag_origin = get_local_mouse_position();
just_selected = !gn->is_selected();
if (!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < get_child_count(); i++) {
@@ -888,7 +888,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
return;
box_selecting = true;
- box_selecting_from = get_local_mouse_pos();
+ box_selecting_from = get_local_mouse_position();
if (b->get_control()) {
box_selection_mode_aditive = true;
previus_selected.clear();
@@ -1167,7 +1167,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node")));
- ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_pos")));
+ ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index bef0808fd0..7655363631 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -208,8 +208,11 @@ void GraphNode::_notification(int p_what) {
Ref<Texture> close = get_icon("close");
Ref<Texture> resizer = get_icon("resizer");
int close_offset = get_constant("close_offset");
+ int close_h_offset = get_constant("close_h_offset");
+ Color close_color = get_color("close_color");
Ref<Font> title_font = get_font("title_font");
int title_offset = get_constant("title_offset");
+ int title_h_offset = get_constant("title_h_offset");
Color title_color = get_color("title_color");
Point2i icofs = -port->get_size() * 0.5;
int edgeofs = get_constant("port_offset");
@@ -236,10 +239,10 @@ void GraphNode::_notification(int p_what) {
if (show_close)
w -= close->get_width();
- draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT), -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
+ draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT) + title_h_offset, -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
if (show_close) {
- Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT), -close->get_height() + close_offset);
- draw_texture(close, cpos);
+ Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT) + close_h_offset, -close->get_height() + close_offset);
+ draw_texture(close, cpos, close_color);
close_rect.position = cpos;
close_rect.size = close->get_size();
} else {
@@ -515,7 +518,7 @@ int GraphNode::get_connection_output_count() {
return conn_output_cache.size();
}
-Vector2 GraphNode::get_connection_input_pos(int p_idx) {
+Vector2 GraphNode::get_connection_input_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -545,7 +548,7 @@ Color GraphNode::get_connection_input_color(int p_idx) {
return conn_input_cache[p_idx].color;
}
-Vector2 GraphNode::get_connection_output_pos(int p_idx) {
+Vector2 GraphNode::get_connection_output_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -687,10 +690,10 @@ void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_connection_output_count"), &GraphNode::get_connection_output_count);
ClassDB::bind_method(D_METHOD("get_connection_input_count"), &GraphNode::get_connection_input_count);
- ClassDB::bind_method(D_METHOD("get_connection_output_pos", "idx"), &GraphNode::get_connection_output_pos);
+ ClassDB::bind_method(D_METHOD("get_connection_output_position", "idx"), &GraphNode::get_connection_output_position);
ClassDB::bind_method(D_METHOD("get_connection_output_type", "idx"), &GraphNode::get_connection_output_type);
ClassDB::bind_method(D_METHOD("get_connection_output_color", "idx"), &GraphNode::get_connection_output_color);
- ClassDB::bind_method(D_METHOD("get_connection_input_pos", "idx"), &GraphNode::get_connection_input_pos);
+ ClassDB::bind_method(D_METHOD("get_connection_input_position", "idx"), &GraphNode::get_connection_input_position);
ClassDB::bind_method(D_METHOD("get_connection_input_type", "idx"), &GraphNode::get_connection_input_type);
ClassDB::bind_method(D_METHOD("get_connection_input_color", "idx"), &GraphNode::get_connection_input_color);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index a606e47acd..a0840544dd 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -138,10 +138,10 @@ public:
int get_connection_input_count();
int get_connection_output_count();
- Vector2 get_connection_input_pos(int p_idx);
+ Vector2 get_connection_input_position(int p_idx);
int get_connection_input_type(int p_idx);
Color get_connection_input_color(int p_idx);
- Vector2 get_connection_output_pos(int p_idx);
+ Vector2 get_connection_output_position(int p_idx);
int get_connection_output_type(int p_idx);
Color get_connection_output_color(int p_idx);
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 9a605c98f3..74cc09d0a6 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1117,7 +1117,7 @@ void ItemList::_scroll_changed(double) {
update();
}
-int ItemList::get_item_at_pos(const Point2 &p_pos, bool p_exact) const {
+int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
Vector2 pos = p_pos;
Ref<StyleBox> bg = get_stylebox("bg");
@@ -1165,7 +1165,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
String ItemList::get_tooltip(const Point2 &p_pos) const {
- int closest = get_item_at_pos(p_pos);
+ int closest = get_item_at_position(p_pos);
if (closest != -1) {
if (!items[closest].tooltip_enabled) {
@@ -1362,7 +1362,7 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
- ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos", "exact"), &ItemList::get_item_at_pos, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_item_at_position", "position", "exact"), &ItemList::get_item_at_position, DEFVAL(false));
ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible);
@@ -1395,7 +1395,7 @@ void ItemList::_bind_methods() {
BIND_ENUM_CONSTANT(SELECT_MULTI);
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
- ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "atpos")));
+ ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position")));
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected")));
ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index")));
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 673b7d8956..ccdd705325 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -199,7 +199,7 @@ public:
int find_metadata(const Variant &p_metadata) const;
virtual String get_tooltip(const Point2 &p_pos) const;
- int get_item_at_pos(const Point2 &p_pos, bool p_exact = false) const;
+ int get_item_at_position(const Point2 &p_pos, bool p_exact = false) const;
bool is_pos_at_end_of_items(const Point2 &p_pos) const;
void set_icon_scale(real_t p_scale);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 6a5f56c78c..7493ea95a8 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -49,7 +49,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (b.is_valid()) {
if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT) {
- menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -186,7 +186,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cached_width += font->get_char_size(text[i]).width;
}
- set_cursor_pos(0);
+ set_cursor_position(0);
_text_changed();
}
@@ -273,7 +273,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
delete_text(cc, cursor_pos);
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
undo_text = text;
@@ -297,7 +297,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- set_cursor_pos(0);
+ set_cursor_position(0);
} else if (k->get_alt()) {
#else
@@ -319,10 +319,10 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cc--;
}
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
- set_cursor_pos(get_cursor_pos() - 1);
+ set_cursor_position(get_cursor_position() - 1);
}
shift_selection_check_post(k->get_shift());
@@ -341,7 +341,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
} else if (k->get_alt()) {
#else
if (k->get_alt()) {
@@ -362,10 +362,10 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cc++;
}
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
- set_cursor_pos(get_cursor_pos() + 1);
+ set_cursor_position(get_cursor_position() + 1);
}
shift_selection_check_post(k->get_shift());
@@ -418,7 +418,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} else {
undo_text = text;
- set_cursor_pos(cursor_pos + 1);
+ set_cursor_position(cursor_pos + 1);
delete_char();
}
@@ -433,7 +433,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_HOME: {
shift_selection_check_pre(k->get_shift());
- set_cursor_pos(0);
+ set_cursor_position(0);
shift_selection_check_post(k->get_shift());
} break;
case KEY_KP_1: {
@@ -446,7 +446,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_END: {
shift_selection_check_pre(k->get_shift());
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
shift_selection_check_post(k->get_shift());
} break;
@@ -546,7 +546,7 @@ void LineEdit::_notification(int p_what) {
#endif
case NOTIFICATION_RESIZED: {
- set_cursor_pos(get_cursor_pos());
+ set_cursor_position(get_cursor_position());
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
@@ -742,7 +742,7 @@ void LineEdit::_notification(int p_what) {
draw_caret = true;
}
- Point2 cursor_pos = Point2(get_cursor_pos(), 1) * get_minimum_size().height;
+ Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
@@ -806,9 +806,9 @@ void LineEdit::undo() {
cached_width += font->get_char_size(text[i]).width;
if (old_cursor_pos > text.length()) {
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
} else {
- set_cursor_pos(old_cursor_pos);
+ set_cursor_position(old_cursor_pos);
}
_text_changed();
@@ -869,14 +869,14 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
ofs++;
}
- set_cursor_pos(ofs);
+ set_cursor_position(ofs);
/*
int new_cursor_pos=p_x;
int charwidth=draw_area->get_font_char_width(' ',0);
new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth );
if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length();
- set_cursor_pos(window_pos+new_cursor_pos); */
+ set_cursor_position(window_pos+new_cursor_pos); */
}
bool LineEdit::cursor_get_blink_enabled() const {
@@ -929,7 +929,7 @@ void LineEdit::delete_char() {
text.erase(cursor_pos - 1, 1);
- set_cursor_pos(get_cursor_pos() - 1);
+ set_cursor_position(get_cursor_position() - 1);
if (cursor_pos == window_pos) {
@@ -1011,7 +1011,7 @@ float LineEdit::get_placeholder_alpha() const {
return placeholder_alpha;
}
-void LineEdit::set_cursor_pos(int p_pos) {
+void LineEdit::set_cursor_position(int p_pos) {
if (p_pos > (int)text.length())
p_pos = text.length();
@@ -1065,7 +1065,7 @@ void LineEdit::set_cursor_pos(int p_pos) {
update();
}
-int LineEdit::get_cursor_pos() const {
+int LineEdit::get_cursor_position() const {
return cursor_pos;
}
@@ -1093,7 +1093,7 @@ void LineEdit::append_at_cursor(String p_text) {
String pre = text.substr(0, cursor_pos);
String post = text.substr(cursor_pos, text.length() - cursor_pos);
text = pre + p_text + post;
- set_cursor_pos(cursor_pos + p_text.length());
+ set_cursor_position(cursor_pos + p_text.length());
}
}
@@ -1330,8 +1330,8 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_placeholder"), &LineEdit::get_placeholder);
ClassDB::bind_method(D_METHOD("set_placeholder_alpha", "alpha"), &LineEdit::set_placeholder_alpha);
ClassDB::bind_method(D_METHOD("get_placeholder_alpha"), &LineEdit::get_placeholder_alpha);
- ClassDB::bind_method(D_METHOD("set_cursor_pos", "pos"), &LineEdit::set_cursor_pos);
- ClassDB::bind_method(D_METHOD("get_cursor_pos"), &LineEdit::get_cursor_pos);
+ ClassDB::bind_method(D_METHOD("set_cursor_position", "position"), &LineEdit::set_cursor_position);
+ ClassDB::bind_method(D_METHOD("get_cursor_position"), &LineEdit::get_cursor_position);
ClassDB::bind_method(D_METHOD("set_expand_to_text_length", "enabled"), &LineEdit::set_expand_to_text_length);
ClassDB::bind_method(D_METHOD("get_expand_to_text_length"), &LineEdit::get_expand_to_text_length);
ClassDB::bind_method(D_METHOD("cursor_set_blink_enabled", "enabled"), &LineEdit::cursor_set_blink_enabled);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 52a4a29a33..661f9b60b9 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -149,8 +149,8 @@ public:
String get_placeholder() const;
void set_placeholder_alpha(float p_alpha);
float get_placeholder_alpha() const;
- void set_cursor_pos(int p_pos);
- int get_cursor_pos() const;
+ void set_cursor_position(int p_pos);
+ int get_cursor_position() const;
void set_max_length(int p_max_length);
int get_max_length() const;
void append_at_cursor(String p_text);
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index ab2c2f445f..71b9c4ec72 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -540,14 +540,6 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
it = _get_next_item(it);
- if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y > p_ofs.y + y + lh) {
- //at the end of all, return this
- if (r_outside) *r_outside = true;
- *r_click_item = itp;
- *r_click_char = rchar;
- return;
- }
-
if (it && (p_line + 1 < p_frame->lines.size()) && p_frame->lines[p_line + 1].from == it) {
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh) {
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 16d1b320b7..41f4beb1c9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -106,9 +106,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (ofs < grabber_ofs) {
if (scrolling) {
- target_scroll = target_scroll - get_page();
+ target_scroll = CLAMP(target_scroll - get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() - get_page();
+ target_scroll = CLAMP(get_value() - get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {
@@ -130,9 +130,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
update();
} else {
if (scrolling) {
- target_scroll = target_scroll + get_page();
+ target_scroll = CLAMP(target_scroll + get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() + get_page();
+ target_scroll = CLAMP(get_value() + get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index e182e491d3..c71093b947 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -182,7 +182,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
-void ScrollContainer::_update_scrollbar_pos() {
+void ScrollContainer::_update_scrollbar_position() {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
@@ -205,7 +205,7 @@ void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- call_deferred("_update_scrollbar_pos");
+ call_deferred("_update_scrollbar_position");
};
if (p_what == NOTIFICATION_SORT_CHILDREN) {
@@ -448,7 +448,7 @@ void ScrollContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_h_scroll_enabled"), &ScrollContainer::is_h_scroll_enabled);
ClassDB::bind_method(D_METHOD("set_enable_v_scroll", "enable"), &ScrollContainer::set_enable_v_scroll);
ClassDB::bind_method(D_METHOD("is_v_scroll_enabled"), &ScrollContainer::is_v_scroll_enabled);
- ClassDB::bind_method(D_METHOD("_update_scrollbar_pos"), &ScrollContainer::_update_scrollbar_pos);
+ ClassDB::bind_method(D_METHOD("_update_scrollbar_position"), &ScrollContainer::_update_scrollbar_position);
ClassDB::bind_method(D_METHOD("set_h_scroll", "val"), &ScrollContainer::set_h_scroll);
ClassDB::bind_method(D_METHOD("get_h_scroll"), &ScrollContainer::get_h_scroll);
ClassDB::bind_method(D_METHOD("set_v_scroll", "val"), &ScrollContainer::set_v_scroll);
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 9076be0d72..2c5d60de6c 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -70,7 +70,7 @@ protected:
void _scroll_moved(float);
static void _bind_methods();
- void _update_scrollbar_pos();
+ void _update_scrollbar_position();
public:
int get_v_scroll() const;
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 4661f54526..8fda5df53c 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -162,18 +162,20 @@ void Slider::_notification(int p_what) {
Size2i size = get_size();
Ref<StyleBox> style = get_stylebox("slider");
Ref<StyleBox> focus = get_stylebox("focus");
+ Ref<StyleBox> grabber_area = get_stylebox("grabber_area");
Ref<Texture> grabber = get_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
Ref<Texture> tick = get_icon("tick");
if (orientation == VERTICAL) {
int widget_width = style->get_minimum_size().width + style->get_center_size().width;
+ float areasize = size.height - grabber->get_size().height;
style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
+ grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * get_as_ratio() - grabber->get_size().height / 2), Size2i(widget_width, areasize * get_as_ratio() + grabber->get_size().width / 2)));
/*
if (mouse_inside||has_focus())
focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height)));
*/
- float areasize = size.height - grabber->get_size().height;
if (ticks > 1) {
int tickarea = size.height - tick->get_height();
for (int i = 0; i < ticks; i++) {
@@ -186,13 +188,15 @@ void Slider::_notification(int p_what) {
} else {
int widget_height = style->get_minimum_size().height + style->get_center_size().height;
- style->draw(ci, Rect2i(Point2i(0, size.height / 2 - widget_height / 2), Size2i(size.width, widget_height)));
+ float areasize = size.width - grabber->get_size().width;
+
+ style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height)));
+ grabber_area->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(areasize * get_as_ratio() + grabber->get_size().width / 2, widget_height)));
/*
if (mouse_inside||has_focus())
focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height)));
*/
- float areasize = size.width - grabber->get_size().width;
if (ticks > 1) {
int tickarea = size.width - tick->get_width();
for (int i = 0; i < ticks; i++) {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index f462989f53..60b6746ae8 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -72,7 +72,7 @@ void SpinBox::_range_click_timeout() {
if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- bool up = get_local_mouse_pos().y < (get_size().height / 2);
+ bool up = get_local_mouse_position().y < (get_size().height / 2);
set_value(get_value() + (up ? get_step() : -get_step()));
if (range_click_timer->is_one_shot()) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 461ae3444b..98a8db336e 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -208,6 +208,9 @@ void TabContainer::_notification(int p_what) {
break;
}
+ // Draw the tab area.
+ panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
+
// Draw all visible tabs.
int x = 0;
for (int i = 0; i < tab_widths.size(); i++) {
@@ -280,9 +283,6 @@ void TabContainer::_notification(int p_what) {
Point2(x, y_center - (decrement->get_height() / 2)),
Color(1, 1, 1, first_tab_cache > 0 ? 1.0 : 0.5));
}
-
- // Draw the tab area.
- panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
} break;
case NOTIFICATION_THEME_CHANGED: {
if (get_tab_count() > 0) {
@@ -655,6 +655,10 @@ void TabContainer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
+
+ BIND_ENUM_CONSTANT(ALIGN_LEFT);
+ BIND_ENUM_CONSTANT(ALIGN_CENTER);
+ BIND_ENUM_CONSTANT(ALIGN_RIGHT);
}
TabContainer::TabContainer() {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 1738e303aa..d79ce25344 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -36,6 +36,10 @@
#include "project_settings.h"
#include "scene/main/viewport.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_scale.h"
+#endif
+
#define TAB_PIXELS
static bool _is_text_char(CharType c) {
@@ -729,15 +733,18 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color);
}
- if (text.is_breakpoint(line)) {
-
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
- }
-
if (line == cursor.line) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_end, get_row_height()), cache.current_line_color);
}
+ if (text.is_breakpoint(line) && !draw_breakpoint_gutter) {
+#ifdef TOOLS_ENABLED
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color);
+#else
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
+#endif
+ }
+
// draw breakpoint marker
if (text.is_breakpoint(line)) {
if (draw_breakpoint_gutter) {
@@ -1766,7 +1773,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
- menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -1837,7 +1844,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->is_pressed()) {
- highlighted_word = get_word_at_pos(get_local_mouse_pos());
+ highlighted_word = get_word_at_pos(get_local_mouse_position());
update();
} else {
@@ -2793,12 +2800,16 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int ini = selection.from_line;
int end = selection.to_line;
for (int i = ini; i <= end; i++) {
- if (text[i][0] == '#')
+ if (get_line(i).begins_with("#"))
_remove_text(i, 0, i, 1);
}
} else {
- if (text[cursor.line][0] == '#')
+ if (get_line(cursor.line).begins_with("#")) {
_remove_text(cursor.line, 0, cursor.line, 1);
+ if (cursor.column >= get_line(cursor.line).length()) {
+ cursor.column = MAX(0, get_line(cursor.line).length() - 1);
+ }
+ }
}
update();
}
@@ -3488,7 +3499,7 @@ String TextEdit::get_text() {
String TextEdit::get_text_for_lookup_completion() {
int row, col;
- _get_mouse_pos(get_local_mouse_pos(), row, col);
+ _get_mouse_pos(get_local_mouse_position(), row, col);
String longthing;
int len = text.size();
@@ -4255,6 +4266,10 @@ bool TextEdit::is_insert_mode() const {
return insert_mode;
}
+bool TextEdit::is_insert_text_operation() {
+ return (current_op.type == TextOperation::TYPE_INSERT);
+}
+
uint32_t TextEdit::get_version() const {
return current_op.version;
}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 68ef559f46..7e61c4e8b1 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -386,6 +386,8 @@ public:
void begin_complex_operation();
void end_complex_operation();
+ bool is_insert_text_operation();
+
void set_text(String p_text);
void insert_text_at_cursor(const String &p_text);
void insert_at(const String &p_text, int at);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index de17416d8e..8d6eb0f8e2 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -333,6 +333,15 @@ bool TreeItem::is_collapsed() {
return collapsed;
}
+void TreeItem::set_custom_minimum_height(int p_height) {
+ custom_min_height = p_height;
+ _changed_notify();
+}
+
+int TreeItem::get_custom_minimum_height() const {
+ return custom_min_height;
+}
+
TreeItem *TreeItem::get_next() {
return next;
@@ -703,6 +712,9 @@ void TreeItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collapsed", "enable"), &TreeItem::set_collapsed);
ClassDB::bind_method(D_METHOD("is_collapsed"), &TreeItem::is_collapsed);
+ ClassDB::bind_method(D_METHOD("set_custom_minimum_height", "height"), &TreeItem::set_custom_minimum_height);
+ ClassDB::bind_method(D_METHOD("get_custom_minimum_height"), &TreeItem::get_custom_minimum_height);
+
ClassDB::bind_method(D_METHOD("get_next"), &TreeItem::get_next);
ClassDB::bind_method(D_METHOD("get_prev"), &TreeItem::get_prev);
ClassDB::bind_method(D_METHOD("get_parent"), &TreeItem::get_parent);
@@ -759,6 +771,10 @@ void TreeItem::_bind_methods() {
BIND_ENUM_CONSTANT(CELL_MODE_RANGE_EXPRESSION);
BIND_ENUM_CONSTANT(CELL_MODE_ICON);
BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM);
+
+ BIND_ENUM_CONSTANT(ALIGN_LEFT);
+ BIND_ENUM_CONSTANT(ALIGN_CENTER);
+ BIND_ENUM_CONSTANT(ALIGN_RIGHT);
}
void TreeItem::clear_children() {
@@ -780,6 +796,7 @@ TreeItem::TreeItem(Tree *p_tree) {
tree = p_tree;
collapsed = false;
disable_folding = false;
+ custom_min_height = 0;
parent = 0; // parent item
next = 0; // next in list
@@ -921,6 +938,9 @@ int Tree::compute_item_height(TreeItem *p_item) const {
default: {}
}
}
+ int item_min_height = p_item->get_custom_minimum_height();
+ if (height < item_min_height)
+ height = item_min_height;
height += cache.vseparation;
@@ -1508,7 +1528,7 @@ void Tree::_range_click_timeout() {
if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- Point2 pos = get_local_mouse_pos() - cache.bg->get_offset();
+ Point2 pos = get_local_mouse_position() - cache.bg->get_offset();
if (show_column_titles) {
pos.y -= _get_title_button_height();
@@ -1656,7 +1676,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
p_item->select(col);
emit_signal("multi_selected", p_item, col, true);
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
//p_item->selected_signal.call(col);
@@ -1677,7 +1697,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
select_single_item(p_item, root, col, selected_item, &inrange);
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
} else {
@@ -1693,7 +1713,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
}
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
}
}
@@ -1894,7 +1914,7 @@ void Tree::_text_editor_modal_close() {
return;
}
- if (value_editor->has_point(value_editor->get_local_mouse_pos()))
+ if (value_editor->has_point(value_editor->get_local_mouse_position()))
return;
text_editor_enter(text_editor->get_text());
@@ -1990,7 +2010,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (!k->is_pressed())
return;
- if (k->get_alt() || k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
+ if (k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
return;
if (!root)
return;
@@ -2005,48 +2025,47 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
break; \
}
case KEY_RIGHT: {
+ bool dobreak = true;
//TreeItem *next = NULL;
if (!selected_item)
break;
- if (select_mode == SELECT_ROW)
+ if (select_mode == SELECT_ROW) {
EXIT_BREAK;
- if (selected_col >= (columns.size() - 1))
+ }
+ if (selected_col > (columns.size() - 1)) {
EXIT_BREAK;
- if (select_mode == SELECT_MULTI) {
- selected_col++;
- emit_signal("cell_selected");
+ }
+ if (k->get_alt()) {
+ selected_item->set_collapsed(false);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(false);
+ next = next->get_next_visible();
+ }
+ } else if (selected_col == (columns.size() - 1)) {
+ if (selected_item->get_children() != NULL && selected_item->is_collapsed()) {
+ selected_item->set_collapsed(false);
+ } else {
+ selected_col = 0;
+ dobreak = false; // fall through to key_down
+ }
} else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col++;
+ emit_signal("cell_selected");
+ } else {
- selected_item->select(selected_col + 1);
+ selected_item->select(selected_col + 1);
+ }
}
-
update();
ensure_cursor_is_visible();
accept_event();
-
- } break;
- case KEY_LEFT: {
-
- //TreeItem *next = NULL;
- if (!selected_item)
+ if (dobreak) {
break;
- if (select_mode == SELECT_ROW)
- EXIT_BREAK;
- if (selected_col <= 0)
- EXIT_BREAK;
- if (select_mode == SELECT_MULTI) {
- selected_col--;
- emit_signal("cell_selected");
- } else {
-
- selected_item->select(selected_col - 1);
}
-
- update();
- accept_event();
-
- } break;
+ }
case KEY_DOWN: {
TreeItem *next = NULL;
@@ -2093,6 +2112,48 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
accept_event();
} break;
+ case KEY_LEFT: {
+ bool dobreak = true;
+
+ //TreeItem *next = NULL;
+ if (!selected_item)
+ break;
+ if (select_mode == SELECT_ROW) {
+ EXIT_BREAK;
+ }
+ if (selected_col < 0) {
+ EXIT_BREAK;
+ }
+ if (k->get_alt()) {
+ selected_item->set_collapsed(true);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(true);
+ next = next->get_next_visible();
+ }
+ } else if (selected_col == 0) {
+ if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) {
+ selected_item->set_collapsed(true);
+ } else {
+ selected_col = columns.size() - 1;
+ dobreak = false; // fall through to key_up
+ }
+ } else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col--;
+ emit_signal("cell_selected");
+ } else {
+
+ selected_item->select(selected_col - 1);
+ }
+ }
+ update();
+ accept_event();
+
+ if (dobreak) {
+ break;
+ }
+ }
case KEY_UP: {
TreeItem *prev = NULL;
@@ -2304,7 +2365,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
int col, h, section;
TreeItem *it = _find_item_at_pos(root, mpos, col, h, section);
- if (drop_mode_flags && it != drop_mode_over || section != drop_mode_section) {
+ if ((drop_mode_flags && it != drop_mode_over) || section != drop_mode_section) {
drop_mode_over = it;
drop_mode_section = section;
update();
@@ -2409,7 +2470,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (cache.click_type == Cache::CLICK_BUTTON) {
// make sure in case of wrong reference after reconstructing whole TreeItems
- cache.click_item = get_item_at_pos(cache.click_pos);
+ cache.click_item = get_item_at_position(cache.click_pos);
emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);
}
cache.click_type = Cache::CLICK_NONE;
@@ -2469,7 +2530,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (!root || (!root->get_children() && hide_root)) {
if (b->get_button_index() == BUTTON_RIGHT && allow_rmb_select) {
- emit_signal("empty_tree_rmb_selected", get_local_mouse_pos());
+ emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
}
break;
}
@@ -2478,7 +2539,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
pressing_for_editor = false;
blocked++;
- bool handled = propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b);
+ propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b);
blocked--;
if (pressing_for_editor) {
@@ -3367,7 +3428,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
return NULL;
}
-int Tree::get_column_at_pos(const Point2 &p_pos) const {
+int Tree::get_column_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3393,7 +3454,7 @@ int Tree::get_column_at_pos(const Point2 &p_pos) const {
return -1;
}
-int Tree::get_drop_section_at_pos(const Point2 &p_pos) const {
+int Tree::get_drop_section_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3418,7 +3479,7 @@ int Tree::get_drop_section_at_pos(const Point2 &p_pos) const {
return -100;
}
-TreeItem *Tree::get_item_at_pos(const Point2 &p_pos) const {
+TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3591,8 +3652,9 @@ void Tree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column);
ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect);
ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos"), &Tree::get_item_at_pos);
- ClassDB::bind_method(D_METHOD("get_column_at_pos", "pos"), &Tree::get_column_at_pos);
+ ClassDB::bind_method(D_METHOD("get_item_at_position", "position"), &Tree::get_item_at_position);
+ ClassDB::bind_method(D_METHOD("get_column_at_position", "position"), &Tree::get_column_at_position);
+ ClassDB::bind_method(D_METHOD("get_drop_section_at_position", "position"), &Tree::get_drop_section_at_position);
ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible);
@@ -3618,8 +3680,8 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_selected"));
ADD_SIGNAL(MethodInfo("cell_selected"));
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
- ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos")));
- ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos")));
+ ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
+ ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("item_rmb_edited"));
ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 06d6d3ad5a..e723fa227b 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -145,6 +145,7 @@ private:
bool collapsed; // wont show childs
bool disable_folding;
+ int custom_min_height;
TreeItem *parent; // parent item
TreeItem *next; // next in list
@@ -230,6 +231,9 @@ public:
void set_collapsed(bool p_collapsed);
bool is_collapsed();
+ void set_custom_minimum_height(int p_height);
+ int get_custom_minimum_height() const;
+
TreeItem *get_prev();
TreeItem *get_next();
TreeItem *get_parent();
@@ -521,9 +525,9 @@ protected:
public:
virtual String get_tooltip(const Point2 &p_pos) const;
- TreeItem *get_item_at_pos(const Point2 &p_pos) const;
- int get_column_at_pos(const Point2 &p_pos) const;
- int get_drop_section_at_pos(const Point2 &p_pos) const;
+ TreeItem *get_item_at_position(const Point2 &p_pos) const;
+ int get_column_at_position(const Point2 &p_pos) const;
+ int get_drop_section_at_position(const Point2 &p_pos) const;
void clear();
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index a92155cc4f..e08d050ca7 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -278,11 +278,11 @@ String VideoPlayer::get_stream_name() const {
return stream->get_name();
};
-float VideoPlayer::get_stream_pos() const {
+float VideoPlayer::get_stream_position() const {
if (playback.is_null())
return 0;
- return playback->get_pos();
+ return playback->get_position();
};
Ref<Texture> VideoPlayer::get_video_texture() {
@@ -327,7 +327,7 @@ void VideoPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name);
- ClassDB::bind_method(D_METHOD("get_stream_pos"), &VideoPlayer::get_stream_pos);
+ ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position);
ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay);
ClassDB::bind_method(D_METHOD("has_autoplay"), &VideoPlayer::has_autoplay);
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index b78f3aabe7..bea10907bb 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -92,7 +92,7 @@ public:
float get_volume_db() const;
String get_stream_name() const;
- float get_stream_pos() const;
+ float get_stream_position() const;
void set_autoplay(bool p_enable);
bool has_autoplay() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index c3d9d97c5a..319f123da9 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -50,7 +50,6 @@ void Node::_notification(int p_notification) {
Variant time = get_process_delta_time();
const Variant *ptr[1] = { &time };
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_process, ptr, 1);
}
} break;
@@ -60,7 +59,6 @@ void Node::_notification(int p_notification) {
Variant time = get_fixed_process_delta_time();
const Variant *ptr[1] = { &time };
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_fixed_process, ptr, 1);
}
@@ -134,7 +132,6 @@ void Node::_notification(int p_notification) {
set_fixed_process(true);
}
- Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
}
//emit_signal(SceneStringNames::get_singleton()->enter_tree);
@@ -209,7 +206,6 @@ void Node::_propagate_enter_tree() {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, NULL, 0);
}
@@ -273,7 +269,6 @@ void Node::_propagate_exit_tree() {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0);
}
emit_signal(SceneStringNames::get_singleton()->tree_exited);
@@ -2117,7 +2112,15 @@ Node *Node::_duplicate(int p_flags) const {
if (!(p_flags & DUPLICATE_SCRIPTS) && name == "script/script")
continue;
- node->set(name, get(name));
+ Variant value = get(name);
+ // Duplicate dictionaries and arrays, mainly needed for __meta__
+ if (value.get_type() == Variant::DICTIONARY) {
+ value = Dictionary(value).copy();
+ } else if (value.get_type() == Variant::ARRAY) {
+ value = Array(value).duplicate();
+ }
+
+ node->set(name, value);
}
node->set_name(get_name());
@@ -2199,7 +2202,16 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
String name = E->get().name;
- node->set(name, get(name));
+
+ Variant value = get(name);
+ // Duplicate dictionaries and arrays, mainly needed for __meta__
+ if (value.get_type() == Variant::DICTIONARY) {
+ value = Dictionary(value).copy();
+ } else if (value.get_type() == Variant::ARRAY) {
+ value = Array(value).duplicate();
+ }
+
+ node->set(name, value);
}
node->set_name(get_name());
@@ -2657,7 +2669,7 @@ void Node::_bind_methods() {
GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE);
ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"));
- ClassDB::bind_method(D_METHOD("_add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name);
ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name);
@@ -2681,7 +2693,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_to_group", "group", "persistent"), &Node::add_to_group, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_from_group", "group"), &Node::remove_from_group);
ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group);
- ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_pos"), &Node::move_child);
+ ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_position"), &Node::move_child);
ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups);
ClassDB::bind_method(D_METHOD("raise"), &Node::raise);
ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index a71b491bae..4f62d88934 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -870,7 +870,6 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
if (!n->can_process())
continue;
- Variant::CallError ce;
n->call_multilevel(p_method, (const Variant **)v, 1);
//ERR_FAIL_COND(node_count != g.nodes.size());
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 434d594bbb..e19f2031dd 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1339,7 +1339,7 @@ Vector2 Viewport::get_mouse_position() const {
void Viewport::warp_mouse(const Vector2 &p_pos) {
Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_pos);
- Input::get_singleton()->warp_mouse_pos(gpos);
+ Input::get_singleton()->warp_mouse_position(gpos);
}
void Viewport::_gui_sort_subwindows() {
@@ -2580,7 +2580,7 @@ int Viewport::get_render_info(RenderInfo p_info) {
void Viewport::set_snap_controls_to_pixels(bool p_enable) {
- snap_controls_to_pixels=p_enable;
+ snap_controls_to_pixels = p_enable;
}
bool Viewport::is_snap_controls_to_pixels_enabled() const {
@@ -2588,7 +2588,6 @@ bool Viewport::is_snap_controls_to_pixels_enabled() const {
return snap_controls_to_pixels;
}
-
void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &Viewport::set_use_arvr);
@@ -2674,7 +2673,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect);
ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Viewport::warp_mouse);
ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack);
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
@@ -2763,6 +2762,15 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(MSAA_4X);
BIND_ENUM_CONSTANT(MSAA_8X);
BIND_ENUM_CONSTANT(MSAA_16X);
+
+ BIND_ENUM_CONSTANT(USAGE_2D);
+ BIND_ENUM_CONSTANT(USAGE_2D_NO_SAMPLING);
+ BIND_ENUM_CONSTANT(USAGE_3D);
+ BIND_ENUM_CONSTANT(USAGE_3D_NO_EFFECTS);
+
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
}
Viewport::Viewport() {
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 9ed3734a36..b9dfbd6bb0 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -430,6 +430,7 @@ void register_scene_types() {
ClassDB::register_class<StaticBody2D>();
ClassDB::register_class<RigidBody2D>();
ClassDB::register_class<KinematicBody2D>();
+ ClassDB::register_class<KinematicCollision2D>();
ClassDB::register_class<Area2D>();
ClassDB::register_class<CollisionShape2D>();
ClassDB::register_class<CollisionPolygon2D>();
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index eae95d9247..8dcc8d4e14 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -613,7 +613,7 @@ int Animation::transform_track_insert_key(int p_track, float p_time, const Vecto
return ret;
}
-void Animation::track_remove_key_at_pos(int p_track, float p_pos) {
+void Animation::track_remove_key_at_position(int p_track, float p_pos) {
int idx = track_find_key(p_track, p_pos, true);
ERR_FAIL_COND(idx < 0);
@@ -707,12 +707,12 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key
Dictionary d = p_key;
Vector3 loc;
- if (d.has("loc"))
- loc = d["loc"];
+ if (d.has("location"))
+ loc = d["location"];
Quat rot;
- if (d.has("rot"))
- rot = d["rot"];
+ if (d.has("rotation"))
+ rot = d["rotation"];
Vector3 scale;
if (d.has("scale"))
@@ -799,8 +799,8 @@ Variant Animation::track_get_key_value(int p_track, int p_key_idx) const {
ERR_FAIL_INDEX_V(p_key_idx, tt->transforms.size(), Variant());
Dictionary d;
- d["loc"] = tt->transforms[p_key_idx].value.loc;
- d["rot"] = tt->transforms[p_key_idx].value.rot;
+ d["location"] = tt->transforms[p_key_idx].value.loc;
+ d["rotation"] = tt->transforms[p_key_idx].value.rot;
d["scale"] = tt->transforms[p_key_idx].value.scale;
return d;
@@ -903,10 +903,10 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
TransformTrack *tt = static_cast<TransformTrack *>(t);
ERR_FAIL_INDEX(p_key_idx, tt->transforms.size());
Dictionary d = p_value;
- if (d.has("loc"))
- tt->transforms[p_key_idx].value.loc = d["loc"];
- if (d.has("rot"))
- tt->transforms[p_key_idx].value.rot = d["rot"];
+ if (d.has("location"))
+ tt->transforms[p_key_idx].value.loc = d["location"];
+ if (d.has("rotation"))
+ tt->transforms[p_key_idx].value.rot = d["rotation"];
if (d.has("scale"))
tt->transforms[p_key_idx].value.scale = d["scale"];
@@ -1590,7 +1590,7 @@ float Animation::get_step() const {
void Animation::_bind_methods() {
- ClassDB::bind_method(D_METHOD("add_track", "type", "at_pos"), &Animation::add_track, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_track", "type", "at_position"), &Animation::add_track, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("remove_track", "idx"), &Animation::remove_track);
ClassDB::bind_method(D_METHOD("get_track_count"), &Animation::get_track_count);
ClassDB::bind_method(D_METHOD("track_get_type", "idx"), &Animation::track_get_type);
@@ -1604,10 +1604,10 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("track_set_imported", "idx", "imported"), &Animation::track_set_imported);
ClassDB::bind_method(D_METHOD("track_is_imported", "idx"), &Animation::track_is_imported);
- ClassDB::bind_method(D_METHOD("transform_track_insert_key", "idx", "time", "loc", "rot", "scale"), &Animation::transform_track_insert_key);
+ ClassDB::bind_method(D_METHOD("transform_track_insert_key", "idx", "time", "location", "rotation", "scale"), &Animation::transform_track_insert_key);
ClassDB::bind_method(D_METHOD("track_insert_key", "idx", "time", "key", "transition"), &Animation::track_insert_key, DEFVAL(1));
ClassDB::bind_method(D_METHOD("track_remove_key", "idx", "key_idx"), &Animation::track_remove_key);
- ClassDB::bind_method(D_METHOD("track_remove_key_at_pos", "idx", "pos"), &Animation::track_remove_key_at_pos);
+ ClassDB::bind_method(D_METHOD("track_remove_key_at_position", "idx", "position"), &Animation::track_remove_key_at_position);
ClassDB::bind_method(D_METHOD("track_set_key_value", "idx", "key", "value"), &Animation::track_set_key_value);
ClassDB::bind_method(D_METHOD("track_set_key_transition", "idx", "key_idx", "transition"), &Animation::track_set_key_transition);
ClassDB::bind_method(D_METHOD("track_get_key_transition", "idx", "key_idx"), &Animation::track_get_key_transition);
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index e653f6b124..6235e161a3 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -245,7 +245,7 @@ public:
void track_set_key_value(int p_track, int p_key_idx, const Variant &p_value);
int track_find_key(int p_track, float p_time, bool p_exact = false) const;
void track_remove_key(int p_track, int p_idx);
- void track_remove_key_at_pos(int p_track, float p_pos);
+ void track_remove_key_at_position(int p_track, float p_pos);
int track_get_key_count(int p_track) const;
Variant track_get_key_value(int p_track, int p_key_idx) const;
float track_get_key_time(int p_track, int p_key_idx) const;
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 659322897a..e47cb971ae 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -61,7 +61,7 @@ int AudioStreamPlaybackSample::get_loop_count() const {
return 0;
}
-float AudioStreamPlaybackSample::get_pos() const {
+float AudioStreamPlaybackSample::get_position() const {
return float(offset >> MIX_FRAC_BITS) / base->mix_rate;
}
@@ -536,6 +536,14 @@ void AudioStreamSample::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo");
ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
+
+ BIND_ENUM_CONSTANT(FORMAT_8_BITS);
+ BIND_ENUM_CONSTANT(FORMAT_16_BITS);
+ BIND_ENUM_CONSTANT(FORMAT_IMA_ADPCM);
+
+ BIND_ENUM_CONSTANT(LOOP_DISABLED);
+ BIND_ENUM_CONSTANT(LOOP_FORWARD);
+ BIND_ENUM_CONSTANT(LOOP_PING_PONG);
}
AudioStreamSample::AudioStreamSample() {
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index 6cb255fedf..46fa78ddcf 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -71,7 +71,7 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index be994e3b33..029a9ef0e8 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -172,8 +172,8 @@ void BitMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create);
ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image"), &BitMap::create_from_image_alpha);
- ClassDB::bind_method(D_METHOD("set_bit", "pos", "bit"), &BitMap::set_bit);
- ClassDB::bind_method(D_METHOD("get_bit", "pos"), &BitMap::get_bit);
+ ClassDB::bind_method(D_METHOD("set_bit", "position", "bit"), &BitMap::set_bit);
+ ClassDB::bind_method(D_METHOD("get_bit", "position"), &BitMap::get_bit);
ClassDB::bind_method(D_METHOD("set_bit_rect", "p_rect", "bit"), &BitMap::set_bit_rect);
ClassDB::bind_method(D_METHOD("get_true_bit_count"), &BitMap::get_true_bit_count);
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 7fbaa1f73c..daa8fc1874 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -84,15 +84,6 @@ int Curve::add_point(Vector2 p_pos, real_t left_tangent, real_t right_tangent, T
int i = get_index(p_pos.x);
- int nearest_index = i;
- if (i + 1 < _points.size()) {
- real_t diff0 = p_pos.x - _points[i].pos.x;
- real_t diff1 = _points[i + 1].pos.x - p_pos.x;
-
- if (diff1 < diff0)
- nearest_index = i + 1;
- }
-
if (i == 0 && p_pos.x < _points[0].pos.x) {
// Insert before anything else
_points.insert(0, Point(p_pos, left_tangent, right_tangent, left_mode, right_mode));
@@ -250,7 +241,7 @@ int Curve::set_point_offset(int p_index, float offset) {
return i;
}
-Vector2 Curve::get_point_pos(int p_index) const {
+Vector2 Curve::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, _points.size(), Vector2(0, 0));
return _points[p_index].pos;
}
@@ -331,18 +322,19 @@ real_t Curve::interpolate_local_nocheck(int index, real_t local_offset) const {
const Point a = _points[index];
const Point b = _points[index + 1];
- // Cubic bezier
-
- // ac-----bc
- // / \
- // / \ Here with a.right_tangent > 0
- // / \ and b.left_tangent < 0
- // / \
- // a b
- //
- // |-d1--|-d2--|-d3--|
- //
- // d1 == d2 == d3 == d / 3
+ /* Cubic bezier
+ *
+ * ac-----bc
+ * / \
+ * / \ Here with a.right_tangent > 0
+ * / \ and b.left_tangent < 0
+ * / \
+ * a b
+ *
+ * |-d1--|-d2--|-d3--|
+ *
+ * d1 == d2 == d3 == d / 3
+ */
// Control points are chosen at equal distances
real_t d = b.pos.x - a.pos.x;
@@ -488,11 +480,10 @@ real_t Curve::interpolate_baked(real_t offset) {
void Curve::_bind_methods() {
- ClassDB::bind_method(D_METHOD("add_point", "pos", "left_tangent", "right_tangent", "left_mode", "right_mode"),
- &Curve::add_point, DEFVAL(0), DEFVAL(0), DEFVAL(TANGENT_FREE), DEFVAL(TANGENT_FREE));
+ ClassDB::bind_method(D_METHOD("add_point", "position", "left_tangent", "right_tangent", "left_mode", "right_mode"), &Curve::add_point, DEFVAL(0), DEFVAL(0), DEFVAL(TANGENT_FREE), DEFVAL(TANGENT_FREE));
ClassDB::bind_method(D_METHOD("remove_point", "index"), &Curve::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points);
- ClassDB::bind_method(D_METHOD("get_point_pos", "index"), &Curve::get_point_pos);
+ ClassDB::bind_method(D_METHOD("get_point_position", "index"), &Curve::get_point_position);
ClassDB::bind_method(D_METHOD("set_point_value", "index", "y"), &Curve::set_point_value);
ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_value);
ClassDB::bind_method(D_METHOD("interpolate", "offset"), &Curve::interpolate);
@@ -522,6 +513,10 @@ void Curve::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
ADD_SIGNAL(MethodInfo(SIGNAL_RANGE_CHANGED));
+
+ BIND_ENUM_CONSTANT(TANGENT_FREE);
+ BIND_ENUM_CONSTANT(TANGENT_LINEAR);
+ BIND_ENUM_CONSTANT(TANGENT_MODE_COUNT);
}
int Curve2D::get_point_count() const {
@@ -543,7 +538,7 @@ void Curve2D::add_point(const Vector2 &p_pos, const Vector2 &p_in, const Vector2
emit_signal(CoreStringNames::get_singleton()->changed);
}
-void Curve2D::set_point_pos(int p_index, const Vector2 &p_pos) {
+void Curve2D::set_point_position(int p_index, const Vector2 &p_pos) {
ERR_FAIL_INDEX(p_index, points.size());
@@ -551,7 +546,7 @@ void Curve2D::set_point_pos(int p_index, const Vector2 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-Vector2 Curve2D::get_point_pos(int p_index) const {
+Vector2 Curve2D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector2());
return points[p_index].pos;
@@ -895,12 +890,12 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const
void Curve2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Curve2D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos", "in", "out", "atpos"), &Curve2D::add_point, DEFVAL(Vector2()), DEFVAL(Vector2()), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("set_point_pos", "idx", "pos"), &Curve2D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "idx"), &Curve2D::get_point_pos);
- ClassDB::bind_method(D_METHOD("set_point_in", "idx", "pos"), &Curve2D::set_point_in);
+ ClassDB::bind_method(D_METHOD("add_point", "position", "in", "out", "at_position"), &Curve2D::add_point, DEFVAL(Vector2()), DEFVAL(Vector2()), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_point_position", "idx", "position"), &Curve2D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "idx"), &Curve2D::get_point_position);
+ ClassDB::bind_method(D_METHOD("set_point_in", "idx", "position"), &Curve2D::set_point_in);
ClassDB::bind_method(D_METHOD("get_point_in", "idx"), &Curve2D::get_point_in);
- ClassDB::bind_method(D_METHOD("set_point_out", "idx", "pos"), &Curve2D::set_point_out);
+ ClassDB::bind_method(D_METHOD("set_point_out", "idx", "position"), &Curve2D::set_point_out);
ClassDB::bind_method(D_METHOD("get_point_out", "idx"), &Curve2D::get_point_out);
ClassDB::bind_method(D_METHOD("remove_point", "idx"), &Curve2D::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve2D::clear_points);
@@ -920,9 +915,6 @@ void Curve2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
- /*ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_out"), "set_points_out","get_points_out");
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_pos"), "set_points_pos","get_points_pos");
-*/
}
Curve2D::Curve2D() {
@@ -959,7 +951,7 @@ void Curve3D::add_point(const Vector3 &p_pos, const Vector3 &p_in, const Vector3
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-void Curve3D::set_point_pos(int p_index, const Vector3 &p_pos) {
+void Curve3D::set_point_position(int p_index, const Vector3 &p_pos) {
ERR_FAIL_INDEX(p_index, points.size());
@@ -967,7 +959,7 @@ void Curve3D::set_point_pos(int p_index, const Vector3 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-Vector3 Curve3D::get_point_pos(int p_index) const {
+Vector3 Curve3D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector3());
return points[p_index].pos;
@@ -1390,14 +1382,14 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const
void Curve3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Curve3D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos", "in", "out", "atpos"), &Curve3D::add_point, DEFVAL(Vector3()), DEFVAL(Vector3()), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("set_point_pos", "idx", "pos"), &Curve3D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "idx"), &Curve3D::get_point_pos);
+ ClassDB::bind_method(D_METHOD("add_point", "position", "in", "out", "at_position"), &Curve3D::add_point, DEFVAL(Vector3()), DEFVAL(Vector3()), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_point_position", "idx", "position"), &Curve3D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "idx"), &Curve3D::get_point_position);
ClassDB::bind_method(D_METHOD("set_point_tilt", "idx", "tilt"), &Curve3D::set_point_tilt);
ClassDB::bind_method(D_METHOD("get_point_tilt", "idx"), &Curve3D::get_point_tilt);
- ClassDB::bind_method(D_METHOD("set_point_in", "idx", "pos"), &Curve3D::set_point_in);
+ ClassDB::bind_method(D_METHOD("set_point_in", "idx", "position"), &Curve3D::set_point_in);
ClassDB::bind_method(D_METHOD("get_point_in", "idx"), &Curve3D::get_point_in);
- ClassDB::bind_method(D_METHOD("set_point_out", "idx", "pos"), &Curve3D::set_point_out);
+ ClassDB::bind_method(D_METHOD("set_point_out", "idx", "position"), &Curve3D::set_point_out);
ClassDB::bind_method(D_METHOD("get_point_out", "idx"), &Curve3D::get_point_out);
ClassDB::bind_method(D_METHOD("remove_point", "idx"), &Curve3D::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve3D::clear_points);
@@ -1418,9 +1410,6 @@ void Curve3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
- /*ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_out"), "set_points_out","get_points_out");
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_pos"), "set_points_pos","get_points_pos");
-*/
}
Curve3D::Curve3D() {
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 3071aee5de..e7d47f4056 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -92,7 +92,7 @@ public:
void set_point_value(int p_index, real_t pos);
int set_point_offset(int p_index, float offset);
- Vector2 get_point_pos(int p_index) const;
+ Vector2 get_point_position(int p_index) const;
Point get_point(int p_index) const;
@@ -180,8 +180,8 @@ protected:
public:
int get_point_count() const;
void add_point(const Vector2 &p_pos, const Vector2 &p_in = Vector2(), const Vector2 &p_out = Vector2(), int p_atpos = -1);
- void set_point_pos(int p_index, const Vector2 &p_pos);
- Vector2 get_point_pos(int p_index) const;
+ void set_point_position(int p_index, const Vector2 &p_pos);
+ Vector2 get_point_position(int p_index) const;
void set_point_in(int p_index, const Vector2 &p_in);
Vector2 get_point_in(int p_index) const;
void set_point_out(int p_index, const Vector2 &p_out);
@@ -245,8 +245,8 @@ protected:
public:
int get_point_count() const;
void add_point(const Vector3 &p_pos, const Vector3 &p_in = Vector3(), const Vector3 &p_out = Vector3(), int p_atpos = -1);
- void set_point_pos(int p_index, const Vector3 &p_pos);
- Vector3 get_point_pos(int p_index) const;
+ void set_point_position(int p_index, const Vector3 &p_pos);
+ Vector3 get_point_position(int p_index) const;
void set_point_tilt(int p_index, float p_tilt);
float get_point_tilt(int p_index) const;
void set_point_in(int p_index, const Vector3 &p_in);
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index fdea5960e5..2fbd5ebdd3 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -794,7 +794,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// RichTextLabel
theme->set_stylebox("focus", "RichTextLabel", focus);
- theme->set_stylebox("normal", "RichTextLabel", make_stylebox(tree_bg_png, 3, 3, 3, 3));
+ theme->set_stylebox("normal", "RichTextLabel", make_empty_stylebox(0, 0, 0, 0));
theme->set_font("normal_font", "RichTextLabel", default_font);
theme->set_font("bold_font", "RichTextLabel", default_font);
@@ -879,7 +879,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png));
theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png));
theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png));
- theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_png));
+ theme->set_icon("SnapGrid", "GraphEdit", make_icon(icon_snap_grid_png));
theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5));
theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05));
theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2));
diff --git a/scene/resources/default_theme/icon_snap.png b/scene/resources/default_theme/icon_snap_grid.png
index 93194d34e7..44db9bdfdc 100644
--- a/scene/resources/default_theme/icon_snap.png
+++ b/scene/resources/default_theme/icon_snap_grid.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index bed4bdb760..6643b4ccc1 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -182,8 +182,8 @@ static const unsigned char icon_reload_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x1, 0x59, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xcd, 0x92, 0x31, 0x4b, 0x3, 0x31, 0x18, 0x86, 0x9f, 0x5c, 0xe, 0xec, 0x20, 0x76, 0x70, 0x39, 0xd0, 0xe3, 0xba, 0x74, 0x51, 0x41, 0xdd, 0xfc, 0x7, 0xba, 0xb8, 0x8, 0x52, 0xec, 0x2e, 0x4e, 0x3a, 0x88, 0x3f, 0xa3, 0xa3, 0x53, 0x7, 0x47, 0x67, 0x41, 0x17, 0xdd, 0x9c, 0x5c, 0x3b, 0xd8, 0x82, 0x64, 0x68, 0xca, 0xd5, 0x55, 0x11, 0x3c, 0x1a, 0x87, 0x24, 0x2e, 0xd7, 0x72, 0x9e, 0x9e, 0xab, 0xbe, 0xd3, 0xc7, 0x1b, 0x9e, 0x37, 0xf9, 0xbe, 0x7c, 0xf0, 0xd7, 0x12, 0x3f, 0x99, 0x4a, 0xa9, 0xb9, 0x30, 0xc, 0x8f, 0x84, 0x10, 0x7, 0xc0, 0x5a, 0x6e, 0x3f, 0x3a, 0xe7, 0x2e, 0xad, 0xb5, 0xdd, 0x66, 0xb3, 0xf9, 0x51, 0x19, 0x90, 0xa6, 0xe9, 0x92, 0xb5, 0xf6, 0x6, 0x58, 0xaf, 0xb8, 0xb4, 0x27, 0xa5, 0xdc, 0x8d, 0xe3, 0xf8, 0x19, 0x20, 0x28, 0xdf, 0x5c, 0x80, 0x53, 0x60, 0xdf, 0x18, 0x53, 0x37, 0xc6, 0xd4, 0xbd, 0xf7, 0x7b, 0xc0, 0x13, 0xb0, 0x61, 0xad, 0xbd, 0x56, 0x4a, 0xcd, 0x1, 0x84, 0xc5, 0x80, 0x30, 0xc, 0x8f, 0xa6, 0xb0, 0x94, 0x72, 0x33, 0x8e, 0xe3, 0x97, 0xc2, 0xf1, 0xd5, 0x68, 0x34, 0xba, 0xf7, 0xde, 0xf7, 0x80, 0xd, 0x29, 0xe5, 0x21, 0x70, 0xfe, 0xe5, 0x5, 0x42, 0x88, 0x76, 0x5e, 0x9e, 0x96, 0x60, 0x0, 0x92, 0x24, 0x79, 0x75, 0xce, 0x9d, 0x1, 0x4, 0x41, 0xd0, 0xfe, 0xd6, 0x2, 0xb0, 0x2, 0x60, 0x8c, 0xb9, 0xab, 0xe8, 0x1f, 0x6b, 0xed, 0x6d, 0x5e, 0xae, 0xce, 0x2, 0xb4, 0xd6, 0x17, 0x5a, 0x6b, 0x7, 0xcc, 0x3, 0xd4, 0x6a, 0xb5, 0x37, 0xad, 0xf5, 0xc5, 0x4f, 0x1, 0x41, 0x10, 0x7c, 0x19, 0x7c, 0x90, 0x3, 0xc7, 0xc0, 0xa0, 0xe0, 0xf, 0x72, 0xef, 0x9b, 0x84, 0x10, 0xdb, 0x79, 0xd9, 0x9f, 0x5, 0x44, 0x51, 0x94, 0x9, 0x21, 0x5a, 0x40, 0x6, 0x64, 0x42, 0x88, 0x56, 0x14, 0x45, 0x59, 0x19, 0x1e, 0x8f, 0xc7, 0x8b, 0x52, 0xca, 0xe, 0x80, 0x73, 0xee, 0x12, 0xa, 0xbf, 0x90, 0x24, 0x49, 0x7f, 0x38, 0x1c, 0x1e, 0x3, 0x34, 0x1a, 0x8d, 0x7e, 0x11, 0x54, 0x4a, 0x2d, 0x48, 0x29, 0x77, 0xac, 0xb5, 0x1d, 0xef, 0xfd, 0x32, 0xd0, 0x9b, 0x4c, 0x26, 0x5d, 0xa8, 0xd8, 0xc4, 0xb2, 0xf2, 0xf9, 0x4c, 0x55, 0xbd, 0x48, 0xbf, 0xe8, 0x1d, 0x78, 0x70, 0xce, 0x9d, 0x64, 0x59, 0xb6, 0x35, 0x85, 0xff, 0x87, 0x3e, 0x1, 0x53, 0x7, 0x87, 0x11, 0xd3, 0x3a, 0x9b, 0x9e, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
-static const unsigned char icon_snap_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0xc2, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x90, 0xbd, 0xa, 0xc2, 0x30, 0x14, 0x85, 0xbf, 0x5b, 0x5c, 0x23, 0xe8, 0x6c, 0x9f, 0xc1, 0xb7, 0xd0, 0x47, 0xd1, 0x47, 0x70, 0x48, 0xa1, 0x43, 0x57, 0xe9, 0xd3, 0x88, 0x93, 0xef, 0xe0, 0xea, 0x5c, 0x9d, 0x1d, 0xb2, 0x96, 0xc6, 0xa1, 0x9, 0xd4, 0xd8, 0xd8, 0x4a, 0xfd, 0x20, 0x10, 0xee, 0xcf, 0xe1, 0xdc, 0x3, 0x1d, 0x8c, 0x31, 0xd6, 0x18, 0x63, 0x9, 0x88, 0xd5, 0x1, 0x92, 0xbe, 0xe2, 0x2f, 0x4c, 0x16, 0x90, 0x98, 0xb5, 0x21, 0x94, 0x52, 0xf2, 0x17, 0x7, 0x6f, 0x7c, 0xb, 0x2b, 0xc6, 0x64, 0x7, 0xb3, 0xa1, 0x1, 0x5b, 0x14, 0x29, 0x50, 0x2, 0x1b, 0x0, 0x44, 0x2e, 0x34, 0xcd, 0x41, 0xb2, 0xec, 0x6, 0x20, 0xdd, 0x61, 0x6f, 0xdf, 0x7, 0xe4, 0x96, 0xaf, 0xc0, 0x32, 0xd0, 0x7d, 0x2, 0x6b, 0xd1, 0xba, 0x4a, 0xfc, 0xdd, 0x91, 0xdb, 0x4b, 0xb7, 0x7c, 0x2, 0x56, 0xd4, 0x75, 0xa, 0x9c, 0x81, 0x5, 0x70, 0x84, 0xe1, 0xc, 0x5a, 0xdb, 0x75, 0xbd, 0x17, 0xad, 0x1f, 0x92, 0xe7, 0x77, 0x60, 0xe7, 0x7a, 0x5b, 0x80, 0x44, 0x29, 0x25, 0xfe, 0xf5, 0x8, 0x28, 0x0, 0xb7, 0xd8, 0x46, 0xa0, 0x75, 0xe5, 0xbe, 0xf3, 0x31, 0xe, 0x7e, 0x23, 0xcc, 0xc2, 0x3a, 0xc2, 0xb9, 0x58, 0xfd, 0x83, 0xc9, 0x2, 0x63, 0x78, 0x1, 0x4a, 0x50, 0x70, 0x86, 0xcc, 0x86, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+static const unsigned char icon_snap_grid_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x4, 0x73, 0x42, 0x49, 0x54, 0x8, 0x8, 0x8, 0x8, 0x7c, 0x8, 0x64, 0x88, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xe, 0xc4, 0x0, 0x0, 0xe, 0xc4, 0x1, 0x95, 0x2b, 0xe, 0x1b, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x0, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x0, 0x0, 0x0, 0xc2, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x90, 0xbd, 0xa, 0xc2, 0x30, 0x14, 0x85, 0xbf, 0x5b, 0x5c, 0x23, 0xe8, 0x6c, 0x9f, 0xc1, 0xb7, 0xd0, 0x47, 0xd1, 0x47, 0x70, 0x48, 0xa1, 0x43, 0x57, 0xe9, 0xd3, 0x88, 0x93, 0xef, 0xe0, 0xea, 0x5c, 0x9d, 0x1d, 0xb2, 0x96, 0xc6, 0xa1, 0x9, 0xd4, 0xd8, 0xd8, 0x4a, 0xfd, 0x20, 0x10, 0xee, 0xcf, 0xe1, 0xdc, 0x3, 0x1d, 0x8c, 0x31, 0xd6, 0x18, 0x63, 0x9, 0x88, 0xd5, 0x1, 0x92, 0xbe, 0xe2, 0x2f, 0x4c, 0x16, 0x90, 0x98, 0xb5, 0x21, 0x94, 0x52, 0xf2, 0x17, 0x7, 0x6f, 0x7c, 0xb, 0x2b, 0xc6, 0x64, 0x7, 0xb3, 0xa1, 0x1, 0x5b, 0x14, 0x29, 0x50, 0x2, 0x1b, 0x0, 0x44, 0x2e, 0x34, 0xcd, 0x41, 0xb2, 0xec, 0x6, 0x20, 0xdd, 0x61, 0x6f, 0xdf, 0x7, 0xe4, 0x96, 0xaf, 0xc0, 0x32, 0xd0, 0x7d, 0x2, 0x6b, 0xd1, 0xba, 0x4a, 0xfc, 0xdd, 0x91, 0xdb, 0x4b, 0xb7, 0x7c, 0x2, 0x56, 0xd4, 0x75, 0xa, 0x9c, 0x81, 0x5, 0x70, 0x84, 0xe1, 0xc, 0x5a, 0xdb, 0x75, 0xbd, 0x17, 0xad, 0x1f, 0x92, 0xe7, 0x77, 0x60, 0xe7, 0x7a, 0x5b, 0x80, 0x44, 0x29, 0x25, 0xfe, 0xf5, 0x8, 0x28, 0x0, 0xb7, 0xd8, 0x46, 0xa0, 0x75, 0xe5, 0xbe, 0xf3, 0x31, 0xe, 0x7e, 0x23, 0xcc, 0xc2, 0x3a, 0xc2, 0xb9, 0x58, 0xfd, 0x83, 0xc9, 0x2, 0x63, 0x78, 0x1, 0x4a, 0x50, 0x70, 0x86, 0xcc, 0x86, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned char icon_stop_png[] = {
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 82739b58a0..b2d87c8f35 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -397,7 +397,7 @@ unsigned long DynamicFontAtSize::_ft_stream_io(FT_Stream stream, unsigned long o
FileAccess *f = (FileAccess *)stream->descriptor.pointer;
- if (f->get_pos() != offset) {
+ if (f->get_position() != offset) {
f->seek(offset);
}
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index ea75748b3d..2b44ea4554 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -80,13 +80,13 @@ void Font::update_changes() {
void Font::_bind_methods() {
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "string", "modulate", "clip_w"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "string", "modulate", "clip_w"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_ascent"), &Font::get_ascent);
ClassDB::bind_method(D_METHOD("get_descent"), &Font::get_descent);
ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height);
ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint);
ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size);
- ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "pos", "char", "next", "modulate"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index a187692bcb..abe9a00c3f 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -67,8 +67,8 @@ RID Material::get_rid() const {
}
void Material::_validate_property(PropertyInfo &property) const {
- if (!_can_do_next_pass() && property.name=="next_pass") {
- property.usage=0;
+ if (!_can_do_next_pass() && property.name == "next_pass") {
+ property.usage = 0;
}
}
@@ -80,7 +80,7 @@ void Material::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_render_priority", "priority"), &Material::set_render_priority);
ClassDB::bind_method(D_METHOD("get_render_priority"), &Material::get_render_priority);
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "render_priority", PROPERTY_HINT_RANGE, itos(RENDER_PRIORITY_MIN) + "," + itos(RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RENDER_PRIORITY_MIN) + "," + itos(RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass");
BIND_CONSTANT(RENDER_PRIORITY_MAX);
@@ -212,7 +212,7 @@ void ShaderMaterial::get_argument_options(const StringName &p_function, int p_id
bool ShaderMaterial::_can_do_next_pass() const {
- return shader.is_valid() && shader->get_mode()==Shader::MODE_SPATIAL;
+ return shader.is_valid() && shader->get_mode() == Shader::MODE_SPATIAL;
}
ShaderMaterial::ShaderMaterial() {
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index aa7827a61a..db5d87d703 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -422,6 +422,46 @@ void Mesh::_bind_methods() {
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES);
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP);
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_FAN);
+
+ BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
+ BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
+
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_TANGENT);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_COLOR);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV2);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_BONES);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_WEIGHTS);
+ BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX);
+
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_BASE);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_VERTEX);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_NORMAL);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TANGENT);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_COLOR);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TEX_UV);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_TEX_UV2);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_BONES);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_WEIGHTS);
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_INDEX);
+
+ BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_2D_VERTICES);
+ BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_16_BIT_BONES);
+
+ BIND_ENUM_CONSTANT(ARRAY_COMPRESS_DEFAULT);
+
+ BIND_ENUM_CONSTANT(ARRAY_VERTEX);
+ BIND_ENUM_CONSTANT(ARRAY_NORMAL);
+ BIND_ENUM_CONSTANT(ARRAY_TANGENT);
+ BIND_ENUM_CONSTANT(ARRAY_COLOR);
+ BIND_ENUM_CONSTANT(ARRAY_TEX_UV);
+ BIND_ENUM_CONSTANT(ARRAY_TEX_UV2);
+ BIND_ENUM_CONSTANT(ARRAY_BONES);
+ BIND_ENUM_CONSTANT(ARRAY_WEIGHTS);
+ BIND_ENUM_CONSTANT(ARRAY_INDEX);
+ BIND_ENUM_CONSTANT(ARRAY_MAX);
}
Mesh::Mesh() {
@@ -761,7 +801,7 @@ Array ArrayMesh::surface_get_arrays(int p_surface) const {
Array ArrayMesh::surface_get_blend_shape_arrays(int p_surface) const {
ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Array());
- return Array();
+ return VisualServer::get_singleton()->mesh_surface_get_blend_shape_arrays(mesh, p_surface);
}
int ArrayMesh::get_surface_count() const {
@@ -1010,6 +1050,8 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &ArrayMesh::surface_get_material);
ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name);
ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name);
+ ClassDB::bind_method(D_METHOD("surface_get_arrays", "surf_idx"), &ArrayMesh::surface_get_arrays);
+ ClassDB::bind_method(D_METHOD("surface_get_blend_shape_arrays", "surf_idx"), &ArrayMesh::surface_get_blend_shape_arrays);
ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape);
ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape);
ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline);
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 53c6eb2d89..f4edb258b6 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -120,6 +120,7 @@ public:
virtual int surface_get_array_len(int p_idx) const = 0;
virtual int surface_get_array_index_len(int p_idx) const = 0;
virtual Array surface_get_arrays(int p_surface) const = 0;
+ virtual Array surface_get_blend_shape_arrays(int p_surface) const = 0;
virtual uint32_t surface_get_format(int p_idx) const = 0;
virtual PrimitiveType surface_get_primitive_type(int p_idx) const = 0;
virtual Ref<Material> surface_get_material(int p_idx) const = 0;
@@ -174,7 +175,7 @@ public:
void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>());
Array surface_get_arrays(int p_surface) const;
- virtual Array surface_get_blend_shape_arrays(int p_surface) const;
+ Array surface_get_blend_shape_arrays(int p_surface) const;
void add_blend_shape(const StringName &p_name);
int get_blend_shape_count() const;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index c525ca600a..5d6f44dfef 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -92,7 +92,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
NODE_FROM_ID(nparent, n.parent);
#ifdef DEBUG_ENABLED
- if (!nparent && n.parent & FLAG_ID_IS_PATH) {
+ if (!nparent && (n.parent & FLAG_ID_IS_PATH)) {
WARN_PRINT(String("Parent path '" + String(node_paths[n.parent & FLAG_MASK]) + "' for node '" + String(snames[n.name]) + "' has vanished when instancing: '" + get_path() + "'.").ascii().get_data());
}
@@ -489,7 +489,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
// only save what has been changed
// only save changed properties in instance
- if (E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE || E->get().name == "__meta__") {
+ if ((E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE) || E->get().name == "__meta__") {
//property has requested that no instance state is saved, sorry
//also, meta won't be overridden or saved
continue;
@@ -1288,7 +1288,7 @@ bool SceneState::is_node_instance_placeholder(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, nodes.size(), false);
- return nodes[p_idx].instance >= 0 && nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER;
+ return nodes[p_idx].instance >= 0 && (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER);
}
Ref<PackedScene> SceneState::get_node_instance(int p_idx) const {
@@ -1313,7 +1313,7 @@ String SceneState::get_node_instance_placeholder(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, nodes.size(), String());
- if (nodes[p_idx].instance >= 0 && nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER) {
+ if (nodes[p_idx].instance >= 0 && (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER)) {
return variants[nodes[p_idx].instance & FLAG_MASK];
}
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index cfc1468533..ba356d89b1 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -105,6 +105,15 @@ Array PrimitiveMesh::surface_get_arrays(int p_surface) const {
return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh, 0);
}
+Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const {
+ ERR_FAIL_INDEX_V(p_surface, 1, Array());
+ if (pending_request) {
+ _update();
+ }
+
+ return Array();
+}
+
uint32_t PrimitiveMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, 1, 0);
if (pending_request) {
@@ -119,6 +128,8 @@ Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const {
}
Ref<Material> PrimitiveMesh::surface_get_material(int p_idx) const {
+ ERR_FAIL_INDEX_V(p_idx, 1, NULL);
+
return material;
}
@@ -151,6 +162,8 @@ void PrimitiveMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_material", "material"), &PrimitiveMesh::set_material);
ClassDB::bind_method(D_METHOD("get_material"), &PrimitiveMesh::get_material);
+ ClassDB::bind_method(D_METHOD("get_mesh_arrays"), &PrimitiveMesh::get_mesh_arrays);
+
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material");
}
@@ -168,6 +181,10 @@ Ref<Material> PrimitiveMesh::get_material() const {
return material;
}
+Array PrimitiveMesh::get_mesh_arrays() const {
+ return surface_get_arrays(0);
+}
+
PrimitiveMesh::PrimitiveMesh() {
// defaults
mesh = VisualServer::get_singleton()->mesh_create();
@@ -213,7 +230,6 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
prevrow = 0;
for (j = 0; j <= (rings + 1); j++) {
v = j;
- w;
v /= (rings + 1);
w = sin(0.5 * Math_PI * v);
@@ -292,7 +308,6 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
prevrow = 0;
for (j = 0; j <= (rings + 1); j++) {
v = j;
- w;
v /= (rings + 1);
v += 1.0;
diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h
index 34fb75a196..38a5695883 100644
--- a/scene/resources/primitive_meshes.h
+++ b/scene/resources/primitive_meshes.h
@@ -67,6 +67,7 @@ public:
virtual int surface_get_array_len(int p_idx) const;
virtual int surface_get_array_index_len(int p_idx) const;
virtual Array surface_get_arrays(int p_surface) const;
+ virtual Array surface_get_blend_shape_arrays(int p_surface) const;
virtual uint32_t surface_get_format(int p_idx) const;
virtual Mesh::PrimitiveType surface_get_primitive_type(int p_idx) const;
virtual Ref<Material> surface_get_material(int p_idx) const;
@@ -78,6 +79,8 @@ public:
void set_material(const Ref<Material> &p_material);
Ref<Material> get_material() const;
+ Array get_mesh_arrays() const;
+
PrimitiveMesh();
~PrimitiveMesh();
};
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 14e2ef83f8..f0304bfaa5 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -679,7 +679,7 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
String base_path = local_path.get_base_dir();
- uint64_t tag_end = f->get_pos();
+ uint64_t tag_end = f->get_position();
while (true) {
@@ -741,7 +741,7 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
fw->store_line("[ext_resource path=\"" + path + "\" type=\"" + type + "\" id=" + itos(index) + "]");
- tag_end = f->get_pos();
+ tag_end = f->get_position();
}
}
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
index 2ca9a14562..3813854922 100644
--- a/scene/resources/shader_graph.cpp
+++ b/scene/resources/shader_graph.cpp
@@ -172,8 +172,8 @@ void ShaderGraph::_bind_methods() {
ClassDB::bind_method(D_METHOD("node_add","shader_type","node_type","id"),&ShaderGraph::node_add);
ClassDB::bind_method(D_METHOD("node_remove","shader_type","id"),&ShaderGraph::node_remove);
- ClassDB::bind_method(D_METHOD("node_set_pos","shader_type","id","pos"),&ShaderGraph::node_set_pos);
- ClassDB::bind_method(D_METHOD("node_get_pos","shader_type","id"),&ShaderGraph::node_get_pos);
+ ClassDB::bind_method(D_METHOD("node_set_position","shader_type","id","position"),&ShaderGraph::node_set_position);
+ ClassDB::bind_method(D_METHOD("node_get_position","shader_type","id"),&ShaderGraph::node_get_position);
ClassDB::bind_method(D_METHOD("node_get_type","shader_type","id"),&ShaderGraph::node_get_type);
@@ -501,7 +501,7 @@ void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) {
_request_update();
}
-void ShaderGraph::node_set_pos(ShaderType p_type,int p_id, const Vector2& p_pos) {
+void ShaderGraph::node_set_position(ShaderType p_type,int p_id, const Vector2& p_pos) {
ERR_FAIL_INDEX(p_type,3);
ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
@@ -509,7 +509,7 @@ void ShaderGraph::node_set_pos(ShaderType p_type,int p_id, const Vector2& p_pos)
_request_update();
}
-Vector2 ShaderGraph::node_get_pos(ShaderType p_type,int p_id) const {
+Vector2 ShaderGraph::node_get_position(ShaderType p_type,int p_id) const {
ERR_FAIL_INDEX_V(p_type,3,Vector2());
ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector2());
@@ -1245,7 +1245,7 @@ Variant ShaderGraph::node_get_state(ShaderType p_type,int p_id) const {
ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Variant());
const Node& n = shader[p_type].node_map[p_id];
Dictionary s;
- s["pos"]=n.pos;
+ s["position"]=n.pos;
s["param1"]=n.param1;
s["param2"]=n.param2;
Array keys;
@@ -1263,12 +1263,12 @@ void ShaderGraph::node_set_state(ShaderType p_type,int p_id,const Variant& p_sta
ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
Node& n = shader[p_type].node_map[p_id];
Dictionary d = p_state;
- ERR_FAIL_COND(!d.has("pos"));
+ ERR_FAIL_COND(!d.has("position"));
ERR_FAIL_COND(!d.has("param1"));
ERR_FAIL_COND(!d.has("param2"));
ERR_FAIL_COND(!d.has("default_keys"));
- n.pos=d["pos"];
+ n.pos=d["position"];
n.param1=d["param1"];
n.param2=d["param2"];
Array keys = d["default_keys"];
diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h
index 9a74b6c53a..5d9dd7054f 100644
--- a/scene/resources/shader_graph.h
+++ b/scene/resources/shader_graph.h
@@ -195,8 +195,8 @@ public:
void node_add(ShaderType p_type, NodeType p_node_type, int p_id);
void node_remove(ShaderType p_which,int p_id);
- void node_set_pos(ShaderType p_which,int p_id,const Point2& p_pos);
- Point2 node_get_pos(ShaderType p_which,int p_id) const;
+ void node_set_position(ShaderType p_which,int p_id,const Point2& p_pos);
+ Point2 node_get_position(ShaderType p_which,int p_id) const;
void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
NodeType node_get_type(ShaderType p_which,int p_id) const;
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index 9af8c42110..2ef20f67f5 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -419,10 +419,10 @@ void ProceduralSky::_queue_update() {
call_deferred("_update_sky");
}
-void ProceduralSky::_thread_done(const Ref<Image> &image) {
+void ProceduralSky::_thread_done(const Ref<Image> &p_image) {
- VS::get_singleton()->texture_allocate(texture, image->get_width(), image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
- VS::get_singleton()->texture_set_data(texture, image);
+ VS::get_singleton()->texture_allocate(texture, p_image->get_width(), p_image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
+ VS::get_singleton()->texture_set_data(texture, p_image);
_radiance_changed();
Thread::wait_to_finish(sky_thread);
memdelete(sky_thread);
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 3d085f7166..4627c900ff 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -178,7 +178,7 @@ public:
void set_border_width_all(int p_size);
int get_border_width_min() const;
- void set_border_width(Margin p_margin, int p_size);
+ void set_border_width(Margin p_margin, int p_width);
int get_border_width(Margin p_margin) const;
//blend
@@ -214,7 +214,7 @@ public:
int get_shadow_size() const;
//ANTI_ALIASING
- void set_anti_aliased(const bool &p_anit_aliasing);
+ void set_anti_aliased(const bool &p_anti_aliased);
bool is_anti_aliased() const;
//tempAA
void set_aa_size(const int &p_aa_size);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6a9ded9ea3..c202fad1a4 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -70,7 +70,7 @@ void Texture::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_alpha"), &Texture::has_alpha);
ClassDB::bind_method(D_METHOD("set_flags", "flags"), &Texture::set_flags);
ClassDB::bind_method(D_METHOD("get_flags"), &Texture::get_flags);
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data);
@@ -488,7 +488,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
while (mipmaps > 1 && p_size_limit > 0 && (sw > p_size_limit || sh > p_size_limit)) {
- f->seek(f->get_pos() + size);
+ f->seek(f->get_position() + size);
mipmaps = f->get_32();
size = f->get_32();
@@ -610,7 +610,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
- f->seek(f->get_pos() + ofs);
+ f->seek(f->get_position() + ofs);
PoolVector<uint8_t> img_data;
img_data.resize(total_size - ofs);
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index e08be02a07..30264691ee 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -55,7 +55,7 @@ public:
virtual float get_length() const = 0;
- virtual float get_pos() const = 0;
+ virtual float get_position() const = 0;
virtual void seek_pos(float p_time) = 0;
virtual void set_audio_track(int p_idx) = 0;