Texture Atlas just replace texture

Hi all!

I’m a pretty to playcanvas and I’m running into an issue.

  1. I want to use a texture with all sorts of icons and button backgrounds in 2d space.
    I’ve created a Texture Atlas and in the Sprite Editor I’ve generate frames and created some sprites, some even with border to use slicing. And it all work pretty great! The sprites appear in my resources and are ready to be used.

  2. I’ve changed some of my icons on the texture in Photoshop, and now I just want to use this image instead of the texture that the Texture Atlas is using.

  3. I uploaded the new file, and now I want to use it instead of the old image! I created a new Texture atlas out of the new image, quickly generated some frames again and now I’m trying to use Replace on the old Atlas. Which kind of works, the sprites seem to use the new atlas (because I generated the frames). Otherwise it would have been disaster.

  4. PROBLEM: some of the custom work I did with the sizing and borders of some frames/sprites are not correct anymore. And I have to do the work all over. This seems like an insane workflow.

QUESTION: how can I just replace the texture (image) of the atlas, but keep all associated texture atlas definition data as it is?

I really feel that I’m missing something super obvious here. I’ve already found where the atlas data is defined, it is in one of the config files when you export the project. But it seems like the biggest hack to change the associated file there, and it will also of course not work in the editor.

Help!

Diederik / Xform

@dave @vaios @yaustar

Sorry to bump this. I’ve tried using TexturePacker, which has it’s own quirks (for instance that you MUST have seperate sprite files already and cannot use an existing compiles (atlas) texture as a starting point.

An important issue here is that I cannot seem to define 9-slice sprites if have a json (array) output. Any ideas on what I can use as a workaround?

The main question here is still ofcourse that I just want to be able to replace the texure image that is used by the atlas I created and edited in PlayCanvas itself.

Thanks in advance for your help!

Diederik / Xform

1 Like

Hi,

If you just want to replace the image with another image of the same size then you can just upload your new image with the same name and extension and that will replace your old Atlas. The only ‘quirk’ here is that you need to tick “Create Atlases” under the Texture Import Settings in your Settings panel. That is because by default if you upload an image it will create a Texture Asset not a Texture Atlas asset. With that checkbox ticked it will create an Atlas instead.

I think we don’t support 9-slicing settings from Texture Packer at the moment.

1 Like

I see. Was the idea that a user would generally only be working in 2D or 3D but very rarely both?

No it’s just that when you upload an image we have to decide what type of an asset to create. So far an image meant a Texture Asset. Now that we have Texture Atlas assets we’ve added this checkbox to say that when you upload an image it should create that instead.

There is also an idea to check the name of existing Texture and Texture Atlas assets and if one with the same name is found then replace that. But that has its own problems.

Hmm… Maybe there could be a context menu option to update selected asset with local file. So the user can:

  • right click on the texture asset or texture atlas
  • select update with local file from the context menu
  • file dialog appears
  • user selects local asset
  • texture atlas/asset gets updated

Admittedly, not as convenient when you have lots of files to update

Yeah we could do something like that but we’d still need a way for a user to upload multiple texture atlases for example or like you said when you have to update multiple files. So that would be something on top of what we have I guess.

1 Like

Hi guys! Thanks for your elaborate responses!

I haven’t been able to try the solution yet, but it sounds like what I’m looking for!
If it works, it would be handy to mention this in the documentation somewhere :).
[UPDATE]: IT WORKS!

If we’re doing feature requests: my solution would be that when you select Create Texture Atlas, a seperate json file is created next to the texture asset, in which all data is defined and kept. So it would contain the data that defines the frames, names, borders, slices etc. AND of course, a reference to the texture file asset. The sprites would refer to this json file.

Loading in an external json file in the sprite editor (i.e. from TexturePacker) should keep the texture reference as it is, if possible.

About TexturePacker and 9-slicing: I think it’s more a feature not supported in the json format that TexturePacker outputs.So you might want to contact those guy(s) if they can include it. Or create a neat PlayCanvas json template (and make it include the texture reference ;)).

I hope this makes sense. For now: thanks a bunch for your response, hope it works.
I think the whole PlayCanvas editor is pretty neat and enjoy working with it, funnily enough ;).

Cheers,

Diederik / Xform

2 Likes