Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose soft body pin methods to GDScript #52369

Merged
merged 2 commits into from
Sep 17, 2021
Merged

Conversation

bengtsts
Copy link
Contributor

@bengtsts bengtsts commented Sep 3, 2021

This change was merged into master #51364 but requires class name changes for 3.x in code and documentation.
Node3D changed to Spatial and SoftBody3D to SoftBody.

@bengtsts bengtsts requested review from a team as code owners September 3, 2021 03:46
@Calinou Calinou added this to the 3.4 milestone Sep 3, 2021
@pouleyKetchoupp pouleyKetchoupp requested review from a team and removed request for pouleyKetchoupp September 3, 2021 21:00
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've just re-run the linux job, I don't think it failed for a good reason.

@pouleyKetchoupp
Copy link
Contributor

My bad, there's a legitimate error in mono:

/home/runner/work/godot/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/SoftBody.cs(634,74): error CS1750: A value of type 'string' cannot be used as a default parameter because there are no standard conversions to type 'NodePath' [/home/runner/work/godot/godot/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj]

I'm not sure why this is happening. Maybe something wrong with an empty NodePath as default parameter.

@pouleyKetchoupp
Copy link
Contributor

I've just tested locally, it looks like it could be a bug in mono (maybe fixed only on master since this error happens on 3.x only).

The generated mono glue for the new exposed method is:

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private static IntPtr method_bind_34 = Object.godot_icall_Object_ClassDB_get_method(nativeName, "set_point_pinned");

[GodotMethod("set_point_pinned")]
public void SetPointPinned(int pointIndex, bool pinned, NodePath attachmentPath = "")
{
    NativeCalls.godot_icall_3_802(method_bind_34, Object.GetPtr(this), pointIndex, pinned, NodePath.GetPtr(attachmentPath));
}

Although the node path argument should be NodePath attachmentPath = NodePath() or NodePath attachmentPath = NodePath("")

@neikeq Do you know what could cause this issue?

@neikeq
Copy link
Contributor

neikeq commented Sep 4, 2021

@pouleyKetchoupp

This:

case Variant::STRING:
case Variant::NODE_PATH:
r_iarg.default_argument = "\"" + r_iarg.default_argument + "\"";
break;

should be:

if (r_iarg.type.cname == name_cache.type_NodePath) {
	r_iarg.default_argument = "(%s)\"" + r_iarg.default_argument + "\"";
	r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
} else {
	CRASH_COND(r_iarg.type.cname != name_cache.type_String);
	r_iarg.default_argument = "\"" + r_iarg.default_argument + "\"";
}
break;

to match current master.

@akien-mga
Copy link
Member

Rebasing on latest 3.x should fix the Mono build issue.

@pouleyKetchoupp
Copy link
Contributor

Please squash your commits (see interactive rebase) and it should be good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants