Merge pull request #39293 from madmiraal/fix-27921

Correct misspellings of damped spring.
This commit is contained in:
Rémi Verschelde 2020-06-05 11:04:46 +02:00 committed by GitHub
commit 06a2fb0bac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 45 additions and 45 deletions

View file

@ -864,28 +864,28 @@
Creates a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. Creates a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself.
</description> </description>
</method> </method>
<method name="damped_string_joint_get_param" qualifiers="const"> <method name="damped_spring_joint_get_param" qualifiers="const">
<return type="float"> <return type="float">
</return> </return>
<argument index="0" name="joint" type="RID"> <argument index="0" name="joint" type="RID">
</argument> </argument>
<argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam"> <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedSpringParam">
</argument> </argument>
<description> <description>
Returns the value of a damped spring joint parameter. Returns the value of a damped spring joint parameter. See [enum DampedSpringParam] for a list of available parameters.
</description> </description>
</method> </method>
<method name="damped_string_joint_set_param"> <method name="damped_spring_joint_set_param">
<return type="void"> <return type="void">
</return> </return>
<argument index="0" name="joint" type="RID"> <argument index="0" name="joint" type="RID">
</argument> </argument>
<argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam"> <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedSpringParam">
</argument> </argument>
<argument index="2" name="value" type="float"> <argument index="2" name="value" type="float">
</argument> </argument>
<description> <description>
Sets a damped spring joint parameter. See [enum DampedStringParam] for a list of available parameters. Sets a damped spring joint parameter. See [enum DampedSpringParam] for a list of available parameters.
</description> </description>
</method> </method>
<method name="free_rid"> <method name="free_rid">
@ -1247,13 +1247,13 @@
</constant> </constant>
<constant name="JOINT_PARAM_MAX_FORCE" value="2" enum="JointParam"> <constant name="JOINT_PARAM_MAX_FORCE" value="2" enum="JointParam">
</constant> </constant>
<constant name="DAMPED_STRING_REST_LENGTH" value="0" enum="DampedStringParam"> <constant name="DAMPED_SPRING_REST_LENGTH" value="0" enum="DampedSpringParam">
Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart.
</constant> </constant>
<constant name="DAMPED_STRING_STIFFNESS" value="1" enum="DampedStringParam"> <constant name="DAMPED_SPRING_STIFFNESS" value="1" enum="DampedSpringParam">
Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length.
</constant> </constant>
<constant name="DAMPED_STRING_DAMPING" value="2" enum="DampedStringParam"> <constant name="DAMPED_SPRING_DAMPING" value="2" enum="DampedSpringParam">
Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).
</constant> </constant>
<constant name="CCD_MODE_DISABLED" value="0" enum="CCDMode"> <constant name="CCD_MODE_DISABLED" value="0" enum="CCDMode">

View file

@ -35842,7 +35842,7 @@ msgstr ""
#: doc/classes/PhysicsServer2D.xml:888 #: doc/classes/PhysicsServer2D.xml:888
msgid "" msgid ""
"Sets a damped spring joint parameter. See [enum DampedStringParam] for a " "Sets a damped spring joint parameter. See [enum DampedSpringParam] for a "
"list of available parameters." "list of available parameters."
msgstr "" msgstr ""

View file

@ -35852,7 +35852,7 @@ msgstr ""
#: doc/classes/PhysicsServer2D.xml:888 #: doc/classes/PhysicsServer2D.xml:888
msgid "" msgid ""
"Sets a damped spring joint parameter. See [enum DampedStringParam] for a " "Sets a damped spring joint parameter. See [enum DampedSpringParam] for a "
"list of available parameters." "list of available parameters."
msgstr "" msgstr ""

View file

