• Editor
  • Copy a mesh with a portion of the original image (?)

Related Discussions
...

Okay so here's my problem:

sometimes I like to take a mesh, cut it, and have the part I just cut out blend seamlessly with the source mesh. E.g. there's a sprite that's a head with glasses, I want to cut out the glasses, and put them into a copy of the mesh (with all the weights and animations). If you just cut the glasses, copy the head mesh and change the path to the glasses you'll end up with a very distorted image of the glasses, so that doesn't work like that.

I've been working around this by placing some border pixels onto the new (glasses) layer, but sometimes I still can't get things to work (like today).

Is there a proper way of doing this? If not, can we have a checkbox of some kind to help with this?

Thanks ๐Ÿ™‚.


This is frustrating.


  • the PS script baking layers together happens again (sometimes)

  • another thing - selection of overlapping meshes. In AutoCAD you can hover a bunch of overlapping objects, hold shift, then hit space and cycle through them. Might be handy in Spine!

Hello booboogaga,
regarding your first request, I believe it might be similar to this issue here: Prompt for user decision when mesh images are resized ยท #205 ยท EsotericSoftware/spine-editor
which is also explained here: Meshes - Spine User Guide: Image resize
(if not, could you provide visual examples of what you mean?)

Regarding the ps script problem, could you send us a PSD that shows the problem indicating which layers get merged together, please?

In Spine hitting space blessedly deselects whatever you selected, so in case we do something like this, we'd need different hotkeys, will have to hear what Nate thinks about it!

Erikari wrote

In Spine hitting space blessedly deselects whatever you selected, so in case we do something like this, we'd need different hotkeys, will have to hear what Nate thinks about it!

Yeah, but you'd have SHIFT pressed at the time you hit SPACE ๐Ÿ˜‰


Okay, I feel like I should elaborate.

Let's say I have this drawing of an arm.

Then I want to have the fingers on top of a weapon, so I cut them out and place on a new layer in PS, you get the idea.

