GetImage in edittime from pluginproperty like 3DShape plugin

0 favourites
  • 12 posts
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Hey forum!

    I was in the process of creating a sort of SpriteCloner plugin that basically clones a sprite object without having to add many other sprite objects to the project (sounds confusing, but I need it for my project). Anyway, I've now added a plugin property where you can select a sprite (just like 3DShape's front face object property). Now I would like to set the image of this instance of my sprite cloner plugin to that of the selected sprite in the edit time. Now where do I get the image of the selected sprite?

    It should basically work just like in the 3DShape plugin in which the face of the Shape gets updated during edittime:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone know the answer to this?

  • No one?

  • The object property gives an id, and you can use one of the runtime methods to get the object class from the id. Object class is just the base of object type so you should be able to use the methods of either. From the object type you can use get image to get an animation interface where you can get the texture.

    This is based on looking through the sdk docs.

  • The object property gives an id, and you can use one of the runtime methods to get the object class from the id. Object class is just the base of object type so you should be able to use the methods of either. From the object type you can use get image to get an animation interface where you can get the texture.

    This is based on looking through the sdk docs.

    Yeah I already got to the part to get the texture in edittime but I don't how I can then set the image of my plugin to the texture I just got

  • If you got the texture then it’s just a matter of using it in the render function I suppose.

  • If you got the texture then it’s just a matter of using it in the render function I suppose.

    During edittime? What would be the render function here?

  • At edit time and at runtime there are sdk functions where you specify how the object is drawn in your plugin.

  • At edit time and at runtime there are sdk functions where you specify how the object is drawn in your plugin.

    Great! Is there a way that I can get the texture as image? Like a png or a blob or something?

  • The sdk manual says nothing about getting a texture’s image.

    Take all my suggestions with a grain of salt. I can only go by what I find in the manual. When actually making a plugin you have the other tool of using console.log with whatever object you’re curious about and then you can then browse that object from the browsers debug console. That would let you confirm the things the manual lists as well as show anything not mentioned.

  • The sdk manual says nothing about getting a texture’s image.

    Take all my suggestions with a grain of salt. I can only go by what I find in the manual. When actually making a plugin you have the other tool of using console.log with whatever object you’re curious about and then you can then browse that object from the browsers debug console. That would let you confirm the things the manual lists as well as show anything not mentioned.

    Thanks a lot! One more thing: What is the difference between a Texture and an Image?

  • On disk or on a server it’s considered a file such as png.

    Once the file is loaded and decoded into an array of pixels in memory it’s an image.

    To render the image it needs to be copied over to video memory which is a texture.

    In webgl for example you’d first create an html image object from the png then a webgl texture object from the image.

    If you delve into webgl you can get pixels back into an image. Basically render the texture to a framebuffer and call getpixels to get an array of the pixels. Then create an html canvas of the same size, get an image buffer from that and copy the array of pixels to that. Finally canvas.imageUrl will give a data url (aka base64 version of a png) that you can load into an image or download. That’s basically how taking a screenshot works.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)