Skip to content

Commit

Permalink
Allow passing DynGd to Godot APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Nov 24, 2024
1 parent 13cc14f commit 8176c01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion godot-core/src/meta/args/object_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ where
}
}
*/

impl<T, U> AsObjectArg<T> for &Gd<U>
where
T: GodotClass + Bounds<Declarer = bounds::DeclEngine>,
Expand Down
12 changes: 12 additions & 0 deletions itest/rust/src/object_tests/dyn_gd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ fn dyn_gd_downgrade() {
assert_eq!(gd.instance_id(), dyn_id);
}

#[itest]
fn dyn_gd_pass_to_godot_api() {
let child = foreign::NodeHealth::new_alloc().into_dyn();

let mut parent = Node::new_alloc();
parent.add_child(&child);

assert_eq!(child.get_parent().as_ref(), Some(&parent));

parent.free();
}

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Example symbols

Expand Down

0 comments on commit 8176c01

Please sign in to comment.