-
Notifications
You must be signed in to change notification settings - Fork 21
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
ShaderMaterial: How do you create a JS object based on an interface with no class implementation? #33
Comments
What I ended up doing is make a copy of the generated class for I'm not sure if this will work, but it's not throwing any errors anymore. |
Ah, it works! For those interested, I urge you to add "DebugLayer" to the generator classes and add this to any scene:
It's nice to verify that the shaders have been loaded (even if they're not working as intended) |
Hello @limefrogyank, Sorry for not getting back to you sooner on this issue! Here is an example of a generated interface: IAudioEngine.cs If you have any other issues or questions that would be appreciated! And thanks for showing interest in this project! |
Hi @canhorn How do you create a new instance of an interface-nameCachedEntity? If I look at Line 223 in 7e927d2
But neither of these actually calls and therefore __guid is always null. When I try to set a property on a CachedEntity using
|
@badcommandorfilename (I have not tested this fully) function createEmptyObject() {
return {};
} public static IAudioEnginCachedEntity CreateNew()
{
return EventHorizonBlazorInterop.FuncClass(
entity => new IAudioEnginCachedEntity(entity),
new string[] { "createEmptyObject" }
);
} This will run the object through the caching layers giving it a GUID that will allow for it to be resolved, fixing the type error from the bridge. I will see if I can get something into the generator or supporting library that will bake this into the implementations for the interface in C#. |
Thanks for confirming @canhorn ! I came up with a similar solution by shimming in:
Into the parameterless constructors where needed. If adding that to GenerateInteropClassStatement.cs seems like an acceptable solution I can make a PR, but if you've already got a fix in mind this is fine for me as a workaround. I actually even tried just adding it to:
And so far that hasn't broken anything (although it is probably allocating too many excess entity objects) =) |
I tried adding
ShaderMaterial
to the generator project. However, one of the parameters for the constructor takes anIShaderMaterialOptions
. That has no constructor in the Babylon library, it's just an interface. I have no idea how to use that via the generated classes... as far as I can tell, you need a typescript class implementing the interface.The text was updated successfully, but these errors were encountered: