Fix changes after ObjectTypeDB -> ClassDB renaming
This commit is contained in:
parent
9ba5414391
commit
5aceaeb86d
|
@ -23,9 +23,9 @@ This makes Objects gain a lot of functionality, like for example
|
|||
.. code:: cpp
|
||||
|
||||
obj = memnew(CustomObject);
|
||||
print_line("Object Type: ",obj->get_type()); //print object type
|
||||
print_line("Object class: ", obj->get_class()); // print object class
|
||||
|
||||
obj2 = obj->cast_to<OtherType>(); // converting between types, this also works without RTTI enabled.
|
||||
obj2 = obj->cast_to<OtherClass>(); // converting between classes, this also works without RTTI enabled.
|
||||
|
||||
References:
|
||||
~~~~~~~~~~~
|
||||
|
@ -43,16 +43,16 @@ Classes are registered by calling:
|
|||
|
||||
.. code:: cpp
|
||||
|
||||
ClassDB::register_type<MyCustomType>()
|
||||
ClassDB::register_class<MyCustomClass>()
|
||||
|
||||
Registering it will allow the type to be instanced by scripts, code, or
|
||||
Registering it will allow the class to be instanced by scripts, code, or
|
||||
creating them again when deserializing.
|
||||
|
||||
Registering as virtual is the same but it can't be instanced.
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
ClassDB::register_virtual_type<MyCustomType>()
|
||||
ClassDB::register_virtual_class<MyCustomClass>()
|
||||
|
||||
Object-derived classes can override the static function
|
||||
``static void _bind_methods()``. When one class is registered, this
|
||||
|
@ -88,7 +88,7 @@ string passing the name can be passed for brevity.
|
|||
References:
|
||||
~~~~~~~~~~~
|
||||
|
||||
- `core/object_type_db.h <https://github.com/godotengine/godot/blob/master/core/object_type_db.h>`__
|
||||
- `core/class_db.h <https://github.com/godotengine/godot/blob/master/core/class_db.h>`__
|
||||
|
||||
Constants
|
||||
---------
|
||||
|
@ -165,10 +165,9 @@ set/get functions exist. Example:
|
|||
|
||||
.. code:: cpp
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT,"amount"), _SCS("set_amount"), _SCS("get_amount") )
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount"), "set_amount", "get_amount")
|
||||
|
||||
This creates the property using the setter and the getter. ``_SCS`` is a
|
||||
macro that creates a StringName efficiently.
|
||||
This creates the property using the setter and the getter.
|
||||
|
||||
Binding properties using ``_set``/``_get``/``_get_property_list``
|
||||
-----------------------------------------------------------------
|
||||
|
@ -184,8 +183,8 @@ call).
|
|||
.. code:: cpp
|
||||
|
||||
void _get_property_info(List<PropertyInfo> *r_props); // return list of properties
|
||||
bool _get(const StringName& p_property, Variany& r_value) const; //return true if property was found
|
||||
bool _set(const StringName& p_property, const Variany& p_value); //return true if property was found
|
||||
bool _get(const StringName &p_property, Variant &r_value) const; // return true if property was found
|
||||
bool _set(const StringName &p_property, const Variant &p_value); // return true if property was found
|
||||
|
||||
This is also a little less efficient since ``p_property`` must be
|
||||
compared against the desired names in serial order.
|
||||
|
@ -217,7 +216,7 @@ languages). Connecting to them is rather easy:
|
|||
.. code:: cpp
|
||||
|
||||
obj->connect(<signal>, target_instance, target_method)
|
||||
//for example
|
||||
// for example:
|
||||
obj->connect("enter_tree", this, "_node_entered_tree")
|
||||
|
||||
The method ``_node_entered_tree`` must be registered to the class using
|
||||
|
|
Loading…
Reference in New Issue