From 32dd9a9f668db31e348c5ef5bc181cdb91c07299 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Sun, 20 Aug 2017 17:45:01 +0200 Subject: ClassDB: Provide the enum name of integer constants --- servers/arvr/arvr_interface.cpp | 6 +- servers/arvr_server.cpp | 12 +- servers/physics_2d_server.cpp | 158 ++++++++++++------------ servers/physics_2d_server.h | 2 + servers/physics_server.cpp | 259 ++++++++++++++++++++-------------------- servers/physics_server.h | 2 + 6 files changed, 222 insertions(+), 217 deletions(-) (limited to 'servers') diff --git a/servers/arvr/arvr_interface.cpp b/servers/arvr/arvr_interface.cpp index 81eb011932..1f2e6028b0 100644 --- a/servers/arvr/arvr_interface.cpp +++ b/servers/arvr/arvr_interface.cpp @@ -51,9 +51,9 @@ void ARVRInterface::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "primary"), "set_is_primary", "is_primary"); - BIND_CONSTANT(EYE_MONO); - BIND_CONSTANT(EYE_LEFT); - BIND_CONSTANT(EYE_RIGHT); + BIND_ENUM_CONSTANT(EYE_MONO); + BIND_ENUM_CONSTANT(EYE_LEFT); + BIND_ENUM_CONSTANT(EYE_RIGHT); }; StringName ARVRInterface::get_name() const { diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index 6398d87007..8a064f9cce 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -58,12 +58,12 @@ void ARVRServer::_bind_methods() { ClassDB::bind_method(D_METHOD("add_interface"), &ARVRServer::add_interface); ClassDB::bind_method(D_METHOD("remove_interface"), &ARVRServer::remove_interface); - BIND_CONSTANT(TRACKER_CONTROLLER); - BIND_CONSTANT(TRACKER_BASESTATION); - BIND_CONSTANT(TRACKER_ANCHOR); - BIND_CONSTANT(TRACKER_UNKNOWN); - BIND_CONSTANT(TRACKER_ANY_KNOWN); - BIND_CONSTANT(TRACKER_ANY); + BIND_ENUM_CONSTANT(TRACKER_CONTROLLER); + BIND_ENUM_CONSTANT(TRACKER_BASESTATION); + BIND_ENUM_CONSTANT(TRACKER_ANCHOR); + BIND_ENUM_CONSTANT(TRACKER_UNKNOWN); + BIND_ENUM_CONSTANT(TRACKER_ANY_KNOWN); + BIND_ENUM_CONSTANT(TRACKER_ANY); ADD_SIGNAL(MethodInfo("interface_added", PropertyInfo(Variant::STRING, "name"))); ADD_SIGNAL(MethodInfo("interface_removed", PropertyInfo(Variant::STRING, "name"))); diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index 27732b9c29..898c49a1eb 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -354,12 +354,12 @@ void Physics2DDirectSpaceState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &Physics2DDirectSpaceState::_get_rest_info); //ClassDB::bind_method(D_METHOD("cast_motion","shape","xform","motion","exclude","umask"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0)); - BIND_CONSTANT(TYPE_MASK_STATIC_BODY); - BIND_CONSTANT(TYPE_MASK_KINEMATIC_BODY); - BIND_CONSTANT(TYPE_MASK_RIGID_BODY); - BIND_CONSTANT(TYPE_MASK_CHARACTER_BODY); - BIND_CONSTANT(TYPE_MASK_AREA); - BIND_CONSTANT(TYPE_MASK_COLLISION); + BIND_ENUM_CONSTANT(TYPE_MASK_STATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_KINEMATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_RIGID_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_CHARACTER_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_AREA); + BIND_ENUM_CONSTANT(TYPE_MASK_COLLISION); } int Physics2DShapeQueryResult::get_result_count() const { @@ -604,79 +604,79 @@ void Physics2DServer::_bind_methods() { //ClassDB::bind_method(D_METHOD("sync"),&Physics2DServer::sync); //ClassDB::bind_method(D_METHOD("flush_queries"),&Physics2DServer::flush_queries); - BIND_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS); - BIND_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION); - BIND_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION); - BIND_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD); - BIND_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD); - BIND_CONSTANT(SPACE_PARAM_BODY_TIME_TO_SLEEP); - BIND_CONSTANT(SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS); - - BIND_CONSTANT(SHAPE_LINE); - BIND_CONSTANT(SHAPE_SEGMENT); - BIND_CONSTANT(SHAPE_CIRCLE); - BIND_CONSTANT(SHAPE_RECTANGLE); - BIND_CONSTANT(SHAPE_CAPSULE); - BIND_CONSTANT(SHAPE_CONVEX_POLYGON); - BIND_CONSTANT(SHAPE_CONCAVE_POLYGON); - BIND_CONSTANT(SHAPE_CUSTOM); - - BIND_CONSTANT(AREA_PARAM_GRAVITY); - BIND_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); - BIND_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); - BIND_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); - BIND_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); - BIND_CONSTANT(AREA_PARAM_LINEAR_DAMP); - BIND_CONSTANT(AREA_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(AREA_PARAM_PRIORITY); - - BIND_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); - - BIND_CONSTANT(BODY_MODE_STATIC); - BIND_CONSTANT(BODY_MODE_KINEMATIC); - BIND_CONSTANT(BODY_MODE_RIGID); - BIND_CONSTANT(BODY_MODE_CHARACTER); - - BIND_CONSTANT(BODY_PARAM_BOUNCE); - BIND_CONSTANT(BODY_PARAM_FRICTION); - BIND_CONSTANT(BODY_PARAM_MASS); - BIND_CONSTANT(BODY_PARAM_INERTIA); - BIND_CONSTANT(BODY_PARAM_GRAVITY_SCALE); - BIND_CONSTANT(BODY_PARAM_LINEAR_DAMP); - BIND_CONSTANT(BODY_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(BODY_PARAM_MAX); - - BIND_CONSTANT(BODY_STATE_TRANSFORM); - BIND_CONSTANT(BODY_STATE_LINEAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_SLEEPING); - BIND_CONSTANT(BODY_STATE_CAN_SLEEP); - - BIND_CONSTANT(JOINT_PIN); - BIND_CONSTANT(JOINT_GROOVE); - BIND_CONSTANT(JOINT_DAMPED_SPRING); - - BIND_CONSTANT(DAMPED_STRING_REST_LENGTH); - BIND_CONSTANT(DAMPED_STRING_STIFFNESS); - BIND_CONSTANT(DAMPED_STRING_DAMPING); - - BIND_CONSTANT(CCD_MODE_DISABLED); - BIND_CONSTANT(CCD_MODE_CAST_RAY); - BIND_CONSTANT(CCD_MODE_CAST_SHAPE); - - //BIND_CONSTANT( TYPE_BODY ); - //BIND_CONSTANT( TYPE_AREA ); - - BIND_CONSTANT(AREA_BODY_ADDED); - BIND_CONSTANT(AREA_BODY_REMOVED); - - BIND_CONSTANT(INFO_ACTIVE_OBJECTS); - BIND_CONSTANT(INFO_COLLISION_PAIRS); - BIND_CONSTANT(INFO_ISLAND_COUNT); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_TIME_TO_SLEEP); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS); + + BIND_ENUM_CONSTANT(SHAPE_LINE); + BIND_ENUM_CONSTANT(SHAPE_SEGMENT); + BIND_ENUM_CONSTANT(SHAPE_CIRCLE); + BIND_ENUM_CONSTANT(SHAPE_RECTANGLE); + BIND_ENUM_CONSTANT(SHAPE_CAPSULE); + BIND_ENUM_CONSTANT(SHAPE_CONVEX_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_CONCAVE_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_CUSTOM); + + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); + BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_PRIORITY); + + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); + + BIND_ENUM_CONSTANT(BODY_MODE_STATIC); + BIND_ENUM_CONSTANT(BODY_MODE_KINEMATIC); + BIND_ENUM_CONSTANT(BODY_MODE_RIGID); + BIND_ENUM_CONSTANT(BODY_MODE_CHARACTER); + + BIND_ENUM_CONSTANT(BODY_PARAM_BOUNCE); + BIND_ENUM_CONSTANT(BODY_PARAM_FRICTION); + BIND_ENUM_CONSTANT(BODY_PARAM_MASS); + BIND_ENUM_CONSTANT(BODY_PARAM_INERTIA); + BIND_ENUM_CONSTANT(BODY_PARAM_GRAVITY_SCALE); + BIND_ENUM_CONSTANT(BODY_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_MAX); + + BIND_ENUM_CONSTANT(BODY_STATE_TRANSFORM); + BIND_ENUM_CONSTANT(BODY_STATE_LINEAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_SLEEPING); + BIND_ENUM_CONSTANT(BODY_STATE_CAN_SLEEP); + + BIND_ENUM_CONSTANT(JOINT_PIN); + BIND_ENUM_CONSTANT(JOINT_GROOVE); + BIND_ENUM_CONSTANT(JOINT_DAMPED_SPRING); + + BIND_ENUM_CONSTANT(DAMPED_STRING_REST_LENGTH); + BIND_ENUM_CONSTANT(DAMPED_STRING_STIFFNESS); + BIND_ENUM_CONSTANT(DAMPED_STRING_DAMPING); + + BIND_ENUM_CONSTANT(CCD_MODE_DISABLED); + BIND_ENUM_CONSTANT(CCD_MODE_CAST_RAY); + BIND_ENUM_CONSTANT(CCD_MODE_CAST_SHAPE); + + //BIND_ENUM_CONSTANT( TYPE_BODY ); + //BIND_ENUM_CONSTANT( TYPE_AREA ); + + BIND_ENUM_CONSTANT(AREA_BODY_ADDED); + BIND_ENUM_CONSTANT(AREA_BODY_REMOVED); + + BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS); + BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS); + BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT); } Physics2DServer::Physics2DServer() { diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index f3acd8df18..905f96a5a9 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -201,6 +201,8 @@ public: Physics2DDirectSpaceState(); }; +VARIANT_ENUM_CAST(Physics2DDirectSpaceState::ObjectTypeMask); + class Physics2DShapeQueryResult : public Reference { GDCLASS(Physics2DShapeQueryResult, Reference); diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 86bf6253ee..c51a59973c 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -349,12 +349,12 @@ void PhysicsDirectSpaceState::_bind_methods() { ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32)); ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState::_get_rest_info); - BIND_CONSTANT(TYPE_MASK_STATIC_BODY); - BIND_CONSTANT(TYPE_MASK_KINEMATIC_BODY); - BIND_CONSTANT(TYPE_MASK_RIGID_BODY); - BIND_CONSTANT(TYPE_MASK_CHARACTER_BODY); - BIND_CONSTANT(TYPE_MASK_AREA); - BIND_CONSTANT(TYPE_MASK_COLLISION); + BIND_ENUM_CONSTANT(TYPE_MASK_STATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_KINEMATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_RIGID_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_CHARACTER_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_AREA); + BIND_ENUM_CONSTANT(TYPE_MASK_COLLISION); } int PhysicsShapeQueryResult::get_result_count() const { @@ -506,11 +506,11 @@ void PhysicsServer::_bind_methods() { /* JOINT API */ - BIND_CONSTANT(JOINT_PIN); - BIND_CONSTANT(JOINT_HINGE); - BIND_CONSTANT(JOINT_SLIDER); - BIND_CONSTANT(JOINT_CONE_TWIST); - BIND_CONSTANT(JOINT_6DOF); + BIND_ENUM_CONSTANT(JOINT_PIN); + BIND_ENUM_CONSTANT(JOINT_HINGE); + BIND_ENUM_CONSTANT(JOINT_SLIDER); + BIND_ENUM_CONSTANT(JOINT_CONE_TWIST); + BIND_ENUM_CONSTANT(JOINT_6DOF); ClassDB::bind_method(D_METHOD("joint_create_pin", "body_A", "local_A", "body_B", "local_B"), &PhysicsServer::joint_create_pin); ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer::pin_joint_set_param); @@ -522,20 +522,21 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("pin_joint_set_local_b", "joint", "local_B"), &PhysicsServer::pin_joint_set_local_b); ClassDB::bind_method(D_METHOD("pin_joint_get_local_b", "joint"), &PhysicsServer::pin_joint_get_local_b); - BIND_CONSTANT(PIN_JOINT_BIAS); - BIND_CONSTANT(PIN_JOINT_DAMPING); - BIND_CONSTANT(PIN_JOINT_IMPULSE_CLAMP); - - BIND_CONSTANT(HINGE_JOINT_BIAS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_UPPER); - BIND_CONSTANT(HINGE_JOINT_LIMIT_LOWER); - BIND_CONSTANT(HINGE_JOINT_LIMIT_BIAS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_SOFTNESS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_RELAXATION); - BIND_CONSTANT(HINGE_JOINT_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(HINGE_JOINT_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(HINGE_JOINT_FLAG_USE_LIMIT); - BIND_CONSTANT(HINGE_JOINT_FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(PIN_JOINT_BIAS); + BIND_ENUM_CONSTANT(PIN_JOINT_DAMPING); + BIND_ENUM_CONSTANT(PIN_JOINT_IMPULSE_CLAMP); + + BIND_ENUM_CONSTANT(HINGE_JOINT_BIAS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_UPPER); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_LOWER); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_BIAS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_RELAXATION); + BIND_ENUM_CONSTANT(HINGE_JOINT_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(HINGE_JOINT_MOTOR_MAX_IMPULSE); + + BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_USE_LIMIT); + BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_ENABLE_MOTOR); ClassDB::bind_method(D_METHOD("joint_create_hinge", "body_A", "hinge_A", "body_B", "hinge_B"), &PhysicsServer::joint_create_hinge); @@ -550,60 +551,60 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("slider_joint_set_param", "joint", "param", "value"), &PhysicsServer::slider_joint_set_param); ClassDB::bind_method(D_METHOD("slider_joint_get_param", "joint", "param"), &PhysicsServer::slider_joint_get_param); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_UPPER); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_LOWER); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_UPPER); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_LOWER); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_MAX); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_MAX); ClassDB::bind_method(D_METHOD("joint_create_cone_twist", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer::joint_create_cone_twist); ClassDB::bind_method(D_METHOD("cone_twist_joint_set_param", "joint", "param", "value"), &PhysicsServer::cone_twist_joint_set_param); ClassDB::bind_method(D_METHOD("cone_twist_joint_get_param", "joint", "param"), &PhysicsServer::cone_twist_joint_get_param); - BIND_CONSTANT(CONE_TWIST_JOINT_SWING_SPAN); - BIND_CONSTANT(CONE_TWIST_JOINT_TWIST_SPAN); - BIND_CONSTANT(CONE_TWIST_JOINT_BIAS); - BIND_CONSTANT(CONE_TWIST_JOINT_SOFTNESS); - BIND_CONSTANT(CONE_TWIST_JOINT_RELAXATION); - - BIND_CONSTANT(G6DOF_JOINT_LINEAR_LOWER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_UPPER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_RESTITUTION); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_DAMPING); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_RESTITUTION); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_FORCE_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_ERP); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT); - - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_SWING_SPAN); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_TWIST_SPAN); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_BIAS); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_SOFTNESS); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_RELAXATION); + + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_RESTITUTION); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_DAMPING); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_RESTITUTION); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_ERP); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT); + + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR); ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer::joint_get_type); @@ -642,67 +643,67 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer::get_process_info); - BIND_CONSTANT(SHAPE_PLANE); - BIND_CONSTANT(SHAPE_RAY); - BIND_CONSTANT(SHAPE_SPHERE); - BIND_CONSTANT(SHAPE_BOX); - BIND_CONSTANT(SHAPE_CAPSULE); - BIND_CONSTANT(SHAPE_CONVEX_POLYGON); - BIND_CONSTANT(SHAPE_CONCAVE_POLYGON); - BIND_CONSTANT(SHAPE_HEIGHTMAP); - BIND_CONSTANT(SHAPE_CUSTOM); - - BIND_CONSTANT(AREA_PARAM_GRAVITY); - BIND_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); - BIND_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); - BIND_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); - BIND_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); - BIND_CONSTANT(AREA_PARAM_LINEAR_DAMP); - BIND_CONSTANT(AREA_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(AREA_PARAM_PRIORITY); - - BIND_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); - - BIND_CONSTANT(BODY_MODE_STATIC); - BIND_CONSTANT(BODY_MODE_KINEMATIC); - BIND_CONSTANT(BODY_MODE_RIGID); - BIND_CONSTANT(BODY_MODE_CHARACTER); - - BIND_CONSTANT(BODY_PARAM_BOUNCE); - BIND_CONSTANT(BODY_PARAM_FRICTION); - BIND_CONSTANT(BODY_PARAM_MASS); - BIND_CONSTANT(BODY_PARAM_GRAVITY_SCALE); - BIND_CONSTANT(BODY_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(BODY_PARAM_LINEAR_DAMP); - BIND_CONSTANT(BODY_PARAM_MAX); - - BIND_CONSTANT(BODY_STATE_TRANSFORM); - BIND_CONSTANT(BODY_STATE_LINEAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_SLEEPING); - BIND_CONSTANT(BODY_STATE_CAN_SLEEP); + BIND_ENUM_CONSTANT(SHAPE_PLANE); + BIND_ENUM_CONSTANT(SHAPE_RAY); + BIND_ENUM_CONSTANT(SHAPE_SPHERE); + BIND_ENUM_CONSTANT(SHAPE_BOX); + BIND_ENUM_CONSTANT(SHAPE_CAPSULE); + BIND_ENUM_CONSTANT(SHAPE_CONVEX_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_CONCAVE_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_HEIGHTMAP); + BIND_ENUM_CONSTANT(SHAPE_CUSTOM); + + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); + BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_PRIORITY); + + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); + + BIND_ENUM_CONSTANT(BODY_MODE_STATIC); + BIND_ENUM_CONSTANT(BODY_MODE_KINEMATIC); + BIND_ENUM_CONSTANT(BODY_MODE_RIGID); + BIND_ENUM_CONSTANT(BODY_MODE_CHARACTER); + + BIND_ENUM_CONSTANT(BODY_PARAM_BOUNCE); + BIND_ENUM_CONSTANT(BODY_PARAM_FRICTION); + BIND_ENUM_CONSTANT(BODY_PARAM_MASS); + BIND_ENUM_CONSTANT(BODY_PARAM_GRAVITY_SCALE); + BIND_ENUM_CONSTANT(BODY_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_MAX); + + BIND_ENUM_CONSTANT(BODY_STATE_TRANSFORM); + BIND_ENUM_CONSTANT(BODY_STATE_LINEAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_SLEEPING); + BIND_ENUM_CONSTANT(BODY_STATE_CAN_SLEEP); /* - BIND_CONSTANT( JOINT_PIN ); - BIND_CONSTANT( JOINT_GROOVE ); - BIND_CONSTANT( JOINT_DAMPED_SPRING ); + BIND_ENUM_CONSTANT( JOINT_PIN ); + BIND_ENUM_CONSTANT( JOINT_GROOVE ); + BIND_ENUM_CONSTANT( JOINT_DAMPED_SPRING ); - BIND_CONSTANT( DAMPED_STRING_REST_LENGTH ); - BIND_CONSTANT( DAMPED_STRING_STIFFNESS ); - BIND_CONSTANT( DAMPED_STRING_DAMPING ); + BIND_ENUM_CONSTANT( DAMPED_STRING_REST_LENGTH ); + BIND_ENUM_CONSTANT( DAMPED_STRING_STIFFNESS ); + BIND_ENUM_CONSTANT( DAMPED_STRING_DAMPING ); */ - //BIND_CONSTANT( TYPE_BODY ); - //BIND_CONSTANT( TYPE_AREA ); + //BIND_ENUM_CONSTANT( TYPE_BODY ); + //BIND_ENUM_CONSTANT( TYPE_AREA ); - BIND_CONSTANT(AREA_BODY_ADDED); - BIND_CONSTANT(AREA_BODY_REMOVED); + BIND_ENUM_CONSTANT(AREA_BODY_ADDED); + BIND_ENUM_CONSTANT(AREA_BODY_REMOVED); - BIND_CONSTANT(INFO_ACTIVE_OBJECTS); - BIND_CONSTANT(INFO_COLLISION_PAIRS); - BIND_CONSTANT(INFO_ISLAND_COUNT); + BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS); + BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS); + BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT); } PhysicsServer::PhysicsServer() { diff --git a/servers/physics_server.h b/servers/physics_server.h index b38e14eb0c..a8c2a7761d 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -201,6 +201,8 @@ public: PhysicsDirectSpaceState(); }; +VARIANT_ENUM_CAST(PhysicsDirectSpaceState::ObjectTypeMask); + class PhysicsShapeQueryResult : public Reference { GDCLASS(PhysicsShapeQueryResult, Reference); -- cgit v1.2.3