diff options
Diffstat (limited to 'scene')
30 files changed, 617 insertions, 121 deletions
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..d8cef5b937 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() { @@ -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; } diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h index 017ccf13ff..36aadfd265 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,6 +37,24 @@ 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); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index 53db30e3ce..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)); @@ -247,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; @@ -284,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; } @@ -298,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 { @@ -317,7 +317,7 @@ 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 * / \ @@ -337,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); @@ -360,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; } @@ -371,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)); @@ -396,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)); } @@ -420,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)); @@ -449,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)); } @@ -476,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]]); @@ -541,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 @@ -552,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; @@ -565,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/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/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 966dd88a2c..147d3bf115 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -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; }; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 096f787873..7402e664d9 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -405,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/physics_body.cpp b/scene/3d/physics_body.cpp index 7525eb5069..6551deabf2 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -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() 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_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 7a5c7e450b..38d0527288 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1808,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/audio/audio_player.cpp b/scene/audio/audio_player.cpp index 6a582c9a3d..661d085dfd 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -308,6 +308,10 @@ void AudioStreamPlayer::_bind_methods() { 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/gui/control.cpp b/scene/gui/control.cpp index 87dfd95724..2d5b54257a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -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 { 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/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/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..2ca4c81319 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) { @@ -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(); } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index db282262ec..1aaea98798 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; @@ -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; @@ -3593,6 +3654,7 @@ void Tree::_bind_methods() { 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_drop_section_at_pos", "pos"), &Tree::get_drop_section_at_pos); ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 06d6d3ad5a..5f19558597 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(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 567b1dd7a1..d27a1a5641 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2762,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/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 659322897a..dff0fb8588 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -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/curve.cpp b/scene/resources/curve.cpp index 2e89a739bd..1066848dd1 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -514,6 +514,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 { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 04efe88102..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() { 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); |