Skip to content

Commit

Permalink
Merge pull request #9918 from Calinou/gdextension-cpp-example-fix-add…
Browse files Browse the repository at this point in the history
…-property

Fix `ADD_PROPERTY()` calls in GDExtension C++ example to use correct syntax
  • Loading branch information
mhilbrunner authored Sep 9, 2024
2 parents d1c0b15 + fe80ff2 commit ea97a4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tutorials/scripting/gdextension/gdextension_cpp_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ show the methods we end up changing, don't remove the lines we're omitting:
void GDExample::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_amplitude"), &GDExample::get_amplitude);
ClassDB::bind_method(D_METHOD("set_amplitude", "p_amplitude"), &GDExample::set_amplitude);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "amplitude"), "set_amplitude", "get_amplitude");
}
Expand Down Expand Up @@ -554,7 +555,8 @@ showing the methods that have changed so don't remove anything we're omitting:
...
ClassDB::bind_method(D_METHOD("get_speed"), &GDExample::get_speed);
ClassDB::bind_method(D_METHOD("set_speed", "p_speed"), &GDExample::set_speed);
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
}
GDExample::GDExample() {
Expand Down Expand Up @@ -648,7 +650,7 @@ as follows:
void GDExample::_bind_methods() {
...
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
ADD_SIGNAL(MethodInfo("position_changed", PropertyInfo(Variant::OBJECT, "node"), PropertyInfo(Variant::VECTOR2, "new_pos")));
}
Expand Down

0 comments on commit ea97a4d

Please sign in to comment.