Skip to content

Commit ea97a4d

Browse files
authored
Merge pull request #9918 from Calinou/gdextension-cpp-example-fix-add-property
Fix `ADD_PROPERTY()` calls in GDExtension C++ example to use correct syntax
2 parents d1c0b15 + fe80ff2 commit ea97a4d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tutorials/scripting/gdextension/gdextension_cpp_example.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ show the methods we end up changing, don't remove the lines we're omitting:
497497
void GDExample::_bind_methods() {
498498
ClassDB::bind_method(D_METHOD("get_amplitude"), &GDExample::get_amplitude);
499499
ClassDB::bind_method(D_METHOD("set_amplitude", "p_amplitude"), &GDExample::set_amplitude);
500+
500501
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "amplitude"), "set_amplitude", "get_amplitude");
501502
}
502503
@@ -554,7 +555,8 @@ showing the methods that have changed so don't remove anything we're omitting:
554555
...
555556
ClassDB::bind_method(D_METHOD("get_speed"), &GDExample::get_speed);
556557
ClassDB::bind_method(D_METHOD("set_speed", "p_speed"), &GDExample::set_speed);
557-
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
558+
559+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
558560
}
559561
560562
GDExample::GDExample() {
@@ -648,7 +650,7 @@ as follows:
648650
649651
void GDExample::_bind_methods() {
650652
...
651-
ADD_PROPERTY("GDExample", PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
653+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed", PROPERTY_HINT_RANGE, "0,20,0.01"), "set_speed", "get_speed");
652654
653655
ADD_SIGNAL(MethodInfo("position_changed", PropertyInfo(Variant::OBJECT, "node"), PropertyInfo(Variant::VECTOR2, "new_pos")));
654656
}

0 commit comments

Comments
 (0)