Then I animate the arm, and when it's ready, I'd like to copy (or even make a linked mesh and place it in a different slot, but that's coming in the next release, right?) the mesh and place the fingers inside. And I don't want to animate them separately, I want them to copy the weights and animations of the arm, but with a different sprite of different size and shape.

Here's a good example of handling this from Adobe. You have your mesh, and then you have the sprite position inside of the mesh. You can translate, rotate, scale, and shear it easily, without modifying the mesh itself.

So I can copy the mesh and replace the image inside. Then place it however I need to.


there's an attachment limit so I'm making another post



As you can see, the mesh is copied and the sprite inside is replaced with an image that's different in size and shape.

Next, regarding the selection of overlapping objects.

You don't have to worry about the SPACE bar being bound to deselect all command, because you'll use a combination of SHIFT+SPACE (or a different one, but this one is quite handy).

Here's how Autodesk describes the feature in case I'm not being clear:

"[...] you can cycle through the objects by rolling over the object on top to highlight it. Press and hold Shift, and then press the Spacebar continuously. When the required object is highlighted, left-click to select it."

And here's a gif showing how it works (not mine):

There are projects where it's literally impossible to find the point that selects a certain object, and since there's also no type-to-filter option for the tree yet (and this is a very busy project, remember? ๐Ÿ™‚ ), it requires miles of scrolling all the time.

Hope this helps to understand my original post ๐Ÿ™‚.

A linked mesh in a different slot is the best solution. The different slot part is coming in the future. :time:

Something could be done for selecting an attachment when many overlap. It's true shift+spacebar is separate from spacebar alone and is available, but I'm not sure this is the best solution. It works fine for 2-3 overlapping attachments, but is clumsy for more. It could be a menu that is shown with the names of each attachment under the mouse, similar to Photoshop's move tool. I've created an issue:
https://waffle.io/EsotericSoftware/spine/cards/5b0f2d72ecc63b001db338d2

Somewhat related is the long awaited (issue #1!) having a menu for selecting an attachment slot for a slot:
https://waffle.io/EsotericSoftware/spine/cards/5732404485eb351400827948

A linked mesh in a different slot is a part of the solution, yes, but I still don't see a convenient way to solve the issue in my example. How to get the fingers placed exactly where they belong in a mesh that was created for the whole arm?

The way I do it now, is leave a few pixels of the original arm sprite when cutting out the fingers, so I end up with a sprite of the same size. It's a workaround but I feel it's not the optimal way to handle this.

Are you using the Photoshop script to bring in the layers in the right position?

yep


If it's not clear what I'm trying to achieve, I can make a video and show the process and the challenges.


Regarding the AutoCAD shift+space to cycle selection - I've used the feature extensively while working in AutoCAD and can confirm that it's more convenient than selecting from a drop-down menu even if 10+ objects are involved. At least for me.
The drop-down requires you to pick from a list of similar object names, and cycling just highlights the objects so it's easy to just focus on the one you need and wait for it to glow. :nod:

Ah, you want the weights from the arm mesh on the fingers. The only reasonable way to do that would be to have an image the same size as the arm but only having the fingers, duplicate the arm, change the image to the fingers image, then cut the mesh down to just having the hand. This isn't great because you'd have a lot of whitespace in your texture atlas (if exporting images or video it's fine, since you don't care about a texture atlas).

If you make the hand image smaller (cutting off the whitespace) after cutting the mesh down to just the hand, then Spine's mesh image scaling rules will scale your mesh UVs the same amount, which is not what you want. Currently, and unfortunately, there is no way to reduce the size of a mesh image and keep the UVs the same size. The issue for that is here. You can subscribe for updates on the right of that page. (I know Erikari mentioned this above, just repeating for clarity.)

You can't move the image under the mesh like in your example for technical reasons. Mesh rendering is done from a texture atlas. Mesh vertices are mapped to a location in the atlas image. If you want blank space in the mesh, blank space is needed in the atlas image.

It sounds like the hotkey does make sense. We could have both a select box and a hotkey.

Okay, so you just confirmed that my way of handling is the only was possible, which is nice, so thanks, Nate ๐Ÿ™‚. At least I know I'm not missing an obvious solution.

Maybe, just maybe, there's a way to tell the PS script to "make a layer same size as this other layer"? Like, I have the arm, then I copy and cut it to just have the fingers, and name them [arm]fingers and the script treats this layer like the arm layer when stripping the transparent pixels? So the result would be a 'fingers' layer that's the same size and has the same coordinates as the 'arm' layer, and it's ez-pz to swap it in the linked mesh? :happy:

The Photoshop export script doesn't do it. I wonder how common this is? Are you using a runtime? It's not great to have lots of blank space in the texture. :doh: If using a runtime it could be OK if not used very often, but then maybe the export script doesn't need the functionality.

Probably the fastest way in Photoshop is to hide all layers except the arm and hand, Image -> Trim (all sides), hide the arm, then save the file as the hand image.

I don't know if people use this trick often, but I would pay to have this option in the PS export script.

Of course, it's not ideal to have blank space in the texture, but I still do it. Only I do it manually, so it's not precise at all and takes a long time to get done right. ๐Ÿ™

How often are you doing this? Are you using a runtime?

Here's a faster Photoshop way, and you don't need to hide things to start: ctrl+click the arm layer, press C (crop tool), press enter (crop to selection), right click the hand layer and hide other layers, save the file as the hand image.

Thanks for the instruction, this is definitely easier than the way I'm currently doing it. And no, I'm not using a runtime.

BUT, in some cases I keep adding skins to the file and keep exporting the layers using the PS script, which will overwrite the images that I'd manually create using your method. So I'll have to keep them in a separate folder and then re-write the exported images every time. And if there was such a feature in the PS export script I could set everything up neatly ๐Ÿ™‚.

You could use [ignore] in the arm layer so the script doesn't export it at all. When you run the script again it won't touch the images you export manually.

It does make some sense for the export script to handle it when not using a runtime, though I expect it would confuse everyone else (or encourage use of it with runtimes).

I understand it's not an often requested / used feature, but so is the creation of bones by the script, and yet there it is ๐Ÿ™‚. Some people will definitely appreciate it (I know I would!).

Thanks for seriously considering this and all the answers and hints.

๐Ÿ˜‰


Nate wrote

How often are you doing this? Are you using a runtime?

Here's a faster Photoshop way, and you don't need to hide things to start: ctrl+click the arm layer, press C (crop tool), press enter (crop to selection), right click the hand layer and hide other layers, save the file as the hand image.

Just tried this method and it does exactly what I need. Thanks!