Improve range property hints for various collision shapes

Fixes #36419.

Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
(cherry picked from commit 0d772c6e6e)
This commit is contained in:
Rémi Verschelde 2022-03-26 16:20:30 +01:00
parent 81eda4eee0
commit c4897c4b8d
9 changed files with 17 additions and 13 deletions

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "capsule_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> CapsuleShape::get_debug_mesh_lines() {
@ -106,8 +107,8 @@ void CapsuleShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_height", "get_height");
}
CapsuleShape::CapsuleShape() :

View file

@ -109,8 +109,8 @@ void CapsuleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape2D::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape2D::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_height", "get_height");
}
CapsuleShape2D::CapsuleShape2D() :

View file

@ -55,7 +55,7 @@ void CircleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CircleShape2D::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &CircleShape2D::get_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,16384,0.5"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
}
Rect2 CircleShape2D::get_rect() const {

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "cylinder_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> CylinderShape::get_debug_mesh_lines() {
@ -99,8 +100,8 @@ void CylinderShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CylinderShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CylinderShape::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
}
CylinderShape::CylinderShape() :

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "height_map_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
@ -191,8 +192,8 @@ void HeightMapShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data);
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data);
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_map_depth", "get_map_depth");
ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "map_data"), "set_map_data", "get_map_data");
}

View file

@ -105,7 +105,7 @@ void LineShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_d"), &LineShape2D::get_d);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "normal"), "set_normal", "get_normal");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "d"), "set_d", "get_d");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "d", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_d", "get_d");
}
LineShape2D::LineShape2D() :

View file

@ -81,7 +81,7 @@ void RayShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape::get_slips_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}

View file

@ -141,7 +141,7 @@ void RayShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape2D::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape2D::get_slips_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "sphere_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> SphereShape::get_debug_mesh_lines() {
@ -77,7 +78,7 @@ void SphereShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape::get_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
}
SphereShape::SphereShape() :