lucid's Recent Forum Activity

  • 3-20-2026

    • Updated to Addon SDK v2

    Please note:

    For legacy projects updating from a previous version of the plugin, if you're using self-draw, you'll need to click on the new property button labeled "Extract embedded atlas files" in order to make those objects visible.

    This is a (hopefully temporary) workaround for a function that's not in the new SDK. I've posted about it to let Ashley know, and we'll update the plugin to eliminate this requirement if and when the SDK supports the required function.

  • Hi Ashley, hope all is well. We just got finished porting the Spriter plugin to the new SDK, and there are a few of features from the original that are either missing or we couldn't locate in the docs as officially supported. We were able to find workarounds for all of them, but we would prefer to use the SDK as intended.

    1. Accessing a plugin's own animation frames at runtime

    We use SetHasAnimations(true) and load atlas PNGs into the plugin's animation frames at import time (editor-side). At runtime we need to enumerate those frames (legacy equivalent: GetObjectClass().GetAnimations()[0].GetFrames()), but we can't find a documented SDK v2 runtime API for this.

    With the edit-time access, we're manually adding the images we need to the project files which works, but means duplicating image data.

    2. Runtime methods/properties we couldn't find

    There are also several runtime operations where we're probing multiple method names, because we couldn't find the documented SDK v2 equivalent. This is working as a temporary workaround, but we'd like to replace these with the correct single API call. Apologies if they're already in the docs. I did a few searches and I couldn't find them:

    • Set origin/hotspot (SetOriginX/setOriginX, SetOriginY/setOriginY)

    • Invalidate bbox (SetBboxChanged/setBboxChanged)

    • Enable/disable collision (SetCollisionEnabled/setCollisionEnabled)

    • Enumerate instances (instances(), getAllInstances(), GetInstances())

    • Object type name (GetName(), .name)

    • Instance UID (GetUID(), getUID(), getUid(), .uid)

    • Container siblings (GetSiblings(), getSiblings())

    • Picked/paired instance (getPickedInstances(), getFirstPickedInstance(), getPairedInstance())

    • Sprite frame index (read) (_currentFrameIndex, currentFrameIndex, animationFrame)

    • Sprite frame index (write) (_DoChangeAnimFrame(), _changeAnimFrameIndex, animationFrame)

    • No-premultiply blend (renderer.SetNoPremultiplyAlphaBlend/setNoPremultiplyAlphaBlend)

  • hello EMI INDO

    Could you please run the automation script on (unless this is something I'm supposed to download myself and use. I can't find the download link):

    construct.net/en/make-games/addons/192/spriter

    I'm guessing it will need some manual tweaking after the automated process, but I wouldn't mind the head start. Thanks for the work you've done here.

  • 6-26-2024

    • Fixed a long standing bug where alpha values weren't multiplying correctly resulting in odd rendering in self-draw mode
    • Changed the default value for blend mode to use effects blend mode. This value should always be used, but we will keep the option in there to avoid breaking old projects
  • Ashley - that was it. Thank you.

  • Ashley

    I altered your drawing plugin example to make a bare bones test. I made it use the this._info.SetHasAnimations(true) instead of this._info.SetHasImage(true) and it just grabs the image from the first frame of the first animation. I also changed the renderer script to draw a series of partially overlapping images with varying opacity.

    This is all it does in render:

    renderer.SetAlphaBlend();
    const imageInfo = this._objectClass.GetAnimations()[0].GetFrames()[0].GetImageInfo();
    const texture = imageInfo.GetTexture();
    
    if (!texture)
    	return;	
    
    const wi = this.GetWorldInfo();
    const quad = wi.GetBoundingQuad();
    const rcTex = imageInfo.GetTexRect();
    
    renderer.SetTexture(texture);
    for (var i = 0; i < 5; i++)
    {
    	renderer.SetOpacity(1.0-(i/4.0));
    	renderer.Quad3(quad, rcTex);
    	quad.offset(-50, 0); 
    	renderer.Quad3(quad, rcTex);
    	quad.offset(-50, 0); 			
    }
    

    Here are the files if you want to test for yourself:

    download test plugin

    download test project

    If I use renderer.SetAlphaBlend() or don't set the blend mode at all, it looks like this:

    You can see it seems to multiply the color value making it brighter and brighter as the opacity gets lower and lower. (Opacity decreases as it goes from right to left)

    I know you said it would require preMultiplied alpha, but just for completeness sake, if I use renderer.SetNoPremultiplyAlphaBlend(), it looks like this:

    If you look to the edges of the head you can see that partially transparent colors have the background color bleed through.

    If I just manually paste separate instances with different opacities in the editor rather than draw them in the Draw function, we get what we would expect:

    Is this a bug in the SDK? Or is there something I can do to make the plugins draw how we see it in that last image?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley, for the sake of brevity, let's say I have

    var texture = this.GetObjectClass().GetAnimations()[0].GetFrames()[0].GetImageInfo().GetTexture();
    
    renderer.SetTexture(texture);
    renderer.SetOpacity(1);
    renderer.SetColorRgba(1,1,1,1);
    

    and then a Quad4

    Is there something I could be doing here to change the texture to or from non-premultiplied alpha or premultiplied mode?

  • Hello all, Ashley

    I've been at this for many hours and I can't figure out why it is doing this.

    In the original plugin SDK, within Draw(renderer), I have:

    renderer.SetNoPremultiplyAlphaBlend();
    

    followed by multiple:

    renderer.Quad4(q,finalUv)
    

    This was working on a much older version of C3.

    When I do this with overlapping Quad4s, the background color shows through semi-transparent parts of the quads.

    it should look like this (the red square is fully opaque):

    but instead it looks like this (I made the lower layer green to make the issue more obvious):

    here's another example (none of the green lines should be there. And they appear everywhere there are semi-transparent areas and borders):

    I tried setting

    renderer.SetAlphaBlend().
    

    I tried:

    const wi = this.GetWorldInfo();
    renderer.SetBlendMode(wi.GetBlendMode());
    

    which both result in a different visual issue even when normal blending mode is set. It looks hyper-saturated. Like two semi-transparent items are having their brightness multiplied:

    I also tried:

    • with and without a layer beneath
    • with and without force own texture set for the layer being drawn to
    • using Quad3D2 instead of Quad4
    • using source images of different bitdepths
    • several webGL workarounds I found on the web for similar issues

    but it always has this same result.

    Any ideas?

  • luckyrawatlucky

    8-16-2021

    • Fixed bug (introduced when multi-spritesheet import was added) that prevented non-self-draw zip files from being imported.
  • 8-12-2021

    • Fixed a bug where projects could sometimes freeze on single atlas image projects in newer versions of C3
  • FunkY Koval

    I will look into this in the future. I'm not sure when, but definitely not before late next month, as the move has been delayed and is still eating up a lot of time.

    Chadori

    Thank you. Possibly/probably no bug is definitely good news.

    ibiz

    Yes. Use File | Generate spritesheets for project images and in the dialog that appears make sure to embed the spritesheet info into the file so the plugin can read it. And on the left side of the dialog there are options for how to size the spritesheet including splitting it into multiple sheets.

  • Hello everyone. I'm currently preparing to move to a new city, so I'll be pretty busy and scarce for the next couple of weeks.

    7-7-2021

    • Added support for multiple spritesheets (make sure all sprite sheet json files are in zip)

    Chadori it's definitely not supposed to work like that. I just tried it out, and it's behaving as expected and firing one time for each key. If you want to send me an example of a non-working project I can look into it.

lucid's avatar

lucid

Member since 16 Jan, 2009

Twitter
lucid has 25 followers

Connect with lucid

Trophy Case

  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

24/44
How to earn trophies