Skip to content

Commit

Permalink
Derive Var and Export for DynGd<T, D>
Browse files Browse the repository at this point in the history
- Rename test class from `RefcGdExporter` to `RefcDynGdExporter`
  • Loading branch information
Yarwin committed Jan 8, 2025
1 parent aae1e66 commit 602a3a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions godot-core/src/registry/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ pub(crate) fn try_dynify_object<T: GodotClass, D: ?Sized + 'static>(
Err(error.into_error(object))
}

/// Responsible for creating hint_string for [`DynGd<T, D>`][crate::obj::DynGd] properties that works with [`PropertyHint::NODE_TYPE`][crate::global::PropertyHint::NODE_TYPE] or [`PropertyHint::RESOURCE_TYPE`][crate::global::PropertyHint::RESOURCE_TYPE].
/// Responsible for creating hint_string for [`DynGd<T, D>`][crate::obj::DynGd] properties which works with [`PropertyHint::NODE_TYPE`][crate::global::PropertyHint::NODE_TYPE] or [`PropertyHint::RESOURCE_TYPE`][crate::global::PropertyHint::RESOURCE_TYPE].
///
/// Godot offers very limited capabilities when it comes to validating properties in the editor if given class isn't a tool.
/// Proper hint string combined with `PropertyHint::NODE_TYPE` or `PropertyHint::RESOURCE_TYPE` allows to limit selection only to valid classes - this being the ones registered as implementors of given `DynGd<T, D>`'s `D` trait.
/// Proper hint string combined with `PropertyHint::NODE_TYPE` or `PropertyHint::RESOURCE_TYPE` allows to limit selection only to valid classes - those registered as implementors of given `DynGd<T, D>`'s `D` trait.
///
/// See also [Godot docs for PropertyHint](https://docs.godotengine.org/en/stable/classes/[email protected]#enum-globalscope-propertyhint).
pub(crate) fn get_dyn_property_hint_string<D>() -> GString
Expand Down
4 changes: 2 additions & 2 deletions itest/godot/ManualFfiTests.gd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func test_export():
node.free()

func test_export_dyn_gd():
var dyn_gd_exporter = RefcGdExporter.new()
var dyn_gd_exporter = RefcDynGdExporter.new()

# NodeHealth is valid candidate both for `empty` and `second` fields.
var node = NodeHealth.new()
Expand All @@ -86,7 +86,7 @@ func test_export_dyn_gd():
node.free()

func test_export_dyn_gd_should_fail_for_wrong_type():
var dyn_gd_exporter = RefcGdExporter.new()
var dyn_gd_exporter = RefcDynGdExporter.new()
var refc = RefcHealth.new()

disable_error_messages()
Expand Down
2 changes: 1 addition & 1 deletion itest/rust/src/object_tests/dyn_gd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl InstanceIdProvider for foreign::NodeHealth {

#[derive(GodotClass)]
#[class(init)]
struct RefcGdExporter {
struct RefcDynGdExporter {
#[var]
first: Option<DynGd<Object, dyn Health>>,
#[export]
Expand Down

0 comments on commit 602a3a0

Please sign in to comment.