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

GDScript but not C# is able to set Blend Shapes values via code #36243

Closed
GeorgeS2019 opened this issue Feb 15, 2020 · 4 comments
Closed

GDScript but not C# is able to set Blend Shapes values via code #36243

GeorgeS2019 opened this issue Feb 15, 2020 · 4 comments

Comments

@GeorgeS2019
Copy link

GeorgeS2019 commented Feb 15, 2020

Godot version: 3.2 (stable) mono

OS/device including version: Windows 10 19014

Issue description:
The attached project shows GDScript (but not a similar c#) is able to set the blend_shape value via code

Steps to reproduce:
See the attached project, run Game scene with 2 sphere, the one (red) with GDscript works, not the green sphere with c#

Minimal reproduction project:
[BlendShapeCsharp.zip]
(https://github.com/godotengine/godot/files/4208427/BlendShapeCsharp.zip)
Ref of the modified project:

Other open issues with blend shapes
Most relevant:
#15778

Other FYI isseus:
#31595
#34658
#24226
#17749

@GeorgeS2019
Copy link
Author

In Csharp, BlendShape are get and set through two classes
ArrayMesh.cs and VisualServer.cs

Interestingly, in ArrayMesh.cs there is no corresponding SetBlendShapeWeight method
Could this explain why the above bug happens?

================================================
There is this method in VisualServer.cs

/// <summary>
/// <para>Sets the weight for a given blend shape associated with this instance.</para>
/// </summary>
[GodotMethod("instance_set_blend_shape_weight")]
public static void InstanceSetBlendShapeWeight(RID instance, int shape, float weight)
{
     NativeCalls.godot_icall_3_630(method_bind_262, ptr, RID.GetPtr(instance), shape, ref weight);
}

@BastiaanOlij
Copy link
Contributor

instance_set_blend_shape_weight is a method that is called from MeshInstance and takes data from the mesh instance consuming the mesh. I'm guessing each mesh instance can set their own weights even when they reuse the same mesh.

If you try and call that method on the visual server and pass it an ArrayMesh instead of a MeshInstance I can imagine it will crash.

@neikeq
Copy link
Contributor

neikeq commented Feb 24, 2020

From a quick look, you're calling set in GDScript but _Set in C# instead of Set. Could that be the cause?

@GeorgeS2019
Copy link
Author

@neikeq I just check, U are right. Next time, I go straight to u without waiting too long here :-)

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

No branches or pull requests

5 participants