SpriteLoop + Defold Extension Development Log

SpriteLoop 0.10.0 is now available.

Highlights

  • Source image reloading
  • Animation events
  • Smart Limb setup editing
  • Animation & skin duplication
  • Fullscreen mode
  • Move tool
  • Animated WebP export
  • Defold extension improvements

Timeline Events:


Reloading source images:


Exporting progress:

The Defold extension is updated to support events & fix some component bugs. Thanks @Alexander_Bulatov for the bug reports :1st_place_medal:

https://github.com/Balkan-Ram-Games/spriteloop-defold/archive/refs/tags/v0.8.0-alpha.zip

The new API for Events:

local spriteloop = require "spriteloop.spriteloop"

function init(self)
    self.step_listener = spriteloop.listen("#robot", "step", function(event)
        print("step at frame", event.frame)
    end)
end

function update(self, dt)
    spriteloop.dispatch_events("#robot")
end

function final(self)
    spriteloop.unlisten("#robot", self.step_listener)
end

Let me know if you find anything broken :smiley:

6 Likes

Great job! I really appreciate how quickly you’re improving SpriteLoops and responding to feedback.

3 Likes

I couldn’t get the callback example from the documentation to work.

Using the documented approach:

local spriteloop = require "spriteloop.spriteloop"

function init(self)
    self.step_listener = spriteloop.listen("#robot", "step", function(event)
        print("step at frame", event.frame)
    end)
end

function update(self, dt)
    spriteloop.dispatch_events("#robot")
end

function final(self)
    spriteloop.unlisten("#robot", self.step_listener)
end

No callbacks are triggered.

However, this approach works:

function update(self, dt)
    local events = spriteloop.dispatch_events("#robot")

    for _, event in ipairs(events) do
        print(event.name, event.frame)
    end
end

So the events are definitely being generated and returned by dispatch_events(), but the listener callback never seems to be called.

Hi, it works on my computer! :grin:

Can you check if the example project works for you? There is a Load Events button that starts the test scene.

Off the top of my head, possible reasons it may not work:

  • There might still be a bug with the component not updating and reading an old file without events.
  • The extension version may not be updated.
  • The events may have different names.
  • The #component name may be incorrect.
  • The animation has to be played after the listeners are defined.
  • You should use either the consume_events approach or the listeners approach, not both.

Events are stored as a list/queue. The listeners approach consumes them for you and triggers the callback. The consume approach gives you more control, but if the events are not consumed, they will pile up.

P.S.

It’s too early and I can’t read! :sweat_smile:

If the other approach works, then it’s probably not an issue with the component not updating or the extension version.

Please check the test scene and let me know if it works or not. Feel free to open an issue on GitHub if it still fails.

1 Like

Sorry, my mistake! :sweat_smile:

The issue was on my side - I used the wrong event name when registering the listener.

After correcting the event name, the callbacks work as expected. Thanks for taking the time to help and for the detailed explanation!

1 Like

After updating to Defold 1.13.0, projects using the SpriteLoops extension no longer build on my Mac (Apple Silicon).

The build fails while processing the extension and attempting to run protoc:

com.defold.extender.ExtenderException: java.io.IOException: Cannot run program ".../protoc": Failed to exec spawn helper

Has anyone else encountered this issue with Defold 1.13.0 or other native extensions?

The same project was building successfully before the update.

I think there is a general issue with the native extension server. I’m getting a different error while testing another extension(s). Maybe @ekharkunov might help

ext.manifest
	com.defold.extender.ExtenderException: java.io.IOException: Cannot run program "clang++" (in directory "/var/folders/tn/5rwq3j0d41z37qlbh_15j9m80000gn/T/job5852987532467959181"): Failed to exec spawn helper: pid: 22121, exit code: 1, error: 0 (none) 
Possible reasons:
  - Spawn helper ran into JDK version mismatch
  - Spawn helper ran into unexpected internal error
  - Spawn helper was terminated by another process
Possible solutions:
  - Restart JVM, especially after in-place JDK updates
  - Check system logs for JDK-related errors
  - Re-install JDK to fix permission/versioning problems
  - Switch to legacy launch mechanism with -Djdk.lang.Process.launchMechanism=FORK
2 Likes

What i make wrong?

local spriteloop = require “spriteloop.spriteloop”

function init(self)
local component = “#spriteloop”
spriteloop.set_skin(component, “test”)
spriteloop.set_variant(component, “Artboard 13”, “Artboard 5”)
end

When I build it, the skin changes, the variant doesn’t change.

Can be something with the names. In all my examples I use dashes and underscore instead of spaces. I can check the code later today. It can be something like the animation IDs issue.

P.S. I haven’t had the chance to test te beta yet.

this is a test example, in the main project I have the names lower case without spaces and other separators, and it’s the same there.

1 Like

The issue is with the IDs :grinning_face_with_smiling_eyes:

You can try:

spriteloop.get_info()

to inspect the IDs of the parts and variants.

They will look something like this:

"id": "variant_ab7b0f44d79f479f9a9d1b977b5e869f",
"part": "part_4111115cfdc04d618e31b2182375636e"

I’ll update the extension to work with display names instead :sweat_smile:

The example scene works because I store those IDs in variables and then pick random ones, so I never type them manually.

My bad! :face_with_hand_over_mouth:

1 Like

Pushed a small fix for the Defold extension and updated the app as well.

Changes in this update:

  • Fixes skin renaming issues
  • Adds part and variant keys to the API

I also created a separate GitHub repo for SpriteLoop app issue tracking, so app-related bugs and feature requests can go there.

There is also a Discussions board in the repo if anyone wants deeper discussions about workflows, feature ideas, or other SpriteLoop-related topics.

This forum thread is still the main place for updates, but it has grown quite a bit, so I thought having a dedicated repo and discussions board might help keep things organized, and maybe save the forum moderators from too many SpriteLoop notifications :grinning_face_with_smiling_eyes:

New Defold extension version (v0.8.1-alpha):
Download v0.8.1-alpha

SpriteLoop app repo (issues / discussions):
SpriteLoop App Repository

3 Likes

A small update before everybody hits the beach :palm_tree::ocean::beach_with_umbrella:

SpriteLoop 0.11.0 is now available.

  • Added a brand new Start Screen with recent projects, pinning, and quick project actions.
  • Added data package import (spriteloop.import.json) for creating projects directly from external tools.
  • Released first official import plugins for Krita and Photoshop.
  • Export settings are now saved per project and restored automatically.

7 Likes

Love it—the new interface looks really cool. I hope future versions include features for color manipulation; you know, for images that need to change color at runtime—it’s pretty tough dealing with a bunch of all-white sprites, as you can imagine! :rofl:

1 Like