A plugin similar to extension-simpledata

I’m trying to make a plugin based on simpledata. I want to put binary data on an object.

I expect the following code to return the contents of the binary file:

go.get("/go#data", "data")

But at the moment I only get the hash of the binary file name.

defold-component-data.zip (48.8 KB)

Is this even possible or does it contradict defold?
I’ve achieved the following at the moment, but I don’t understand how to make the editor collect the data. Is it possible?

2 Likes

I think that go.get is able to return only number, hash, url, vector3, vector4, quat, bool, matrix4 types.

If you want to return something else, then you need to implement a custom Lua function like simpledata.get_array_f32, as it was in the example.

1 Like

First of all, I can’t get the data from the binary file to get into the build.

You just need a function that takes a hashed file path and reads its contents. sys.load_resource() should do this, but it seems to only accept the path as a string for some reason. It should be easy to write your own simpledata.get_bin() function like resource.get_atlas().

1 Like