Custom Importer API now available

For discussion and help with the Construct 3 Plugin SDK

Post » Mon Jan 08, 2018 5:14 pm

In Construct 3 r76, we've added the first iteration of the Custom Importer API. The intent of this API is to allow plugins to import custom data formats in to C3 projects, in particular, skeletal animation formats. The API is designed to be general purpose, and it should allow the developers of these formats to maintain their own importers themselves, without having to go via Scirra.

To get started, download the plugin SDK v1.2 and check out the customImporterPlugin sample. Download the Custom Importer API sample data further down the page too. If you then install the plugin, then drag-and-drop the sample data .zip to an empty layout, it should create and position three sprite instances based on the data in the zip. It's pretty basic but hopefully it's enough to demonstrate the principle of reading a custom data format.

The current API is definitely a minimum-viable-product, and I expect we'll have to add many more API interfaces to fully support skeletal animation formats. So for that I'm interested to hear back from any other developers what kinds of other APIs that are needed. All currently available APIs in r76 are already documented - the starting point is SDK.UI.Util.AddDragDropFileHandler(). If it's not documented, we haven't added it yet, so please add it to your request list.

Please let me know how this works out for you! Tagging some developers who may be interested: @lucid @badlogic @kmoon11
Scirra Founder
B
414
S
245
G
92
Posts: 25,201
Reputation: 200,343

Post » Sat Jan 13, 2018 6:14 pm

Thanks @Ashley - will take a look
Spriter Dev
B
103
S
22
G
12
Posts: 3,285
Reputation: 17,151

Post » Tue Jan 23, 2018 3:17 pm

@Ashley - I have a couple of questions about the importer API. First in the example plugin.js, on line 70, you have: const imageEntry = zipFile.GetEntry(filename);

// Look for the given filename in the zip file.
const imageEntry = zipFile.GetEntry(filename);
if (!imageEntry)
return; // referenced filename is missing in zip

// If the file exists, read the referenced image file as a Blob.
const imageBlob = await zipFile.ReadBlob(imageEntry);


Is it possible to have it read from the folder of the dropped file, or does it have to be a zip file that contains the other files?

Second question, how would I go about adding entries to the event sheet - In C2, dragging and dropping the scml file created the On Initialized event, and added the Associate actions. Is this possible with this API yet?
Spriter Dev
B
103
S
22
G
12
Posts: 3,285
Reputation: 17,151

Post » Wed Jan 24, 2018 11:51 am

lucid wrote:Is it possible to have it read from the folder of the dropped file, or does it have to be a zip file that contains the other files?

Do you mean reading a different file on disk other than the one dropped in? No, that would be a security issue, so browsers block it at the moment. This is why everything's centered on a zip file, since you can get an entire folder of files.

Second question, how would I go about adding entries to the event sheet - In C2, dragging and dropping the scml file created the On Initialized event, and added the Associate actions. Is this possible with this API yet?

It's not possible yet - best post a comment on the issue so it's not forgotten: https://github.com/Scirra/Construct-3-bugs/issues/836
Scirra Founder
B
414
S
245
G
92
Posts: 25,201
Reputation: 200,343


Return to Plugin SDK

Who is online

Users browsing this forum: No registered users and 0 guests