@ -309,10 +309,10 @@ RID DampedSpringJoint2D::_configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *
RID dsj = PhysicsServer2D::get_singleton()->damped_spring_joint_create(anchor_A, anchor_B, body_a->get_rid(), body_b->get_rid()); RID dsj = PhysicsServer2D::get_singleton()->damped_spring_joint_create(anchor_A, anchor_B, body_a->get_rid(), body_b->get_rid());
if (rest_length) { if (rest_length) {
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_REST_LENGTH, rest_length); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_REST_LENGTH, rest_length);
} }
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_STIFFNESS, stiffness); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_STIFFNESS, stiffness);
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_DAMPING, damping); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_DAMPING, damping);
return dsj; return dsj;
} }
@ -330,7 +330,7 @@ void DampedSpringJoint2D::set_rest_length(real_t p_rest_length) {
rest_length = p_rest_length; rest_length = p_rest_length;
update(); update();
if (get_joint().is_valid()) { if (get_joint().is_valid()) {
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_REST_LENGTH, p_rest_length ? p_rest_length : length); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_REST_LENGTH, p_rest_length ? p_rest_length : length);
} }
} }
@ -342,7 +342,7 @@ void DampedSpringJoint2D::set_stiffness(real_t p_stiffness) {
stiffness = p_stiffness; stiffness = p_stiffness;
update(); update();
if (get_joint().is_valid()) { if (get_joint().is_valid()) {
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_STIFFNESS, p_stiffness); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_STIFFNESS, p_stiffness);
} }
} }
@ -354,7 +354,7 @@ void DampedSpringJoint2D::set_damping(real_t p_damping) {
damping = p_damping; damping = p_damping;
update(); update();
if (get_joint().is_valid()) { if (get_joint().is_valid()) {
PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_DAMPING, p_damping); PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_DAMPING, p_damping);
} }
} }

View file

@ -390,29 +390,29 @@ void DampedSpringJoint2DSW::solve(real_t p_step) {
B->apply_impulse(rB, j); B->apply_impulse(rB, j);
} }
void DampedSpringJoint2DSW::set_param(PhysicsServer2D::DampedStringParam p_param, real_t p_value) { void DampedSpringJoint2DSW::set_param(PhysicsServer2D::DampedSpringParam p_param, real_t p_value) {
switch (p_param) { switch (p_param) {
case PhysicsServer2D::DAMPED_STRING_REST_LENGTH: { case PhysicsServer2D::DAMPED_SPRING_REST_LENGTH: {
rest_length = p_value; rest_length = p_value;
} break; } break;
case PhysicsServer2D::DAMPED_STRING_DAMPING: { case PhysicsServer2D::DAMPED_SPRING_DAMPING: {
damping = p_value; damping = p_value;
} break; } break;
case PhysicsServer2D::DAMPED_STRING_STIFFNESS: { case PhysicsServer2D::DAMPED_SPRING_STIFFNESS: {
stiffness = p_value; stiffness = p_value;
} break; } break;
} }
} }
real_t DampedSpringJoint2DSW::get_param(PhysicsServer2D::DampedStringParam p_param) const { real_t DampedSpringJoint2DSW::get_param(PhysicsServer2D::DampedSpringParam p_param) const {
switch (p_param) { switch (p_param) {
case PhysicsServer2D::DAMPED_STRING_REST_LENGTH: { case PhysicsServer2D::DAMPED_SPRING_REST_LENGTH: {
return rest_length; return rest_length;
} break; } break;
case PhysicsServer2D::DAMPED_STRING_DAMPING: { case PhysicsServer2D::DAMPED_SPRING_DAMPING: {
return damping; return damping;
} break; } break;
case PhysicsServer2D::DAMPED_STRING_STIFFNESS: { case PhysicsServer2D::DAMPED_SPRING_STIFFNESS: {
return stiffness; return stiffness;
} break; } break;
} }

View file

@ -151,8 +151,8 @@ public:
virtual bool setup(real_t p_step); virtual bool setup(real_t p_step);
virtual void solve(real_t p_step); virtual void solve(real_t p_step);
void set_param(PhysicsServer2D::DampedStringParam p_param, real_t p_value); void set_param(PhysicsServer2D::DampedSpringParam p_param, real_t p_value);
real_t get_param(PhysicsServer2D::DampedStringParam p_param) const; real_t get_param(PhysicsServer2D::DampedSpringParam p_param) const;
DampedSpringJoint2DSW(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, Body2DSW *p_body_a, Body2DSW *p_body_b); DampedSpringJoint2DSW(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, Body2DSW *p_body_a, Body2DSW *p_body_b);
~DampedSpringJoint2DSW(); ~DampedSpringJoint2DSW();

View file

@ -1113,7 +1113,7 @@ real_t PhysicsServer2DSW::pin_joint_get_param(RID p_joint, PinJointParam p_param
return pin_joint->get_param(p_param); return pin_joint->get_param(p_param);
} }
void PhysicsServer2DSW::damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value) { void PhysicsServer2DSW::damped_spring_joint_set_param(RID p_joint, DampedSpringParam p_param, real_t p_value) {
Joint2DSW *j = joint_owner.getornull(p_joint); Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND(!j); ERR_FAIL_COND(!j);
ERR_FAIL_COND(j->get_type() != JOINT_DAMPED_SPRING); ERR_FAIL_COND(j->get_type() != JOINT_DAMPED_SPRING);
@ -1122,7 +1122,7 @@ void PhysicsServer2DSW::damped_string_joint_set_param(RID p_joint, DampedStringP
dsj->set_param(p_param, p_value); dsj->set_param(p_param, p_value);
} }
real_t PhysicsServer2DSW::damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const { real_t PhysicsServer2DSW::damped_spring_joint_get_param(RID p_joint, DampedSpringParam p_param) const {
Joint2DSW *j = joint_owner.getornull(p_joint); Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!j, 0); ERR_FAIL_COND_V(!j, 0);
ERR_FAIL_COND_V(j->get_type() != JOINT_DAMPED_SPRING, 0); ERR_FAIL_COND_V(j->get_type() != JOINT_DAMPED_SPRING, 0);

View file

@ -266,8 +266,8 @@ public:
virtual RID damped_spring_joint_create(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, RID p_body_a, RID p_body_b = RID()); virtual RID damped_spring_joint_create(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, RID p_body_a, RID p_body_b = RID());
virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value); virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value);
virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const; virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const;
virtual void damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value); virtual void damped_spring_joint_set_param(RID p_joint, DampedSpringParam p_param, real_t p_value);
virtual real_t damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const; virtual real_t damped_spring_joint_get_param(RID p_joint, DampedSpringParam p_param) const;
virtual JointType joint_get_type(RID p_joint) const; virtual JointType joint_get_type(RID p_joint) const;

View file

@ -287,8 +287,8 @@ public:
FUNC3(pin_joint_set_param, RID, PinJointParam, real_t); FUNC3(pin_joint_set_param, RID, PinJointParam, real_t);
FUNC2RC(real_t, pin_joint_get_param, RID, PinJointParam); FUNC2RC(real_t, pin_joint_get_param, RID, PinJointParam);
FUNC3(damped_string_joint_set_param, RID, DampedStringParam, real_t); FUNC3(damped_spring_joint_set_param, RID, DampedSpringParam, real_t);
FUNC2RC(real_t, damped_string_joint_get_param, RID, DampedStringParam); FUNC2RC(real_t, damped_spring_joint_get_param, RID, DampedSpringParam);
FUNC1RC(JointType, joint_get_type, RID); FUNC1RC(JointType, joint_get_type, RID);

View file

@ -654,8 +654,8 @@ void PhysicsServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("groove_joint_create", "groove1_a", "groove2_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::groove_joint_create, DEFVAL(RID()), DEFVAL(RID())); ClassDB::bind_method(D_METHOD("groove_joint_create", "groove1_a", "groove2_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::groove_joint_create, DEFVAL(RID()), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("damped_spring_joint_create", "anchor_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::damped_spring_joint_create, DEFVAL(RID())); ClassDB::bind_method(D_METHOD("damped_spring_joint_create", "anchor_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::damped_spring_joint_create, DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("damped_string_joint_set_param", "joint", "param", "value"), &PhysicsServer2D::damped_string_joint_set_param); ClassDB::bind_method(D_METHOD("damped_spring_joint_set_param", "joint", "param", "value"), &PhysicsServer2D::damped_spring_joint_set_param);
ClassDB::bind_method(D_METHOD("damped_string_joint_get_param", "joint", "param"), &PhysicsServer2D::damped_string_joint_get_param); ClassDB::bind_method(D_METHOD("damped_spring_joint_get_param", "joint", "param"), &PhysicsServer2D::damped_spring_joint_get_param);
ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer2D::joint_get_type); ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer2D::joint_get_type);
@ -727,9 +727,9 @@ void PhysicsServer2D::_bind_methods() {
BIND_ENUM_CONSTANT(JOINT_PARAM_MAX_BIAS); BIND_ENUM_CONSTANT(JOINT_PARAM_MAX_BIAS);
BIND_ENUM_CONSTANT(JOINT_PARAM_MAX_FORCE); BIND_ENUM_CONSTANT(JOINT_PARAM_MAX_FORCE);
BIND_ENUM_CONSTANT(DAMPED_STRING_REST_LENGTH); BIND_ENUM_CONSTANT(DAMPED_SPRING_REST_LENGTH);
BIND_ENUM_CONSTANT(DAMPED_STRING_STIFFNESS); BIND_ENUM_CONSTANT(DAMPED_SPRING_STIFFNESS);
BIND_ENUM_CONSTANT(DAMPED_STRING_DAMPING); BIND_ENUM_CONSTANT(DAMPED_SPRING_DAMPING);
BIND_ENUM_CONSTANT(CCD_MODE_DISABLED); BIND_ENUM_CONSTANT(CCD_MODE_DISABLED);
BIND_ENUM_CONSTANT(CCD_MODE_CAST_RAY); BIND_ENUM_CONSTANT(CCD_MODE_CAST_RAY);

View file

@ -552,13 +552,13 @@ public:
virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) = 0; virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) = 0;
virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const = 0; virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const = 0;
enum DampedStringParam { enum DampedSpringParam {
DAMPED_STRING_REST_LENGTH, DAMPED_SPRING_REST_LENGTH,
DAMPED_STRING_STIFFNESS, DAMPED_SPRING_STIFFNESS,
DAMPED_STRING_DAMPING DAMPED_SPRING_DAMPING
}; };
virtual void damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value) = 0; virtual void damped_spring_joint_set_param(RID p_joint, DampedSpringParam p_param, real_t p_value) = 0;
virtual real_t damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const = 0; virtual real_t damped_spring_joint_get_param(RID p_joint, DampedSpringParam p_param) const = 0;
virtual JointType joint_get_type(RID p_joint) const = 0; virtual JointType joint_get_type(RID p_joint) const = 0;
@ -678,7 +678,7 @@ VARIANT_ENUM_CAST(PhysicsServer2D::BodyState);
VARIANT_ENUM_CAST(PhysicsServer2D::CCDMode); VARIANT_ENUM_CAST(PhysicsServer2D::CCDMode);
VARIANT_ENUM_CAST(PhysicsServer2D::JointParam); VARIANT_ENUM_CAST(PhysicsServer2D::JointParam);
VARIANT_ENUM_CAST(PhysicsServer2D::JointType); VARIANT_ENUM_CAST(PhysicsServer2D::JointType);
VARIANT_ENUM_CAST(PhysicsServer2D::DampedStringParam); VARIANT_ENUM_CAST(PhysicsServer2D::DampedSpringParam);
//VARIANT_ENUM_CAST( PhysicsServer2D::ObjectType ); //VARIANT_ENUM_CAST( PhysicsServer2D::ObjectType );
VARIANT_ENUM_CAST(PhysicsServer2D::AreaBodyStatus); VARIANT_ENUM_CAST(PhysicsServer2D::AreaBodyStatus);
VARIANT_ENUM_CAST(PhysicsServer2D::ProcessInfo); VARIANT_ENUM_CAST(PhysicsServer2D::ProcessInfo);